This article outlines how to build a custom root filesystem with Buildroot to use on Armv8 FVP's. More specifically the article discusses:
These instructions are targeted primarily for the Armv8 Base Platform FVP but in general can be applied to different FVP's
Initialize a workspace which will ontain all of the needed directories and tools. From this point onwards, this directory will be refered to as <workspace>.
Follow the Arm Platforms instructions for Armv8-A FVPs to initialize a prebuilt OpenEmbedded Minimal configuration into the <workspace> directory.
| Workspace | <workspace> |
| Platform | Armv8-A Base Platform with 64-bit software stack |
| Type | Use prebuilt configuration |
| Configuration | Latest-armlt + OpenEmbedded Minimal 15.09 |
Install the Armv8 Base Platform model from Arm Developer.
Install the libncurses5 and kpartx packages.
To create a custom filesystem a tool called Buildroot will be used.To download Buildroot navigate to the Buildroot Downloads page and download the latest realease. This will download a .tar.bz2 file which needs to be copied and extracted to the <workspace> directory.
To configure Buildroot navigate to the newly created directory <workspace>/buildroot/ and run 'make menuconfig' to modify the buildroot configuration.
### Extract the buildroot directory to your workspace
$ sudo tar -xvf /path/to/buildroot-snapshot.tar.bz2 -C <workspace>
$ cd <workspace>/buildroot/
### Configure Buildroot
$ make menuconfig
Configure Buildroot like so:
Then build using the 'make' command
$ make ARCH=arm64 BR2_JLEVEL=N
WARNING: You should never use make -jN with Buildroot: top-level parallel make is at the time of writing not supported. Instead, use the BR2_JLEVEL option to tell Buildroot to run the compilation of each individual package with make -jN
The output of the build process will be located on <workspace>/buildroot/output/images/ and it will be in a .tar format
The resulting Buildroot filesystem needs to be burnt to an image by:
### Create an empty filesystem image
$ sudo dd if=/dev/zero of=<workspace>/rootfs.img bs=1G count=0 seek=1
### Run gdisk in order to partition the image. When prompted type 'n' to create a new partition
### and accept all the defaults when prompted (this is done by simply pressing the 'ENTER' key)
$ sudo gdisk <workspace>/rootfs.img
### Map the partitions as a virtual block device
$ sudo kpartx -a <workspace>/rootfs.img
The name of the mapped partition needs to be found in order to modify it.
This command will produce an output like the one seen on the figure below. From there one can identify the name of the partition.
Figure 1: The partition we are looking for is highlighted inside the red box. In this case it is loop18p1
Format image partition as an EXT4 filesystem:
### Convert image's partition to EXT4 format filesysten
### NOTE: X is used to specify the loop number as seen through the lsblk output
$ sudo mkfs.ext4 /dev/mapper/loopXp1
### mount the formatted partition
$ sudo mkdir /mnt/mydrive
$ sudo mount /dev/mapper/loopXp1 /mnt/mydrive
### Extract the Buildroot rootfs to the mounted partition
$ sudo tar -xvf <workspace>/buildroot/output/images/rootfs.tar -C /mnt/mydrive
### Unmount the filesystem and un-map tha image's partitions
$ sudo umount /mnt/mydrive
$ sudo kpartx -d <workspace>/rootfs.img
Now that a populated filesystem image exists, it can be booted from within the model. As such the model needs to be run. Hence, the DISK variable must be configured to point the image created in PART II of this tutorial. Additionally, the MODEL which is going to be used also needs to be exported in order to be visible to the execution script. Hence, the following commands need to be executed.
### Set the DISK variable to point to the rootfs.img that was created in PART II
### Make the DISK variable visible to the execution script
$ export DISK=<workspace>/rootfs.img
$ chmod a+w $DISK
### Set the MODEL to the Armv8 Base Platform model
$ export MODEL=/path/to/FVP_Base_RevC-2xAEMv8A
### Navigate to the model's specific directory and run the model
$ cd <workspace>/fvp-latest-oe-uboot/
Interrupt U-Boot's default boot and edit the kernel command line arguments:
### Set the boot arguments and save the changes fvp# set origbootargs "$bootargs"
fvp# set bootargs “console=ttyAMA0 earlycon=pl011 debug user_debug=31 systemd.log_target=null androidboot.hardware=fvpbase root=/dev/vda1 rw rootwait loglevel=9”
### Reset the model and let the autoboot process to run
The FVP will reboot into your custom Buildroot filesystem; you will need to login as "root" with no password
You can check everything is working by running `df -h' and ensuring you see `/dev/root' listed
Figure 2: Running df -h should output the Filesystems.