Create a file linuxrc

Creating linuxrc, add the following: [arm @ localhost my_rootfs] #vi linuxrc

#!/bin/sh

 

# Mount / etc is ramfs, and from under / mnt / etc copy files to the / etc directory which echo "mount / etc as ramfs"

/bin/mount ­n ­t ramfs ramfs /etc

/bin/cp ­a /mnt/etc/* /etc

 

echo "re­create the /etc/mtab entries"

# re­create the /etc/mtab entries

/bin/mount ­f ­t cramfs ­o remount,ro /dev/mtdblock/2 /

 

#mount some file system

echo "­­­­­­­­­­­­mount /dev/shm as tmpfs"

/bin/mount ­n ­t tmpfs tmpfs /dev/shm

 

# Mount / proc proc file system is

echo "­­­­­­­­­­­­mount /proc as proc"

/bin/mount ­n ­t proc none /proc

 

# Mount / sys sysfs file system is

echo "­­­­­­­­­­­­mount /sys as sysfs"

/bin/mount ­n ­t sysfs none /sys exec /sbin/init

2. Modify permissions

[arm@localhost my_rootfs]#chmod 775 linuxrc [arm@localhost my_rootfs]#ls linuxrc ­al

­rwxrwxr­x  1 root root  533 Jun  4 11:19 linuxrc

 

When compiling the kernel, specify command line parameters are as follows

Boot options> Default kernel command string: My command-line parameters are as follows noinitrd root = / dev / mtdblock2 init = / linuxrc console = ttySAC0,115200

 

The first application after which the init specify kernel execution to be loaded, the default is / sbin / init, as specified here / linuxrc

Guess you like

Origin www.cnblogs.com/fanweisheng/p/11105659.html