Migrating Linux Kernel from Apalis TK1 V1.1A to V1.2A

I’m attempting to update our Linux code-base to run on the Apalis TK1 V1.2.

I’ve merged the latest Linux kernel source and script changes and I am able to build the zImage and the dtb files and I’ve also successfully deployed these to our target hardware containing the TK1 V1.2.

However, when trying to boot the module, the system refuses to boot from the eMMC and goes through all the other available boot devices before ultimately failing:

Booting from internal eMMC chip...
reading tegra124-apalis-v1.2-eval.dtb
53812 bytes read in 16 ms (3.2 MiB/s)
reading zImage
5473816 bytes read in 139 ms (37.6 MiB/s)
MMC: no card present
switch to partitions #0, OK
mmc2 is current device
Scanning mmc 2:1...
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
starting USB...
USB0:   USB EHCI 1.10
USB1:   USB EHCI 1.10
USB2:   USB EHCI 1.10
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 1 for devices... 1 USB Device(s) found
scanning bus 2 for devices... 1 USB Device(s) found

USB device 0: unknown device
e1000: no NVM
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
DHCP client bound to address 192.168.0.158 (1143 ms)
*** Warning: no boot file name; using 'C0A8009E.img'
Using e1000#0 device
TFTP from server 192.168.0.4; our IP address is 192.168.0.158
Filename 'C0A8009E.img'.
Load address: 0x81000000
Loading: *
TFTP error: 'File not found' (1)
Not retrying...
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/01-00-14-2d-63-0b-eb
Using e1000#0 device
TFTP from server 192.168.0.4; our IP address is 192.168.0.158
Filename 'pxelinux.cfg/01-00-14-2d-63-0b-eb'.
Load address: 0x90100000
Loading: *
TFTP error: 'File not found' (1)
Not retrying...

One thing I did notice is that the loadaddr=0x81000000 parameter was set differently to how our compile script was running (now changed LOADADDR to match the above):

make -j3 zImage LOADADDR=0x80008000

Here’s the printenv output in case this helps with anything.

U-Boot 2016.11-2.8.6+g83a53c1c0c (Apr 01 2019 - 09:57:13 +0000)

