diff mbox

boot-wrapper-aarch64: Allow users to specify an initrd/initramfs file.

Message ID 1475880304-21773-2-git-send-email-hollis_blanchard@mentor.com
State Superseded, archived
Headers show

Commit Message

Hollis Blanchard Oct. 7, 2016, 10:45 p.m. UTC
Signed-off-by: Hollis Blanchard <hollis_blanchard@mentor.com>
---
 boot/boot-wrapper-aarch64/Config.in               |    8 ++++++++
 boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk |    4 ++++
 2 files changed, 12 insertions(+), 0 deletions(-)

Comments

Thomas Petazzoni Oct. 25, 2016, 9:57 p.m. UTC | #1
Hello,

On Fri, 7 Oct 2016 15:45:03 -0700, Hollis Blanchard wrote:
> Signed-off-by: Hollis Blanchard <hollis_blanchard@mentor.com>
> ---
>  boot/boot-wrapper-aarch64/Config.in               |    8 ++++++++
>  boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk |    4 ++++
>  2 files changed, 12 insertions(+), 0 deletions(-)

Thanks for your patch, sorry for the somewhat slow reply.

> +config BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK
> +	string "Ramdisk"
> +	default ""

I would like this option to include the filesystem produced by
Buildroot (in cpio format) as the initramfs. So something like:

	bool "Include ramdisk in image"
	depends on BR2_TARGET_ROOTFS_CPIO

> +	help
> +	  Embed an initramfs file in the kernel image, and provide

It does not embed the initramfs in the kernel image, but in the boot
wrapper image.

> +	  linux,initrd-start and linux,initrd-end properties in the /chosen device
> +	  tree node.
> +
>  endif
> diff --git a/boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk b/boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk
> index c56bdee..28b2061 100644
> --- a/boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk
> +++ b/boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk
> @@ -30,6 +30,10 @@ BOOT_WRAPPER_AARCH64_CONF_OPTS = \
>  	--with-kernel-dir=$(LINUX_DIR) \
>  	--with-cmdline=$(BR2_TARGET_BOOT_WRAPPER_AARCH64_BOOTARGS)
>  
> +ifneq ($(BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK),)
> +	BOOT_WRAPPER_AARCH64_CONF_OPTS += --with-initrd=$(BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK)

Don't indent code inside conditions.

> +endif

It should be something like:

ifeq ($(BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK),y)
BOOT_WRAPPER_AARCH64_CONF_OPTS += --with-initrd=$(BINARIES_DIR)/rootfs.cpio
BOOT_WRAPPER_AARCH64_DEPENDENCIES += rootfs-cpio
endif

or something along those lines.

Best regards,

Thomas
Hollis Blanchard Oct. 25, 2016, 10:28 p.m. UTC | #2
On 10/25/2016 02:57 PM, Thomas Petazzoni wrote:
> Hello,
>
> On Fri, 7 Oct 2016 15:45:03 -0700, Hollis Blanchard wrote:
>> Signed-off-by: Hollis Blanchard <hollis_blanchard@mentor.com>
>> ---
>>   boot/boot-wrapper-aarch64/Config.in               |    8 ++++++++
>>   boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk |    4 ++++
>>   2 files changed, 12 insertions(+), 0 deletions(-)
> Thanks for your patch, sorry for the somewhat slow reply.
No problem; thanks for catching it after a busy week of travel.
>> +config BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK
>> +	string "Ramdisk"
>> +	default ""
> I would like this option to include the filesystem produced by
> Buildroot (in cpio format) as the initramfs. So something like:
>
> 	bool "Include ramdisk in image"
> 	depends on BR2_TARGET_ROOTFS_CPIO

I'm actually using it to embed an AOSP ramdisk.img, so I have 
BR2_TARGET_ROOTFS_CPIO=n, but I can see how that would be more generally 
useful. :-) Perhaps options like these?

config STANDARD_RAMDISK
bool "Include standard ramdisk in image"
depends on BR2_TARGET_ROOTFS_CPIO

config EXTERNAL_RAMDISK
bool "Include external ramdisk in image"
depends on !STANDARD_RAMDISK

