歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 基於現有的Linux LiveCD加入自己的內核和ramfs

基於現有的Linux LiveCD加入自己的內核和ramfs

日期:2017/2/28 14:22:02   编辑:Linux教程

實現目標:基於現有的Linux LiveCD加入自己的內核和ramfs

原LiveCD:install-amd64-minimal-20130711.iso (gentoo)

工作系統:CentOS

1.復制原LiveCD的內容:

[root@localhost Downloads]# mkdir /mnt/livecd
[root@localhost Downloads]# mkdir /mnt/img
[root@localhost Downloads]# mount -t iso9660 -o loop install-amd64-minimal-20130711.iso /mnt/livecd/
mount: /dev/loop0 is write-protected, mounting read-only
[root@localhost Downloads]# cp -r /mnt/livecd/* /mnt/img

2.切換到/mnt/img, 查看一下/mnt/img下面的內容。

[root@localhost img]# ls
gentoo.efimg image.squashfs livecd README.txt
gentoo.efimg.mountPoint isolinux

3.把自己的內核和ramfs放入到isolinux文件夾裡。這裡內核是bzImage, ramfs是ramfs.tar.gz

[root@localhost img]# ls isolinux/
boot.cat elilo.efi F4.msg F7.msg isolinux.bin memtest86
boot.msg F2.msg F5.msg gentoo isolinux.cfg ramfs.tar.gz
bzImage F3.msg F6.msg gentoo.igz kernels.msg System.map-gentoo

4.修改isolinux.cfg, 加入一項啟動(其中append那一項,可以根據自己需要來增減參數):

label hello-test
kernel bzImage
append root=/dev/ram init=/linuxrc initrd=ramfs.tar.gz

5.回到img,制作自己的iso文件

mkisofs -R -b isolinux/isolinux.bin -c isolinux/boot.cat -o /tmp/test.iso -V "test Linux" -no-emul-boot -boot-load-size 4 -boot-info-table .

6.把test.iso直接用虛擬機,或刻錄下去,進入啟動界面時,按TAB鍵,可以看到hello-test這一項,輸入它,啟動:

Copyright © Linux教程網 All Rights Reserved