Hi Dan,
On 03.11.23 03:08, Dan Hilgert wrote:
> Hi Stefano,
>
> We discovered something unexpected with the disk partitioner handler
> using SWUpdate v2023.05
>
> *
>
> We created an swu image setup as follows:
>
> o
>
> software=
>
> o
>
> {
>
> o
>
> version="1.0";
>
> o
>
> description="Update Image";
>
> o
>
>
> o
>
> hardware-compatibility: [ "1.0"];
>
> o
>
>
> o
>
> partitions: (
>
> o
>
> {
>
> o
>
> type="diskpart";
>
> o
>
> device="/dev/mmcblk0";
>
> o
>
> properties:{
>
> o
>
> labeltype="dos";
>
> o
>
> partition-1= [ "size=512M", "start=2048", "name=boot",
> "type=0xC", "flag=boot", "fstype=vfat"];
>
> o
>
> }
>
> o
>
> }
>
> o
>
> );
>
> o
>
> files:(
>
> o
>
> {
>
> o
>
> filename="BOOT.BIN";
>
> o
>
> path="/BOOT.BIN";
>
> o
>
> device="/dev/mmcblk0p1"
>
> o
>
> filesystem="vfat"
>
> o
>
> }
>
> o
>
> );
>
> o
>
> }
>
> o
>
>
> *
>
Ok
> Verified newly created filesystem has no errors using dosfsck
>
Ok
> *
>
> Mounted partition in linux and verified file is present
Ok
>
> *
>
> Rebooted device and inspected partition while in U-Boot
>
> *
>
> I am not able to view any files on the partition using fatls mmc
> 0:1, however the file is clearly present as the device booted into
> U-Boot
>
>
> It appears that the issue has something to do with the way swupdate is
> creating the FAT file system on the new partition.
I am just reading back what you have written, and asking me why we get
to different result. You write:
- FAT was created by SWUpdate
- Filesystem check is ok
- Linux has no issue at all with the filesystem.
Now why the reason should be in SWUpdate and not in U-Boot, and maybe in
the vendor U-Boot because you probably are you using the Vendor's fork
xilinx-uboot instead of U-Boot mainline?
> Ext4 file systems
> seem to work ok. We also noticed the FAT file system is being created
> using the fatfs library rather than any native Linux tools like when we
> run mkfs.
As it should be. Calling external tools is a big security risk. An
attacker can have compromised the shell (or the external tool as well),
and this opens to a range of possible attacks. An Updater must be
self-contained, and then fatfs is used. Code form mkfs.vfat could not be
used due to license incompatibilities (the same happened in U-Boot). But
as Linux has no problem, it does not seems an issue here.
>
>
> To verify this was a mkfs issue and not partition related, we did the
> following:
>
> *
>
> Ran swupdate with our image creating new partition and filesystem again
>
> *
>
> Recreated filesystem manually in Linux
>
> o
>
> mkfs.vfat -F 32 -n boot /dev/mmcblk0p1
>
> *
>
> Mounted recreated file system and scp BOOT.BIN file into it
>
> *
>
> Unmounted file system and rebooted device
>
> *
>
> I am now able to see the file on that partition in U-Boot using
> fatls mmc 0:1
Sure there are some differencies, but it does not mean that the cause is
in SWUpdate and not in U-Boot. You are also saying that board is
booting, and if you have not a copy of BOOT.BIN on a SPI flash as in
many Xilinx's design, the board *really* boots from it. That means the
FAT implementation inside the BootROM can mount the filesystem and read
BOOT.BIN without issue.
So again, whiere should be the cause ?
Best regards,
Stefano Babic
>
>
> Any insight you can offer into this would be greatly appreciated.
>
>
> Thanks,
>
> *Dan Hilgert* | President
> *Embedded Design Engineering*
>
www.eemn.io <
http://www.eemn.io>
>
> <
https://linkedin.com/in/dan-hilgert-3462b782/>
>
> --
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
swupdate+u...@googlegroups.com
> <mailto:
swupdate+u...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/swupdate/CAO3KV1emuFkCdrCus5rr65%3DEO_7JZAoBd258fMJv8Qjz_o6Mqg%40mail.gmail.com <
https://groups.google.com/d/msgid/swupdate/CAO3KV1emuFkCdrCus5rr65%3DEO_7JZAoBd258fMJv8Qjz_o6Mqg%40mail.gmail.com?utm_medium=email&utm_source=footer>.