arm64 foundation model and Ubuntu Core
This guide aims to get an arm64 Ubuntu image built and running using the ARM Foundation Model. This will allow you to experiment with this architecture on your amd64 system. Note that ARM do not support the foundation model for i386 systems currently.
This guide assumes you will be working in fresh directory heiracy, and that that $BASE points to the root of that directory:
BASE=$HOME/arm64; mkdir $BASE; export BASE; cd $BASE
You will need
- an amd64 Ubuntu install of 13.10 or later (or similar),
- several gigabytes of free disk space,
- root access on the above to build images and install software, and
- to be prepared to run binaries for which you have no source (from ARM).
If the last of these was not a deal breaker, then read on.
ARM Foundation Model
You will need a copy of the proprietory and binary only Foundation Model emulator. This can be obtained directly from ARM starting from the URL below. You will need to make an accounts, and there is no source for this, if you care about such things. Sorry.
Extract the tarball somewhere:
cd $BASE; tar xvf <image>
Ubuntu Core Image
You will need the official Ubuntu Core release image for the 13.10. This can be obtained from the URL below:
This tarball needs converting into a bootable disk image for the emulator. The easiest way to do this is using the conversion script:
Simply run this on the tarball you downloaded above, note that this script uses sudo internally to obtain root priviledges:
The emulator requires an external wrapped kernel image to boot the foundation model. These contain the kernel itself and a mini bootloader which supplies the required device-tree for the foundation model. You can obtain prebuilt kernel images from the arm64 kernel archive:
Rolling your own
If you prefer to roll your own kernel images, you can build those from kernel .deb as found in main archive. You will need the boot-wrappper-aarch64 published on git.kernel.org:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/boot-wrapper-aarch64.git
Note: for the following commands to work, you'll need to go back to an earlier revision of this tool:
cd boot-wrapper-aarch64 && git reset --hard 47cdf0391af24f6d9b8eb82324f28b2086198290
You will also need an appropriate dts (device tree source file) for the foundation model. This is included in the kernel source tree arch/arm64/boot/dts/foundation-v8.dts, or you can use mine: tree:
You will also need an kernel .deb, which you will need to extract the arm64 kernel image:
dpkg -x linux-image...deb $BASE/kernel
Finally build the wrapped kernel .axf:
KERNEL=`echo $BASE/kernel/boot/vmlinuz-*-generic`; (cd boot-wrapper-aarch64 && make FDT_SRC=$BASE/foundation-v8.dts clean && make CROSS_COMPILE=aarch64-linux-gnu- FDT_SRC=$BASE/foundation-v8.dts KERNEL=$KERNEL BOOTARGS="console=ttyAMA0 root=/dev/vda earlyprintk=pl011,0x1c090000 consolelog=9 rw")
Starting the image
Now that you have the foundation model, the Ubuntu Core image built, and a bootable kernel image, we are ready to actually start the emulation:
$BASE/Foundation_v8pkg/models/Linux64_GCC-4.1/Foundation_v8 --image $BASE/kernel-latest.axf --block-device $BASE/ubuntu-core-13.10-core-arm64.img --network=nat --network-nat-ports="2222=22,8080=80"
The foundation model can do some NAT port forwarding for you, as well. If you'd like to, say, forward some ports for sshd or httpd, use something like the following on your command line:
If you have more than one core on your host machine and would like to run the model with more cores, you can use the --cores switch. It's not a good plan to specify more real cores than your host machine has:
You should expect to see minimal diagnostics in the originating window, you should also expect a new XTerm to start containing the console output from the emulator.
After a minute or two (it is no rocket ship) you should see a login prompt, use username root password root. Networking should be setup via NAT to your machines internet connection and you should be able to install additional packages etc as needed.