Live DVD

From LinuxMCE
Revision as of 01:24, 4 March 2012 by L3mce (Talk | contribs) (Directory Structure)

Jump to: navigation, search

This wiki attempts to explain the live DVD creation techniques used to produce a universally installable DVD in lmcemaster.sh


Directory Structure

You will note the script creates 3 temporary folders.

$ISODIR is the file structure of the DVD itself. This contains the casper/ubiquity bits, the sqashed file system, bootloader and preseed data. The only files placed here should relate to the operations of the DVD itself. File:Http://i40.tinypic.com/scgiz5.png On the DVD itself this folder becomes /cdrom/

$WORKDIR is the work in progress, that is to say the file structure that will be installed on the target machine from the dvd. This root directory is where we put things, and manipulate them for the most part instead of the host. There are some catch-22s which require us to manipulate the host image prior to its being copied to this directory. On the DVD itself this folder becomes /target/

$DDDIR is the chrooted host directory structure we are building the DVD to install from. This file structure is ALSO the host environment on the DVD which Ubiquity functions over top of, and how we will facilitate live booting. This expects a DD image, which is then loop mounted to a temporary directory for manipulation. As little change as possible should be made to this directory. If you destroy/move things around in here, those changes persist, making it difficult or impossible to create more than one DVD from a single image. On the DVD itself this folder becomes /root/

The WORKDIR directory will serve as the host environment on the live DVD over which ubiquity is run. The WORKDIR is also the file system which will be installed on the hard drive, and become /target on the DVD after it is installed to the drive. Post operation can occur via the d-i preseed/late_command in the preseed.cfg file. The DDDIR and WORKDIR look identical on the DVD save the addition of the /target directory on the DDDIR, which contains the mounted WORKDIR. Chroot operations can occur to that /target directory as well.

Generated Files

We create a few files throughout this process. This explains what and why.

interfaces.temp This file sets two nics as dhcp so as to find internet when needed, as when it is needed, it is needed. This file is used twice. The chrooted environment needs internet and presumes there are two nics, and doesn't know which one it is on. The post installer needs internet prior to DCE nic configuration and presumes the same. If there is only one nic avail, this still works, though it is hacky and I do not like it. Exists at /target/etc/network

 auto lo
 iface lo inet loopback
 
 auto eth0
 iface eth0 inet dhcp
 
 auto eth1
 iface eth1 inet dhcp


isolinux.cfg this is the boot configuration for isolinux. This sets up the menu, and specifies boot options etc as well as layout options and the preseed file. Colors are in hex format, preceded by an alpha level ATRRGGBB where AT=Alpha Transparency RR=Red GG=Green BB=Blue (example FFFC9306). Exists at /cdrom/isolinux/isolinux.cfg

 default vesamenu.c32
 prompt 0
 timeout 450
 totaltimeout 450
 
 menu width 78
 menu margin 14
 menu rows 6
 menu vshift 2
 menu timeoutrow 11
 menu tabmsgrow 10
 menu background splash.png
 menu title $LIVECDLABEL
 menu color tabms 0 #fffc9306 #fffc9306 std
 menu color timeout 0 #ff000000 #fffc9306 std
 menu color border 0 #ffffffff #ee000000 std
 menu color title 0 #ff00ff00 #ee000000 std
 menu color sel 0 #ffffffff #fffc9306 std
 menu color unsel 0 #ffffffff #ee000000 std
 menu color hotkey 0 #ff00ff00 #ee000000 std
 menu color hotsel 0 #ffffffff #85000000 std
 #####menu color option  forground #ALPHA/R/G/B  background #ALPHA/R/G/B
 #####blue ff98a5e0
 
 label live
   menu label Live - Boot LinuxMCE Live! from DVD
   kernel /casper/vmlinuz
   append preseed/file=/cdrom/preseed.cfg boot=casper initrd=/casper/initrd.gz quiet splash --
 
 label install
   menu label Install LinuxMCE - Start the installer
   kernel /casper/vmlinuz
   append preseed/file=/cdrom/preseed.cfg boot=casper only-ubiquity initrd=/casper/initrd.gz quiet splash --
 
 label xforcevesa
   menu label xforcevesa - boot Live in safe graphics mode
   kernel /casper/vmlinuz
   append preseed/file=/cdrom/preseed.cfg boot=casper xforcevesa initrd=/casper/initrd.gz quiet splash --
 
 label memtest
   menu label memtest - Run memtest
   kernel /isolinux/memtest
   append -
 
 label hd
   menu label hd - boot the first hard disk
   localboot 0x80
 append -


preseed.cfg There are a LOT of possible options for this menu. I am currently only disabling language packs, performing autoconfig for the dvd host (not the target mind you), and performing the post-install (note, late_command not currently working). Exists at /cdrom/preseed.cfg and at /cdrom/casper/preseed.cfg

 tasksel tasksel/first multiselect
 d-i pkgsel/install-language-support boolean false
 d-i preseed/early_command string service mysql stop 
 d-i netcfg/choose_interface select auto
 d-i finish-install/reboot_in_progress note
 ubiquity ubiquity/success_command string bash /cdrom/install/postseed.sh 


