From: Jonathan Liu <net147@gmail.com>
To: yocto@yoctoproject.org
Subject: [meta-raspberrypi][PATCH] u-boot: Simplify boot script
Date: Wed, 2 Nov 2016 00:49:11 +1100 [thread overview]
Message-ID: <20161101134911.11547-1-net147@gmail.com> (raw)
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@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}
--
2.10.1
next reply other threads:[~2016-11-01 13:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-01 13:49 Jonathan Liu [this message]
2016-11-02 7:46 ` [meta-raspberrypi][PATCH] u-boot: Simplify boot script Paul Barker
2016-11-03 5:58 ` Khem Raj
2016-11-03 20:57 ` Paul Barker
2016-11-03 21:55 ` Jonathan Liu
2016-11-03 22:14 ` Paul Barker
2016-11-04 12:13 ` Jonathan Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161101134911.11547-1-net147@gmail.com \
--to=net147@gmail.com \
--cc=yocto@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.