»¨Á˼¸Ììʱ¼ä×öÁ˸ö¿ÉÒÔ¹âÅÌÆô¶¯µÄlinuxϵͳ,´óС5.15M,¹¦ÄÜ°üÀ¨linux´ó¶àÊý»ù±¾ÃüÁî
Ò».ϵͳ½éÉÜ:
ÎļþϵͳÓõÄÊÇram,ËٶȺܿì,²ÉÓÃisolinux¹âÅÌÆô¶¯,¿ÉÒÔ·½±ãÉý¼¶kernelºÍ¸ü¸Äroot fs(Ôö¼õlinuxÃüÁî),ʵ¼ÊÉÏÕâ¸ö¶«Î÷»¹¿ÉÒÔ×öµÄ¸üС,¿¼Âǵ½ÊÇisoËùÒÔ²»ÊǺÜÔÚºõ¿Õ¼ä,Èç¹ûÊÇǶÈëʽϵͳ,¿ÉÒÔ¿¼ÂÇ°Ñroot fs²ÉÓÃgzip -9ѹËõ´æÖü.ÎÒ²âÊÔÁËÍêÈ«¿ÉÒÔÔÚ1.44MÒÔÄÚ½â¾öÎÊÌâ.
ÖÆ×÷·½·¨:
¶þ.֪ʶ±³¾°
1.linuxÆô¶¯
Ê×ÏÈ,Ö÷°åµÄBIOS»á¶ÁÈ¡Ó²Å̵ÄÖ÷Òýµ¼¼Ç¼(MBR),MBRÖдæ·ÅµÄÊÇÒ»¶ÎºÜСµÄ³ÌÐò,ËûµÄ¹¦ÄÜÊÇ´ÓÓ²Å̶ÁÈ¡²Ù×÷ϵͳºËÐÄÎļþ²¢ÔËÐÐ,ÒòΪÕâ¸öС³ÌÐò̫СÁË,Òò´Ëͨ³£Õâ¸öС³ÌÐò²»¾ß±¸Ö±½ÓÒýµ¼ÏµÍ³Äں˵ÄÄÜÁ¦,ËûÏÈÈ¥Òýµ¼ÁíÒ»¸öÉÔ΢´óÒ»µãµÄС³ÌÐò,ÔÙÓÉÕâ¸ö´óÒ»µãµÄС³ÌÐòÈ¥Òýµ¼ÏµÍ³ÄÚºË(ps:Õâ¸öÉÔ΢´óÒ»µãµÄ³ÌÐò,¾ÍÊÇÎÒÃÇƽ³£ÊìÖªµÄliloºÍgrub,µ«ÊDZ¾ÏµÍ³²ÉÓõÄisolinux+mkisofs). LinuxϵͳÄں˱»Òýµ¼³ÌÐò×°ÈëÄں˲¢ÔËÐкó,linuxÄں˻á¼ì²âϵͳÖеĸ÷ÖÖÓ²¼þ.²¢×öºÃ¸÷ÖÖÓ²¼þµÄ³õʼ»¯¹¤×÷,ʹËûÃÇÔÚϵͳÕýʽÔËÐкóÄÜÕý³£¹¤×÷.Ö®ºóÄÚºË×öµÄ×îºóÒ»¸ö¹¤×÷ÊÇÔËÐÐ /sbinϵÄinit³ÌÐò,initÊÇÓ¢Îĵ¥´Êinitialization(³õʼ»¯)µÄ¼ò³Æ,init³ÌÐòµÄ¹¤×÷ÊǶÁÈ¡/etc/inittabÎļþÖÐÃèÊöµÄÖ¸Áî,¶ÔϵͳµÄ¸÷ÖÖÈíÓ²¼þ»·¾³×ö×î³õ»¯É趨.×îºóÔËÐÐgettyµÈ´ýÓû§ÊäÈëÓû§ÃûµÇ¼ϵͳ.ËùÓеŤ×÷¾ÍÕâô¼òµ¥,ËäÈ»linuxÆô¶¯µÄʱºòÓкܶàÄÚÈÝ,¿´ÉÏȥʮ·Ö¸ßÉî,µ«ÊǶ¼²»¹ýÊǶÔÕâ¸ö¹ý³ÌµÄÀ©³ä.Ã÷°×ÁËÕâ¸öµÀÀí,Äã¿ÉÒÔдһЩ½Å±¾³ÌÐòÈÃËûÔÚϵͳÆô¶¯µÄÌض¨Ê±¼äÔËÐÐÍê³ÉÈÎÎñ.ÊÂʵÉÏϵͳÄں˲¢²»¹ØÐÄ/sbinϵÄinitÊDz»ÊÇÕæµÄinit,Ö»ÒªÊÇ·ÅÔÚ/sbinÏÂÃû½ÐinitµÄ¿ÉÖ´ÐгÌÐòËû¶¼¿ÉÒÔÖ´ÐÐ,ÔÚ±¾ÏµÍ³ÖÐ,ÎÒÖ±½ÓÈÃϵͳ½øÈë/bin/bash,ÈÆ¿ªÁËϵͳloginµÇ½ÑéÖ¤.
2.Ò»¸ö²Ù×÷ϵµÄ¹¹³É
Òýµ¼³ÌÐò+ÄÚºË+Îļþϵͳ(ps:²»ÖªµÀÕâÑù˵ȷÇв»,µ«ÎÒÊÇÕâôÈÏΪµÄ)
3.Äں˱àÒë
http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/custom-guide/ch-custom-kernel.html
http://ourbbs.8800.org/linux/Linux%20Forum/linux/0399307373822/forum_topic
ÆäʵÎÒÃÇÕâÀïûÓÐÕâô¸´ÔÓ,Ö»ÐèÒª¼òµ¥µÄ¼¸²½¾ÍokÁË
ÏÂÔØÄÚºËÔ´´úÂë,½âѹµ½/usr/src/ÏÂÃæ,×÷Ò»¸öÁ¬½Ó(ps:û¸ã¶®ÎªÊ²Ã´,manualÉÏÕâô˵µÄ)
cd /usr/src
ln -s linux-*-* linux *±íʾÄãÏÂÔصÄÄں˰汾ºÅ
cd linux
make mrproper
make menuconfig
make dep
meke clean
make bzImage
ºÃÁË,ÎÒûÓмÓÈë¶ÔmodulesµÄÖ§³Ö,Éú³ÉµÄbzImageÎļþÔÚusr/src/linux/arch/i386/
4.busybox
1,busybox¼ò½é
busyboxÊÇÒ»¸ö¼¯³ÉÁËÒ»°Ù¶à¸ö×î³£ÓÃlinuxÃüÁîºÍ¹¤¾ßµÄÈí¼þ,ËûÉõÖÁ»¹¼¯³ÉÁËÒ»¸öhttp·þÎñÆ÷ºÍÒ»¸ötelnet·þÎñÆ÷,¶øËùÓÐÕâÒ»Çй¦ÄÜÈ´Ö»ÓÐÇøÇø1M×óÓҵĴóС.ÎÒÃÇƽʱÓõÄÄÇЩlinuxÃüÁî¾ÍºÃ±ÈÊÇ·ÖÁ¦Ê½µÄµç×ÓÔª¼þ,¶øbusybox¾ÍºÃ±ÈÊÇÒ»¸ö¼¯³Éµç·,°Ñ³£ÓõŤ¾ßºÍÃüÁ³ÉѹËõÔÚÒ»¸ö¿ÉÖ´ÐÐÎļþÀï,¹¦ÄÜ»ù±¾²»±ä,¶ø´óСȴСºÜ¶à±¶,ÔÚǶÈëʽlinuxÓ¦ÓÃÖÐ,busyboxÓзdz£¹ãµÄÓ¦ÓÃ,ÁíÍâ,´ó¶àÊýlinux·¢ÐаæµÄ°²×°³ÌÐòÖж¼ÓÐbusyboxµÄÉíÓ°,°²×°linuxµÄʱºò°¸ctrl+alt+F2¾ÍÄܵõ½Ò»¸ö¿ØÖÆ̨,¶øÕâ¸ö¿ØÖÆ̨ÖеÄËùÓÐÃüÁÊÇÖ¸ÏòbusyboxµÄÁ´½Ó. BusyboxµÄСÉí²Ä´ó×÷ÓõÄÌØÐÔ,¸øÖÆ×÷Ò»ÕÅÈíÅ̵Älinux´øÀ´Á˼°´ó·½±ã.
2,busyboxµÄÓ÷¨
¿ÉÒÔÕâÑùÓÃbusybox #busybox ls ,ËûµÄ¹¦ÄܾÍÏ൱ÔËÐÐlsÃüÁî ×î³£ÓõÄÓ÷¨Êǽ¨Á¢Ö¸ÏòbusyboxµÄÁ´½Ó,²»Í¬µÄÁ´½ÓÃûÍê³É²»Í¬µÄ¹¦ÄÜ.
#ln -s busybox ls
#ln -s busybox rm
#ln -s busybox mkdir
È»ºó·Ö±ðÔËÐÐÕâÈý¸öÁ´½Ó:
#./ls
#./rm
#./mkdir
¾Í¿ÉÒÔ·Ö±ðÍê³ÉÁËls rm ºÍmkdirÃüÁîµÄ¹¦ÄÜ.ËäÈ»ËûÃǶ¼Ö¸Ïòͬһ¸ö¿ÉÖ´ÐгÌÐòbusybox
µ«ÊÇÖ»ÒªÁ´½ÓÃû²»Í¬,Íê³ÉµÄ¹¦ÄܾͲ»Í¬,busybox¾ÍÊÇÕâôµÄÉñÆæ. Ä¿Ç°°æ±¾ÊÇbusybox1.0Õýʽ°æ.
3.ÏÂÔØ
http://www.busybox.net/downloads/
Èý.×¼±¸¹¤×÷
1.mkdir -p /mnt/myOS -----×÷Ϊ²úÉúÎÒÃÇÐÂϵͳµÄĿ¼
2.mkdir -p /mnt/myOS/isolinux -----±ØÐè,²Îhttp://syslinux.zytor.com/iso.php
3.°²×°mkisofs,¿ÉÒÔÖ±½ÓÏÂÔØrpmÀ´°²×°,°æ±¾×îÐÂΪÒË ---rpm -ivh ***.rpm
4.±àÒëÄÚºË,Éú³ÉbzImage,cp bzImage /mnt/myOS/ -----±àÒëÄÚºËÇë²Î¿¼,Çë×¢ÒâÒ»¶¨¼ÓÈëRAM disk support ºÍinitial RAM disk (initrd) support µÄÖ§³Ö,Òª²»È»µÈÏÂÄãµÄÐÂϵͳ¿Ï¶¨Æô¶¯²»ÁË
5.ÏÂÔØbusybox -----http://www.busybox.net/downloads/
ËÄ.±àÒë
busyboxµÄÅäÖóÌÐòºÍlinuxÄں˲˵¥ÅäÖ÷½Ê½¼òֱһģһÑù.ÊìϤÓÃmake menuconfig·½Ê½ÅäÖÃlinuxÄں˵ÄÅóÓÑ
ºÜÈÝÒ×ÉÏÊÖ.
#cp busybox-1.00.tar.gz /tmp/ada
#cd /tmp/ada
#tar xvfz busybox-1.00.tar.gz
#cd busybox-1.00
#make menuconfig
ÏÂÃæÊÇÐèÒª±àÒë½øbusyboxµÄ¹¦ÄÜÑ¡Ïî,ÆäËûµÄ¿ÉÒÔ¸ù¾ÝÐèÒª×ÔÑ¡,µ«ÊÇͬÑù²»ÒªÌ«Ì°ÐÄ.
General ConfigurationÓ¦¸ÃÑ¡µÄÑ¡Ïî
Show verbose applet usage messages
Runtime SUID/SGID configuration via /etc/busybox.conf
Build Options
Build BusyBox as a static binary (no shared libs)
Õâ¸öÑ¡ÏîÊÇÒ»¶¨ÒªÑ¡ÔñµÄ,ÕâÑù²ÅÄÜ°Ñbusybox±àÒë³É¾²Ì¬Á´½ÓµÄ¿ÉÖ´ÐÐÎļþ,ÔËÐÐʱ²Å¶ÀÁ¢ÓÚÆäËûº¯Êý¿â.·ñÔò
±ØÐèÒªÆäËû¿âÎļþ²ÅÄÜÔËÐÐ,ÔÚµ¥Ò»¸ölinuxÄں˲»ÄÜʹËûÕý³£¹¤×÷.
Installation Options
Don't use /usr
Õâ¸öÑ¡ÏîÒ²Ò»¶¨ÒªÑ¡,·ñÔòmake install ºóbusybox½«°²×°ÔÚÔϵͳµÄ/usrÏÂ,Õ⽫¸²¸ÇµôϵͳÔÓеÄÃüÁî.Ñ¡Ôñ
Õâ¸öÑ¡Ïîºó,make installºó»áÔÚbusyboxĿ¼ÏÂÉú³ÉÒ»¸ö½Ð_installµÄĿ¼,ÀïÃæÓÐbusyboxºÍÖ¸ÏòËûµÄÁ´½Ó.
ÆäËûÑ¡ÏÊÇһЩlinux»ù±¾ÃüÁîÑ¡Ïî,×Ô¼ºÐèÒªÄÄЩÃüÁî¾Í±àÒë½øÈ¥,Ò»°ãÓÃĬÈϵľͿÉÒÔÁË.
ÅäÖúúóÍ˳ö²¢±£´æ.
make
make install
±àÒëºÃºóÔÚbusyboxĿ¼ÏÂÉú³É×ÓĿ¼_install,ÀïÃæµÄÄÚÈÝ:
drwxr-xr-x 2 root root 4096 11ÔÂ 24 15:28 bin
lrwxrwxrwx 1 root root 11 11ÔÂ 24 15:28 linuxrc -> bin/busybox
drwxr-xr-x 2 root root 4096 11ÔÂ 24 15:28 sbin
ÆäÖпÉÖ´ÐÐÎļþbusyboxÔÚbinĿ¼ÏÂ,ÆäËûµÄ¶¼ÊÇÖ¸ÏòËûµÄ·ûºÅÁ´½Ó.
Îå.ÖÆ×÷×Ô¼ºµÄroot fs
1.Ŀ¼½á¹¹
mkdir /mnt/myOS/rootfs
cd /mnt/myOS/rootfs
mkdir etc usr var tmp proc home root dev
ÆäÖÐetc,procºÍdevÊÇÒ»¶¨Òª½¨µÄ,binºÍsbin²»Óý¨,ÒòΪbusyboxÖÐÒѾÓÐÁË.
ÆäËûµÄ¿ÉÒÔÏóÕ÷ÐԵĽ¨¼¸¸ö¾Í¿ÉÒÔÁË.
¿½±´busybox
#cp -R /tmp/ada/busybox-1.00/_install/* /mnt/myOS/rootfs/
2.É豸Îļþ
ÎÒÊÇÖ±½ÓÔÚredhatϵͳ/devĿ¼ÀïcpµÄ,·½·¨ÈçÏÂ:
#cp -R /dev/console ./
#cp -R /dev/null ./
#cp -R /dev/zero ./
ÄãÈÏΪÐèÒªµÄ¶¼cp¹ýÀ´
3,½¨Á¢etcĿ¼ÏµÄÅäÖÃÎļþ
Õâ¸öÇë²Î¿¼ÎÒµÄ/etc
4.ÖÆ×÷ramdiskÓ³ÏóÎļþ
cd /mnt/myOS/
dd if=/dev/zero of=/dev/ram0 bs=1M count=4 ------³õʼ»¯4MÄÚ´æ¿Õ¼ä
mkfs.ext2 -m0 /dev/ram0 ------¸ñʽ»¯Îªext2
mkdir /mnt/ram
mount /dev/ram0 /mnt/ram ------¹ÒÔص½/mnt/ram
cp -R rootfs/* /mnt/ram ------°ÑrootfsдÈëÄÚ´æ
umount /mnt/ram
dd if=/dev/ram0 of=/mnt/myOS/ramdisk.img ------°ÑÄÚ´æÖеÄÄÚÈÝÒÔÓ³Ïó·½Ê½È¡³ö
ok,Õâ¸öramdisk.img¾ÍÊÇÎÒÃǵÄrootfs
Áù.ÕûºÏ
1.kernel
cp /usr/src/linux/arch/i386/bzImage /mnt/myOS/
2.rootfs
ÒѾÔÚÕâ¸öĿ¼ÁË,¾ÍÊÇramdisk.img
3.isolinux
cp isolinux.bin isolinux.cfg /mnt/myOS/isolinux
±à¼isolinux.cfg.д·¨ºÍgrubµÄ²î²»¶à
Æß.ÖÆ×÷iso
cd /mnt/myOS
Ŀ¼ÀïµÄ¶«Î÷ÈçÏÂ:
©¦ bzImage
©¦ ramdisk.img
©¦
©¸©¤isolinux
isolinux.bin
isolinux.cfg
boot.cat ----|
-> ÕâÁ½¸öÎļþÄã¿ÉÒÔ×Ô¼ºËæ±ãд
boot.msg ----|
mkisofs - myiso.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table /mnt/Myiso
ºÇºÇ,Íê³ÉÁË,¸Ï¿ì²âÊÔÄã×Ô¼ºµÄOS°É
dzj ÓÚ 2008-02-24 00:19:00·¢±í:
ok
hqg250 ÓÚ 2008-02-16 08:16:36·¢±í:
ǿѽ£¬¹þ¹þ¡£Ñ§Ñ§