config EXTERNAL_RAMDISK_PATH
string "External ramdisk path"
depends on EXTERNAL_RAMDISK
Hollis Blanchard Jan. 11, 2017, 11:55 p.m. UTC | #3
On 10/25/2016 02:57 PM, Thomas Petazzoni wrote:
>>   boot/boot-wrapper-aarch64/Config.in               |    8 ++++++++
>>   boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk |    4 ++++
>>   2 files changed, 12 insertions(+), 0 deletions(-)
> [...]
>
> It should be something like:
>
> ifeq ($(BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK),y)
> BOOT_WRAPPER_AARCH64_CONF_OPTS += --with-initrd=$(BINARIES_DIR)/rootfs.cpio
> BOOT_WRAPPER_AARCH64_DEPENDENCIES += rootfs-cpio
> endif
I'm preparing a resend on this, but I'm having trouble with the dependency:

$ rm /scratch1/hblancha/build/buildroot/images/rootfs.cpio
$ make O=/scratch1/hblancha/build/buildroot boot-wrapper-aarch64-dirclean all
[...]
/scratch1/hblancha/build/buildroot/host/usr/bin/aarch64-buildroot-linux-gnu-ld: cannot find /scratch1/hblancha/build/buildroot/images/rootfs.cpio

I can see that rootfs-* is defined and used in fs/, but, well, ... it 
doesn't seem to be working in this boot/ Makefile. Any advice?

Hollis Blanchard <hollis_blanchard@mentor.com>
Mentor Graphics Emulation Division
Arnout Vandecappelle Jan. 12, 2017, 10:30 p.m. UTC | #4
On 12-01-17 00:55, Hollis Blanchard wrote:
> On 10/25/2016 02:57 PM, Thomas Petazzoni wrote:
>>>   boot/boot-wrapper-aarch64/Config.in               |    8 ++++++++
>>>   boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk |    4 ++++
>>>   2 files changed, 12 insertions(+), 0 deletions(-)
>> [...]
>>
>> It should be something like:
>>
>> ifeq ($(BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK),y)
>> BOOT_WRAPPER_AARCH64_CONF_OPTS += --with-initrd=$(BINARIES_DIR)/rootfs.cpio
>> BOOT_WRAPPER_AARCH64_DEPENDENCIES += rootfs-cpio
>> endif
> I'm preparing a resend on this, but I'm having trouble with the dependency:
> 
> $ rm /scratch1/hblancha/build/buildroot/images/rootfs.cpio
> $ make O=/scratch1/hblancha/build/buildroot boot-wrapper-aarch64-dirclean all
> [...]
> /scratch1/hblancha/build/buildroot/host/usr/bin/aarch64-buildroot-linux-gnu-ld:
> cannot find /scratch1/hblancha/build/buildroot/images/rootfs.cpio
> 
> I can see that rootfs-* is defined and used in fs/, but, well, ... it doesn't
> seem to be working in this boot/ Makefile. Any advice?

 Difficult to say without seeing the patch. Does it work correctly if you call
'make rootfs-cpio boot-wrapper-arch64'?


 Regards,
 Arnout

> 
> Hollis Blanchard <hollis_blanchard@mentor.com>
> Mentor Graphics Emulation Division
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
diff mbox

Patch

diff --git a/boot/boot-wrapper-aarch64/Config.in b/boot/boot-wrapper-aarch64/Config.in
index c4e63e2..2563f58 100644
--- a/boot/boot-wrapper-aarch64/Config.in
+++ b/boot/boot-wrapper-aarch64/Config.in
@@ -32,4 +32,12 @@  config BR2_TARGET_BOOT_WRAPPER_AARCH64_BOOTARGS
 	  Kernel bootargs to embed inside the image generated by the
 	  boot wrapper.
 
+config BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK
+	string "Ramdisk"
+	default ""
+	help
+	  Embed an initramfs file in the kernel image, and provide
+	  linux,initrd-start and linux,initrd-end properties in the /chosen device
+	  tree node.
+
 endif
diff --git a/boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk b/boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk
index c56bdee..28b2061 100644
--- a/boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk
+++ b/boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk
@@ -30,6 +30,10 @@  BOOT_WRAPPER_AARCH64_CONF_OPTS = \
 	--with-kernel-dir=$(LINUX_DIR) \
 	--with-cmdline=$(BR2_TARGET_BOOT_WRAPPER_AARCH64_BOOTARGS)
 
+ifneq ($(BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK),)
+	BOOT_WRAPPER_AARCH64_CONF_OPTS += --with-initrd=$(BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK)
+endif
+
 # We need to convince the configure script that the Linux kernel tree
 # exists, as well as the DTB and the kernel Image. Even though those
 # are available on the build machine, the configure script uses