openwrt/target/linux/imx/image/bootscript-gateworks_venice
Tim Harvey bd512e368f imx: add Gateworks Venice support
Add support for Gateworks Venice imx8m family of boards:
 - required kernel modules for on-board devices
 - image generation
 - initial network config
 - sysupgrade support

The resulting compressed disk image
(bin/targets/imx/cortexa53/openwrt-imx-cortexa53-gateworks_venice-squashfs-img.gz)
can be installed on a Gateworks venice board via U-Boot:

u-boot=> tftpboot $loadaddr openwrt-imx-cortexa53-gateworks_venice-squashfs-img.gz && \
         gzwrite mmc $dev $loadaddr $filesize

WARNING: this will overwrite any boot firmware on the eMMC user hardware
partition which if being used will brick your board requiring JTAG to
re-program boot firmware and recover

The compressed disk image contains the partition table and filesystems only
and that it is expected that boot firmware is installed properly on the
eMMC boot0 hardware partition. The easiest way to ensure this is to
use the Gateworks JTAG adapter/process to install the latest boot firmware
as follows from a Linux host:
  wget http://dev.gateworks.com/jtag/jtag_usbv4
  chmod +x jtag_usbv4
  wget http://dev.gateworks.com/venice/images/firmware-venice-imx8mm.bin
  sudo ./jtag_usbv4 -p firmware-venice-imx8mm.bin

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
2024-03-24 21:19:10 +01:00

42 lines
2.4 KiB
Plaintext

# distro-config bootscript
# - use only well-known variable names provided by U-Boot Distro boot
# - devtype - device type script run from (mmc|usb|scsi)
# - devnum - device number script run from (0 based int)
# - distro_bootpart - partition script run from (0 based int)
# - prefix - directory boot script was found in
# - kernel_addr_r - address to load kernel image to
# - fdt_addr_r - address to load dtb to
# - ftdcontroladdr - address dtb is at
# - fdt_file{1,2,3,4,5} name of fdt to load
# - fdt_overlays - list of fdt overlay files to load and apply
echo "Gateworks Venice OpenWrt Boot script v1.0"
# determine root device using PARTUUID:
# - this avoids any difference beteween uboot's device names/numbers
# not matching Linux as device enumeration is not a set API.
# - PARTUUID is disk UUID concatenated with partition number
# - for MBR disk UUID is unique disk id at offset 440
# - for GPT disk UUID is GPT UUID
# - for OpenWrt the squasfs rootfs is not readable by U-Boot so we have
# a 'boot' partition containing bootscript kernel dtbs followed by the rootfs
# partition, therefore we add 1 to the current partition
setexpr rootpart ${distro_bootpart} + 1 # root on 'next' partition
part uuid ${devtype} ${devnum}:${rootpart} uuid
setenv bootargs ${bootargs} console=${console} root=PARTUUID=${uuid} rootfstype=squashfs,ext4,f2fs rootwait
# load dtb (we try fdt_file and then fdt_file{1,2,3,4,5})
echo "loading DTB..."
setenv fdt_addr
setenv fdt_list $fdt_file $fdt_file1 $fdt_file2 $fdt_file3 $fdt_file4 $fdt_file5
setenv load_fdt 'echo Loading $fdt...; load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${fdt} && setenv fdt_addr ${fdt_addr_r}'
setenv apply_overlays 'fdt addr $fdt_addr_r && fdt resize && for fdt in "$fdt_overlays"; do load ${devtype} ${devnum}:${distro_bootpart} $loadaddr $prefix/$fdt && fdt apply $loadaddr && echo applied $prefix/$fdt; done'
for fdt in ${fdt_list}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${fdt}; then run load_fdt; fi; done
if test -z "$fdt_addr"; then echo "Warning: Using bootloader DTB"; setenv fdt_addr $fdtcontroladdr; fi
if test -n "$fdt_overlays"; then echo "Applying overlays"; run apply_overlays; fi
if test -n "$fixfdt"; then echo "Adjusting FDT"; run fixfdt; fi
# load and boot kernel
echo "loading kernel..."
load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} ${prefix}Image &&
booti ${kernel_addr_r} - ${fdt_addr}