BuildRoot Build Guide-Root file system (ROOTFS)
BuildRoot's ROOTFS build process has a big frame, some parts are buildroot system, some details need to be realized by themselves, Rootfs is also the most complicated part of BuildRoot.
Rootfs Overview of the build process
The build process for Rootfs is shown in 1. where the light box is BuildRoot implements the framework of the Deep Purple box for user-implemented scripts.
Figure 1 Rootfs production of buildroot system
The following points need to be summed up:
1. The new buildroot has moved Rootfs/etc/init.d/'s RCS and other startup scripts to the package/initscripts/directory.
2. The system default RCS script does not directly do the system user state initiates the initialization operation, but will call the/etc/init.d/directory under the sxx beginning of the script execution System user state starts the process, where xx is a number, the smaller the number of script takes precedence over the large number of script is called. The boot script for the actual system user state should be named in this format sxx, install to the output/target/etc/init.d/directory.
3. Fakeroot is a software package used on the host, it will be compiled by BuildRoot download, to provide a virtual root environment for the build Rootfs, only under the root authority, to the output/target/directories and files into the root user , and create a dev node. With the Fakeroot environment, the system Builder does not need to acquire the root authority of the host, but also can change the file to root under Fakeroot and make the root mode.
4. The user-specific format of the Rootfs script, will eventually be written into a script, the script is executed in the fakeroot environment.
How to build your own rootfs
Clear the process can be in the buildroot environment to build their own rootfs, with a friendly tiny4412 development Board Rootfs For example, the demo once to build their own rootfs process.
Friendly official ROOTFS compressed package on CD is Rootfs_qtopia_ Qt4-20141213.tar.gz, this rootfs is very bloated, we need to cut it, it is best to be able to use BusyBox to do a minimum of rootfs out, but because temporarily did not touch its every detail, afraid of the direct compilation of Rootfs can not start, So we'd better cut the boot script in its official /etc/init.d/ directory to make sure the system starts .
1. In the buildroot/system/directory, copy one copy of the skeleon/directory to tiny4412_skeleton/, while copying a device_table.txt to Tiny4412_device_ Table.txt, because there are special parts of the tiny4412 file system that need to be modified, to make a copy without affecting the generic template.
Figure 2 The contents of the system/directory after copying
2. According to the ROOTFS content of the friendly official, the tiny4412_skeleton/etc/catalogue is subject to some limitation and modification, and the deletion is as follows
Figure 3 Deleting the modified tiny4412_skeleton/etc/directory
3. The official file system,/etc/init.d/in the script CP to tiny4412_skeleton/etc/init.d/, in fact, RCS renamed s00_tiny4412 to match sxx format, XX represents the number.
4. Modify the tiny4412_device_table.txt slightly to remove the content that is not used in some of the smallest systems such as passwd.
Figure4 Modified Tiny4412_device_table.txt File
5. Because the tiny4412 file system is special, using a friendly and dedicated MAKE_EXT4FS tools to make, and this is an open source bin program, some parameters and nodes are written inside the dead, so we need to separate in the fs/, Add a method to the file system that makes the tiny4412.
6. Add the tiny4412_ext4/directory under the fs/directory, and the friendly official MAKE_EXT4FS tool CP to this directory, of course config.in files and tiny4412_ext4.mk scripts are essential. Don't forget to fs/config.in the newly added configuration file config.in source in the "Oh!"
FIGURE5 script directory specifically added for tiny4412 ext4 file system creation
Figure6 content in the tiny4412_ext4/directory
Figure7 the newly added config.in in fs/config.in.
7. Add the following configuration code in Tiny4412_ext4/config.in, where BR2_TARGET_ROOTFS_TINY4412_EXT4 is essential to allow the system to recognize variables of the file system type. The remaining variables are configurable in Menuconfig, the file system size, the path to the image authoring tool, and the last name of the image
Config BR2_TARGET_ROOTFS_TINY4412_EXT4 BOOL "Ext4 root filesystem for tiny4412" help Build AEXT4 root filesystem specify for tiny4412 If BR2_TARGET_ROOTFS_TINY4412_EXT4 Config br2_target_rootfs_tiny4412 _ext4_len string "Length of Rootfs" Default "397508608" Config BR 2_target_rootfs_tiny4412_ext4_mk_tool_path string "Make image Toolpath" Default "$ (topdir)/fs/tiny4412_ext4/make_ext4fs" Config Br2_target_rootfs_tiny4412_ext4_image_name string "image name" default "Rootfs_qtopia_qt4.img" endif
8. Add the Rootfs build script to the Tiny4412_ext4.mk script. the core of making a script is actually Rootfs_tiny4412_ext4_cmd function, it will be in the fs/common.mk script, which is written Fakeroot execution script, and then the Fakeroot be executed in the environment. the Rootfs_tiny4412_ext4_cmd function calls the Make_ext4fs tool to generate an image of ROOTFS based on the configured parameters.
################################################################################ # # Build the TINY4412_EXT4 root filesyste M Image # ################################################################################ Tiny4412_ext4_opts: =-s-l$ (Br2_target_rootfs_tiny4412_ext4_len) Tiny4412_ext4_opts + =-Root-l Linux Ifeq ($ (BR2_TARGET_ROOTFS_TINY4412_EXT4), y) Packages_permissions_table: = endif Define Rootfs_tiny4412_ext4_cmd $ (Br2_target_rootfs_tiny4412_ext4_mk_tool_path) $ (tiny4412_ext4_opts) [email  ;p rotected] $ (target_dir) endef $ (eval $ (call ROOTFS_TARGET,TINY4412_EXT4))
9. Next is the configuration of make menuconfig. In Menuconfig-to-systemconfiguration, the customer skeleton path and path to Permissiontable are populated in 1-4 steps, and we have copied the modified tiny4412 _skeleton and Tiny4412_device_table.txt.
Figure8 Menuconfig---systemconfiguration configuration
10. In Menuconfig-to-filesystemimages, select the Ext4 rootfs tor tiny4412 We just made, and the remaining parameters are estimated to be dead inside the Make_ext4fs tool program, using the default line. In addition, in this option, BusyBox is selected by default, so BusyBox all software in the application is compiled and Install to the output/target/ directory.
Figure9 Menuconfig---Filesystem images configuration
11. After saving, make ROOTFS-TINY4412_EXT4 generates our own file system. With tiny4412 SD card burned in, can boot up, s00_tiny4412 script further cut, we can get a tiny4412 on the Development Board on the smallest boot up Linux system.
BuildRoot Build Guide-Root file system (ROOTFS)