久久ER99热精品一区二区-久久精品99国产精品日本-久久精品免费一区二区三区-久久综合九色综合欧美狠狠

新聞中心

EEPW首頁 > 嵌入式系統 > 設計應用 > 最小的Linux系統制作過程詳解

最小的Linux系統制作過程詳解

作者: 時間:2016-10-08 來源:網絡 收藏

其中init.d是一個目錄,從busybox-1.00源代碼目錄下拷貝過來.

#cp -R /babylinux/busybox-1.00/examples/bootflopyp/etc/init.d /babylinux/rootfs/etc/

busybox.conf是一個空文件.

其他文件的內容如下:

fstab

/dev/fd0 / ext2 defaults 0 0

none /proc proc defaults 0 0

/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0

/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0

group

root:x:0:root

inittab

::sysinit:/etc/init.d/rcS

::askfirst:/bin/sh

tty2::respawn:/bin/getty 38400 tty2

tty3::respawn:/bin/getty 38400 tty3

tty4::respawn:/bin/getty 38400 tty4

# Stuff to do when restarting the init process

::restart:/bin/init

# Stuff to do before rebooting

::ctrlaltdel:/bin/reboot

::shutdown:/bin/umount -a -r

::shutdown:/bin/swapoff -a

issue

Baby Linux release 0.1

motd

mtab

passwd

root::0:0:root:/root:/bin/ash

profile

# /etc/profile: system-wide .profile file for the Bourne shells

echo

echo

export PS1=[u@h w]$

echo Done

alias ll='ls -l'

alias du='du -h'

alias df='df -h'

alias rm='rm -i'

echo

resolv.conf

nameserver 202.96.209.5

nameserver 202.96.209.6

shadow

root:$1$$adltAB9Sr/MSKqylIvSJT/:12705:0:99999:7:::

shadow-

root:$1$DWU.tenP$B7ANiXoGoiZMwJR6Ih8810:12705:0:99999:7:::

其中有很多是從原系統的/etc下拷貝過來修改的,如果你是一個具有中等以上水平的linux愛好者,那么應該一看就明白了,當然,你也可以根據自己的需要修改這些文件.其中最重要的是fstab和inittab,busybox內建的init程序用到的inittab文件的語法和一般的不一樣,不能直接把原系統/etc下inittab文件拷貝過來.可以把busybox-1.00目錄下的示例文件拷貝過來修改用.具體請看busybox的文檔. busybox的init也可以不用inittab.但是在我制作babylinux過程中有一個非常奇怪的bug.所有/sbin下的busybox鏈接在做成壓縮的根文件系統,解壓后都不能正常運行,顯示找不到該命令.只有當我在/bin下做這些鏈接時才能運行.具體原因還不太清除,所以你需要做下面的工作:

#cd /babylinux/rootfs/sbin

#ls

chroot getty ifconfig losetup pivot_root reboot swapoff sysctl

fdisk halt init mkswap poweroff route swapon telnetd

查看到sbin下有上述鏈接

轉到bin下

#cd /babylinux/rootfs/bin

重新做這些鏈接:

#ln -s busybox chroot

#ln -s busybox getty

#ln -s busybox ifconfig

...

然后把sbin下的鏈接刪除,以節省空間

#rm -rf /babylinux/rootfs/sbin/*

再把原先inittab中所有的sbin改成bin

init.d下的文件:

rcS

請確保這個文件是可執行的,否則請改成可執行的:

#chmod u+x rcS

rcS的內容:

#! /bin/sh

mount -o remount,rw /

/bin/mount -a

>/etc/mtab

echo

echo

echo

echo

echo -en ttWelcom to \033[0;32mBabyLinux\033][0;39mn

echo -en \033][0;36mn

echo

echo -en ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ttn

echo -en + This is a tiny linux system based on a floppy.It contains ttn

echo -en + more than 100 basic Linux commands and tools.The kernel of ttn

echo -en + this tiny system support all kinds of normal filesystems. ttn

echo -en + linux ext2,ext3,jfs,reiserfs and windows fat,vfat,ntfs][readonly]ttn

echo -en + is supported! So it is a powerful small system you can use it ttn

echo -en + as a linux and windows rescue disk.Beside this,the kernel alsottn

echo -en + contains the drivers of Reltek8139,NE2000,via-rhine ethernetttn

echo -en + adpater. you can configure the IPaddress and netmask with toolsttn

echo -en + 'ifconfig' and config the default gateway with command 'route'. ttn

echo -en + Is there anything else? Haha,this is a telnet server build-inttn

echo -en + you can type 'telnetd' to startd it and thus your friends canttn

echo -en + logon to your system to help you solve the problem.ttn

echo -en + \033[0;32mAll these great features are powered by BusyBox 1.0\033][0;36mttn

echo -en + This is a free system tool developed by GuCuiwen.ttn

echo -en + RUN YOUR OWN RISK of using it ! if you have any problem pleasettn

echo -en + mailto : win2linux@163.com Enjoy!!ttn

echo -en ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ttn

echo -en \033][0;39mn



關鍵詞:

評論


相關推薦

技術專區

關閉