This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
Files
lsts_glued/systems/lctr-a72xx/fs/etc/flash-kernel/bootscript/bootscr.rpi
Diogo Cordeiro 2c67b5490e Add some stuff
2020-09-16 16:11:26 +01:00

66 lines
2.5 KiB
Plaintext

# Ubuntu Classic RPi U-Boot script (for armhf and arm64)
# Expects to be called with the following environment variables set:
#
# devtype e.g. mmc/scsi etc
# devnum The device number of the given type
# distro_bootpart The partition containing the boot files
# (introduced in u-boot mainline 2016.01)
# prefix Prefix within the boot partiion to the boot files
# kernel_addr_r Address to load the kernel to
# fdt_addr_r Address to load the FDT to
# ramdisk_addr_r Address to load the initrd to.
# Take fdt addr from the prior stage boot loader, if available
if test -n "$fdt_addr"; then
fdt addr ${fdt_addr}
fdt move ${fdt_addr} ${fdt_addr_r} # implicitly sets fdt active
else
fdt addr ${fdt_addr_r}
fi
fdt get value bootargs /chosen bootargs
setenv bootargs "@@LINUX_KERNEL_CMDLINE_DEFAULTS@@ ${bootargs} @@LINUX_KERNEL_CMDLINE@@"
@@UBOOT_ENV_EXTRA@@
@@UBOOT_PREBOOT_EXTRA@@
if test -z "${fk_image_locations}"; then
setenv fk_image_locations ${prefix}
fi
for pathprefix in ${fk_image_locations}; do
# Store the gzip header (1f 8b) in the kernel area for comparison to the
# header of the image we load. Load "vmlinuz" into the portion of memory for
# the RAM disk (because we want to uncompress to the kernel area if it's
# compressed) and compare the word at the start
mw.w ${kernel_addr_r} 0x8b1f # little endian
if load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} ${pathprefix}vmlinuz; then
kernel_size=${filesize}
if cmp.w ${kernel_addr_r} ${ramdisk_addr_r} 1; then
# gzip compressed image (NOTE: *not* a self-extracting gzip compressed
# kernel, just a kernel image that has been gzip'd)
echo "Decompressing kernel..."
unzip ${ramdisk_addr_r} ${kernel_addr_r}
setenv kernel_size ${filesize}
setenv try_boot "booti"
else
# Possibly self-extracting or uncompressed; copy data into the kernel area
# and attempt launch with bootz then booti
echo "Copying kernel..."
cp.b ${ramdisk_addr_r} ${kernel_addr_r} ${kernel_size}
setenv try_boot "bootz booti"
fi
if load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} ${pathprefix}initrd.img; then
setenv ramdisk_param "${ramdisk_addr_r}:${filesize}"
else
setenv ramdisk_param "-"
fi
for cmd in ${try_boot}; do
echo "Booting Ubuntu (with ${cmd}) from ${devtype} ${devnum}:${partition}..."
${cmd} ${kernel_addr_r} ${ramdisk_param} ${fdt_addr_r}
done
fi
done