I'm working through the User Guide for the LS1028A BSP on a LS1028ARDB reference board. (Document Number: LS1028ABSPUG, Rev. 0.3, 04/2019) I'm new to NXP products, but experienced with Linux and embedded processors. I'm completely unfamiliar with NXP products, so I'm working through section 3.1, LS1028A Quick Start.
I've successfully worked through section 3.1.3, Download and assemble LS1028A BSP images. I had a lot of problems with step 3, most due to the web proxy required by my local IT environment (I will post my problems and solutions in another thread so others don't have to suffer through, if I get a chance.) But another big stumbling block was the second to last command, flex-builder -i merge-component -a arm64, would fail with what looked like a Makefile failing to find a Linux modules and/or headers directory structure where it expected them to be. I found a number of posts on these forums detailing similar problems. The most common answer was to perform the merge manually, but that seemed to ignore the root cause of the problem. I was able to solve this by first running flex-builder -c linux -a arm64, which I believe downloaded and built a Linux kernel. After this, the flex-builder -i merge-component -a arm64 command was successful, and I was able to complete all steps in section 3.1.3. (I notice later that in section 3.2 of the User Guide, the Linux build command is documented, although with no indication that it's needed to succeed with section 3.1.3.) One suggestion I have is that the User Guide provide indication of what a the successful execution of each command looks like, so that a novice like myself can tell if there was a problem. My first run through these steps, I wasn't paying close attention, so I thought it was successful. It wasn't until later steps started failing that I went back, noticed some errors that scrolled past, fixed them, and eventually saw that a sucessful step usually prints [Done] in green text.
Now I am working on section 3.1.4, Deploy LS1028A BSP image on board. I am only trying to get experience with this process, so I don't have a particular deployment approach in mind. But as a first attempt I am trying to boot from the removable SD card, while also leaving the factory-installed configuration alone. When powered on, my board reports: Board: LS1028AE Rev1.0-RDB, Version: A, boot from NOR . I have not changed the DIP switches from default.
I got through step 8 of section 188.8.131.52, Option 1 - Deploy LS1028A BSP images using removable storage device . with no apparent errors, but I later noticed that in step 4, the command flex-installer -b bootpartition_arm64_lts_4.14.tgz -r build/images/rootfs_ubuntu_bionic_arm64_201910031619.tgz -d /dev/sdX (run on the host PC) does not include a -f firmware_... argument.
In step 9, when I try to Program/update the composite firmware to FlexSPI NOR flash (or eMMC / SD card) , I power on the board, drop to the uboot shell and run the command for SD Card per the given table and associated note about what file name to use: load mmc 0:2 a0000000 firmware_ls1028ardb_uboot_sdboot.img . The result was ** File not found firmware_ls1028ardb_uboot_sdboot.img ** .
So I go back to the host computer to see if that file even existed in the flexbuild directory. It does not. I poke around a bit and find that later in the User Guide that I can either download the firmware (per section 184.108.40.206) or build it myself (per section 3.2). I choose the latter, and run the command flex-builder -i mkfw -m ls1028ardb -b sd. Further on in section 3.2, I see the command to include the newly created firmware into the SD card: flex-installer -f firmware_ls1028ardb_uboot_sdboot.img -d /dev/mmcblk0.
So I bring the SD card back to the LS1028ARDB board, repeat the power on and uboot interrupt procedure, and again attempt the command load mmc 0:2 a0000000 firmware_ls1028ardb_uboot_sdboot.img . The result is unchanged: ** File not found firmware_ls1028ardb_uboot_sdboot.img ** .
After more investigation, I see that the flex-installer command direct dumps the firmware_*.img directly to the SD card device, rather than place it in a partition. This explains why the load command fails; there is no file with that name on the card.
So next I try several things. First, I ignore the load failure and press on with the next Quick Start commands relevant to SD booting, which are mmc rescan; mmc dev 0; mmc write a0000000 8 0x25000 and qixis_reset sd . This locks up the board, and when I power cycle, the board first attempts to boot off the the SD (MMC read:...) but is followed by Wrong Image Format for bootm command and then ERROR: can't get kernel image!". Fortunately it then immediately boots off the internal default images (Trying load from EMMC ..) which is successful.
When I put the SD card back in the host PC, I see that the first partition (/dev/mmcblk0p1 aka "EFI") that was created by the flex-install command is now corrupt. I assume the mmc write a0000000 8 0x25000 command done above is the culprit. So I recreate the entire SD card with the corresponding flex-install command, once again boot the board back into the uboot prompt, and run only these commands:
mmc rescan; mmc dev 0; qixis_reset sd
This does not lock up the board, but instead causes a reboot. The MMC read... is no longer followed by errors, mmc0 is listed as the current device, uboot finds a boot script, and a kernel on the MMC (SD device), and the kernel starts booting. After the kernel messages, I'm greeted with Welcome to Ubuntu 18.04.3 LTS! (where previously it said QorIQ SDK (FSL Reference Distro).)
It's downhill from there, because the Linux startup sequence fails and dumps me into emergency mode. Something to do with systemd-fsck apparently. But that's a problem for tomorrow....
OK, as of this writing, My current personal version of version 0.4 of the Quick Start guide is:
tar xvzf flexbuild_<version>.tgz
flex-build -c linux -a arm64 # this step is not in the Quick Start guide; it downloads Linux source apparently needed by the next step.
flex-builder -i merge-component -a arm64
flex-builder -i compressrfs -a arm64
Section 220.127.116.11 (Option 1 - Deploying to removable storage, SD card in my case)
flex-builder -i mkfw -m ls1028ardb -b sd # this command is not in the Quick Start; it creates the uboot firmware.
flex-installer -b bootpartition_arm64_lts_<version>.tgz -r build/images/rootfs_ubuntu_bionic_arm64_<timestamp>.tgz -d /dev/sdX
sudo dd if=firmware_ls1028ardb_uboot_sdboot.img of=dev/sdX bs=512 seek=8 # this command is no in the Quick Start; it embeds the uboot firmware into the SD card so that it can be used to boot the system.
# alternative to running the dd command is to add the flag "-f firmware_ls1028ardb_uboot_sdboot.img" to the flex-installer command.
Place the SD card into the unit and reboot it. Interuptt the boot process so that you can enter uboot commands.
*** DO NOT RUN THE UBOOT COMMANDS AS LISTED IN THE QUICK START ***
The "load mmc 0:2 a000000 firmware_ls1028ardb_uboot_sdboot.img" command will fail. That file is nowhere on the the SD card partition file systems. It is already embedded into the SD card (but not in a file system).
If you proceed to run "mmc write a0000000 8 0x25000" command, the SD card will be corrupted.
My theory (thanks to Vadim's advice) is that the load command is supposed to load the firmware file from an SD card partition file system into memory, then the mmc write command writes the memory back out to the SD card but embedded into it as a bootable binary blob. But since the load command failed, there's only garbage in memory which will get written to the SD card. The Load and Write are completely unnecessary since the firmware is already there since it was added using the "dd" command or the "-f firmware.img" flag to the "flex-installer" command
The uboot commands that do work safely for me are:
mmc dev 0
This reboot the unit using the SD card firmware, boot, and root images/data. You'll have to repeat the (corrected) uboot commands each time you boot, at least until you change the DIP switches (if I understand correctly; haven't tried it yet.)
This boots into the Ubuntu root filesystem. Unfortunately I still get file system and device I/O errors, as described here. So it's possible the above procedure still has errors.
I'm working through the same problems, same guide.
I found a thread that explains how to get around the `merge-component` failing due to a symlink error.
For step 9 of 18.104.22.168 - here's what I did:
There is no mention on where to get the uboot images. After some research, I found this thread which has a link.
Put this image on a FAT-formatted USB drive and inserted it into the board, along with the SD card created using `flex-installer`.
Power the board and monitor the serial terminal. I saw something like this:
Model: NXP Layerscape 1028a RDB Board
Board: LS1028AE Rev1.0-RDB, Version: A, boot from NOR.
Interrupt the boot sequence to enter U-Boot prompt.
Used the U-Boot command reference to understand what is going on here. Basically, we're copying the uboot image to RAM from the the USB drive, and then writing it to the first partition of the SD card, which as you said was left blank/corrupted.
The following comments refer to the U-Boot commands from the guide:
#1 => usb start
#2 => load usb 0 a0000000 <filename>
#3 => mmc rescan; mmc dev 0; mmc write a0000000 8 0x25000
#4 => qixis_reset sd
For command # 2: The output of `usb start` lists the usb devices. I had only 1 plugged in (the drive with the image). This number is used in the 2nd command. Optionally you can specify 0:X (as per guide), where X is the partition on that usb drive.
For command # 3: Run `mmc list` to identify the # of mmc device that your SD card was assigned. The output will have (sd) is parenthesis next to it.
Command #4 will restart the board and hopefully boot to Ubuntu.
The boot log will look similar, except:
Model: NXP Layerscape 1028a RDB Board
Board: LS1028AE Rev1.0-RDB, Version: A, boot from SD.
The board is now booted to Ubuntu. Note that if you reboot, it'll boot from NOR again. Boot sequence can then be interrupted at U-Boot and `=> qixis_reset sd` run again to change boot target.
After that I took care of the `merge-component` problem from before.
The ubuntu distro is fully functional.
Hope this helps :smileyhappy:
Hi Vadim, thank you for your reply, and for sharing your experiences. I wonder if, instead of having a USB drive in addition to the SD card, you could copy the firmware into the first partition of the SD card (as partitioned by flex-installer). The flex-installer seems to make 3 partitions. The first is FAT formatted, and is remains empty, at least if you are following the Quick Start guide. The second one is formatted EXT4 (which is backwards compatible with EXT2, which will make uboot happy) and contains the linux kernel and other booting-related data. The third partition contains the Root file systems, and is also EXT4/EXT2 formatted.
So, if you copy the firmware to the FAT partition, you can modify all of your uboot commands that refer to "usb" to instead to refer to "mmc". This way you won't need the USB drive any more. In theory. This assumes you don't have a requirement or desire to use the USB drive, of course.
Strike that suggestion. I see the firmware file is 42 Mbytes, while the FAT partition is only 24 Mbytes big. It won't fit on the SD Card's first partition. This must be why Pavel suggests to run the "dd" command on the Host PC.
Hivadim.email@example.com, I'm having the same problems and thanks for the help. I wanted to ask if you modified the DIP Switches during the process? Did you use the configuration for FSPI NOR (default) boot? Can't we change it to SD Card (SDHC1) Boot after you successfully boot to Ubuntu? Btw, if I recall correctly, the default switch settings were different than NOR settings.
I have not modified the DIP switch configuration, and intentionally so. You're right in that it should take care of the board booting from NOR again after restart/reset/power cycling. I'll try that.
Build image for your board using the following command:
flex-builder -i mkfw -m ls1028ardb -b sd
Find .img file using the following path:
Connect SD card using SD card reader to your PC host.
Write this image to SD on your PC host using the following command
sudo dd if= firmware_ls1028ardb_uboot_sdboot.img of=/dev/sdb bs=512 seek=8
Have a great day,
Note: If this post answers your question, please click the Correct Answer button. Thank you!
Pavel, thank you for your reply. I'm struggling with your advice, however.
As reported, I did discover that I needed to run flex-builder -i mkfw -m ls1028ardb -b sd. Vadim below suggests an alternative, which is to download the already built firmware. Unfortunately the Quick Start section of the user guide did not mention either variation of this step. Just as the Quick Start instructions omitted the need to run flex-builder -l linux... before running flex-builder -i merge-components in the previous section.
The "dd" command you mention will dump the firmware directly to the start of the SD card. This will overwrite the superblock and partition data, and maybe corrupt the first partition, depending on how big the firmware is vs how much offset space the flex-installer command reserved before creating the first partition. This is also done automatically when I run flex-installer. So I expect to get the same results as I reported above. This is because the "dd" command will not place the firmware file into a file system on any of the SD card partitions. Yet the Quick Start section of the user guide says the next thing to do is run
I'm sure your advice makes sense in some context, but I don't think it's in the context of how the Quick Start guide is currently written. I don't think the steps listed in the Quick Start section of the user guide are cohesive at all. I wonder if perhaps your suggestion of using the "dd" command is what is required if / when you change the DIP switches? If so, the Quick Start guide should say that rather than saying to interrupt the uboot and run the "load mmc..." command.
The rest of Vadim's suggestion below makes me wonder if the "load mmc..." command will work if I copy the firmware file into the VFAT-formatted partition of the SD card rather than let flex-installer "dd" the firmware directly on to the SD card.
Pavel I think I understand why you suggest the running the dd command. It's needed to put the firmware onto the SD card in order to make the card bootable. But it's also important to add that the uboot command "mmc write ..." should not get executed as the Quick Start guide specifies, because unless you are able to successfully run the "load" uboot command, the "mmc write" command has nothing to write to the SD card, and it appears that it will corrupt the card.