postseed.sh This is the local file which mounts the target appropriately to perform the post install, and launches said post install and the local OnScreenDisplay which alerts the installer what is occurring. This is problematic atm. It exists at /cdrom/install/postseed.sh

 #!/bin/bash
 mount -o bind /dev /target/dev
 mount -t proc none /target/proc
 mount -t devpts none /target/dev/pts
 mount -t proc sysfs /target/sys
 echo "Performing post-install steps. Please be patient." > /target/tmp/messenger
 export DISPLAY=:0 
 /cdrom/install/messages.sh && chroot /target bash /root/new-installer/postinst.sh


messages.sh This makes use of BootMessages.sh, which the gnome on-screen display utility. This method prevents the messages from blinking... however defining and calling these messages is proving elusive atm. I can drop to tty and export DISPLAY=:0 and run the script and it works like a dream. Calling it from the script the preseed calls isn't working atm. exists at /cdrom/install/messages.sh

 #!/bin/bash
 export DISPLAY=:0
 msgchk=/target/tmp/msgchk
 newmsg=/target/tmp/messenger
 if [ ! -f $msgchk ]; then touch -r $msgchk; fi
 while true; do 
    if [ $newmsg -nt $msgchk ]; then 
       /target/usr/pluto/bin/BootMessage.sh "`cat $newmsg`"
       touch -r $newmsg $msgchk 
    fi
 done


postinst.sh is the post installer. This is designed to be run from the preseed post, which chroots into the /target directory and performs the post install before rebooting. It is currently being run on reboot, which will itself need to be rebooted when finished. Should it be run chrooted, the mysqld commands must be unhashed for version control. Exists at /target/root/new-installer/postinst.sh

 #!/bin/bash
 . /usr/pluto/bin/GeneralFunctions.sh
 . /root/new-installer/dvd-installer.sh
 export LC_ALL=C
 echo "Please be patient while post-installer finalizes new install" > /tmp/messenger
 service mysql stop
 sleep 3
 `mysqld --skip-networking&` &
 cp /etc/network/interfaces.temp /etc/network/interfaces
 
 #Execute Functions ---these functions exist mostly in /target/root/new-installer/dvd-installer.sh 
 pinger
 gpgUpdate
 TimeUpdate
 Pre-InstallNeededPackages
 CreatePackagesFiles
 PreSeed_Prefs
 Fix_Initrd_Vmlinux
 Nic_Config
 Setup_Pluto_Conf
 Setup_NIS
 Create_And_Config_Devices
 Configure_Network_Options
 UpdateUpgrade
 VideoDriverSetup
 addAdditionalTTYStart
 TempEMIFix
 CreateFirstBoot
 InitialBootPrep
 echo "/bin/false" > /etc/X11/default-display-manager
 # In general I don't think chattr is a great idea... but this will prevent it from EVER being overwritten again without chattr -i first.
 chattr +i /etc/X11/default-display-manager
 mv /root/new-installer/lmcemaster/runners/* /etc/init.d
 update-alternatives --install /lib/plymouth/themes/default.plymouth default.plymouth /lib/plymouth/themes/LinuxMCE/LinuxMCE.plymouth 900
 update-initramfs -u
 umount -lf /dev/pts
 umount -lf /sys
 umount -lf /proc
 service mysql stop
 killall -9 mysqld_safe
 kill \`lsof |grep mysqld|cut -d" " -f3|sort -u\`
 umount -lf /dev
 echo "Rebooting" > /target/tmp/messenger
 sleep 3
 #rm /target/tmp/messenger
 reboot


README.diskdefines Defines the architecture, diskname etc. Exists at /cdrom/README.diskdefines and /cdrom/casper/README.diskdefines

 #define DISKNAME  $LIVECDLABEL
 #define TYPE  binary
 #define TYPEbinary  1
 #define ARCH  $ARCH
 #define ARCH$ARCH  1
 #define DISKNUM  1
 #define DISKNUM1  1
 #define TOTALNUM  0
 #define TOTALNUM0  1

_________________________________________________________________________________________________________________


Moved upstart jobs

I am also moving and rewriting the following files for various reasons/conflicts from /etc/init.d, and using the opportunity to run a couple of commands on boot. I will probably add more to this list as the enormous list of things running for LMCE slow down the operation of the DVD. These files are moved to /root/new-installer/lmcemaster/runners

nis - ypbind server fails and takes forever to do so. Painful.

0start_avwizard - we need to do some work before we try that.

linuxmce - absent avwizard, linuxmce will attempt to run.

The Move

The move is the process of creating the required subdirectories in the WORKDIR, and copying over most of the DDDIR. The majority of the move is done with rsync in the /etc folder. cp is used for the home directory to capture hidden files. Then install specific files are removed. During this time, the initrd.gz, vmlinuz, vesamenu32, and isolinux.bin files are created or moved. The plymouth theme is also created at this and the initramfs is generated, and the process is then repeated and updated with the -u option as the shutdown screen from the original was persisting after the make.

The Squash

Both the WORKDIR and the DDDIR file systems are squashed. The file system, again, is the base of the target image. The working DDDIR file system is the FS the DVD is running, and that which casper takes its cues from as to how to implement the backend to the WORKDIR target. Ubiquity is the front end with the KDE installer which installs the root system for kubuntu, using the casper ghosting. Again... key pieces that you want on the target that are specific to our system should go in the work directory.

(more to follow)