Updating the kernel, Debian, GCC for i.MX287 in 2022

I’ve been trying to update everything on my i.MX287. Since I have a few of these lying around, I wanted to run something more modern on it. I am trying to follow this guide and adapt it for the i.MX28 as needed.

here are my settings:

  • I am using Ubuntu 22.04 as my build environment (inside a VM)
  • GCC 7.5 from here (gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi.tar.xz),
  • v2022.07 U-boot tag from the u-boot repo (could not find a right U-boot patch for this board),
  • Used this config for building u-boot: mx28evk_config,
  • Linux 5.3 kernel from RobertCNelson/armv5_devel repo,
  • Debian 11.4 (debian-11.4-minimal-armel-2022-07-11.tar.xz).

I managed to go all the way through the tutorial (applying small fixes and adjustments as needed). When I try to boot from the microSD card however, it throws this error: 0x80502008.

The only thing I can think of is that U-boot didn’t work, or that I need to either do an extra step in getting it to work, or I need a patch for the i.MX28.

The main goal here is to get a modern compiler (GCC 7 or higher) on my build machine so that I can run apps built on newer versions of C++ on my target board. It does seem possible, but perhaps I’m missing a step somewhere.

Any help here would be greatly appreciated!

HI @akram.ali which board do you have?

The mx28 family needs a few updates on mainline, i’d actually start with an older branch:

https://www.mail-archive.com/u-boot@lists.denx.de/msg413310.html

For a newer toolchain, pick one of these 5 toolchains:

These are the official toolchains tested by u-boot in all CI operations, so any change on mx287 would have been tested by these…

So personally i’d first start a rebuild with:

https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/6.4.0/x86_64-gcc-6.4.0-nolibc-arm-linux-gnueabi.tar.xz

and then try:

https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/x86_64-gcc-7.3.0-nolibc_arm-linux-gnueabi.tar.xz

Finally…

https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/9.2.0/x86_64-gcc-9.2.0-nolibc-arm-linux-gnueabi.tar.xz

Regards,

1 Like

Hi @RobertCNelson thanks for your reply.

I have a few custom boards we built several years ago based on the i.MX28 Eval kit.

Based on the mail link you sent, am I correct in interpreting that as using v2020.01 branch? Or does that mean I need to use something older than v2020.01?

Also, another instruction that I was confused about from the original getting started tutorial was u-boot patches, as I did not find any for mx28evk. Should I just skip that step and assume that there are no new patches for this board?

I will try those toolchains in that order - thanks!

I’d first try something after: v2019.01 but before v2020.01 just to see if U-Boot loads…

Regards,

@RobertCNelson I’m trying it out and will update here with progress.

I have one more question: For the last step in File Systems Table (/etc/fstab):

sudo sh -c “echo ‘/dev/mmcblk0p2 / auto errors=remount-ro 0 1’ >> /media/rootfs/etc/fstab”

should I replace mmcblk0p2 with sdb2 (referring to my SD card)?

Hi @akram.ali no… “/dev/sdb2” is what shows up when connected to your pc…

Boot the first time, then look at the boot log, you should see a mmc0 or mmc1 boot entry in the log… Based on that set ‘etc/fstab’…

Regards,

@RobertCNelson Unfortunately, I still get the following error when trying to boot from the SD card:

0x80502008
          HTLLCL0x80206008

I used v2019.10 for u-boot.

@RobertCNelson just to add on what else I did to get it to build:

  1. When configuring u-boot, I used the following command:

    make ARCH=arm CROSS_COMPILE=${CC} mx28evk_config

    where mx28evk_config replaces mx23_olinuxino_defconfig from the original guide.

  2. I added support for Ubuntu 22.04 in kernelbuildscripts/scripts/host_det.sh by adding a case for jammy under “Future Debian names”.

  3. I forced the build script to use the proper toolchain. In kernelbuildscripts/build_kernel.sh, there’s a line of code:

    unset CC

    This causes the script to download whatever it thinks the latest ARM toolchain is. If you comment out this line, it will use the toolchain we set our CC variable to point to.

  4. When running the build_kernel.sh script, it fails halfway through by throwing this error:

    multiple definition of ‘yylloc’; scripts/dtc/dtc-lexer.lex.o:

    In order to fix this, I edited the file kernelbuildscripts/KERNEL/scripts/dtc/dtc-lexer.lex.c. I changed the line YYLTYPE yylloc and to extern YYLTYPE yylloc, saved it and closed the file.

    Doing this will be detected as a change by git, so I went back to build_kernel.sh, commented out the line:

    /bin/sh -e “${DIR}/scripts/git.sh” || { exit 1 ; }

    and then in copy_defconfig() function, I removed the word distclean from this line:

    make ARCH=${KERNEL_ARCH} CROSS_COMPILE="${CC}" distclean

    Now running the build_kernel.sh script again, it continues through the build process. I did see a few unrelated warnings pop up, but it still compiled at the end.

  5. When the kernel compiles, it asks for configuration. I setup the following default command string:

    noinitrd console=ttyAM0,115200 root=/dev/mmcblk1p3 rw rootwait ip=none ssp1

Then proceed on with installing the kernel and root file system on a microSD card. Unfortunately, it still throws the same error as the previous post when trying to boot the board from the SD card.

Hi @akram.ali i found my mx23 board, which branch are you on right now?

Do a git reset HEAD --hard and then a git pull

I’ve fixed and boot tested, v4.9.x-imxv5, v4.14.x-imxv5 and v4.19.x-imxv5 so far…

Once i get things back to v5.15.x i’ll work on u-boot. :wink:

Regards,

@RobertCNelson I’m on v2019.10.

Sorry not u-boot yet, just the linux kernel scripts:

Regards,

Sorry, I misread that. I’m on v5.0.x-imxv5.

HEAD is now at 23efb01 kernel bump: v5.0-rc2

Just figured the “longterm” branch is better than the latest :grin:

Ah, just boot tested and pushed that one…

Regards,

@RobertCNelson Thanks for the quick update! I’ll give it a go!

@RobertCNelson it now builds without errors!

I’m still getting the same error codes on boot, so I’ll now wait for your u-boot fix. Thanks again for the support - highly appreciated.

Hi @akram.ali how much memory does your board have? the 64MB of ram on the mx23 really struggles with Debian 11… I’ve been pruning things but with systemd, we might be the end of the mx23 family on ‘stable’ debian…

As far as u-boot… something changed after… v2021.07, updated the wiki page and git repo…

Even thou, i checked out v2021.10… it shows up as…

U-Boot 2021.07-dirty (Aug 05 2022 - 23:08:12 -0500)

So something changed…

Regards,

@RobertCNelson I have 256MB on my mx28 board, so might fare slightly better.

I’ll give v2021.07 a shot… If that didn’t work, I’ll try v2021.10.