Changes between Initial Version and Version 1 of buildroot


Ignore:
Timestamp:
11/01/2017 03:22:34 PM (7 years ago)
Author:
Tim Harvey
Comment:

initial page

Legend:

Unmodified
Added
Removed
Modified
  • buildroot

    v1 v1  
     1[[PageOutline]]
     2
     3= Buildroot =
     4A Linux kernel without a root filesystem (aka rootfs) is useless. There are many sources for root filesystems including complete Linux distributions like Ubuntu (often too big, or limited in arch availability), pre-built root filesystems from vendors (often too limited), root filesystems built manually with Busybox (still often too limited) and more. There are Embedded Linux build systems which try to be more flexible like !OpenEmbedded, Yocto, and OpenWrt but these tend to be not easy to understand or quick to setup. Buildroot tends to be a much more simplistic approach using standard makefiles, can produce a root filesystem in minutes, and has 1000+ userspace libs/apps available.
     5
     6Using a buildroot rootfs is extremely useful for kernel development because you can build a rootfs small enough to embed it into the kernel via [#initramfs initramfs].
     7
     8suggested tools to include for kernel development:
     9 * dropbear for SSH
     10 * benchmarksiozone, bonnie++, LTP, netperf, ramspeed, stress, lmbench, iostat, memtester, etc
     11 * debug tools; evtest, i2c-tools, devmem2, pciutils, usbutils, libv4l, alsa-utils, linux-firmware, mii-diag, iperf, iw
     12 * filesystem tools: resize2fs (BR2_PACKAGE_E2FSPROGS_RESIZE2FS) adds 1.2MB for 2.4MB cpio
     13
     14Building:
     15{{{#!bash
     16git clone https://github.com/buildroot/buildroot.git
     17cd buildroot
     18make menconfig # configure
     19make -j8
     20ls output/images
     21}}}
     22 * Note that like many build systems sources will be downloaded from the network during the build process
     23 * The .config file contains all the configuration options from the {{{make menuconfig}}}
     24 * see sections below on configuration tips for various platforms
     25
     26References:
     27 * https://buildroot.org
     28 * https://buildroot.org/downloads/manual/manual.html
     29 * http://free-electrons.com/pub/conferences/2013/kernel-recipes/rootfs-kernel-developer/rootfs-kernel-developer.pdf
     30
     31
     32[=#initramfs]
     33== initramfs ==
     34Using buildroot to create a very small (typically ~1.5MiB) root filesystem that can be embeeded in a kernel via {{{initramfs}}} is very popular for kernel development.
     35
     36To build a rootfs suitable for use as an initramfs:
     37 - Select target arch
     38 - Configure toolchain or point to external toolchain
     39 - System configuration - select devtmpfs /dev management method and ensure serial
     40port for the getty is correct
     41 - Filesystem images - select cpio format
     42 - use {{{make}}} to build - your rootfs will be in output/images/rootfs.cpio and will build within minutes
     43 - a default config using busybox will be about 1.5MiB
     44
     45Make sure your kernel has the following:
     46 - CONFIG_DEVTMPFS=y, to get devtmpfs support, to provide a dynamic /dev
     47 - CONFIG_INITRAMFS_SOURCE="/path/to/buildroot/output/images/rootfs.cpio"
     48 - CONFIG_INITRAMFS_COMPRESSION_GZIP=y or some other compression algorithm
     49
     50If using buildbot to build kernel add the following to automatically build a kernel using to buildroot rootfs as an initramfs:
     51 * BR2_TARGET_ROOTFS_INITRAMFS=y
     52
     53See also:
     54 * [wiki:linux/initramfs linux/initramfs]
     55
     56
     57[=#busybox]
     58== Busybox config ==
     59Busybox is used by default for all of the tools in the rootfs built by buildroot. If you want to alter the default configuration of busybox itself you can access it via {{{make menuconfig}}}:
     60 * Target packages -> !BusyBox -> !BusyBox configuration file to use
     61 * defaults to package/busybox/busybox.config
     62
     63
     64== Ventana (IMX6) ==
     65To configure buildroot for the i.MX6 SoC found on the Ventana product family:
     66 * Target options -> Target Architecture -> ARM (little endian)
     67 * Target options -> Target Architecture Variant -> cortex-A9 (BR2_GCC_TARGET_CPU)
     68 * Target options -> Enable NEON SIMD extension support (BR2_ARM_ENABLE_NEON=y)
     69 * Target options -> Enable VFP extension support (BR2_ARM_ENABLE_VFP=y)
     70 * Target options -> Floating point strategy (NEON) (BR2_ARM_FPU_NEON=y)
     71 * Filesystem images -> tar the root filesystem -> Compression method (xz)
     72 * Filesystem images -> initial RAM filesystem linked into linux kernel
     73
     74This builds a 500KiB output/images/rootfs.tar.xz in less than 5 minutes on a typical Linux desktop.
     75
     76If you also want buildroot to build a kernel using the buildroot rootfs embedded as an initramfs then enable the following to create a kernel suitable for imx_v6_v7 and booting via U-Boot {{{bootm}}}:
     77 * Kernel -> Linux Kernel (BR2_LINUX_KERNEL)
     78 * Kernel -> Defconfig name (imx_v6_v7) (BR2_LINUX_KERNEL_DEFCONFIG)
     79 * Kernel -> Kernel binary format (uImage)
     80 * Kernel -> load address (0x10008000) (BR2_LINUX_KERNEL_UIMAGE_LOADADDR)
     81 * Kernel -> Device Tree Source file names (imx6dl-gw54xx imx6q-gw54xx imx6dl-gw53xx imx6q-gw53xx imx6dl-gw52xx imx6q-gw52xx imx6dl-gw51xx imx6q-gw51xx imx6dl-gw551x imx6q-gw551x imx6dl-gw552x imx6q-gw552x imx6dl-gw553x imx6q-gw553x) (BR2_LINUX_KERNEL_INTREE_DTS_NAME)
     82
     83Adding the kernel build produces a 6.1MB uImage in less than 10 minutes on a typical Linux desktop.
     84
     85To boot this on a Ventana bootloader:
     86{{{#!bash
     87tftpboot ${loadaddr} ventana/uImage && tftpboot ${fdt_addr} ventana/${fdt_file2} && bootm ${loadaddr} - $fdt_addr}
     88}}}
     89
     90Now you have a minimal Linux OS that booted in about 6 seconds.
     91
     92The prebuilt image of this can be found at: http://dev.gateworks.com/buildroot/ventana/minimal
     93
     94Additional tools:
     95 * resize2fs
     96 * screen
     97 * ubi/ubifs tools
     98 * pciutils usb-utils
     99 * disk partitioning tools