| 1 |
# Bootscript using the new unified bootcmd handling |
| 2 |
# introduced with u-boot v2014.10 |
| 3 |
# |
| 4 |
# Expects to be called with the following environment variables set: |
| 5 |
# |
| 6 |
# devtype e.g. mmc/scsi etc |
| 7 |
# devnum The device number of the given type |
| 8 |
# bootpart The partition containing the boot files |
| 9 |
# distro_bootpart The partition containing the boot files |
| 10 |
# (introduced in u-boot mainline 2016.01) |
| 11 |
# prefix Prefix within the boot partiion to the boot files |
| 12 |
# kernel_addr_r Address to load the kernel to |
| 13 |
# fdt_addr_r Address to load the FDT to |
| 14 |
# ramdisk_addr_r Address to load the initrd to. |
| 15 |
# |
| 16 |
# The uboot must support the @@BOOT_CMD@@ and generic filesystem load commands. |
| 17 |
|
| 18 |
# Workaround lack of baudrate included with console on various iMX |
| 19 |
# systems (e.g. wandboard, cubox-i, hummingboard) |
| 20 |
if test "${console}" = "ttymxc0" && test -n "${baudrate}"; then |
| 21 |
setenv console "${console},${baudrate}" |
| 22 |
fi |
| 23 |
|
| 24 |
if test -n "${console}"; then |
| 25 |
setenv bootargs "${bootargs} console=${console}" |
| 26 |
fi |
| 27 |
|
| 28 |
setenv bootargs "@@LINUX_KERNEL_CMDLINE_DEFAULTS@@ ${bootargs} @@LINUX_KERNEL_CMDLINE@@" |
| 29 |
@@UBOOT_ENV_EXTRA@@ |
| 30 |
|
| 31 |
if test -z "${fk_kvers}"; then |
| 32 |
setenv fk_kvers '@@KERNEL_VERSION@@' |
| 33 |
fi |
| 34 |
|
| 35 |
# These two blocks should be the same apart from the use of |
| 36 |
# ${fk_kvers} in the first, the syntax supported by u-boot does not |
| 37 |
# lend itself to removing this duplication. |
| 38 |
|
| 39 |
if test -n "${fdtfile}"; then |
| 40 |
setenv fdtpath dtbs/${fk_kvers}/${fdtfile} |
| 41 |
else |
| 42 |
setenv fdtpath dtb-${fk_kvers} |
| 43 |
fi |
| 44 |
|
| 45 |
if test -z "${distro_bootpart}"; then |
| 46 |
setenv partition ${bootpart} |
| 47 |
else |
| 48 |
setenv partition ${distro_bootpart} |
| 49 |
fi |
| 50 |
|
| 51 |
@@UBOOT_PREBOOT_EXTRA@@ |
| 52 |
|
| 53 |
if test -z "${fk_image_locations}"; then |
| 54 |
setenv fk_image_locations ${prefix} |
| 55 |
fi |
| 56 |
|
| 57 |
for pathprefix in ${fk_image_locations} |
| 58 |
do |
| 59 |
if test -e ${devtype} ${devnum}:${partition} ${pathprefix}vmlinuz-${fk_kvers} |
| 60 |
then |
| 61 |
load ${devtype} ${devnum}:${partition} ${kernel_addr_r} ${pathprefix}vmlinuz-${fk_kvers} \ |
| 62 |
&& load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${pathprefix}${fdtpath} \ |
| 63 |
&& load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${pathprefix}initrd.img-${fk_kvers} \ |
| 64 |
&& echo "Booting Debian ${fk_kvers} from ${devtype} ${devnum}:${partition}..." \ |
| 65 |
&& @@BOOT_CMD@@ ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r} |
| 66 |
fi |
| 67 |
done |
| 68 |
|
| 69 |
for pathprefix in ${fk_image_locations} |
| 70 |
do |
| 71 |
if test -e ${devtype} ${devnum}:${partition} ${pathprefix}vmlinuz |
| 72 |
then |
| 73 |
load ${devtype} ${devnum}:${partition} ${kernel_addr_r} ${pathprefix}vmlinuz \ |
| 74 |
&& load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${pathprefix}dtb \ |
| 75 |
&& load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${pathprefix}initrd.img \ |
| 76 |
&& echo "Booting Debian from ${devtype} ${devnum}:${partition}..." \ |
| 77 |
&& @@BOOT_CMD@@ ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r} |
| 78 |
fi |
| 79 |
done |