diff mbox

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

Message ID 0863737f-d337-2a87-1928-5c96d97e7281@mentor.com
State Changes Requested
Headers show

Commit Message

Hollis Blanchard Jan. 12, 2017, 10:45 p.m. UTC
On 01/12/2017 02:30 PM, Arnout Vandecappelle wrote:
> 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'?

Same error. Earlier I see this:
make: Circular 
/scratch1/hblancha/build/buildroot/build/boot-wrapper-aarch64-4266507a84f8c06452109d38e0350d4759740694/.stamp_configured 
<- rootfs-cpio dependency dropped.

Full patch is here:

Author: Hollis Blanchard <hollis_blanchard@mentor.com>
Date:   Mon Sep 26 15:48:12 2016 -0700

     boot-wrapper-aarch64: Allow users to specify an initrd/initramfs file.
     
     Signed-off-by: Hollis Blanchard <hollis_blanchard@mentor.com>



Hollis Blanchard <hollis_blanchard@mentor.com>
Mentor Graphics Emulation Division

Comments

Arnout Vandecappelle Jan. 13, 2017, 8:30 a.m. UTC | #1
On 12-01-17 23:45, Hollis Blanchard wrote:
> On 01/12/2017 02:30 PM, Arnout Vandecappelle wrote:
>> 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'?
> 
> Same error. Earlier I see this:
> make: Circular
> /scratch1/hblancha/build/buildroot/build/boot-wrapper-aarch64-4266507a84f8c06452109d38e0350d4759740694/.stamp_configured
> <- rootfs-cpio dependency dropped.

 Ah, of course: rootfs-cpio depends on PACKAGES, and boot-wrapper-aarch64 is in
PACKAGES. Same issue as with initramfs, and which is the reason why initramfs
doesn't use the normal DEPENDENCIES approach.

 A fundamental solution would probably involve a change in the infra to support
leaving out a package from PACKAGES (but then there has to be another way of
making sure it *does* get built).

 But for now, all I can think of is to do it similar to how we do it for linux:
create a filesystem target for it, and then add some special custom rule to
boot-wrapper-aarch64 to (re)build it with the cpio archive.

> 
> Full patch is here:
> 
> Author: Hollis Blanchard <hollis_blanchard@mentor.com>
> Date:   Mon Sep 26 15:48:12 2016 -0700
> 
>     boot-wrapper-aarch64: Allow users to specify an initrd/initramfs file.
>         Signed-off-by: Hollis Blanchard <hollis_blanchard@mentor.com>

 BTW you have a missing blank line between the summary and the Sob.


 Regards,
 Arnout

[snip]
diff mbox

Patch

diff --git a/boot/boot-wrapper-aarch64/Config.in b/boot/boot-wrapper-aarch64/Config.in
index efb70dc..d9d7ce6 100644
--- a/boot/boot-wrapper-aarch64/Config.in
+++ b/boot/boot-wrapper-aarch64/Config.in
@@ -32,6 +32,30 @@  config BR2_TARGET_BOOT_WRAPPER_AARCH64_BOOTARGS
           Kernel bootargs to embed inside the image generated by the
           boot wrapper.
  
+choice
+       prompt "Embedded ramdisk"
+       default BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK_NONE
+       help
+         Embed an initramfs file in the bootwrapper image, and provide
+         linux,initrd-start and linux,initrd-end properties in the /chosen
+         device tree node.
+
+config BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK_NONE
+       bool "None"
+
+config BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK_BUILDROOT
+       bool "Buildroot ramdisk"
+       depends on BR2_TARGET_ROOTFS_CPIO
+
+config BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK_CUSTOM
+       bool "Custom ramdisk"
+
+endchoice
+
+config BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK_CUSTOM_PATH
+       depends on BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK_CUSTOM
+       string "Path to external ramdisk"
+
  config BR2_TARGET_BOOT_WRAPPER_AARCH64_PSCI
         bool "Boot secondary SMP cores using PSCI"
         help
diff --git a/boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk b/boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk
index 601cfab..88816a4 100644
--- a/boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk
+++ b/boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk
@@ -36,6 +36,13 @@  else
  BOOT_WRAPPER_AARCH64_CONF_OPTS += --disable-psci
  endif
  
+ifneq ($(BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK_BUILDROOT),)
+BOOT_WRAPPER_AARCH64_CONF_OPTS += --with-initrd=$(BINARIES_DIR)/rootfs.cpio
+BOOT_WRAPPER_AARCH64_DEPENDENCIES += rootfs-cpio
+else ifneq ($(BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK_CUSTOM),)
+BOOT_WRAPPER_AARCH64_CONF_OPTS += --with-initrd=$(BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK_CUSTOM_PATH)
+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