1. Create an image file
Generate a file that can be virtualized into a device. The file name is init. IMG.
# Dd If =/dev/Zero of = init. img bs = 102 COUNT = 500
Note: BS * count indicates the block device size (byte)
Format a block Device
# Mke2fs-M0-F init. img
2. configure root FS (root file system)
Load init. IMG and romfs to the host file system.
A. The current directory uClinux-DIST has two empty directories: Ram and Rom. Copy romfs. IMG from images/to uClinux-Dist /.
# Mount init. img ram/-o loop
# Mount romfs. img rom/-o loop
B. Create a directory required by ramfs, that is, create a subdirectory In the ram directory.
# Mkdir RAM/bin
# Mkdir RAM/dev
# Mkdir RAM/etc
# Mkdir RAM/var
C. Copy the required files from the ROM directory to the ram directory (ramfs)
# Cp-a ROM/etc/* RAM/etc/
# Cp-a ROM/bin/sh RAM/bin
# Cp-a ROM/bin/init RAM/bin/init
D. Create device Node)
# Mknod RAM/dev/ttys0 C 4 64
# Mknod RAM/dev/console C 5 1
3. Uninstall init. IMG and romfs. IMG to save init. IMG.
# Umount Ram
# Umount Rom