Running Linux on a software model
Software models do not usually have all the features of a hardware platform like Ethernet, persistent Flash memory, boot monitor. This page describes a way to build an ELF image from kernel, filesystem and simple boot code to initialise the registers and UART0. The example files are to be used with the ARM Ltd. models that emulate a RealView/EB platform.Includes running SMP kernels.
Kernel configuration and filesystem requirements
The kernel needs the following configuration options set:
CONFIG_BLK_DEV_INITRD=y
The kernel command line options and initramfs address/size is set by the boot code and passed to the kernel via the ATAG list. The boot code expects a kernel image with 64 bytes U-Boot header (
uImage
).
The filesystem needs to be in a
.cpio.gz
format and have a
/init
link pointing to
/sbin/init
(or the preferred init application). A compressed cpio archive can be created as below (as root or under a fakeroot environment):
cd
find . | cpio --quiet -H newc -o | gzip -9 -n > ../filesystem.cpio.gz
Building the ELF model image
Copy the following files (attached) to a local directory:
Makefile
- builds the ELF model imageboot.S
- simple code to initialise registers and UART0 before branching into the ARM Linux kernelmodel.lds
- linker script used to generate the ELF model image
Copy the
uImage
kernel and
filesystem.cpio.gz
files into the directory created above and the
make
command will build a
linux-image.axf
file that can be loaded into the model and executed.
Example for a RealView/EB model
The following steps generate a
linux-system.axf
file that can be loaded into the model as a normal application:
- Download the
Makefile
, boot.S
and model.lds
files attached to this page - Download the pre-built kernel image and rename it
uImage
- Download the filesystem in cpio format and rename it
filesystem.cpio.gz
- Type
make
The sources and configuration files for the above images are available from the ARM Ltd.
Linux repository or the main ARM Ltd.
Linux page.
--
CatalinMarinas - 03 Dec 2009