aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosua Mayer <josua.mayer97@gmail.com>2017-04-23 17:20:58 +0200
committerFelix Fietkau <nbd@nbd.name>2017-05-30 14:00:30 +0200
commit88389bfe4130e07833b41950abe5323a2fc5e6be (patch)
treef8048225c268f4eea918826d8320344fc422fe00
parente2814f641600efabfa906fa0a5957eaf055a67e5 (diff)
downloadupstream-88389bfe4130e07833b41950abe5323a2fc5e6be.tar.gz
upstream-88389bfe4130e07833b41950abe5323a2fc5e6be.tar.bz2
upstream-88389bfe4130e07833b41950abe5323a2fc5e6be.zip
mvebu: update boot-script to use generic variables
U-Boot provides standard variables for load addresses, and filesystem-agnostic load-commands. Furthermore thanks to distro-boot, the device and partition from which the system boots is known. The new boot-script makes use of all this information. Tested on the only board that uses this boot-script: Clearfog Pro Signed-off-by: Josua Mayer <josua.mayer97@gmail.com>
-rw-r--r--target/linux/mvebu/image/cfbase-boot.script29
-rw-r--r--target/linux/mvebu/image/cfpro-boot.script25
2 files changed, 44 insertions, 10 deletions
diff --git a/target/linux/mvebu/image/cfbase-boot.script b/target/linux/mvebu/image/cfbase-boot.script
index 3043d261ce..5f9bcd70ba 100644
--- a/target/linux/mvebu/image/cfbase-boot.script
+++ b/target/linux/mvebu/image/cfbase-boot.script
@@ -1,7 +1,26 @@
-setenv bootargs console=ttyS0,115200n8 root=/dev/mmcblk0p2 rootfstype=squashfs rootwait overlay=/dev/mmcblk0p3
-setenv fdt_high 0x07a12000
+# Standard Boot-Script
+# use only well-known variable names provided by U-Boot Distro boot
+# This script assumes that there is a boot partition,
+# and that the root partition is always the next one.
-fatload mmc 0:1 0x02000000 zImage
-fatload mmc 0:1 0x05F00000 armada-388-clearfog-base.dtb
+# Override DeviceTree for Clearfog Base
+# removed once U-Boot is able to detect the board variant.
+setenv fdtfile armada-388-clearfog-base.dtb
-bootz 0x02000000 - 0x05F00000
+# generate bootargs for rootfs on MMC
+if test "${devtype}" = "mmc"; then
+ setexpr lede_rootpart ${distro_bootpart} + 1
+ setenv bootargs ${bootargs} root=/dev/mmcblk${devnum}p${lede_rootpart} rootfstype=auto rootwait
+fi
+
+# here one could add logic for other rootfs device types such as scsi and usb
+
+# add console= option to bootargs, if any
+if test -n "${console}"; then
+ setenv bootargs ${bootargs} console=${console}
+fi
+
+echo "Booting Linux with ${bootargs}"
+load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${fdtfile}
+load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} zImage
+bootz ${kernel_addr_r} - ${fdt_addr_r}
diff --git a/target/linux/mvebu/image/cfpro-boot.script b/target/linux/mvebu/image/cfpro-boot.script
index 6f7653bace..e1523f8fb3 100644
--- a/target/linux/mvebu/image/cfpro-boot.script
+++ b/target/linux/mvebu/image/cfpro-boot.script
@@ -1,7 +1,22 @@
-setenv bootargs console=ttyS0,115200n8 root=/dev/mmcblk0p2 rootfstype=squashfs rootwait overlay=/dev/mmcblk0p3
-setenv fdt_high 0x07a12000
+# Standard Boot-Script
+# use only well-known variable names provided by U-Boot Distro boot
+# This script assumes that there is a boot partition,
+# and that the root partition is always the next one.
-fatload mmc 0:1 0x02000000 zImage
-fatload mmc 0:1 0x05F00000 armada-388-clearfog-pro.dtb
+# generate bootargs for rootfs on MMC
+if test "${devtype}" = "mmc"; then
+ setexpr lede_rootpart ${distro_bootpart} + 1
+ setenv bootargs ${bootargs} root=/dev/mmcblk${devnum}p${lede_rootpart} rootfstype=auto rootwait
+fi
-bootz 0x02000000 - 0x05F00000
+# here one could add logic for other rootfs device types such as scsi and usb
+
+# add console= option to bootargs, if any
+if test -n "${console}"; then
+ setenv bootargs ${bootargs} console=${console}
+fi
+
+echo "Booting Linux with ${bootargs}"
+load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${fdtfile}
+load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} zImage
+bootz ${kernel_addr_r} - ${fdt_addr_r}