Working with aarch64 disk images

Posted: May 3, 2013 in Uncategorized

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. 

parted  ./vexpress64-openembedded_minimal-armv8_20130423-299.img

(parted) unit
Unit? [B]? B
(parted) print
Model: (file)
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

(parted) q


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.

  1. Ryan Harkin says:

    I use kpartx, it requires an extra istall, but involves less thinking.

    Eg, from the ARMLT release notes, we mount the first partition as loop, but you could easily use the same trick to mount the 2nd partition, and so on:

    sudo kpartx -a linaro.img
    mkdir boot
    sudo mount /dev/mapper/loop0p1 boot
    cp boot/uImage .
    cp boot/uInitrd .
    cp -ar boot/rtsm rtsm
    sudo umount boot

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s