Livecd笔记

发布时间 2023-06-26 14:04:18作者: 咿呀哒喏

注:以centos7livecd为例

1. 目录结构

[root@santiagod ~]# tree /mnt
/mnt
├── EFI
│   └── BOOT
│       ├── BOOTX64.efi
│       ├── fonts
│       │   └── unicode.pf2
│       ├── grub.cfg
│       └── grubx64.efi
├── isolinux
│   ├── boot.cat
│   ├── efiboot.img
│   ├── initrd0.img
│   ├── isolinux.bin
│   ├── isolinux.cfg
│   ├── macboot.img
│   ├── vesamenu.c32
│   └── vmlinuz0
└── LiveOS
    └── squashfs.img

5 directories, 13 files

 

2. legacy/bios: isolinux.cfg

[root@santiagod ~]# cat /mnt/isolinux/isolinux.cfg

default vesamenu.c32
timeout 100
menu background
menu autoboot Starting CentOS Linux 7 in # second{,s}. Press any key to interrupt.

menu clear
menu title CentOS Linux 7
menu vshift 8
menu rows 18
menu margin 8
#menu hidden
menu helpmsgrow 15
menu tabmsgrow 13

menu color border * #00000000 #00000000 none
menu color sel 0 #ffffffff #00000000 none
menu color title 0 #ff7ba3d0 #00000000 none
menu color tabmsg 0 #ff3a6496 #00000000 none
menu color unsel 0 #84b8ffff #00000000 none
menu color hotsel 0 #84b8ffff #00000000 none
menu color hotkey 0 #ffffffff #00000000 none
menu color help 0 #ffffffff #00000000 none
menu color scrollbar 0 #ffffffff #ff355594 none
menu color timeout 0 #ffffffff #00000000 none
menu color timeout_msg 0 #ffffffff #00000000 none
menu color cmdmark 0 #84b8ffff #00000000 none
menu color cmdline 0 #ffffffff #00000000 none

menu tabmsg Press Tab for full configuration options on menu items.
menu separator
menu separator
label linux0
  menu label ^Start CentOS Linux 7 Live
  kernel vmlinuz0
  append initrd=initrd0.img root=live:CDLABEL=CentOS-7-livecd-x86_64 rootfstype=auto ro rd.live.image quiet  rhgb rd.luks=0 rd.md=0 rd.dm=0
  menu default
menu separator
menu begin ^Troubleshooting
  menu title Troubleshooting
label basic0
  menu label Start CentOS Linux 7 Live in ^basic graphics mode.
  kernel vmlinuz0
  append initrd=initrd0.img root=live:CDLABEL=CentOS-7-livecd-x86_64 rootfstype=auto ro rd.live.image quiet  rhgb rd.luks=0 rd.md=0 rd.dm=0 nomodeset
  text help
      Try this option out if you're having trouble starting.
  endtext
label check0
  menu label ^Test this media & start CentOS Linux 7 Live
  kernel vmlinuz0
  append initrd=initrd0.img root=live:CDLABEL=CentOS-7-livecd-x86_64 rootfstype=auto ro rd.live.image quiet  rhgb rd.luks=0 rd.md=0 rd.dm=0 rd.live.check
menu separator
label local
  menu label Boot from ^local drive
  localboot 0xffff
menu separator
label returntomain
  menu label Return to ^main menu.
  menu exit
menu end

3. uefi/efi:grub.cfg

[root@santiagod ~]# cat /mnt/EFI/BOOT/grub.cfg

set default="1"

function load_video {
  insmod efi_gop
  insmod efi_uga
  insmod video_bochs
  insmod video_cirrus
  insmod all_video
}

load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2

set timeout=10
### END /etc/grub.d/00_header ###

search --no-floppy --set=root -l 'CentOS-7-livecd-x86_64'

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Start CentOS Linux 7 Live' --class fedora --class gnu-linux --class gnu --class os {
        linuxefi /isolinux/vmlinuz0 root=live:LABEL=CentOS-7-livecd-x86_64 ro rd.live.image quiet  rhgb
        initrdefi /isolinux/initrd0.img
}
menuentry 'Test this media & start CentOS Linux 7 Live' --class fedora --class gnu-linux --class gnu --class os {
        linuxefi /isolinux/vmlinuz0 root=live:LABEL=CentOS-7-livecd-x86_64 ro rd.live.image quiet  rhgb rd.live.check
        initrdefi /isolinux/initrd0.img
}

submenu 'Troubleshooting -->' {
menuentry 'Start CentOS Linux 7 Live in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os {
        linuxefi /isolinux/vmlinuz0 root=live:LABEL=CentOS-7-livecd-x86_64 ro rd.live.image quiet  rhgb nomodeset
        initrdefi /isolinux/initrd0.img
}
}
[root@santiagod ~]#

4. 系统镜像文件:sqashfs.img

[root@santiagod ~]# mount /mnt/LiveOS/squashfs.img livecd/
[root@santiagod ~]# tree livecd/
livecd/
└── LiveOS
    └── ext3fs.img

1 directory, 1 file
[root@santiagod ~]# mount livecd/LiveOS/ext3fs.img /mnt/
[root@santiagod ~]# ls /mnt
bin  boot  dev  etc  home  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var