手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>网站运营>建站经验>列表

利用BusyBox定制Linux Live CD

来源:互联网 作者:west263.com 时间:2008-04-16
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!

   ftp://ftp.fsl.cs.sunysb.edu/pub/unionfs

Once downloaded, take a look at the Makefile. Below I have edited it to fit my environment, since my 2.6.11 kernel source is currently under "/home/chirico/kernel/BUILD/linux-2.6.11". So this is what my Unionfs Makefile looks like. All I did was change the variable LINUXSRC as shown below:

  #

# Makefile for the Linux 2.4 unionfs

#

# this should point to where your kernel headers are

#LINUXSRC = /lib/modules/`uname -r`/build

# Chirico change below - put in your location

LINUXSRC = /home/chirico/kernel/BUILD/linux-2.6.11

After this change, run "make", which will produce "unionfs.ko".

  # make

I copied "unionfs.ko" to the "_install/unionfs" directory. When you boot-up your cd, you can load this module manually.

  # insmod /unionfs/unionfs.ko

After loading successfully, you see it in "/proc/modules"

  # cat /proc/modules

Now, create the 3 directories.

  # mkdir -p /Fruits /Vegetables /mnt/healthy

And mount

  # mount -t unionfs -o dirs=/Fruits:/Begetables none /mnt/healthy

By the way, you can combine more than two directories. For example you could have done the following command.

  # mount -t unionfs -o dirs=/Fruits:/Vegetables:/etc none /mnt/healthy

To see the full power of Unionfs, you should create files in each of the individual directories.

The real power of Unionfs comes with NFS. See the proj_unionfs.tar.gz or cdrom_linux_boot_unionfs.iso. There is a special "/sbin/nfsmount", copied from Fedora Core 3 "/bin/mount", that will work with version 4 of NFS. Do NOT copy over the BusyBox mount command.

  $ /sbin/nfsmount -t nfs 192.168.1.182:/home /home2

See (TIP 104) on the How_to_Linux_and_Open_Source.txt tips in the reference on setting up the server to test the configuration.


STEP 9: The ISOLINUX Boot Loader

This is the boot loader. This is the first program run from the CD.

Note the following directory layout in "proj1/staging_iso_image/"

  $ cd proj1/staging_iso_image

$ tree .

.

`-- boot

`-- isolinux

|-- boot.cat

|-- isolinux.bin

|-- isolinux.cfg

|-- linux26

`-- menu.txt

There are two directories here "boot" and "isolinux", with all of the files under "isolinux". A description of each file is shown below:

boot.cat - The El Torito specification requires a "boot catalog" to be created.

isolinux.bin - This is the ISOLINUX boot loader program

isolinux.cfg - Configuration file that contains the necessary instructions for loading the kernel as shown directly below. The kernel is the file "linux26" and after the kernel loads, the compressed image file "initrd.bin" will be mounted on "/dev/ram0". After it gets mounted the program "/sbin/init", will start.

        default 1

prompt 1

timeout 300

display menu.txt

label 1

kernel linux26

append ramdisk_size=128000 initrd=initrd.bin init=/sbin/init root=/dev/ram0

label 2

kernel linux26

append ramdisk_size=128000 initrd=initrd.bin init=/sbin/init root=/dev/ram0 ramdisk_size=128000 vga=788

label 3

kernel linux26

append ramdisk_size=128000 initrd=initrd.bin init=/sbin/init root=/dev/ram0 ramdisk_size=128000 vga=791

linux26 - This is the kernel image, or the results of "make bzImage".

menu.txt - A menu specified in "isolinux.cfg" is shown directly below:


Choose Menu Option

1) Text Mode

2) 800x600 x 16bit color

3) 1024x768 x 16bit color

Copyright GPL (c) Mike Chirico

(mchirico@users.sourceforge.net)

For instructions on how to build your own:

http://souptonuts.sourceforge.net/cdrom.htm

Password for root is root

STEP 10: mkisofs - command to make CD image

The following command is run from the "proj1" directory. It is helpful to look at the "createiso" file for the complete process, which includes the command for building images/initrd.bin in the compressed format.

      $ mkisofs -R -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o iso/cdrom_linux_boot_proj1.iso staging_iso_image/boot

http://sourceforge.net/project/filemodule_monitor.php?filemodule_id=145435


FAQ:

(f.1) Can you store additional data on the cdrom and read it after boot-up? How?

You must have the correct "major" and "minor" numbers for your cdrom device. For example, I have a "Second IDE hard disk/CD-ROM interface." See http://souptonuts.sourceforge.net/devices.txt for the match on that, which tells me I need "22 block 0" for the mknod command. To get this mounted, all the commands are listed here below.

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!