Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->Linux技术 ->Linux安全 ->正文

利用BusyBox定制Linux Live CD

来源:Linux时代 作者:Mike Chirico  时间:2007-04-22 点击: [收藏] [投稿]

  #
  # 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

 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<



上一篇:基于FreeBSD5.4全能服务器安装v1.01   下一篇:使用 Perl 自动化 UNIX 系统管理

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
Power by linux-cn.com 粤ICP备05006655号