Skip to contentSkip to conversation

u-boot: Simplify boot script

PATCH In review Jonathan Liu 3 participants 5 messages Nov 27, 2016 – Nov 30, 2016 Broadcom BCM2711/BCM2835 Arm architecture

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 u-boot: Simplify boot script

A patch is backported to check if the firmware loaded a device tree blob into memory and set the fdt_addr variable if it is found. The U-Boot script will then read the command line arguments generated by the firmware from the device tree and boot the kernel with the command line arguments and the loaded device tree.

This allows things like MAC address, board revision and serial number to be correctly configured and options in config.txt to be used.

---
Changes in v4:
- Backport patch from upstream instead of using own patch
Changes in v3:
- Removed incorrect check if fdt_addr_r is already set. The check condition was inverted and fdt_addr_r variable is always set to 0x100 by default.
Changes in v2:
- Instead of setting device_tree_address to 0x100 in config.txt, patch U-Boot to detect the device tree blob address if it was loaded.

 recipes-bsp/rpi-u-boot-scr/files/boot.cmd          |   3 +
 .../rpi-u-boot-scr/files/raspberrypi/boot.cmd      |   6 -
 .../rpi-u-boot-scr/files/raspberrypi0/boot.cmd     |   6 -
 .../rpi-u-boot-scr/files/raspberrypi2/boot.cmd     |   6 -
 .../rpi-u-boot-scr/files/raspberrypi3/boot.cmd     |   6 -
 ...through-of-the-firmware-provided-FDT-blob.patch | 156 +++++++++++++++++++++
 recipes-bsp/u-boot/u-boot_%.bbappend               |   2 +
 7 files changed, 161 insertions(+), 24 deletions(-)
 create mode 100644 recipes-bsp/rpi-u-boot-scr/files/boot.cmd
 delete mode 100644 recipes-bsp/rpi-u-boot-scr/files/raspberrypi/boot.cmd
 delete mode 100644 recipes-bsp/rpi-u-boot-scr/files/raspberrypi0/boot.cmd
 delete mode 100644 recipes-bsp/rpi-u-boot-scr/files/raspberrypi2/boot.cmd
 delete mode 100644 recipes-bsp/rpi-u-boot-scr/files/raspberrypi3/boot.cmd
 create mode 100644 recipes-bsp/u-boot/files/rpi-passthrough-of-the-firmware-provided-FDT-blob.patch
recipes-bsp/rpi-u-boot-scr/files/boot.cmd new file +3 -0
new file mode 100644
index 0000000..2e8452e
@@ -0,0 +1,3 @@
+fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs
+fatload mmc 0:1 ${kernel_addr_r} uImage
+bootm ${kernel_addr_r} - ${fdt_addr}
recipes-bsp/rpi-u-boot-scr/files/raspberrypi/boot.cmd deleted +0 -6
deleted file mode 100644
index c86c758..0000000
@@ -1,6 +0,0 @@
-setenv fdtfile bcm2708-rpi-b.dtb
-setenv bootargs 'earlyprintk console=tty0 console=ttyAMA0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait noinitrd'
-mmc dev 0
-fatload mmc 0:1 ${kernel_addr_r} uImage
-fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}
-bootm ${kernel_addr_r} - ${fdt_addr_r}
recipes-bsp/rpi-u-boot-scr/files/raspberrypi0/boot.cmd deleted +0 -6
deleted file mode 100644
index c86c758..0000000
@@ -1,6 +0,0 @@
-setenv fdtfile bcm2708-rpi-b.dtb
-setenv bootargs 'earlyprintk console=tty0 console=ttyAMA0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait noinitrd'
-mmc dev 0
-fatload mmc 0:1 ${kernel_addr_r} uImage
-fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}
-bootm ${kernel_addr_r} - ${fdt_addr_r}
recipes-bsp/rpi-u-boot-scr/files/raspberrypi2/boot.cmd deleted +0 -6
deleted file mode 100644
index aa4ea64..0000000
@@ -1,6 +0,0 @@
-setenv fdtfile bcm2709-rpi-2-b.dtb
-setenv bootargs 'earlyprintk console=tty0 console=ttyAMA0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait noinitrd'
-mmc dev 0
-fatload mmc 0:1 ${kernel_addr_r} uImage
-fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}
-bootm ${kernel_addr_r} - ${fdt_addr_r}
recipes-bsp/rpi-u-boot-scr/files/raspberrypi3/boot.cmd deleted +0 -6
deleted file mode 100644
index 2950856..0000000
@@ -1,6 +0,0 @@
-setenv fdtfile bcm2710-rpi-3-b.dtb
-setenv bootargs 'earlyprintk console=tty0 console=ttyAMA0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait noinitrd'
-mmc dev 0
-fatload mmc 0:1 ${kernel_addr_r} uImage
-fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}
-bootm ${kernel_addr_r} - ${fdt_addr_r}
recipes-bsp/u-boot/files/rpi-passthrough-of-the-firmware-provided-FDT-blob.patch new file +156 -0

156 lines not on this page · raw message

recipes-bsp/u-boot/u-boot_%.bbappend +2 -0
index 3781666..645547f 100644
@@ -1 +1,3 @@
+FILESEXTRAPATHS_prepend_rpi := "${THISDIR}/files:"
 RDEPENDS_${PN}_append_rpi = " rpi-u-boot-scr"
