2022-03-08 01:07:36 +00:00
|
|
|
# Uses the following env. vars:
|
|
|
|
# devtype e.g. mmc/scsi etc
|
|
|
|
# devnum The device number of the given type
|
|
|
|
# bootpart The partition containing the boot files
|
|
|
|
# board_rev Librem 5 board revision
|
2020-01-14 03:55:23 +00:00
|
|
|
|
2022-03-08 01:07:36 +00:00
|
|
|
|
|
|
|
# Default to devtype=mmc, devnum=0, bootpart=1 if they are unset in the
|
|
|
|
# environment. For supporting older u-boot where these may not be configured.
|
|
|
|
if itest.s "x" == "x$devtype" ; then
|
|
|
|
devtype="mmc"
|
|
|
|
fi
|
|
|
|
if itest.s "x" == "x$devnum" ; then
|
|
|
|
devnum=0
|
|
|
|
fi
|
|
|
|
if itest.s "x" == "x$bootpart" ; then
|
|
|
|
bootpart=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
setenv bootargs init=/init.sh rw console=ttymxc0,115200 cma=256M PMOS_NO_OUTPUT_REDIRECT PMOS_FORCE_PARTITION_RESIZE
|
2020-09-07 23:32:48 +00:00
|
|
|
|
2022-11-04 06:10:39 +00:00
|
|
|
# Select the correct dtb based on device revision
|
|
|
|
# Default to "-r4" if board_rev isn't set, since there are apparently Evergreen
|
|
|
|
# boards that either 1) identify as r4, 2) identify as r5 (or something else?),
|
|
|
|
# or 3) don't identify as anything(?).
|
|
|
|
# See: https://gitlab.com/postmarketOS/pmaports/-/issues/1643#note_1147248594
|
|
|
|
dtb_file=imx8mq-librem5-r4.dtb
|
2021-02-03 06:48:01 +00:00
|
|
|
if itest.s "x3" == "x$board_rev" ; then
|
2020-09-07 23:32:48 +00:00
|
|
|
dtb_file=imx8mq-librem5-r3.dtb
|
2022-11-04 06:10:39 +00:00
|
|
|
elif itest.s "x2" == "x$board_rev" ; then
|
|
|
|
dtb_file=imx8mq-librem5-r2.dtb
|
|
|
|
elif itest.s "x1" == "x$board_rev" ; then
|
|
|
|
dtb_file=imx8mq-librem5-r2.dtb
|
|
|
|
elif itest.s "x0" == "x$board_rev" ; then
|
|
|
|
dtb_file=imx8mq-librem5-r2.dtb
|
2020-09-07 23:32:48 +00:00
|
|
|
fi
|
|
|
|
|
2020-01-14 03:55:23 +00:00
|
|
|
echo Loading DTB
|
2022-03-08 01:07:36 +00:00
|
|
|
ext2load $devtype ${devnum}:${bootpart} ${fdt_addr_r} ${dtb_file}
|
2020-01-14 03:55:23 +00:00
|
|
|
|
|
|
|
echo Loading Initramfs
|
2022-03-08 01:07:36 +00:00
|
|
|
ext2load $devtype ${devnum}:${bootpart} ${ramdisk_addr_r} initramfs
|
2020-01-14 03:55:23 +00:00
|
|
|
|
|
|
|
echo Loading Kernel
|
2022-03-08 01:07:36 +00:00
|
|
|
ext2load $devtype ${devnum}:${bootpart} ${kernel_addr_r} vmlinuz
|
2020-01-14 03:55:23 +00:00
|
|
|
|
|
|
|
echo Resizing FDT
|
|
|
|
fdt addr ${fdt_addr_r}
|
|
|
|
fdt resize
|
|
|
|
|
2022-03-08 01:07:36 +00:00
|
|
|
# For debug
|
|
|
|
printenv
|
|
|
|
|
2020-01-14 03:55:23 +00:00
|
|
|
echo Booting kernel
|
|
|
|
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
|