Difference between revisions of "Step-by-step Buildroot/Busybox Root File System"

From odroid US
Jump to: navigation, search
Line 33: Line 33:
  
 
<pre>
 
<pre>
# Go to some convenient folder
+
# Go to some convenient folder, home if you like
 
cd ~
 
cd ~
 
# Get the example files
 
# Get the example files
Line 45: Line 45:
 
</pre>
 
</pre>
  
 +
Here are the files you now have:
 +
<li>rootfs.tar.gz.  The resulting root file system image.  You can write this to your SD-Card if you just want to see it work
 +
<li>buildroot-2012.11.tar.bz2.  This is the current version of buildroot
 +
<li>odroidu2_just_busybox_defconfig.  This is the tested buildroot configuration we need, it only includes busybox and nothing else.
 +
<li>nfs-mounting-boot.tgz.  This is a boot partition image.  You can extract this to your SD-Card boot partition, if you don't want to build your own kernel we need a kernel that included the smsc95xx driver for odroid-U2 in order to bring up the network.
 +
</pre>
  
Configure buildroot with just the busybox package:
+
 
 +
=== Expand buildroot and Configure it ===
 +
In the buildroot-example directory
 
<pre>
 
<pre>
cp  
+
# expand the tarball
 +
tar -xvjf buildroot-2012.11.tar.bz2
 +
# Add our configuration
 +
cp odroidu2_just_busybox_defconfig buildroot-2012.11/configs/
 +
# move to the buildroot top directory.  This is where you drive buildroot from
 +
cd buildroot-2012.11
 +
# and select our configuration
 +
make odroidu2_just_busybox_defconfig
  
 
</pre>
 
</pre>
 +
 +
=== Build the Root File System ===
 +
I hope this amazes you!  The buildroot guys have done a terrific service to the community.  Visit them here: [http://www.buildroot.org/ Buildroot]
 +
 +
The make could take some time, depending on which packages you already have installed.
 +
<pre>
 +
make
 +
</pre>
 +
 +
That's all there is to it. 
 +
<li> ./output/images/rootfs.tar.gz holds the root file system tarball
 +
 +
<pre>
 +
ls output/build
 +
</pre>
 +
These are the packages that were downloaded, configured and patched for cross-building:
 +
busybox-1.20.2  host-ccache-3.1.7  host-fakeroot-1.18.2  host-makedevs-undefined
 +
 +
 +
 +
 +
 +
=== Next Steps ===
 +
You can add packages, like openssl, dropbear, or any of hundreds of others by doing 'make menuconfig' in the buildroot-2012.11 directory.  It can be an iterative process since you generally need to make dependent libraries before the apps that need them.
 +
 +
You can add applets to busybox by running 'make menuconfig' in the output/build/busybox-1.20.2 directory

Revision as of 15:47, 19 January 2013

UNDER CONSTRUCTION -- ACTIVE EDITING, PLEASE DON'T MAKE CHANGES


This tutorial is for Developers. It is written to work with the odroidu2-ubuntu or odroidu2-debian SD-Card images [is this specific enough?]

It is not for Android developers.

Introduction

Did you know you can easily make a very small custom-built Linux system? The key is to use the famous "Buildroot" package. This tutorial presents an example to get you started.

You can add additional packages as you like. Many products have been built using this technique with busybox playing the central role.


Prerequisites

  • You MUST have access to the serial console -- use the USB/Serial adapter [check actual Hardkernel name]
  • You need an SD-card reader/writer
  • You need to start with an SD-Card loaded with the odroid ubuntu image: odroidu2_20130104-linaro-ubuntu-desktop-uSDeMMC.img.xz. You can read about how to install it here: Step-by-step Ubuntu SD Card Setup
  • You need a Linux host (or virtual machine) running a Debian-based distribution: Debian, Ubuntu, Mint, Knoppix, etc. This is because the buildroot scripts pick up packages, including an ARM toolchain that are automatically installed.
  • For this tutorial, you can use the provided odroidu2 kernel -- or build your own, see: Kernel Compiling. The kernel must have the network driver (smsc95xx) built-in rather than built as a kernel module. This lets us bring up the network interface once the root file system is installed.
  • You need to be able to write the resulting root file system image to the SD-Card. See: [Updating from Root File System Images]

    Overview

    We are going to:

  • Download the example files and extract them
  • Expand the buildroot package and add the odroidu2 configuration
  • Use make to pull in all required packages and prepare the root file system image
  • Write the image to SD-Card
  • Boot the buildroot root file system on our odroid

    Download Example Files

    You can use your browser, or use web get.

    # Go to some convenient folder, home if you like
    cd ~
    # Get the example files
    wget http://odroid.us/odroid/users/osterluk/buildroot-example/buildroot-example.tgz
    wget http://odroid.us/odroid/users/osterluk/buildroot-example/buildroot-example.tgz.md5sum
    md5sum -c buildroot-example.tgz.md5sum
    # Assuming the md5sum is correct, continue
    tar -xvf buildroot-example.tgz
    cd buildroot-example
    
    

    Here are the files you now have:

  • rootfs.tar.gz. The resulting root file system image. You can write this to your SD-Card if you just want to see it work
  • buildroot-2012.11.tar.bz2. This is the current version of buildroot
  • odroidu2_just_busybox_defconfig. This is the tested buildroot configuration we need, it only includes busybox and nothing else.
  • nfs-mounting-boot.tgz. This is a boot partition image. You can extract this to your SD-Card boot partition, if you don't want to build your own kernel we need a kernel that included the smsc95xx driver for odroid-U2 in order to bring up the network. </pre>

    Expand buildroot and Configure it

    In the buildroot-example directory

    # expand the tarball
    tar -xvjf buildroot-2012.11.tar.bz2 
    # Add our configuration
    cp odroidu2_just_busybox_defconfig buildroot-2012.11/configs/
    # move to the buildroot top directory.  This is where you drive buildroot from
    cd buildroot-2012.11
    # and select our configuration
    make odroidu2_just_busybox_defconfig
    
    

    Build the Root File System

    I hope this amazes you! The buildroot guys have done a terrific service to the community. Visit them here: Buildroot

    The make could take some time, depending on which packages you already have installed.

    make
    

    That's all there is to it.

  • ./output/images/rootfs.tar.gz holds the root file system tarball
     ls output/build
    

    These are the packages that were downloaded, configured and patched for cross-building: busybox-1.20.2 host-ccache-3.1.7 host-fakeroot-1.18.2 host-makedevs-undefined



    Next Steps

    You can add packages, like openssl, dropbear, or any of hundreds of others by doing 'make menuconfig' in the buildroot-2012.11 directory. It can be an iterative process since you generally need to make dependent libraries before the apps that need them.

    You can add applets to busybox by running 'make menuconfig' in the output/build/busybox-1.20.2 directory