SoC: tegra124
Reset cause: POR
DRAM:  2 GiB
MMC:   Tegra SD/MMC: 0, Tegra SD/MMC: 1, Tegra SD/MMC: 2
In:    serial
Out:   serial
Err:   serial
Model: Toradex Apalis TK1 2GB V1.2A, Serial# 06491115
Net:   No ethernet found.
Hit any key to stop autoboot:  0
Apalis TK1 # printenv
arch=arm
baudrate=115200
board=apalis-tk1
board_name=apalis-tk1
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
boot_file=zImage
boot_net_pci_enum=pci enum
boot_net_usb_start=usb start
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_targets=mmc1 mmc2 mmc0 usb0 pxe dhcp
bootcmd=run emmcboot; setenv fdtfile ${soc}-${fdt_module}-${fdt_board}.dtb && run distro_bootcmd
bootcmd_dhcp=run boot_net_usb_start; run boot_net_pci_enum; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;
bootcmd_mmc0=setenv devnum 0; run mmc_boot
bootcmd_mmc1=setenv devnum 1; run mmc_boot
bootcmd_mmc2=setenv devnum 2; run mmc_boot
bootcmd_pxe=run boot_net_usb_start; run boot_net_pci_enum; dhcp; if pxe get; then pxe boot; fi
bootcmd_usb0=setenv devnum 0; run usb_boot
bootdelay=1
console=ttyS0
cpu=armv7
defargs=lp0_vec=2064@0xf46ff000 core_edp_mv=1150 core_edp_ma=4000 usb_port_owner_info=2 lane_owner_info=6 emc_max_dvfs=0 pcie_aspm=off user_debug=30
dfu_alt_info=apalis-tk1.img raw 0x0 0x500 mmcpart 1; boot part 0 1 mmcpart 0; rootfs part 0 2 mmcpart 0; zImage fat 0 1 mmcpart 0; tegra124-apalis-eval.dtb fat 0 1 mmcpart 0
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
emmcargs=ip=off root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait
emmcboot=run setup; setenv bootargs ${defargs} ${emmcargs} ${setupargs} ${vidargs}; echo Booting from internal eMMC chip...; run emmcdtbload; load mmc 0:1 ${kernel_addr_r} ${boot_file} && run fdt_fixup && bootz ${kernel_addr_r} - ${dtbparam}
emmcdtbload=setenv dtbparam; load mmc 0:1 ${fdt_addr_r} ${soc}-${fdt_module}-${fdt_board}.dtb && setenv dtbparam ${fdt_addr_r}
ethaddr=00:14:2d:63:0b:eb
fdt_addr_r=0x82000000
fdt_board=eval
fdt_fixup=;
fdt_high=ffffffff
fdt_module=apalis-v1.2
fdtcontroladdr=fda32a40
initrd_high=ffffffff
ipaddr=192.168.10.2
kernel_addr_r=0x81000000
loadaddr=0x81000000
mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi
netmask=255.255.255.0
nfsargs=ip=:::::eth0:on root=/dev/nfs rw
nfsboot=pci enum; run setup; setenv bootargs ${defargs} ${nfsargs} ${setupargs} ${vidargs}; echo Booting via DHCP/TFTP/NFS...; run nfsdtbload; dhcp ${kernel_addr_r} && run fdt_fixup && bootz ${kernel_addr_r} - ${dtbparam}
nfsdtbload=setenv dtbparam; tftp ${fdt_addr_r} ${soc}-${fdt_module}-${fdt_board}.dtb && setenv dtbparam ${fdt_addr_r}
pxefile_addr_r=0x90100000
ramdisk_addr_r=0x82100000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.conf; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0x90000000
sdargs=ip=off root=/dev/mmcblk1p2 ro rootfstype=ext4 rootwait
sdboot=run setup; setenv bootargs ${defargs} ${sdargs} ${setupargs} ${vidargs}; echo Booting from MMC/SD card in 8-bit slot...; run sddtbload; load mmc 1:1 ${kernel_addr_r} ${boot_file} && run fdt_fixup && bootz ${kernel_addr_r} - ${dtbparam}
sddtbload=setenv dtbparam; load mmc 1:1 ${fdt_addr_r} ${soc}-${fdt_module}-${fdt_board}.dtb && setenv dtbparam ${fdt_addr_r}
serial#=06491115
serverip=192.168.10.1
setethupdate=if env exists ethaddr; then; else setenv ethaddr 00:14:2d:00:00:00; fi; pci enum && tftpboot ${loadaddr} flash_eth.img && source ${loadaddr}
setsdupdate=setenv interface mmc; setenv drive 1; mmc rescan; load ${interface} ${drive}:1 ${loadaddr} flash_blk.img || setenv drive 2; mmc rescan; load ${interface} ${drive}:1 ${loadaddr} flash_blk.img && source ${loadaddr}
setup=setenv setupargs igb_mac=${ethaddr} consoleblank=0 no_console_suspend=1 console=tty1 console=${console},${baudrate}n8 debug_uartport=lsport,0 ${memargs}
setupdate=run setsdupdate || run setusbupdate || run setethupdate
setusbupdate=usb start && setenv interface usb; setenv drive 0; load ${interface} ${drive}:1 ${loadaddr} flash_blk.img && source ${loadaddr}
soc=tegra124
stderr=serial
stdin=serial
stdout=serial
usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_for_boot_part; fi
usbargs=ip=off root=/dev/sda2 ro rootfstype=ext4 rootwait
usbboot=run setup; setenv bootargs ${defargs} ${setupargs} ${usbargs} ${vidargs}; echo Booting from USB stick...; usb start && run usbdtbload; load usb 0:1 ${kernel_addr_r} ${boot_file} && run fdt_fixup && bootz ${kernel_addr_r} - ${dtbparam}
usbdtbload=setenv dtbparam; load usb 0:1 ${fdt_addr_r} ${soc}-${fdt_module}-${fdt_board}.dtb && setenv dtbparam ${fdt_addr_r}
vendor=toradex
ver=U-Boot 2016.11-2.8.6+g83a53c1c0c (Apr 01 2019 - 09:57:13 +0000)
vidargs=fbcon=map:1

Environment size: 5571/8188 bytes

Some additional info from u-boot:

Apalis TK1 # mmc dev 0 0
switch to partitions #0, OK
mmc0(part 0) is current device
Apalis TK1 # mmc part

Partition Map for MMC device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     8192            32768           9f808538-01     0c
  2     40960           30679040        9f808538-02     83
Apalis TK1 # ls mmc 0:1
  5473816   zimage
    53812   tegra124-apalis-eval.dtb
    53812   tegra124-apalis-v1.2-eval.dtb

3 file(s), 0 dir(s)

Apalis TK1 # ls mmc 0:2
<DIR>       4096 .
<DIR>       4096 ..
<DIR>      16384 lost+found
              62 README.txt
<DIR>       4096 bin
<DIR>       4096 boot
<DIR>       4096 dev
<DIR>      12288 etc
<DIR>       4096 home
<DIR>       4096 lib
<DIR>       4096 media
<DIR>       4096 mnt
<DIR>       4096 opt
<DIR>       4096 proc
<DIR>       4096 root
<DIR>       4096 run
<DIR>      12288 sbin
<DIR>       4096 srv
<DIR>       4096 sys
<DIR>       4096 tmp
<DIR>       4096 usr
<DIR>       4096 var

