ATSAMA5D27-SOM1-EK1 Getting Started - OS Virtualization

Why is one of the basic requirements: running Linux without OS Virtualization Software? Accessing an SD card, for example, is not a problem with Virtualbox.


@simon.brouwer, this is a bigger issue for other ARM devices. With the SAMA5 family’s, the boot-loader utilizes a normal fat32 partition, so i haven’t seen it happen as much with this family. This issue crops up normally when ever you try to dd any data directly from the Virtualization layer to the sdcard thru Windows. It has never been 100% reliable. In most cases, you’ve written the data, then called sync/etc to flush the cache in the VM, except the data still isn’t on the storage medium. It’s as if Windows still has it cache’ed elsewhere.

Simply, it’s not reliable to support. As the issue is NOT the directions, but the user’s system.


Hi Robert, thanks for the explanation.

I wonder whether it is possible to mount an image file as a disk, and set it up in the way described, and to then write the image file to the SD card using a Windows tool such as Win32DiskImager.

@simon.brouwer, sure you can use a loop device and a *.img file, it just takes a few tweaks to the directions…


sudo apt update ; sudo apt install kpartx parted

Setup *.img file, (assuming 250MB for this example)

sudo dd if=/dev/zero of=./sdcard.img bs=1024 count=0 seek=$((1024 * 250))

sudo sfdisk ./sdcard.img <<-__EOF__

Use losetup and grab a free node (by default there are usually 8 loop devices):

sudo losetup -f

Using losetup/kpartx mount *.img file:

sudo losetup /dev/loop0 ./sdcard.img
sudo kpartx -av /dev/loop0
add map loop0p1 (254:0): 0 98304 linear 7:0 2048
add map loop0p2 (254:1): 0 411648 linear 7:0 100352

sudo losetup -a
/dev/loop0: [2049]:5506938 (/home/voodoo/sdcard.img)

ls /dev/mapper/loop*
/dev/mapper/loop0p1  /dev/mapper/loop0p2

sudo mkfs.vfat -F 16 -n BOOT /dev/mapper/loop0p1
sudo mkfs.ext4 -L rootfs /dev/mapper/loop0p2

sudo mount /dev/mapper/loop0p1 /media/boot/
sudo mount /dev/mapper/loop0p2 /media/rootfs/

lsblk | grep loop
loop0       7:0    0   250M  0 loop 
├─loop0p1 254:0    0    48M  0 part /media/boot
└─loop0p2 254:1    0   201M  0 part /media/rootfs

Follow directions like posted, then finally on umount, cleanup with kpartx/losetup:

sudo umount /media/boot
sudo umount /media/rootfs

sudo kpartx -d /dev/loop0
sudo losetup -d /dev/loop0

If you mess up with kpartx/losetup, just use

sudo kpartx -d /dev/loop0 ; sudo losetup -d /dev/loop0

(or reboot to clear up /dev/loopX)…