[yocto] [meta-raspberrypi][PATCH] u-boot: Simplify boot script

Paul Barker paul at paulbarker.me.uk
Wed Nov 2 00:46:35 PDT 2016


On Wed,  2 Nov 2016 00:49:11 +1100
Jonathan Liu <net147 at gmail.com> wrote:

> device_tree_address=0x100 is set in config.txt so the firmware will
> load a patched device tree blob to 0x100 before passing control to
> U-Boot. 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.
> 
> Signed-off-by: Jonathan Liu <net147 at gmail.com>
> ---
>  recipes-bsp/bootfiles/rpi-config_git.bb                | 5 +++++
>  recipes-bsp/rpi-u-boot-scr/files/boot.cmd              | 3 +++
>  recipes-bsp/rpi-u-boot-scr/files/raspberrypi/boot.cmd  | 6 ------
>  recipes-bsp/rpi-u-boot-scr/files/raspberrypi0/boot.cmd | 6 ------
>  recipes-bsp/rpi-u-boot-scr/files/raspberrypi2/boot.cmd | 6 ------
>  recipes-bsp/rpi-u-boot-scr/files/raspberrypi3/boot.cmd | 6 ------
>  6 files changed, 8 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
> 
> diff --git a/recipes-bsp/bootfiles/rpi-config_git.bb
> b/recipes-bsp/bootfiles/rpi-config_git.bb index f610718..2f4d25c
> 100644 --- a/recipes-bsp/bootfiles/rpi-config_git.bb
> +++ b/recipes-bsp/bootfiles/rpi-config_git.bb
> @@ -76,6 +76,11 @@ do_deploy() {
>          echo "dispmanx_offline=1"
> >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt fi
>  
> +    # U-Boot Device Tree support
> +    if [ "${KERNEL_IMAGETYPE}" = "uImage" ]; then
> +        sed -i '/#device_tree_address/ c\device_tree_address=0x100'
> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
> +    fi
> +
>      # SPI bus support
>      if [ -n "${ENABLE_SPI_BUS}" ] || [ "${PITFT}" = "1" ]; then
>          echo "# Enable SPI bus"
> >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt diff --git
> >>a/recipes-bsp/rpi-u-boot-scr/files/boot.cmd
> >>b/recipes-bsp/rpi-u-boot-scr/files/boot.cmd
> new file mode 100644
> index 0000000..3f7e3b6
> --- /dev/null
> +++ b/recipes-bsp/rpi-u-boot-scr/files/boot.cmd
> @@ -0,0 +1,3 @@
> +fdt addr ${fdt_addr_r} && fdt get value bootargs /chosen bootargs
> +fatload mmc 0:1 ${kernel_addr_r} uImage
> +bootm ${kernel_addr_r} - ${fdt_addr_r}
> diff --git a/recipes-bsp/rpi-u-boot-scr/files/raspberrypi/boot.cmd
> b/recipes-bsp/rpi-u-boot-scr/files/raspberrypi/boot.cmd deleted file
> mode 100644 index c86c758..0000000
> --- a/recipes-bsp/rpi-u-boot-scr/files/raspberrypi/boot.cmd
> +++ /dev/null
> @@ -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}
> diff --git a/recipes-bsp/rpi-u-boot-scr/files/raspberrypi0/boot.cmd
> b/recipes-bsp/rpi-u-boot-scr/files/raspberrypi0/boot.cmd deleted file
> mode 100644 index c86c758..0000000
> --- a/recipes-bsp/rpi-u-boot-scr/files/raspberrypi0/boot.cmd
> +++ /dev/null
> @@ -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}
> diff --git a/recipes-bsp/rpi-u-boot-scr/files/raspberrypi2/boot.cmd
> b/recipes-bsp/rpi-u-boot-scr/files/raspberrypi2/boot.cmd deleted file
> mode 100644 index aa4ea64..0000000
> --- a/recipes-bsp/rpi-u-boot-scr/files/raspberrypi2/boot.cmd
> +++ /dev/null
> @@ -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}
> diff --git a/recipes-bsp/rpi-u-boot-scr/files/raspberrypi3/boot.cmd
> b/recipes-bsp/rpi-u-boot-scr/files/raspberrypi3/boot.cmd deleted file
> mode 100644 index 2950856..0000000
> --- a/recipes-bsp/rpi-u-boot-scr/files/raspberrypi3/boot.cmd
> +++ /dev/null
> @@ -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}

Looks like I missed the RaspberryPi Device Tree documentation
(https://www.raspberrypi.org/documentation/configuration/device-tree.md)
when putting my patches together. I assumed that they use device trees
in a pretty standard way but looks like I was wrong!

I'll give this a test this week.

Thanks,
Paul



More information about the yocto mailing list