Hello All,
I want to create Squashfs RamDisk, a compressed read-only filesystem, to the root filesystem of Apalis Imx8 !!
I built a Customized Reference-Multimedia-Image according this Article
Article Link
And i have image-Reference-Multimedia-Image.json
{
"config_format": "4",
"autoinstall": false,
"name": "Toradex Embedded Linux Reference Multimedia Image",
"description": "Image for BSP verification with QT and multimedia features",
"version": "5.7.0-devel-20240724124303+build.0",
"release_date": "2024-07-24",
"u_boot_env": "u-boot-initial-env-sd",
"prepare_script": "prepare.sh",
"wrapup_script": "wrapup.sh",
"marketing": "marketing.tar",
"icon": "toradexlinux.png",
"license": "LA_OPT_NXP_SW.html",
"blockdevs": [
{
"name": "mmcblk0",
"partitions": [
{
"partition_size_nominal": 48,
"want_maximised": false,
"content": {
"label": "BOOT",
"filesystem_type": "FAT",
"mkfs_options": "",
"filename": "Reference-Multimedia-Image-apalis-imx8.bootfs.tar.xz",
"uncompressed_size": 11.73046875
}
},
{
"partition_size_nominal": 512,
"want_maximised": false,
"content": {
"filesystem_type": "raw",
"rawfiles": [
{
"filename": "Apalis-iMX8_Reference-Multimedia-Image.rootfs.squashfs"
}
]
}
},
]
},
{
"name": "mmcblk0boot0",
"erase": true,
"content": {
"filesystem_type": "raw",
"rawfiles": [
{
"filename": "imx-boot",
"dd_options": "seek=0"
}
]
}
}
]
}
and boot.scr
'V}\A2!eM\9B\9E\F0\00\00\8E\00\00\00\00\00\00\00\00#p\94>a\00Distro boot script\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\86\00\00\00\00# SPDX-License-Identifier: GPL-2.0+ OR MIT
#
# Copyright 2020 Toradex
#
# Toradex boot script.
#
# Allows to change boot and rootfs devices independently.
# Supports:
# - boot device type: boot_devtype := {mmc, usb, tftp, dhcp}
# - boot device num (for mmc, usb types): boot_devnum := {0 .. MAX_DEV_NUM}
# - boot partition (for mmc, usb types): boot_part := {1 .. MAX_PART_NUM}
# - root device type: root_devtype := {mmc, usb, nfs-dhcp, nfs-static}
# - root device num (for mmc, usb types): root_devnum := {0 .. MAX_DEV_NUM}
# - root partition (for mmc, usb types): root_part := {1 .. MAX_PART_NUM}
#
# Defaults:
# root_devtype = boot_devtype = devtype
# root_devnum = boot_devnum = devnum
# boot_part = distro_bootpart
# root_part = 2
#
# Common variables used in tftp/dhcp modes:
# - Static/dynamic IP mode: ip_dyn := {yes, no}
# - Static IP-address of TFTP/NFS server: serverip := {legal IPv4 address}
# - Static IP-address of the module: ipaddr := {legal IPv4 address}
# - Root-path on NFS-server: rootpath := {legal path, exported by an NFS-server}
#
# Common flags:
# - Skip loading overlays: skip_fdt_overlays := {1, 0}
# 1 - skip, any other value (or undefined variable) - don't skip.
# This variable is adopted from the TorizonCore and shouldn't be
# renamed separately.
if test ${devtype} = "ubi"; then
echo "This script is not meant to distro boot from raw NAND flash."
exit
fi
test -n ${m4boot} || env set m4boot ';'
test -n ${fdtfile} || env set fdtfile ${fdt_file}
test -n ${boot_part} || env set boot_part ${distro_bootpart}
test -n ${root_part} || env set root_part 2
test -n ${boot_devnum} || env set boot_devnum ${devnum}
test -n ${root_devnum} || env set root_devnum ${devnum}
test -n ${kernel_image} || env set kernel_image Image.gz
test -n ${boot_devtype} || env set boot_devtype ${devtype}
test -n ${overlays_file} || env set overlays_file "overlays.txt"
test -n ${overlays_prefix} || env set overlays_prefix "overlays/"
test ${boot_devtype} = "mmc" && env set load_cmd 'load ${boot_devtype} ${boot_devnum}:${boot_part}'
test ${boot_devtype} = "usb" && env set load_cmd 'load ${boot_devtype} ${boot_devnum}:${boot_part}'
test ${boot_devtype} = "tftp" && env set load_cmd 'tftp'
test ${boot_devtype} = "dhcp" && env set load_cmd 'dhcp'
# Set Root source type properly.
# devtype tftp => nfs-static
# devtype ghcp => nfs-dhcp
if test "${root_devtype}" = ""; then
if test ${devtype} = "tftp"; then
env set root_devtype "nfs-static"
else
if test ${devtype} = "dhcp"; then
env set root_devtype "nfs-dhcp"
else
env set root_devtype ${devtype}
fi
fi
fi
if test -n ${setup}; then
run setup
else
env set setupargs 'console=tty1 console=${console},${baudrate} consoleblank=0'
fi
if test ${kernel_image} = "Image.gz"
then
env set kernel_addr_load ${loadaddr}
env set bootcmd_unzip 'unzip ${kernel_addr_load} ${kernel_addr_r}'
else
env set bootcmd_unzip ';'
if test ${kernel_image} = "fitImage"
then
env set kernel_addr_load ${ramdisk_addr_r}
else
env set kernel_addr_load ${kernel_addr_r}
fi
fi
# Set dynamic commands
env set set_bootcmd_kernel 'env set bootcmd_kernel "${load_cmd} \\${kernel_addr_load} \\${kernel_image}"'
env set set_load_overlays_file 'env set load_overlays_file "${load_cmd} \\${loadaddr} \\${overlays_file} && env import -t \\${loadaddr} \\${filesize}"'
if test ${kernel_image} = "fitImage"
then
env set fdt_high
env set fdt_resize true
env set set_bootcmd_dtb 'env set bootcmd_dtb "true"'
env set set_apply_overlays 'env set apply_overlays "for overlay_file in \"\\${fdt_overlays}\"; do env set fitconf_fdt_overlays \"\\"\\${fitconf_fdt_overlays}#conf-\\${overlay_file}\\"\"; env set overlay_file; done; true"'
env set bootcmd_boot 'echo "Bootargs: \${bootargs}" && bootm ${ramdisk_addr_r}#conf-\${fdtfile}\${fitconf_fdt_overlays}'
else
env set fdt_resize 'fdt addr ${fdt_addr_r} && fdt resize 0x20000'
env set set_bootcmd_dtb 'env set bootcmd_dtb "echo Loading DeviceTree: \\${fdtfile}; ${load_cmd} \\${fdt_addr_r} \\${fdtfile}"'
env set set_apply_overlays 'env set apply_overlays "for overlay_file in \\${fdt_overlays}; do echo Applying Overlay: \\${overlay_file} && ${load_cmd} \\${loadaddr} \\${overlays_prefix}\\${overlay_file} && fdt apply \\${loadaddr}; env set overlay_file; done; true"'
env set bootcmd_boot 'echo "Bootargs: \${bootargs}" && booti ${kernel_addr_r} - ${fdt_addr_r}'
fi
# Set static commands
if test ${root_devtype} = "nfs-dhcp"; then
env set rootfsargs_set 'env set rootfsargs "root=/dev/nfs rw ip=dhcp nfsroot=${serverip}:${rootpath},v3,tcp"'
else
if test ${root_devtype} = "nfs-static"; then
env set rootfsargs_set 'env set rootfsargs "root=/dev/nfs rw ip=${ipaddr} nfsroot=${serverip}:${rootpath},v3,tcp"'
else
env set uuid_set 'part uuid ${root_devtype} ${root_devnum}:${root_part} uuid'
env set rootfsargs_set 'run uuid_set && env set rootfsargs root=PARTUUID=${uuid} rootfstype=squashfs ro rootwait'
fi
fi
env set bootcmd_args 'run rootfsargs_set && env set bootargs ${defargs} ${rootfsargs} ${setupargs} ${vidargs} ${tdxargs}'
if test ${skip_fdt_overlays} != 1; then
env set bootcmd_overlays 'run load_overlays_file && run fdt_resize && run apply_overlays'
else
env set bootcmd_overlays true
fi
env set bootcmd_prepare 'run set_bootcmd_kernel; run set_bootcmd_dtb; run set_load_overlays_file; run set_apply_overlays'
env set bootcmd_run 'run m4boot; run bootcmd_dtb && run bootcmd_overlays && run bootcmd_args && run bootcmd_kernel && run bootcmd_unzip && run bootcmd_boot; echo "Booting from ${devtype} failed!" && false'
run bootcmd_prepare
run bootcmd_run
But i faced this error after flash and reset the board
This is uboot command line
U-Boot 2020.04-5.7.0-devel+git.33bb8e968332 (Jul 06 2022 - 12:21:53 +0000)
CPU: NXP i.MX8QM RevB A53 at 1200 MHz
DRAM: 4 GiB
MMC: FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... OK
In: serial
Out: serial
Err: serial
Model: Toradex Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT V1.0B, Serial# 06540921
BuildInfo:
- SCFW 216a2c2e, SECO-FW c9de51c0, IMX-MKIMAGE 6a315dbc, ATF 2fa8c63
- U-Boot 2020.04-5.7.0-devel+git.33bb8e968332
switch to partitions #0, OK
mmc0(part 0) is current device
flash target is MMC:0
Net: eth0: ethernet@5b040000
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot: 0
MMC: no card present
MMC: no card present
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
5838 bytes read in 22 ms (258.8 KiB/s)
## Executing script at 83100000
** Bad device specification ${boot_devtype} ${boot_devnum} **
** Bad device specification ${boot_devtype} ${boot_devnum} **
Loading hdp firmware from 0x000000009c000000 offset 0x0000000000002000
Loading hdp firmware Complete
Loading DeviceTree: imx8qm-apalis-eval.dtb
167910 bytes read in 25 ms (6.4 MiB/s)
43 bytes read in 20 ms (2 KiB/s)
Applying Overlay: apalis-imx8_hdmi_overlay.dtbo
2177 bytes read in 19 ms (111.3 KiB/s)
** Invalid partition 2 **
Booting from mmc failed!
SCRIPT FAILED: continuing...
167910 bytes read in 25 ms (6.4 MiB/s)
starting USB...
Bus usb@5b0d0000: usb dr_mode not found
Port not available.
Bus usbh3: XHCI-imx8 init hccr 0x000000005b130000 and hcor 0x000000005b130080 hc_length 128
Register 2000820 NbrPorts 2
Starting the controller
USB XHCI 1.00
scanning bus usbh3 for devices... 2 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
Device 0: Vendor: ADATA Rev: 1100 Prod: USB Flash Drive
Type: Removable Hard Disk
Capacity: 14800.0 MB = 14.4 GB (30310400 x 512)
... is now current device
Scanning usb 0:1...
ethernet@5b040000 Waiting for PHY auto negotiation to complete............................... TIMEOUT !
Could not initialize PHY ethernet@5b040000
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
When Boot from Ramdisk i faced error
** Invalid partition 2 **
Booting from mmc failed!
SCRIPT FAILED: continuing...
Could you tell me, if you know how to do it?
Thanks advance,