Skip to contentSkip to conversation

boot-wrapper-aarch64 configuration options

Buildroot New Hollis Blanchard 3 participants 9 messages Oct 7, 2016 – Jan 13, 2017

lore
Share & tools
lore
#0 lore raw

I needed these patches to expose some of boot-wrapper-aarch64's underlying configuration options. I hope it's useful.

#1 lore raw

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

---
 boot/boot-wrapper-aarch64/Config.in               |    8 ++++++++
 boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk |    4 ++++
 2 files changed, 12 insertions(+), 0 deletions(-)
boot/boot-wrapper-aarch64/Config.in +8 -0
index c4e63e2..2563f58 100644
@@ -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
boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk +4 -0
index c56bdee..28b2061 100644
@@ -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
Signature · 1 line
1.7.1
#2 lore raw

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

Hello,

Quoted 5 lines · Hollis Blanchard
---
 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.

boot/boot-wrapper-aarch64/Config.in config BR2_TARGET_BOOT_WRAPPER_AARCH64_BOOTARGS · line 37

Quoted 3 lines
boot/boot-wrapper-aarch64/Config.in +3 -0
+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

boot/boot-wrapper-aarch64/Config.in config BR2_TARGET_BOOT_WRAPPER_AARCH64_BOOTARGS · line 39

Quoted 2 lines
boot/boot-wrapper-aarch64/Config.in +2 -0
+	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.

Quoted 9 lines
boot/boot-wrapper-aarch64/Config.in +3 -0
+	  linux,initrd-start and linux,initrd-end properties in the /chosen device
+	  tree node.
+
 endif
boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk +0 -0
index c56bdee..28b2061 100644

boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk BOOT_WRAPPER_AARCH64_CONF_OPTS = \ · line 34

Quoted 5 lines
boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk +2 -0
@@ -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.

boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk BOOT_WRAPPER_AARCH64_CONF_OPTS = \ · line 35

Quoted 1 line
boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk +1 -0
+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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#3 lore raw

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

Quoted 9 lines · Thomas Petazzoni

Hello,

Quoted 5 lines · Hollis Blanchard
---
  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.

Quoted 8 lines

boot/boot-wrapper-aarch64/Config.in config BR2_TARGET_BOOT_WRAPPER_AARCH64_BOOTARGS · line 37

Quoted 3 lines
boot/boot-wrapper-aarch64/Config.in +3 -0
+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

Signature · 2 lines
Hollis Blanchard <[email protected]>
Mentor Graphics Emulation Division
#4 lore raw

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

In reply to Thomas Petazzoni
Quoted 11 lines · Thomas Petazzoni
Quoted 3 lines
  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 <[email protected]>
Mentor Graphics Emulation Division

#5 lore raw

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

Quoted 14 lines · Hollis Blanchard
Quoted 11 lines · Thomas Petazzoni
Quoted 3 lines
  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:

Quoted 8 lines
$ 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

Quoted 9 lines

Hollis Blanchard <[email protected]>
Mentor Graphics Emulation Division

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#6 lore raw

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

Quoted 21 lines · Arnout Vandecappelle
Quoted 20 lines · Hollis Blanchard
Quoted 11 lines · Thomas Petazzoni
Quoted 3 lines
   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
Quoted 4 lines
Quoted 2 lines

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 <[email protected]>
Date:   Mon Sep 26 15:48:12 2016 -0700

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

boot/boot-wrapper-aarch64/Config.in +24 -0
index efb70dc..d9d7ce6 100644
@@ -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
boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk +7 -0
index 601cfab..88816a4 100644
@@ -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

Hollis Blanchard <[email protected]>
Mentor Graphics Emulation Division

#7 lore raw

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

Quoted 24 lines · Hollis Blanchard
Quoted 23 lines · Arnout Vandecappelle
Quoted 22 lines · Hollis Blanchard
Quoted 11 lines · Thomas Petazzoni
Quoted 3 lines
   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?

Quoted 7 lines
Quoted 2 lines

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.

Quoted 8 lines

Full patch is here:

Author: Hollis Blanchard <[email protected]>
Date:   Mon Sep 26 15:48:12 2016 -0700

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

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

Regards,
Arnout

[snip]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#8 lore raw

PATCH 1/1 boot-wrapper-aarch64: Allow users to select the PSCI SMP boot method

In reply to Hollis Blanchard
---
 boot/boot-wrapper-aarch64/Config.in               |    7 +++++++
 boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk |    4 ++++
 2 files changed, 11 insertions(+), 0 deletions(-)
boot/boot-wrapper-aarch64/Config.in +7 -0
index 2563f58..7469727 100644
@@ -40,4 +40,11 @@ config BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK
 	  linux,initrd-start and linux,initrd-end properties in the /chosen device
 	  tree node.
 
+config BR2_TARGET_BOOT_WRAPPER_AARCH64_PSCI
+	bool "Boot secondary SMP cores using PSCI"
+	default n
+	help
+	  Boot secondary SMP cores using PSCI firmware calls. If n, use the spin-table
+	  method instead.
+
 endif
boot/boot-wrapper-aarch64/boot-wrapper-aarch64.mk +4 -0
index 28b2061..0df0859 100644
@@ -34,6 +34,10 @@ ifneq ($(BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK),)
 	BOOT_WRAPPER_AARCH64_CONF_OPTS += --with-initrd=$(BR2_TARGET_BOOT_WRAPPER_AARCH64_RAMDISK)
 endif
 
+ifeq ($(BR2_TARGET_BOOT_WRAPPER_AARCH64_PSCI),y)
+	BOOT_WRAPPER_AARCH64_CONF_OPTS += --enable-psci
+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
Signature · 1 line
1.7.1