top of page

Build the Linux Kernel and Busybox for ARM and run them on QEMU



This post is a condensed version of Mitchel Humphery's excellent post @ link for ARM. Like Mitchel's post, this post gives step-by-step instructions for building a minimal custom Linux kernel, creating a busybox based userland and booting it on an emulator (QEMU). This post builds the versatile_defconfig.


Environment

  • T460

  • Oracle VM VirtualBox Version 5.1.30 r118389 (Qt5.6.2) running on Windows 7 SP1

  • VM's configured with 4 GB of RAM and a 64 GB disk running Ubuntu 16.04.2.

If you need help setting up this environment click here (just install 16.04.02 instead of 16.04.01).



Steps


1. Open a terminal


2. Retrieve new lists of packages

You'll see something like:


3. Get the required packages:

You'll see something like:


...or:


4. Create a workspace:


5. Download and extract the Linux kernel and BusyBox

You'll see something like:


6. Create a minimal userland with Busybox

You'll see something like:


7. Enable static linking in Busybox

7.1. Press enter on Busybox Settings --->


7.2. Press the down arrow 26 times until you hit [ ] Build BusyBox as a static binary (no shared libs)


7.3 Press Y


You should see:


7.4 Select Exit and press Enter twice


7.5 while the cursor is on <Yes>, press Enter to save

You should see:


8. Build Busybox

You should see something like:



9. Build the directory structure of the initramfs

You should see something like:



10. Create init and make it executable


10.1 Type:

10.2 Paste this in (press i)

10.3 Type :w to save, then :q to quit



11. Make init executable:


12. Create the initramfs:


13. Config the Linux kernel with the minimal config

You'll see something like:


14. Turn options on for QEMU:


15. Turn these options on:

This writes .config to $TOP/obj/linux-arm-versatile_defconfig


Use ls -a $TOP/obj/linux-arm-versatile_defconfig to check



16. Make the kernel:

You should see something like:



17. Launch the Linux kernel binary & initrd in QEMU:

You should see something like:



18. Type Control-a x to quit QEMU



References

  • Documentation/Platforms/ARM @ [link]

  • Versatile Express support in QEMU @ [link]

  • Automatically answer defaults when doing 'make oldconfig' on a kernel tree @ [link]

  • this architecture does not have kernel memory protection @ [link]

  • Build the Linux Kernel and Busybox and run them on QEMU @ [link]

  • Build Your ARM Image for QEMU @ [link]

bottom of page