Recently I started working with the software simulator for aarch64. Aarch64 is of course the 64 bit architecture.
One thing I very much enjoy is the ability to modify the contents of the file system of the device under test from my stable workstation. When working with ARM SoC systems like an Arndale or a panda, that’s quite simple, just mount the SD card and away you go. For a software simulator environment it’s a bit different.
When you download the file system image for aarch64 from Linaro once gunziped, you have a .img file. This is a disk image with partitions in it. In order to loop back mount it and get at either the boot partition or the root file system you need to resort to a little trick.
Unit? [B]? B
Disk /home/tgall/aarch64/vexpress64-openembedded_minimal-armv8_20130423-299.img: 536870912B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32256B 54525439B 54493184B primary fat16 boot, lba
2 54525952B 536870911B 482344960B primary ext4
So here we have a disk image with two partitions. The system file system is in the second partition and that’s what I want to mount. Using the partition start vaue in bytes and excluding the ‘B’ at the end of the number, we use that number with mount.
mount -o loop,offset=54525952 -t ext4 ./vexpress64-openembedded_minimal-armv8_20130423-299.img /mnt/aarch-root-filesystem
And there you have it.