1
1
openwrt/target/linux/imx/image/bootscript-kontron_osm-s-imx8mp
Martin Schiller 07a5e432c8 imx: add support for Kontron OSM-S/BL i.MX8MP
This adds support for the Kontron i.MX8MP OSM-S size system-on-module +
eval board.

CPU:      NXP i.MX8MP @ 1600MHz (quad-core A53)
Memory:   4 (up to 8) GByte LPDDR4-RAM
Storage:  32 (up to 128) GByte eMMC + microSD slot
Ethernet: 2x 1 Gbit/s IEEE (1x with TSN)
UART:     1x UART console output on the Mini-B USB Debug Port
          (signals are really UART on this Mini-B USB port!!!, there is
          an adapter with ftdi available from Kontron)
          1x RS232, 1x RS485
USB:	  2x USB 2.0 Type-A, 1x USB 3.0 Type-C DRP
Misc:	  8 (up to 128) kByte EEPROM (at24), RTC, 2x CAN, HDMI, 1x PCIe

This will create an SD card image for the board.
To use this image you have to bring the board to the recovery boot mode
(normal boot mode is eMMC). At the time of writing, the SoM (or the SoC)
has a bug that the FORCE_RECOVERY signal (switch S1 on the eval board)
doesn't work as long as the eMMC boot0 partition contains data.
Therefore you have to wipe this boot0 partition to be able to boot from
SD card. To do this call the following commands at uboot:

mmc dev 0 1
mmc erase 0 0x2000

After that, the system will try to boot from SD card.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
2026-06-01 17:49:36 +02:00

45 lines
2.5 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 "Kontron OSM-S/BL i.MX8MP 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 console "ttymxc2,115200"
setenv bootargs ${bootargs} console=${console} root=PARTUUID=${uuid} rootfstype=squashfs,ext4,f2fs rootwait pci=noaer
setenv fdtfile imx8mp-kontron-bl-osm-s.dtb
# load dtb (we try fdt_file and then fdt_file{1,2,3,4,5})
echo "loading DTB..."
setenv fdt_addr
setenv fdt_list $fdtfile $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 && for fdt in "$fdt_overlays"; do load ${devtype} ${devnum}:${distro_bootpart} $loadaddr $prefix/$fdt && fdt resize $filesize && 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}