User Tools

Site Tools


buildroot

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

buildroot [2010/04/15 21:18] (current)
Line 1: Line 1:
 +Buildroot is a set of makefiles and configurations intended to download and build a series of packages and install them into a target directory.
 +
 +The central package in a buildroot system is uClibc, a lightweight libc designed for use in an embedded environment.
 +
 +The buildroot buildroot system has a series of subdirectories containing package makefiles, patches, configuration modules, and working directories.
 +
 +The configuration system is very much like the old Config.in style linux kernel configuration. The top level Config.in is expected to include those from the subdirectories.
 +
 +Packages to be installed into the root are in package/. Tools needed to build packages as well as the uClibc library and linker are in toolchain. Finally, target/ contains packages that produce tools for building a filesystem image (currently, cramfs, jffs, or ext2fs).
 +
 +Each package lives in a subdirectory with the same name as the package. That directory contains a packagename.mk makefile which specifies package name, download URL, version, and a set of (mostly boilerplate) rules download the source, unpack it, configure it, build the package and install it into the root.
 +
 +
 +Should the upstream source require patching, the diffs should be in the individual package directory the package.mk file should take care of applying them before building the package.
 +
 +Toplevel/dl is where downloaded source tarballs should be placed by the makefile.
 +
 +In addition, should a special configuration file be required (many Free source distributions for embedded use utilize kernel style .config files and make oldconfig to use an existing configuration),​ it too should be in the package directory and the package.mk should copy it into place appropriately during the build process.
 +
 +The package directory should also contain a Config.in specifying the config variable, name, and help. package/​Config.in must be modified to source your Config.in in order for it to actually be seen, as in:
 +  source "​package/​libapsecure/​Config.in"​
 +
 +
 +A Makefile.in should add the build target to targets if the config variable has been set, as in
 +
 +  ifeq ($(strip $(BR2_PACKAGE_LIBAPSECURE)),​y)
 +    TARGETS+=libapsecure  ​
 +  endif
 +
 +
 +
 +===== Installing GRUB =====
 +
 +Once a tarball is created, partition the CF on the host (development) machine and unpack the tarball onto the CF filesystem.
 +
 +Now comes the tricky part. When GRUB boots on the target, the CF will be hd0 and the first partition HD0,0.
 +That will not likely be the case on the host system. It is important to install GRUB on the target, not the host!
 +
 +We assume the host sees the CF as /dev/sdc and it's mounted on /mnt/test
 +
 +grub-install --recheck --root-directory=/​mnt/​test /dev/sdc
 +
 +echo "(hd0) /​dev/​sdc"​ > /​mnt/​test/​boot/​grub/​device.map
 +
 +chroot /mnt/test /bin/bash
 +grub
 +root (hd0,0)
 +setup (hd0)
 +exit
 +
 +
  
buildroot.txt ยท Last modified: 2010/04/15 21:18 (external edit)