Diffstat (limited to 'docs/06-Optional-rootfs-build.txt')
1 files changed, 162 insertions, 74 deletions
diff --git a/docs/06-Optional-rootfs-build.txt b/docs/06-Optional-rootfs-build.txt
index 6dd9d62..913861f 100644
@@ -9,114 +9,202 @@ A Introduction
filesystems and this note doesn't cover all possibilities.
The default virtualizer release contains an empty filesystem
- stub located at:
+ stub located at "bootwrapper/payload/fsimg"
A build using this stub doesn't contain a functional
filesytem that the Linux kernel image can use. fsimg can be
- replaced with a suitable filesystem image but with the
- following constraints:
+ replaced with a suitable initramfs root filesystem image but
+ with the following constraints:
1. Compressed or uncompressed cpio archives are supported.
- 2. The image size is limited to ~200 MB.
+ 2. The image size is limited to ~200 MB. In the default virtualizer
+ build setup, the filesystem image size is limited to 32 MB.
+ In section B. we illustrate a method to create a compressed
+ cpio archive filesystem image that can be used by replacing
+ "bootwrapper/payload/fsimg" file. We will also illustrate
+ what parts of the Virtualizer software need modification to
+ use a cpio archive of size > 32 MB as the root filesystem.
+ The size restriction mentioned in A.2 implies that only very 'lean'
+ filesystems such as busybox <http://www.busybox.net/> may be used.
+ While busybox presents a minimal but robust command line environment,
+ quite often a more conventional desktop like environment with window
+ management on top of an X server is required in order to run web
+ browsers etc.
+ In section C. we illustrate a method to use a larger (~2GB) filesystem
+ image that can be used with the ARM FastModels MMC emulation. Note that
+ the MMC emulations only supports images that are just under 2GB in size.
+ Note that if the MMC route is used, the "bootwrapper/payload/fsimg"
+ filesystem image needs to be replaced by an empty file. This is to
+ prevent Linux from using the cpio archive based initramfs as the root
+ filesystem before it can detect the MMC based root filesystem.
+B Building and using a cpio archive as a initramfs root filesystem
+ The following steps assume that a pre-built root filesystem is already
+ available in a compressed form in the file rootfs.tar.gz.
+ 1. Uncompress the filesystem:
+ sudo tar -zxf rootfs.tar.gz
+ 2. Ensure that the filesystem contains '/init'. It is used by Linux
+ as the default init process when an initramfs filesystem is used.
+ It can be the actual file or a symlink to another 'init' binary.
+ Alternatively, use the 'rdinit=<absolute path to init application>'
+ e.g. 'rdinit=/sbin/init' to specify which init binary should be
+ used by Linux in the absence of '/init'.
+ The kernel command line can be edited in 'bootwrapper/Makefile'. The
+ BOOTARGS variable points to the kernel command line string.
+ 3. Create a compressed cpio archive from the uncompressed filesystem:
+ pushd binary/boot/filesystem.dir
+ sudo sh -c 'find . | cpio --quiet -H newc -o | gzip -3 -n > ../../../rootfs.cpio.gz'
+ 4. Copy the compressed cpio archive to "bootwrapper/payload/fsimg"
+ 5. If the size of the resulting cpio archive is > 32 MB then follow the
+ steps mentioned below. The following diagram illustrates how the
+ payload software (Linux in this case), initramfs filesystem &
+ Virtualizer images are placed relative to each other in physical memory.
+ Base of memory @ $(LOBASE)00000 -> ----------------------
+ | |
+ | |
+ Linux Kernel start @ 0x80008000 -> |--------------------|
+ | |
+ | |
+ | |
+ | |
+ | |
+ | |
+ Filesystem start @ 0x8df00000 -> |--------------------|
+ | |
+ | |
+ | |
+ Virtualizer start @ $(HIBASE)00000 -> |--------------------|
+ | |
+ | |
+ a. Increase the size of the FILESYSTEM region in the scatter file
+ template bootwrapper/boot.map.template to be not less than the
+ size of the cpio archive created in step 3. It is set to 32MB
+ (0x2000000) by default.
+ b. The variable HIBASE contains the value of the MB where the
+ Virtualizer software (bootwrapper/img.axf) is loaded. Increase
+ its value to prevent any overlap between the memory spaces used
+ by the filesystem and the Virtualizer. An overlap will be flagged
+ as a linker error while building the Virtualizer software.
+ HIBASE can be changed as an environment variable at the time of
+ building the Virtualizer software or in each of the following
+ a. "bootwrapper/Makefile"
+ b. "bootwrapper/big-little/Makefile"
- The size restriction implies that only very 'lean'
- filesystems such as busybox <http://www.busybox.net/> may be
- used. While busybox presents a minimal but robust command
- line environment, quite often a more conventional desktop
- like environment with window management on top of an X
- server is required in order to run web browsers etc.
+ If following the latter approach please ensure that both the
+ makefiles contain the same value of HIBASE. The default value of
+ $(HIBASE) is 0x8ff.
- In this note, we illustrate a method to use a larger (~2GB) filesystem image
- that can be used with the ARM FastModels MMC emulation. Note that the MMC
- emulations only supports images that are just under 2GB in size.
+ The start address of the root filesystem is contained in the
+ variable FSADDR. The default value of $(FSADDR) = 0x8df00000.
- Note that if the MMC route is used, the bootwrapper/payload/fsimg filesystem
- image will be suppressed and ignored.
+ The following equation illustrates the relationship between
+ FSADDR and HIBASE mentioned earlier
- Locating a root filesystem on the MMC emulation allows the Linux kernel to
- access and use this filesystem. This is facilitated by indicating the
- filesystem location to the kernel via the kernel command-line arguments by
- appending 'root=/dev/mmcblk0' (for a single partition MMC image) to the
- argument list.
+ $(FSADDR) + size of FILESYSTEM = $(HIBASE)00000
+ 0x8df00000 + 0x2000000 = 0x8ff00000
- Note that when using this technique, the fsimg file is ignored.
+ c. Increase the kernel parameter value mem=nn[KMG] of the Linux kernel
+ in bootwrapper/Makefile so that Linux is aware that the size of
+ physical memory is enough to include the root filesystem image. The
+ default value is 255M.
-B Building and installing a Linux kernel
+ BOOTARGS=mem=255M ...
- A suitable Linux kernel image for use with the virtualizer
- can be built as follows:
+ The following equation should be used as a reference for determining
+ the amount of physical memory made visible to Linux.
- $ tar -jxf arm-virtualizer-v2_2-160212.tar.bz2
- $ cd arm-virtualizer-v2_2-160212/bootwrapper
- $ make clean
- $ pushd /tmp
- $ git clone git://git.kernel.org/pub/scm/linux/kernel/git/maz/ael-kernel.git ael-kernel.git
- $ cd ael-kernel.git
- $ git checkout -b ael-11.06 origin/ael-11.06
- $ yes | make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- vexpress-new_defconfig
- $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4
- $ popd
- $ cp $OLDPWD/arch/arm/boot/Image payload/kernel
+ $(LOBASE)00000 + "size of memory" > $(FSADDR) + size of FILESYSTEM
- Note that the using the vexpress-new_defconfig configuration
- ensures that the kernel is built with MMC support.
+ where $(LOBASE) is start of physical memory in the platform in MB.
+ Its default value is 0x800 which corresponds to the start of physical
+ on the FastModels platform at 0x80000000.
-C Building a suitable root filesystem
+ 7. Build a Linux kernel image for use with the virtualizer by following
+ the steps in "docs/03-Linux-kernel-build.txt".
- A suitable root filesystem can be built using Ubuntu Linux's rootstock utility
- <https://wiki.ubuntu.com/ARM/RootfsFromScratch> as follows:
+ 8. Build the Virtualizer by following the steps in "docs/01-Usage.txt".
- $ sudo apt-get install rootstock
- $ sudo rootstock --fqdn ubuntu --login ubuntu --password ubuntu --imagesize 2040M --seed lxde,gdm --notarball
- $ mv qemu-armel-*.img mmc.img
+ 9. Launch the ARM FastModel by following the steps in "docs/01-Usage.txt".
- Note that the complete filesystem build will take ~30
- minutes. On boot, the username and password is 'ubuntu'.
+C Building and using a root filesystem with ARM FastModels MMC emulation
- The rootstock invocation above will produce a rootfilesystem containing an
- LXDE desktop <http://lxde.org/> that has a firefox browser.
+ 1. Build a Linux kernel image for use with the virtualizer by following
+ the steps in "docs/03-Linux-kernel-build.txt". Please ensure that the
+ kernel is built with MMC support.
-D Modifying the kernel command line to support the MMC image.
+ 2. A suitable root filesystem can be built using the pre-built root
+ filesystem as mentioned under B.
- The virtualizer build system and the mxscripts that are used for launching
- the ARM FastModel require modifications to support the MMC image.
+ a. Create the mmc.dat file.
+ $ dd if=/dev/zero of=mmc.dat bs=1M count=512
- The build system modification is to change the Linux kernel command line
- arguments to make the kernel aware of the location of the root filesystem.
- The command line should contain the string 'root=/dev/mmcblk0'.
+ b. Add /dev/loop<x> as ./mmc.dat and verify which /dev/loop<x> you got.
+ $ sudo losetup -f ./mmc.dat
+ $ sudo losetup -a
- To make this modification, edit the file bootwrapper/Makefile and change the
- BOOTARGS specification on line 42 from:
+ c. Create an ext<2,3,4> filesystem on mmc.dat
+ $ mke2fs -F ./mmc.dat
- BOOTARGS=mem=255M console=ttyAMA0,115200 migration_cost=500
+ d. Create a mountpoint to mount the image on.
+ $ sudo mkdir /mnt/devel
+ $ sudo mount /dev/loop<x> /mnt/devel
+ e. Extract the contents of 'rootfs.tar.gz' into the image
+ $ sudo tar zxvf rootfs.tar.gz --preserve \
+ --strip-components=3 -C /mnt/devel
- BOOTARGS=root=/dev/mmcblk0 mem=255M console=ttyAMA0,115200
- migration_cost=500 cachepolicy=writealloc
+ g. Unmount the image and detach mmc.dat with the loop device
+ $ sudo umount /mnt/devel
+ $ sudo losetup -d /dev/loop<x>
- The ARM FastModel mxscript modification is to get the FastModel to use the
- mmc.img file created in step C above with the MMC emulation.
+ 3. Modify the kernel command line to support the MMC image. This is done
+ by indicating the filesystem location to the kernel via the kernel
+ command-line arguments. Append 'root=/dev/mmcblk0' (for a single
+ partition MMC image) to the argument list. To make this modification,
+ edit the file bootwrapper/Makefile and change the BOOTARGS
+ specification from:
- To make this modification uncomment the 'string mmcimage=' line (line 42)
- and provide the complete path to the mmc.img file generated in step C above.
+ BOOTARGS=mem=255M console=ttyAMA0,115200 migration_cost=500
-E Building the virtualizer
- $ cd bootwrapper
- $ make clean && make
+ BOOTARGS=root=/dev/mmcblk0 mem=255M console=ttyAMA0,115200
+ migration_cost=500 cachepolicy=writealloc
-F Launching the ARM FastModel
+ 4. Build the Virtualizer by following the steps in "docs/01-Usage.txt".
+ Please ensure that the 'bootwrapper/payload/fsimg' filesystem image
+ is replaced by an empty file.
- $ modeldebugger -s big-little-MP<x>.mxscript
+ 5. The ARM FastModel mxscript needs modification to get the FastModel
+ to use the mmc.img file created in step C above with the MMC emulation.
+ To make this change uncomment the 'string mmcimage=' line and provide
+ the complete path to the mmc.img file generated in step 2 above.
- .. where x is 1 or 4 as the case may be (MP1 build or MP4
+ 6. Launch the ARM FastModel by following the steps in "docs/01-Usage.txt".
-G Known limitations
+D Known limitations