Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ BusyBox build root file system     - Linux system network security tools sudo Introduction (Linux)

- Configuring s3c-linux-2.6.28.6-Real6410 appears Unable to find the QT3 installation (Linux)

- Crawl use Wireshark packet on remote Linux (Linux)

- Xshell key authentication mechanism using a remote login Linux (Linux)

- Linux memory Cache Analysis (Linux)

- Grading defense against Linux server attacks (Linux)

- Hadoop 0.23 compile common errors (Server)

- CentOS modify yum update source (Linux)

- Let CentOS6 yum upgrade to support more source rpm package (Linux)

- Redhat Close SELinux correct step (Linux)

- Apache site default home page settings (Server)

- Testing Oracle 11g RMAN replicate database (Database)

- Oracle physical storage structure outline (Database)

- floating IP in OpenStack neutron (Server)

- IOwait Linux system monitoring diagnostic tools (Linux)

- Linux modify environment variables method (Linux)

- Hadoop 2.7.1 installation configuration based on availability QJM (Server)

- Use FirewallD build dynamic firewall (Linux)

- Compression software on a simple comparison of zip and gz (Linux)

- MySQL how to export files with the date format (Database)

 
         
  BusyBox build root file system
     
  Add Date : 2016-07-14      
         
         
         
  BusyBox is a composite of numerous programs simplified version Linux tools, embedded systems use it to quickly build a relatively simple root file system.

1. Download busybox
Official website www.busybox.net
Currently (2015.8.8) The latest stable version is 1.23.2

2. Compiling busybox
Before compiling busybox, please install the cross tool chain, such as I have here is omapl138 toolchain installation location / opt / arm-linux-gcc / omapl138 / bin /, because the same prefix and another compiler compiler, each setting environment variables before use

PATH = $ PATH: / opt / arm-linux-gcc / omapl138 / bin /
cd ~ / buildspace
tar xf ~ / Downloads / busybox-1.23.2.tar.bz2
cd busybox-1.23.2
make menuconfig
make
make install

menuconfig when,
Busybox Settings --->
Build Options --->
() Cross Compiler prefix fill prefix cross tool chain, here is the arm-none-linux-gnueab-
Installation Options ( "make install" behavior) ->
What kind of applet links to install (as soft-links)
(./_install) BusyBox installation prefix installation path, I like to use the default values
Other options are generally enough to use by default.
3. Construction of the root file system directory
As the root user to create the root, busybox copy files, create several directories

sudo -s
mkdir / home / rootfs
cd / home / rootfs
cp -r ~ / biuldspace / busybox-1.23.2 / _install / *.
mkdir dev etc lib mnt opt ​​var tmp proc sys root

Create two basic device files

mknod dev / console c 5 1
mknod dev / null c 1 3

Create / linuxrc initial configuration file / etc / inittab
The file specified in the script to run /etc/init.d.rcS after linuxrc initialization is complete. Then run a shell in ttyS2, the shell does not require login.

:: Sysinit: /etc/init.d/rcS

:: Ctrlaltdel: / sbin / reboot
:: Shutdown: / sbin / swapoff -a
:: Shutdown: / bin / umount -a -r
:: Restart: / sbin / init

ttyS2 :: respawn: - / bin / sh

 /etc/init.d/rcS content. In rcS file, you must use an absolute path, because the environment variable is not initialized ......

mount -a # mount all mount points in the / etc / fstab defined
echo / sbin / mdev> / proc / sys / kernel / hotplug # set hotplug event handler for mdev
mdev -s # initialize the device node maintenance procedures mdev
mkdir / dev / pts # directory as telnetd create pts
mount -t devpts devpts / dev / pts # mount pts directory
/ Bin / hostname -F / etc / hostname # Set the host name. Content / etc / hostname for the host name string

mkdir / var / run #ifup need this directory
/ Sbin / ifup -a # according to / etc / network / interface card settings

/ Usr / sbin / telnetd & # run telnetd
# Your program running in the background

The contents of / etc / fstab of

tmpfs / dev tmpfs defaults 0 0
proc / proc proc defaults 0 0
sysfs / sys sysfs defaults 0 0
tmpfs / var tmpfs defaults 0 0
tmpfs / tmp tmpfs defaults 0 0

Ifup need to create a folder

cd / home / rootfs / etc /
mkdir network
cd network
mkdir if-down.d if-post-down.d if-pre-up.d if-up.d

Content / etc / network / interfaces of

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.0.5
netmask 255.255.255.0
gateway 192.168.0.1

/ Etc / passwd contents

root :: 0: 0: root: / root: / bin / sh

The contents of / etc / profile of

PS1 = '\ u @ \ h: \ w \ $' # Set the terminal prompt
PATH = $ PATH: / usr / local / bin # set the search path
export TERM = vt102 #termcap environment variables, gdb -tui need
export TERMINFO = / usr / share / terminfo

 Copy dynamic library

cd /opt/arm-linux-gcc/omap_4.3.3/arm-none-linux-gnueabi/libc
cp lib / * / home / rootfs / lib /
cp usr / lib / libstdc ++. * / home / rootfs / lib /

Production ubi image file

if [-e ubifs.img]; then rm ubifs.img; fi
if [-e ubi.img]; then rm ubi.img; fi
rootfs = / home / rootfs
mkfs.ubifs -v -r $ {rootfs} -m 2048 -e 126976 -c 3717 -o ubifs.img -F
ubinize -v -o ubi.img -O 2048 -m 2048 -p 128KiB -s 512 ubinize.cfg
rm ubifs.img

Wherein, mkfs.ubifs need to add -F parameter, otherwise ubi file system is likely to be broken at once after the start. Meaning -F parameter is empty free area on the first start.

ubinize.cfg content

[Rootfs]
mode = ubi
image = ubifs.img
vol_id = 0
vol_type = dynamic
vol_name = rootfs
vol_flags = autoresize

mkfs.ubifs is to create a single volume (similar logical partitions) mirror, ubinize is to create a mirror image can contain multiple volumes (similar extended partition). ubinize.cfg, the [] in the name of the volume.
     
         
         
         
  More:      
 
- MySQL service failed to start thinking of settlement under CentOS7 (Database)
- 64-bit Ubuntu 15.10 How to compile the latest version of the 32 Wine 1.7.53 (Linux)
- MySQL optimization resulting order by using filesort (Database)
- Installation and use the telnet command under CentOS 6.x (Linux)
- Moosefs Distributed File System Configuration (Server)
- Use ISO document production OpenStack used CoreOS mirror (Linux)
- numpy and SciPy installation under Python for scientific computing package (Linux)
- Three minutes to teach you to easily grasp the grep command regular expression (Linux)
- Linux performance monitoring - CPU, Memory, IO, Network (Linux)
- Network security system (Network)
- Reset CentOS / RHEL root account password 7 (Linux)
- The security administrator network analysis tools SATAN Introduction under Linux (Linux)
- Oracle create user authorization and in PLSQL (Database)
- To install Xen in Ubuntu 12.04 (Linux)
- CentOS 6.4 installation and configuration LNMP build PHP server runtime environment (Server)
- About Git (Linux)
- Zabbix monitoring tool deployment under Ubuntu server (Server)
- Linux based exercises, interview questions (Linux)
- Update GAMIT10.6 command (Linux)
- Computer black magic: tail recursion (Programming)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.