Thanks Otavio,
I applied the patches and began a clean build. The image is almost
correct:
There are 3 partitions and the FAT32 and the EXT4 look OK but the boot
stream on partition 1 of type 0x53 has the wrong offset in the header.
The file
"core-image-minimal-imx28evk-20180427075602.rootfs.uboot-mxsboot-sdcard"
starts:
00000000 33 22 11 00 01 00 00 00 01 00 00 00 01 00 00 00
00000010 00 00 00 00 00 00 00 00 01 00 00 00 04 08 00 00
00000020 28 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
00000800 97 73 ba 38 41 db b9 70 a6 15 cb b4 9a 1b 1f 4d
00000810 f8 40 89 5e 53 54 4d 50 01 01 01 00 9b a4 00 00
00000820 09 00 00 00 00 00 00 00 01 00 07 00 06 00 01 00
00000830 01 00 00 00 73 67 74 6c 40 ad e3 a1 32 0d 02 00
and so would only be correct if burnt to address 0x00100000 (sector
0x0800) but it is burnt to address 0x00000400 and so the offset in the
header should be 0x000000006.
I tried adding '-p 2' to the line in
meta-freescale/classes/image_types_fsl.bbclass (just as a test):
IMAGE_CMD_uboot-mxsboot-sdcard = "mxsboot -p 2 sd
$/u-boot-$.$ \
$/$.rootfs.uboot-mxsboot-sdcard"
and the file
"core-image-minimal-imx28evk-.......rootfs.uboot-mxsboot-sdcard"
is now:
00000000 33 22 11 00 01 00 00 00 01 00 00 00 01 00 00 00
00000010 00 00 00 00 00 00 00 00 01 00 00 00 06 00 00 00
00000020 28 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
00000800 97 73 ba 38 41 db b9 70 a6 15 cb b4 9a 1b 1f 4d
00000810 f8 40 89 5e 53 54 4d 50 01 01 01 00 9b a4 00 00
00000820 09 00 00 00 00 00 00 00 01 00 07 00 06 00 01 00
00000830 01 00 00 00 73 67 74 6c 40 ad e3 a1 32 0d 02 00
and the .wic looks OK too. I couldn't make the 'wic' command
work so I just unzipped the .wic.gz and used 'dd' to burn the image.
[ The command "wic write sync
didn't know what 'wic' was.]
It now load u-boot which then loads Linux and boots and mounts
/dev/mmcblk0p3 as root.
So, obviously I shouldn't put a hard coded '-p 2' in the
IMAGE_CMD_uboot-mxsboot-sdcard.
How should the location of the bootstream be handled?
The .wks.in template is translated into
part u-boot --source rawcopy
--sourceparams="file==core-image-minimal-imx28evk-20180430014159.rootfs.uboot-mxsboot-sdcard"
--ondisk mmcblk --fstype=ontrackdm6aux3 --align 1
part /boot --source bootimg-partition --ondisk mmcblk
--fstype=vfat --label boot --active --align 4096 --size 16
part / --source rootfs --ondisk mmcblk --fstype=ext4
--label root --align 4096
bootloader --ptable msdos
and the offset of the bootstream is already embedded in
"core-image-minimal-imx28evk-20180430014159.rootfs.uboot-mxsboot-sdcard".
Either:
1. 1. the position of the bootstream needs to be extracted
from the .wks when building the rootfs.uboot-mxsboot-sdcard
2. 2. the definitions/placements in the .wks need to be dynamic
and move partitions around depending on how
rootfs.uboot-mxsboot-sdcard was built
1. 3. the offset in the header of the
bootstream needs to be adjusted at the time
the .wic is written to the sdcard.
4. something I haven't thought of...
Regards,
Colin Moloney