Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
####### # # E-scripts and bootcd (a tool for making livecds) # # Note 1: use the eev command (defined in eev.el) and the # ee alias (in my .zshrc) to execute parts of this file. # Executing this file as a whole makes no sense. # An introduction to eev can be found here: # # (find-eev-quick-intro) # http://angg.twu.net/eev-intros/find-eev-quick-intro.html # # Note 2: be VERY careful and make sure you understand what # you're doing. # # Note 3: If you use a shell other than zsh things like |& # and the for loops may not work. # # Note 4: I always run as root. # # Note 5: some parts are too old and don't work anymore. Some # never worked. # # Note 6: the definitions for the find-xxxfile commands are on my # .emacs. # # Note 7: if you see a strange command check my .zshrc -- it may # be defined there as a function or an alias. # # Note 8: the sections without dates are always older than the # sections with dates. # # This file is at <http://angg.twu.net/e/bootcd.e> # or at <http://angg.twu.net/e/bootcd.e.html>. # See also <http://angg.twu.net/emacs.html>, # <http://angg.twu.net/.emacs[.html]>, # <http://angg.twu.net/.zshrc[.html]>, # <http://angg.twu.net/escripts.html>, # and <http://angg.twu.net/>. # ####### # «.bootcd» (to "bootcd") # «.initrd-shell» (to "initrd-shell") # «.list-of-modules» (to "list-of-modules") # http://lists.alioth.debian.org/pipermail/bootcd-user.mbox/bootcd-user.mbox (find-fline "$S/http/lists.alioth.debian.org/pipermail/bootcd-user.mbox/bootcd-user.mbox" "Never (i)gnore 'Not enough RAM' errors.") ##### # # bootcd # 2004sep16 # ##### # «bootcd» (to ".bootcd") # (find-status "bootcd") # (find-vldifile "bootcd.list") # (find-udfile "bootcd/") # (find-fline "/etc/bootcd/bootcdwrite.conf") # (find-fline "/usr/bin/bootcdwrite") # (find-fline "/usr/share/bootcd/S12bootcdram.sh") # (find-fline "/usr/share/bootcd/S13bootcdflop.sh") # (find-fline "/usr/share/bootcd/bootcd-check.lib") # (find-fline "/usr/share/bootcd/bootcd-ia64.lib") # (find-fline "/usr/share/bootcd/bootcd-run.lib") # (find-fline "/usr/share/bootcd/bootcd2disk") # (find-fline "/usr/share/bootcd/bootcd2disk.conf") # (find-fline "/usr/share/bootcd/bootcdflopcp") # (find-fline "/usr/share/bootcd/default.txt") # (find-fline "/usr/share/doc/bootcd/ChangeLog.gz") # (find-fline "/usr/share/doc/bootcd/FAQ.gz") # (find-fline "/usr/share/doc/bootcd/FAQ.gz" "/etc/mkinitrd/modules") # (find-fline "/usr/share/doc/bootcd/README.Debian") # (find-fline "/usr/share/doc/bootcd/changelog.gz") # (find-fline "/usr/share/doc/bootcd/copyright") # (find-man "1 bootcd") # (find-man "1 bootcd2disk") # (find-man "1 bootcdflopcp") # (find-man "1 bootcdwrite") # (find-man "1 bootcdwrite" "-c <config directory>") # (find-man "1 bootcdwrite" "/etc/bootcd/bootcdwrite.conf") # (find-man "5 bootcd2disk.conf") # (find-udfile "bootcd/FAQ.gz" "SULOGIN=yes") #* # (find-fline "/etc/bootcd/bootcdwrite.conf" "CLEAN_VAR") # (find-fline "/usr/share/bootcd/bootcd-check.lib" "/var will be cleaned") # I feel safer doing the cleaning by hand rm -v /guest/var/cache/apt/archives/*.deb #* ### ### bootcdwrite asks for extra RAM, so create a 512MB swapfile ### # (find-man "1 dd") # (find-man "8 mkswap") swapoff /tmp/swapfile dd bs=1M count=512 if=/dev/zero of=/tmp/swapfile chmod 600 /tmp/swapfile mkswap /tmp/swapfile swapon /tmp/swapfile cat /proc/swaps #* ### ### Prepare the config files and invoke bootcdwrite ### # # (find-fline "/etc/bootcd/") # (find-fline "/etc/bootcd/bootcdwrite.conf") # (find-fline "/etc/bootcd/bootcdwrite.conf" "INITRD=") # (find-fline "/etc/bootcd/bootcdwrite.conf" "NOT_TO_RAM") # (find-sh "egrep -v '^(#|$)' /etc/bootcd/bootcdwrite.conf") # (find-fline "/guest/") # (find-fline "/guest/var/lib/dpkg/info/") # (find-fline "/var/log/bootcdwrite.log") rm -Rv /tmp/etc_bootcd/ mkdir /tmp/etc_bootcd/ rm -Rf /tmp/var_spool/bootcd/ mkdir /tmp/var_spool/bootcd/ cp -v /etc/bootcd/isolinux.cfg /tmp/etc_bootcd/ cp -v /etc/bootcd/syslinux.cfg /tmp/etc_bootcd/ cat < /etc/bootcd/bootcdwrite.conf \ > /tmp/etc_bootcd/bootcdwrite.conf cat >> /tmp/etc_bootcd/bootcdwrite.conf <<'%%%' # ----- SRCDISK=/guest/ KERNEL=$SRCDISK/boot/vmlinuz-2.6.8-1-386 ISO_ONLY="yes" INITRD=$SRCDISK/boot/initrd.img-2.6.8-1-386 CLEAN_VAR="no" VAR=/tmp/var_spool/bootcd # COMPRESS="no" RAMDISK_SIZE=24576 %%% bootcdwrite -c /tmp/etc_bootcd/ #* # As root, to make qemu happier: echo 1024 > /proc/sys/dev/rtc/max-user-freq modprobe tun sudo chmod 666 /dev/net/tun #* python =(<<'%%%' image = open("/tmp/hda.img", "w") image.truncate(1024 * 1048576L) image.close() %%% ) #* # Try the iso image using qemu. # Note: qemu puts the cdrom in hdc. # Use "boot: hdc" # (find-man "1 qemu") # qemu -m 128 \ -hda /tmp/hda.img \ -cdrom /tmp/var_spool/bootcd/cdimage.iso \ -boot d #* ##### # # things to do inside the initrd shell # 2005jan24 # ##### # «initrd-shell» (to ".initrd-shell") modprobe ide-cd modprobe isofs cd /devfs/ide/host0/bus1/target0/lun0/ mount -t iso9660 -o ro cd /mnt # Mystery: how does the initrd shell translate hdc to # /devfs/ide/host0/bus1/target0/lun0/ ? (I haven't unpacked tge initrd # to check yet) # falta dev/tty; criar com mknod pro hell # (find-fline "/dev/") # (find-zsh0 "laf /dev/tty") # (find-zsh0 "laf /dev/hdd") # (find-man "mknod") mknod null c 1 3 mknod tty c 5 0 mknod console c 5 1 mknod hdc c 5 1 mkdir mknod hdc mkdir /tmp/mydevs/ mount -t tmpfs /tmp/mydevs/ cd /tmp/mydevs/ mknod # (find-sh "lsmod") # (find-fline "/var/log/bootcdwrite.log") # Add the line "isofs" (no quotes, just one word): # (find-fline "/etc/mkinitrd/modules") # (find-fline "$ASROOT/etc/mkinitrd/modules") # (find-fline "/dev/") # (find-k26confvar "CONFIG_RAMFS") # (find-k26confvar "CONFIG_TMPFS") # (find-k26docfile "filesystems/tmpfs.txt") # (find-k26docfile "filesystems/devfs/README") # (find-k26docfile "devices.txt" "/dev/hdc") * (eechannel-xterm "A") R mkdir /tmp/devfs mount -t devfs devsf0 /tmp/devfs cd /tmp/devfs # (find-k26file "") # (find-k26file "fs/ramfs/") # (find-k26file "fs/") # (find-es "initrd" "initrd-mkinitrd") # (find-man "8 mkinitrd") ##### # # Changing the list of modules # 2005jan24 # ##### # «list-of-modules» (to ".list-of-modules") # (find-fline "/usr/sbin/mkinitrd") # The trick: change /guest/etc/mkinitrd/modules, remake the initrd in # /guest, remake the iso image. Note that I'm using the default Debian # kernel - if it weren't by that issuing a mkinitd from the host # partition create a big mess. # We need at least ide-cd and isofs. # (find-fline "/etc/mkinitrd/mkinitrd.conf" "DELAY") # (find-fline "/etc/mkinitrd/modules") # (find-fline "/guest/etc/mkinitrd/mkinitrd.conf" "DELAY") # (find-fline "/guest/etc/mkinitrd/modules") # (find-fline "$ASROOT/guest/etc/mkinitrd/mkinitrd.conf" "DELAY") # (find-fline "$ASROOT/guest/etc/mkinitrd/modules") #* # (find-man "8 mkinitrd") fakeroot \ mkinitrd -d /guest/etc/mkinitrd/ \ -o /tmp/initrd.img-2.6.8-1-386 \ 2.6.8-1-386 #* sudo cp -iv /tmp/initrd.img-2.6.8-1-386 \ /guest/boot/initrd.img-2.6.8-1-386 #* # (find-fline "/usr/share/bootcd/S12bootcdram.sh") ##### # # bootcd and discover # 2005jan24 # ##### # (find-status "bootcd-mkinitrd") # (find-vldifile "bootcd-mkinitrd.list") # (find-udfile "bootcd-mkinitrd/") # (find-man "1 bootcdmkinitrd") # (find-fline "/usr/sbin/bootcdmkinitrd") # (find-fline "/usr/share/bootcd/bootcdmodprobe") # (find-status "mkinitrd-cd") # (find-vldifile "mkinitrd-cd.list") # (find-udfile "mkinitrd-cd/") # (find-status "bootcd") # (find-vldifile "bootcd.list") # (find-udfile "bootcd/") initrd-tools busybox apti bootcd-mkinitrd mkinitrd-cd # (find-status "initrd-tools") # (find-vldifile "initrd-tools.list") # (find-udfile "initrd-tools/") # (find-status "mkinitrd-cd") # (find-vldifile "mkinitrd-cd.list") # (find-udfile "mkinitrd-cd/") # (find-fline "/etc/default/initrd-tools.sh") # (find-fline "/etc/init.d/initrd-tools.sh") # (find-fline "/etc/mkinitrd/mkinitrd.conf") # (find-fline "/etc/mkinitrd/modules") # (find-fline "/usr/sbin/mkinitrd") # (find-fline "/usr/share/doc/initrd-tools") # (find-fline "/usr/share/doc/initrd-tools/NEWS.Debian.gz") # (find-fline "/usr/share/doc/initrd-tools/changelog.gz") # (find-fline "/usr/share/doc/initrd-tools/copyright") # (find-fline "/usr/share/initrd-tools") # (find-fline "/usr/share/initrd-tools/echo") # (find-fline "/usr/share/initrd-tools/init") # (find-fline "/usr/share/initrd-tools/linuxrc") # (find-fline "/usr/share/initrd-tools/scripts") # (find-fline "/usr/share/initrd-tools/version") # (find-man "5 mkinitrd.conf") # (find-man "8 mkinitrd") # (find-status "cramfsprogs") # (find-vldifile "cramfsprogs.list") # (find-udfile "cramfsprogs/") # (find-fline "/usr/sbin/cramfsck") # (find-fline "/usr/sbin/mkcramfs") # (find-man "8 mkcramfs") # (find-fline "/usr/share/doc/cramfsprogs/README") # (find-fline "/usr/share/doc/cramfsprogs/copyright") # (find-fline "/usr/share/doc/cramfsprogs/NOTES.gz") # (find-fline "/usr/share/doc/cramfsprogs/changelog.Debian.gz") file -L /initrd.img # (find-fline "/usr/include/linux/initrd.h") # (find-man "4 initrd") http://debian-br-cdd.alioth.debian.org/debian/ bt> Toda vez q inicio meu pc tenho que configurar o pppoeconf echo ppp >> /etc/modules # (find-efunction 'repeat-complex-command) # (find-man "8 mkzftree") # (find-status "mkisofs") # (find-vldifile "mkisofs.list") # (find-udfile "mkisofs/") # (find-man "1 dirsplit" "mp3/Collections/Rock") # (find-fline "/usr/bin/dirsplit") # (find-man "8 mkisofs") # (find-k24file "") # (find-k24file "fs/isofs/") # (find-k24file "fs/isofs/compress.c") ##### # # debconf pre-seeding # 2004sep18 # ##### # (find-status "debconf") # (find-vldifile "debconf.list") # (find-udfile "debconf/") # (find-status "debconf-utils") # (find-vldifile "debconf-utils.list") # (find-udfile "debconf-utils/") # (find-man "1 debconf-get-selections") # (find-man "1 debconf-getlang") # (find-man "1 debconf-loadtemplate") # (find-man "1 debconf-mergetemplate") # (find-fline "/usr/bin/debconf-get-selections") # (find-fline "/usr/bin/debconf-getlang") # (find-fline "/usr/bin/debconf-loadtemplate") # (find-fline "/usr/bin/debconf-mergetemplate") # (find-man "1 debconf-copydb") # (find-man "1 debconf-set-selections") # (find-man "1 debconf-set-selections" "can be used to pre-seed") # (find-man "1 debconf-show") # (find-fline "/usr/bin/debconf") # (find-fline "/usr/bin/debconf-communicate") # (find-fline "/usr/bin/debconf-set-selections") # (find-fline "/usr/bin/debconf-show") # (find-fline "/usr/lib/python2.3/site-packages/debconf.py") # (find-fline "/usr/sbin/dpkg-preconfigure") # (find-fline "/usr/sbin/dpkg-reconfigure") ##### # # debconf-show # 2004dec02 # ##### # (find-sh "sudo debconf-show --listdbs") # (find-sh "sudo debconf-show --listowners | sort") # (find-sh "debconf-show --listowners --db=configdb | sort") # (find-sh "debconf-show --listowners --db=config | sort") # (find-sh "debconf-show --listowners --db=passwords") debconf-show --listdbs debconf-show --listowners | sort debconf-show --listowners --db=configdb | sort debconf-show --listowners --db=config | sort debconf-show --listowners --db=passwords debconf-show d-i debconf-show d-i --db=configdb debconf-show d-i --db=config debconf-show drupal --db=passwords # (find-fline "/etc/debconf.conf") # (find-fline "/var/cache/debconf/config.dat") # (find-fline "/var/cache/debconf/templates.dat") # (find-fline "/var/cache/debconf/passwords.dat") # (find-fline "/var/cache/debconf/config.dat" "exim4/dc_eximconfig_configtype") # (find-fline "/var/cache/debconf/templates.dat" "dc_eximconfig_configtype") ##### # # dvalois's presentation on livecds (using bootcd) # 2004sep18 # ##### #* # http://dvalois.net/downloads/livecd.tar.bz2 rm -Rv /tmp/Apresenta_CD_Live/ tar -C /tmp/ -xvjf $S/http/dvalois.net/downloads/livecd.tar.bz2 cd /tmp/Apresenta_CD_Live/ #* cd /tmp/Apresenta_CD_Live/ openoffice cdlive.sxi & #* # Slide 2 Sarge debootstrap -arch i386 woody /usr/local/chroot-sarge # Slide 3 Sarge chroot /usr/local/chroot-sarge # Slide 4 # Instalar Pacotes, configurar e testar # Montar /proc mount /proc proc -t proc # # Configurar sources.list de acordo com woody, sarge ou sid mcedit /etc/apt/sources.list # # Instalar o que quiser... apt-get install x-window-system-core gnome-core gdm gdm-themes # # Instalar bootcd e bootcd-dvdplus no chroot chroot /usr/local/chroot-sid # Slide 5 # Montar /proc mount /proc proc -t proc # # Configurar sources.list de acordo com woody, sarge ou sid mcedit /etc/apt/sources.list # # Instalar o que quiser... apt-get install x-window-system-core gnome-core gdm gdm-themes # # Instalar bootcd e bootcd-dvdplus no chroot apt-get install bootcd bootcd-dvdplus # # Sair do chroot umount /proc ; exit # Slide 6 # Instalar fora do chroot (no seu sistema habitual) apt-get install bootcd bootcd-dvdplus # # Configurar bootcdwrite.cnf mcedit /etc/bootcd/bootcdwrite.cnf # Slide 7 # Define o ponto inicial de onde a imagem será montada # Exemplo, para montar um bootcd do seu sistema use: # SCRDISK=/ SRCDISK=/usr/local/chroot-sid # # Define o kernel que será utilizado: # KERNEL=$SRCDISK/boot/vmlinuz-2.6.7 # Slide 8 # Duas 'ramdisks' (ram1 e ram2) serão criadas, para conter os seguintes diretórios: # ram1: /dev/ /etc /home /root /tmp # ram2: /var # # Ambas tendo o mesmo tamanho e definido em RAMDISK_SIZE # # Exemplo: Se você deseja gastar 16Mb com 'ramdisks', use: RAMDISK_SIZE=8192 # Slide 9 TYP=CD # Slide 10 CDSCSI=0,0,0 # Slide 11 CDSPEED=8 # Slide 12 # Você pode especificar um ou mais dispositivos de CD para # inicialização. A primeira entrada será considerada como # padrão. Os demais deverão ser informados como opções de # 'boot' pelo usuário. Veja DISPLAY. # CDDEV="/dev/hdc /dev/hda /dev/hdb /dev/hdc /dev/hdd " # CDDEV="/dev/hdc /dev/hda /dev/hdb /dev/hdc /dev/hdd /dev/sr0 /dev/scd0 /dev/scd1" # Slide 13 # BLANKING=yes|no|auto # # Se você for regravar um CD ou DVD, você deve especificar # BLANKING=yes. Se BLANKING=auto for especificado o # bootcdwrite irá sempre tentar apagar o CD, porém irá ignorar # todos os erros durante o processo. # BLANKING=no # Slide 14 # Texto para ser exibido durante o boot (veja a documentação do # syslinux). Esta opção não é suportada em plataformas HPPA # (HP PA-RISC). Exemplo: (de onde você pode colocar # 'display.txt'). # DISPLAY="$SRCDISK/usr/share/bootcd/display.txt" # Este é um texto padrão que exibe as opções de inicialização # /dev/hda, /dev/hdb, /dev/hdc, /dev/hdd, /dev/scd0 and /dev/scd1: # DISPLAY="/usr/share/bootcd/default.txt" # DISPLAY="/usr/share/bootcd/default.txt" # Slide 15 # Se você não tem um gravador de CD e deseja apenas criar uma # imagem ISO então use ISO_ONLY="yes" e defina, também, # BLANKING="no" neste arquivo. # ISO_ONLY="yes" # Slide 16 # DO_CHECK=yes|no # Verificar a ocorrência de possÃveis problemas pode levar um # bom tempo,mas é recomendável fazê-lo. # DO_CHECK=yes # Slide 17 # Se você precisar incluir opções de boot para o kernel como # "root=..." e "ramdisk_size=...", veja maiores detalhes em # "append" em lilo.conf(5). # Exemplo: # APPEND=\\\"aha1542=0x230 console=ttyS0,9600n8\\\" # APPEND="" # Slide 18 # Se SCRDISK não couber em um CD você pode decidir que # diretórios de SCRDISK não serão incluÃdas no CD. # Exemplo de como excluir /home/user1 e /home/user2 # NOT_TO_CD="$SRCDISK/home/user1$SRCDISK/home/user2" # Exemplo2: # NOT_TO_CD="$SRCDISK/home/bs/download $SRCDISK/home/bs/vmware" # NOT_TO_CD="" # Slide 19 # Quanto você inicializa do CD, alguns arquivos serão copiados # para a RAM. Aqui você decide, o que NÃO ficará em RAM. # Os diretórios /etc /var /dev /tmp /home e /root deverão estar em # RAM pois é preciso gravar neles. Nos CDs estes diretórios ficarão # com nomes diferentes (/etc/ro, /var.ro, ...) portanto você nunca # deverá usar estes nomes # em NOT_TO_RAM!!!. Os arquivos # que você excluir em NOT_TO_RAM, serão copiados para o CD e # você terá um link simbólico apontando para eles no sistema de # arquivo em RAM..Exemplo: Se você deseja excluir /home/s/bigfile e /home/bs/bigdir/; NOT_TO_RAM="$SRCDISK/home/bs/bigfile $SRCDISK/home/bs/bigdir" # NOT_TO_RAM="" # Slide 20 # SSHOSTKEY=yes|no # Se você for usar SSH sera útil ter um único SSH HOSTKEY para # cada CD. Eles serão gerados durante a gravação com # SSHHOSTKEY=yes. # SSHHOSTKEY=yes # Espaço disponÃvel para o log e a imagem de disco # ERRLOG=/var/log/bootcdwrite.log VAR=/var/spool/bootcd # Slide 21 # Se CLEAN_VAR=yes então alguns arquivos de 'cache' em /var # serão apagados antes de /var ser copiado para o CD de boot. Isto # irá minimizar a necessidade de espaço no CD. Atualmente # apenas o seguinte comando será executado: apt-get clean # Você pode desligar esta opção com CLEAN_VAR=no # CLEAN_VAR=yes # Slide 22 # FASTBOOT=yes|no # # Se FASTBOOT=yes então imagens adcionais da ramdisk será # criadas pelo bootcdwrite e copiados no CD. Isto permite uma # inicialização mais rápida, mas precisará de # um espaço extra no CD. # # Padrão: # FASTBOOT=yes # FASTBOOT=yes # Slide 23 # ISOLINUX=auto|yes|no # Veja /usr/doc/syslinux/isolinux.doc.gz. # Se for uma versão mais recente do syslinux então isolinux poderá # ser usado ao invés dele e ISOLINUX=auto será tratado como # ISOLINUX=yes. # # Se você deseja permanecer usando syslinux entãi use # ISOLINUX=no. Padrão: ISOLINUX=auto # ISOLINUX=auto # Slide 24 # SYSLINUX_SAVE=yes|no # Esta opção só será considerada se o isolinux não estiver sendo # utilizado. Se SYSLINUX_SAVE=yes então o syslinux será # chamado com a opção "-s". # A página do manual do syslinux diz: '(...) isto instala a "segura, # lenta e estúpida" versão do syslinux (...)'. Em versões mais novas # a opção "-s" é sempre usada. Agora você pode alterá-la. # # Padrão: SYSLINUX_SAVE=yes # Slide 25 # ARCH=auto|HPPA|X86|ia64 # You can create bootcd for HP PA-RISC too. It is possible to let # bootcdwrite detect your architecture with ARCH=auto. # To use ARCH=HPPA the debian package bootcd-hppa must be # installed..Default: ARCH=auto ARCH=auto # Slide 26 # COMPRESS=<yes|no|auto> # Se você precisa usar a compressão transparente em CDs (via # ISO9660 Rock Ridge) coloque COMPRESS=yes. Senão, use # COMPRESS=no. Se desejar que o bootcdwrite verifique se você # precisa ou não de compressão por use COMPRESS=auto. # # Se você definir COMPRESS=auto o bootcdwrite tentará verificar, # se você tem todos os programas necessários instalados. Neste # caso você deve definir DO_CHECK=yes se você for usar # COMPRESS=auto. COMPRESS="auto" # Slide 27 # Copie o seu kernel, config e system.map cp /boot/System.map-2.6.7 /usr/local/chroot-sid/boot/System.map-2.6.7 cp /boot/config-2.6.7 /usr/local/chroot-sid/boot/config-2.6.7 cp /boot/vmlinuz-2.6.7 /usr/local/chroot-sid/boot/vmlinuz-2.6.7 # Slide 28 # Execute o bootcdwrite como root su - ****** bootcdwrite # Slide 29 # Slide 30 # Executando bootcdwrite # Slide 31 # Gravando a iso cdrecord dev=/dev/hdc -speed=8 -v -driveropts=burnfree -data /var/spool/bootcd/cdimage.iso # Local Variables: # coding: utf-8-unix # End: