Make the file system for the ARM development board under Linux
- 2020-12-21 18:16:57
- OfStack
1.Busybox source code please download on the Internet, compile method please refer to Baidu.
2. Please also set the Settings of cross-compilation tool chain first.
If there are no problems with 1 and 2 above, you can use the following script to make a file system for the ARM development board.
You can customize it by yourself and add your own Test demo.
#!/bin/bash
#yuanxin.yang develop 2015-07-05
# File system and Busybox The path of the ====> Customizable
FILESYSTEM=/Softwave/filesystem # Define the location of your own file system
BUSYBOX=/Softwave/arm/busybox-1.17.2 #Busybox Location of software
LIBS=/usr/local/arm/4.5.1/arm-none-linux-gnueabi # The location of the relevant library files for cross-compilation
# Determine if the file exists If there is Just delete
if [ -d $FILESYSTEM ]
then
rm -rf $FILESYSTEM &>/dev/null
mkdir $FILESYSTEM &>/dev/null
else
mkdir $FILESYSTEM &>/dev/null
fi
# copy busybox Relevant documents
if ! cp -rf $BUSYBOX/_install/* $FILESYSTEM &>/dev/null
then
echo "cp busybox failed..."
exit 1
fi
# Copies of the library
if ! cp -rf $LIBS/lib/ $FILESYSTEM/ &>/dev/null
then
echo "copy libs fair...."
exit 1
fi
# copy etc
if ! cp -rf $BUSYBOX/examples/bootfloppy/etc $FILESYSTEM &>/dev/null
then
echo "copy etc fair..."
exit 1
fi
# create Linux The directories
cd $FILESYSTEM &>/dev/null
mkdir boot mnt root sys var net proc tmp dev home opt &>/dev/null
# Modify configuration file
echo > $FILESYSTEM/etc/fstab
# Modify the etc/profile file
echo "# /etc/profile: system-wide .profile file for the Bourne shells" > $FILESYSTEM/etc/profile
echo "echo \"===========================\"" >> $FILESYSTEM/etc/profile
echo "echo \"Welcom to Linux System\"" >> $FILESYSTEM/etc/profile
echo "echo \"===========================\"" >> $FILESYSTEM/etc/profile
echo "export PS1=\"[jiaobenzhijia@Linux \W] # \"" >> $FILESYSTEM/etc/profile
# Modify the etc/init.d/rcS
echo "#! /bin/sh" > $FILESYSTEM/etc/init.d/rcS
echo "/bin/mount -n -t proc none /proc" >> $FILESYSTEM/etc/init.d/rcS
echo "/bin/mount -n -t sysfs none /sys " >> $FILESYSTEM/etc/init.d/rcS
echo "/bin/mount -t ramfs none /dev " >> $FILESYSTEM/etc/init.d/rcS
echo "/bin/mount -n -t ramfs none /tmp " >> $FILESYSTEM/etc/init.d/rcS
echo "/sbin/mdev -s" >> $FILESYSTEM/etc/init.d/rcS
# configuration nfs service
if ! grep "$FILESYSTEM" /etc/exports &>/dev/null
then
echo "/filesystem *(rw,sync,no_root_squash)" >> /etc/exports
fi
# Start the service
iptables -F &>/dev/null
service rpcbind restart
service nfs restart
echo "make filesystem ok....."
exit 0
conclusion