And more info…

I can load in the zimage and tegra124-apalis-v1.2-eval.dtb files but when I try to boot from the ${loadaddr} then the system just resets:

Apalis TK1 # load mmc 0:1 ${kernel_addr_r} zimage
reading zimage
5473816 bytes read in 139 ms (37.6 MiB/s)
Apalis TK1 # load mmc 0:1 ${kernel_addr_r} tegra124-apalis-v1.2-eval.dtb
reading tegra124-apalis-v1.2-eval.dtb
53812 bytes read in 17 ms (3 MiB/s)
Apalis TK1 # go ${loadaddr}
## Starting application at 0x81000000 ...
undefined instruction
pc : [<81000004>]          lr : [<fff46840>]
reloc pc : [<011ce004>]    lr : [<80114840>]
sp : fda327f0  ip : 00000030     fp : fff467f8
r10: 00000002  r9 : fda3fee0     r8 : fda43118
r7 : fffb014c  r6 : 81000000     r5 : 00000002  r4 : fda4311c
r3 : 81000000  r2 : fda4311c     r1 : fda4311c  r0 : 00000001
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...

No, go is not sufficient to hand over control from U-Boot to the Linux Kernel. Either use bootz in case of booting a zImage or bootm if booting an uImage. Please also make sure to load the device tree and the kernel binary to their proper addresses rather then the same one leading to the former just being overwritten by the later.

BTW: One difference I can see from comparing your U-Boot environment with mine from a standard installation is the rw vs. ro in the emmcargs. Nowadays, read-only is recommended as systemd will re-mount it read/write afterwards.

Hi @marcel.tx, I’ve already tried changing this as per another forum post however this didn’t help. Also, yes - apologies - I was originally loading both binaries into the same address. I will give it a try using the bootz command. Thanks

So this works now, right?

Nope, not at all

Will post some meaningful output tomorrow.

Please remember to include any and all information about what exact hardware (module and carrier board) and software versions of things you are talking about. Plus please full serial debug console boot log output attached as textual files. Thanks!

BTW: What exact Linux distribution are you using on your Linux workstation where you did prepare your legacy update media? Could it be that you are just facing the following issue which is one of them many reasons to immediately stop using legacy and move on to the Toradex Easy Installer?

https://developer.toradex.com/software/linux/linux-software/release-details?view=all&issue=37276

Please find attached full serial console boot logs of both Toradex Easy Installer and legacy update procedure doing BSP 2.8b6 installations. So it indeed could work.

Hi @marcel.tx, I’m using Ubuntu 18.04.

Regarding the BSP 2.8b6 installation, are there any special instructions for doing this other than what are detailed on the developer pages?

I have some brand new Apalis TK1 V1.2A modules on my desk this morning with which to try various installations. I’ll be sure to post ALL of the serial console output with my comments.

Your help is really appreciated.

Ok, so here is a log for the legacy LXDE Image 2.8

You really just face the metadata_csum issue as I mentioned above in 37276. Get that thing disabled in whatever unsupported distro you should be using, re-generate your update media and all will be fine.

Alternatively, just do us a favour and start using the Toradex Easy Installer. Thanks!

And here is the output for the TEZI 1.8 Image

This seems to work OK, so I can probably use this as my platform to install both Qt and ROS

Yes, exactly.

@marcel.tx Thanks, yeah, I think I’ll move forward with the TEZI images.

Sorry to be a pain in the ass :slight_smile:

No worries. That legacy stuff is, unfortunately, rather fragile as it depends on various things like e.g. tooling from your distro completely outside of our control.

Just let us know should you have any further questions or comments. We are happy to help!

@marcel.tx Ha, you’ll regret saying that!!

Hi @marcel.tx, I’m having decent success with the Easy Installer now.

Once thing I’m trying to do is to re-package the boot and rootfs into the Easy Installer package however, I’m getting the following error after selecting our package via the GUI:

xz (stdin): File format not recognized
tar: This does not look like a tar archive

I have tarballed the respective folder contents using the following command:

tar cJf ../rootfs.tar.xz *
and
tar cJf ../bootfs.tar.xz *

I’ve also updated the image.json file to reflect the changes in tarball names.

Any clues as to what I may have done wrong?

Thanks!

It would appear that using tar.bz2 files just work so I’ve gone with that approach.

Finally, how can I determine what the uncompressed_size values need to be?

The numbers provided in the image.json from the 1.8 Easy Installer doesn’t seem to match the actual uncompressed file sizes so I’m a little puzzled.

And you did use capital J for xz vs. small j for bz2?

The sizes get automatically filled in during an OpenEmbedded build. However, I believe we round it up quite a bit to avoid running out of space. Just set it to a reasonable value also rather rounding generously up.