To better understand the preparation of the ubifs root file system, first of all, let's briefly describe the composition of the system:
Bootloader (uboot) |
Parames) |
Kernel (kernel) |
Root filesystem (Root file system) |
Bootloader (uboot) is used to load the Operating System. the embedded Linux system consists of the Linux kernel and the root file system.
Therefore, to create a root file system for ubifs, you must first make several parts of the above system support the ubifs file system, you have to add some "things" in these components (supports ubi configuration ):
(Let's Make A metaphor that I understand myself: "daughter-in-law" is like starting the system. Does the daughter-in-law have to be approved and supported by the father-in-law, mother-in-law, mother-in-law, and mother-in-law? Bootloader, parames, kernel, and root
Filesystem is Dad, Mom, mother-in-law, father-in-law... O ~, And you are called "Ubi ")
This blog post focuses on detailed analysis: uboot adds support for ubifs file systems
I. Porting Environment
HOST: vmware-redhat5
§ Development Board: mini2440 -- 256 MB nandflash
§ Kernel: 2.6.29 Compiler: arm-linux-gcc-4.3.2.tgz
§ Uboot: u-boot-2008.10
2. Migration steps
This function supports ubifs file system.
1. add the following configuration to include/configs/mini2440.h: (Note: Different Development Boards have different configuration files under the include/configs/directory, my Development Board is mini2440, So I modified mini2440.h)
# Define config_mtd_device
# Define config_mtd_partitions
# Define config_assist_mtdparts
# Define config_lzo
# Define config_rbtree
# Define config_cmd_ubifs // to support ubifs, you must first enable uboot to support the ubifs burning command.
# Define config_cmd_ubi // uboo-supported ubifs burning command: 1. mtdparts: Used to partition the NAND;
/* 2. NAND erase. Part: Used to erase the specified partition and other commands. For more information about how to create an ubifs image, see the blog article "Create a ubifs image */
// Second, MTD (memory
Technology device memory technology device) is used to access the memory device (ROM, flash) Linux Subsystem
# Define mtdids_default "nand0 = nandflash0" // create a default partition for nandlflash,
# Define mtdparts_default "mtdparts = nandflash0: 384 K (bootloader)," // my partitions:
"128 K (Params ),"\
"5 m (kernel ),"\
"64 m (Root )"
/* Modify the following macros, because using ubifs will occupy more heap and stack space */
# Define config_stacksize (512*1024)
# Define config_sys_malloc_len (config_env_size + 1024*1024)
# Define config_sys_gbl_data_size 512
2. Go back to the uboot top-level directory.
(Uboot may have been compiled, so it is best to use this command to clear intermediate files)
Run the command: Make clean
(Uboot is a general-purpose bootloader that supports multiple development boards. Therefore, choose which board to use before compiling)
Run the command: Make mini2440_config
Note: I am using the mini2440 Development Board, so we need to compile the uboot for this development board. Therefore, the goal here is mini2440_config, indicating that the selected board is mini2440.
(The standard term mini2440_config in makefile is called "target". You can find this target in makefile on the uboot top layer)
Run the command (start uboot compilation): Make cross_compile = arm-Linux-