+SRC_URI_append_rpi = " file://rpi-passthrough-of-the-firmware-provided-FDT-blob.patch"
Signature · 1 line
2.10.2
Reviewed-by on v4 1/1
#1 lore raw
Quoted 10 lines · Jonathan Liu

A patch is backported to check if the firmware loaded a device tree blob into memory and set the fdt_addr variable if it is found. The U-Boot script will then read the command line arguments generated by the firmware from the device tree and boot the kernel with the command line arguments and the loaded device tree.

This allows things like MAC address, board revision and serial number to be correctly configured and options in config.txt to be used.

Signature · 1 line
Tom
#2 lore raw
In reply to Jonathan Liu
Quoted 6 lines · On Sun, 27 Nov 2016 17:37:53 +1100 Jonathan Liu <[email protected]> wrote:

A patch is backported to check if the firmware loaded a device tree blob into memory and set the fdt_addr variable if it is found. The U-Boot script will then read the command line arguments generated by the firmware from the device tree and boot the kernel with the command line arguments and the loaded device tree.

Quoted 7 lines

This allows things like MAC address, board revision and serial number to be correctly configured and options in config.txt to be used.

---
Changes in v4:
- Backport patch from upstream instead of using own patch

I had to make a few additional changes on top of this patch to get a successful compile with u-boot v2016.03. These changes can be seen here:

https://gitlab.com/pbarker/meta-raspberrypi/commit/f880569e62d431cbead1555cf6c47342fe79c969

After those changes though, everything worked as expected on both an original rpi B+ and an rpi3.

Does your patch work cleanly on a later version of u-boot? I know oe-core is likely to upgrade to v2016.11 any day now. We could either apply the changes I've linked to above or hold off until v2016.11 is merged to oe-core if that's what you've tested with.

Thanks,
Paul

#3 lore raw

Hi Paul,

Quoted 23 lines · Paul Barker
Quoted 6 lines · On Sun, 27 Nov 2016 17:37:53 +1100 Jonathan Liu <[email protected]> wrote:

A patch is backported to check if the firmware loaded a device tree blob into memory and set the fdt_addr variable if it is found. The U-Boot script will then read the command line arguments generated by the firmware from the device tree and boot the kernel with the command line arguments and the loaded device tree.

Quoted 7 lines

This allows things like MAC address, board revision and serial number to be correctly configured and options in config.txt to be used.

---
Changes in v4:
- Backport patch from upstream instead of using own patch

I had to make a few additional changes on top of this patch to get a successful compile with u-boot v2016.03. These changes can be seen here:

https://gitlab.com/pbarker/meta-raspberrypi/commit/
f880569e62d431cbead1555cf6c47342fe79c969

Quoted 8 lines

After those changes though, everything worked as expected on both an original rpi B+ and an rpi3.

Does your patch work cleanly on a later version of u-boot? I know oe-core is likely to upgrade to v2016.11 any day now. We could either apply the changes I've linked to above or hold off until v2016.11 is merged to oe-core if that's what you've tested with.

Yes, my patch applies cleanly to v2016.11 as well. I only tested with Raspberry Pi 3 as I didn't have a Raspberry Pi 2 around at the time. The upstream commits landed in master after v2016.11 so backports will be needed until at least v2017.01.

Are you able to squash your changes into this patch and submit a v5 with your Signed-off-by tag?

Thanks.

Regards,
Jonathan

#4 lore raw
Quoted 36 lines · On Wed, 30 Nov 2016 10:14:01 +1100 Jonathan Liu <[email protected]> wrote:

Hi Paul,

Quoted 23 lines · Paul Barker
Quoted 6 lines · On Sun, 27 Nov 2016 17:37:53 +1100 Jonathan Liu <[email protected]> wrote:

A patch is backported to check if the firmware loaded a device tree blob into memory and set the fdt_addr variable if it is found. The U-Boot script will then read the command line arguments generated by the firmware from the device tree and boot the kernel with the command line arguments and the loaded device tree.

Quoted 7 lines

This allows things like MAC address, board revision and serial number to be correctly configured and options in config.txt to be used.

---
Changes in v4:
- Backport patch from upstream instead of using own patch

I had to make a few additional changes on top of this patch to get a successful compile with u-boot v2016.03. These changes can be seen here:

https://gitlab.com/pbarker/meta-raspberrypi/commit/
f880569e62d431cbead1555cf6c47342fe79c969

Quoted 8 lines

After those changes though, everything worked as expected on both an original rpi B+ and an rpi3.

Does your patch work cleanly on a later version of u-boot? I know oe-core is likely to upgrade to v2016.11 any day now. We could either apply the changes I've linked to above or hold off until v2016.11 is merged to oe-core if that's what you've tested with.

Quoted 8 lines

Yes, my patch applies cleanly to v2016.11 as well. I only tested with Raspberry Pi 3 as I didn't have a Raspberry Pi 2 around at the time. The upstream commits landed in master after v2016.11 so backports will be needed until at least v2017.01.

Are you able to squash your changes into this patch and submit a v5 with your Signed-off-by tag?

Will do. Currently in progress, will send once I've given it a quick test.

Thanks,
Paul Barker