Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
gentoo-based liveCD HOWTO
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
kernelOfTruth
Watchman
Watchman


Joined: 20 Dec 2005
Posts: 6111
Location: Vienna, Austria; Germany; hello world :)

PostPosted: Sat Nov 04, 2006 9:27 pm    Post subject: gentoo-based liveCD HOWTO Reply with quote

Hi,

there are so much of them but it's difficult for one to find the suitable: liveCD building HOWTOs

this thread / howto should make it easy for you to build up a liveCD (not usbstick :wink: )

but enough of talking / writing now on to the steps:

03/28/2007

so here the short version :wink: (I have little time):

1)
this is the directory structure of livecd build environment:

Quote:
drwxr-xr-x 2 root root 2 2. Sep 2006 backup
drwxr-xr-x 3 root root 4 2. Sep 2006 boot
-rwxr-xr-x 1 root root 254 25. Mär 18:20 buildcd
-rwxr-xr-x 1 root root 642 25. Mär 13:57 leave
-rw-r--r-- 1 root root 607 15. Jan 15:51 leave~
drwxr-xr-x 2 1001 users 2 15. Jan 15:33 livecd-x86
-rwxr-xr-x 1 root root 61 19. Mär 09:59 make_image.squashfs
-rwxr-xr-x 1 root root 1277 25. Mär 13:57 prepare
-rw-r--r-- 1 root root 1212 15. Jan 15:51 prepare~
drwxr-xr-x 5 root root 14 26. Mär 09:42 small-isolinux
drwxr-xr-x 21 root root 25 25. Mär 12:56 source
drwxr-xr-x 2 root root 2 25. Mär 11:23 usr-include
drwxr-xr-x 2 root root 2 25. Mär 11:23 usr-lib-gcc
drwxr-xr-x 2 root root 243 19. Mär 08:39 usr-lib-gconv
drwxr-xr-x 2 root root 2 15. Jan 15:43 usr-lib-perl5
drwxr-xr-x 6 root root 6 2. Sep 2006 usr-lib-portage
drwxr-xr-x 6 root root 6 25. Mär 14:30 usr-local-portage
drwxr-xr-x 2 root root 2 2. Sep 2006 usr-portage
drwxr-xr-x 3 root root 3 3. Sep 2006 usr-share-binutils_data
drwxr-xr-x 446 root root 446 25. Mär 21:48 usr-share-doc
drwxr-xr-x 2 root root 2 25. Mär 11:23 usr-share-gcc_data
drwxr-xr-x 3 root root 3 3. Sep 2006 usr-share-gtk-doc
drwxr-xr-x 4 root root 5 19. Mär 08:39 usr-share-i18n
drwxr-xr-x 2 root root 127 25. Mär 18:00 usr-share-info
drwxr-xr-x 3 root root 7 4. Mär 10:24 usr-share-libtool
drwxr-xr-x 153 root root 154 25. Mär 15:01 usr-share-locale
drwxr-xr-x 29 root root 29 25. Mär 17:08 usr-share-man
drwxr-xr-x 21 root root 70 25. Mär 17:54 usr-share-zoneinfo
drwxr-xr-x 11 root root 14 25. Mär 21:51 usr-src
drwxr-xr-x 2 root root 2 2. Sep 2006 usr-X11R6-man


the folders with "-" in their name are "outsourced" of the livecd-environment, called "source"

folder "small-linux" is the "visible" content of the livecd which can be seen after having loaded it into your drive
(containing image.squashfs, boot kernel, isolinux, etc etc)

2) first extract stage3 / stage ... tarball into source

3) later move the named folders out of the livecd environment to save space

the folders "boot" & "backup" aren't necessary they are optional for backup purposes

4) create 4 scripts:

prepare.sh (for mounting / readying the livecd environment for work):

Code:
#!/bin/bash

mount -t proc                   none  source/proc

mount -o bind                   /sys  source/sys
mount -o bind                   /dev  source/dev
mount -o bind               usr-src/  source/usr/src

mount -o bind       usr-lib-portage/  source/usr/lib/portage
mount -o bind      usr-share-libtool/ source/usr/share/libtool
#mount -o bind      usr-share-gcc_data/ source/usr/share/gcc-data
mount -o bind     usr-share-binutils_data/ source/usr/share/binutils-data
mount -o bind     usr-share-i18n/     source/usr/share/i18n
#mount -o bind    usr-lib-perl5/      source/usr/lib/perl5
#mount -o bind          usr-lib-gcc/  source/usr/lib/gcc
mount -o bind   usr-lib-gconv/        source/usr/lib/gconv
#mount -o bind           usr-include/  source/usr/include
mount -o bind        usr-share-info/  source/usr/share/info
mount -o bind           usr-share-locale/ source/usr/share/locale
mount -o bind         usr-share-man/  source/usr/share/man
mount -o bind         usr-share-doc/  source/usr/share/doc
mount -o bind     usr-share-gtk-doc/  source/usr/share/gtk-doc
mount -o bind     usr-share-zoneinfo/ source/usr/share/zoneinfo
mount -o bind         usr-X11R6-man/  source/usr/X11R6/man

mount -o bind           /home/        source/home
mount -o bind   usr-local-portage     source/usr/local/portage



leave.sh (for unmounting / leaving the livecd environment):

Code:
#!/bin/bash
###cd ${LIVEDIR}
umount source/proc
umount source/sys
umount source/dev
umount source/usr/src

umount source/usr/lib/portage
#umount source/usr/lib/perl5
#umount source/usr/lib/gcc
umount source/usr/lib/gconv
#umount source/usr/include
umount source/usr/share/binutils-data
umount source/usr/share/libtool
#umount source/usr/share/gcc-data
umount source/usr/share/info
umount source/usr/share/locale
umount source/usr/share/man
umount source/usr/share/i18n
umount source/usr/share/doc
umount source/usr/share/gtk-doc
umount source/usr/share/zoneinfo
umount source/usr/X11R6/man

umount source/home
umount source/usr/local/portage


/home folder is optional, I've located distfiles directory in /home via symbolic link to /usr/portage, so you can leave it out

make_image.squashfs (for creating your livecd "snapshot") [tmpfs optional]:

Code:
#!/bin/sh
mksquashfs source/ /var/tmp/paludis/image.squashfs


I'm mounting a tmpfs to /var/tmp/paludis, so it's faster (optional)


buildcd.sh (for unmounting / leaving the livecd environment):

Code:
#!/bin/sh

mkisofs -pad -l -r -J -v -V "custom-livecd" \
-no-emul-boot -boot-load-size 4 \
-boot-info-table -b isolinux/isolinux.bin \
-c isolinux/boot.cat -hide-rr-moved \
-o /var/tmp/paludis/custom-livecd.iso /home/livecd-x86/small-isolinux


the final livecd script which incorporates the squashfs-image with the "visible" content of your livecd

the name between the 2 "" is your livecd name

the name custom-livecd.iso the name of the iso

adapt /home/livecd-x86/small-isolinux to your directory structure

5) notice:

for mksquashfs to work, you need to install the package "squashfs-tools"

This thread is work in progress and will approximately take some weeks, so please don't rush me, as I have little time ...

I take the freedom to make 3 posts after another that I can extend this howto when needed ...
_________________
https://github.com/kernelOfTruth/ZFS-for-SystemRescueCD/tree/ZFS-for-SysRescCD-4.9.0
https://github.com/kernelOfTruth/pulseaudio-equalizer-ladspa

Hardcore Gentoo Linux user since 2004 :D


Last edited by kernelOfTruth on Wed Mar 28, 2007 6:04 pm; edited 5 times in total
Back to top
View user's profile Send private message
kernelOfTruth
Watchman
Watchman


Joined: 20 Dec 2005
Posts: 6111
Location: Vienna, Austria; Germany; hello world :)

PostPosted: Sat Nov 04, 2006 9:27 pm    Post subject: Reply with quote

6) content of "small-isolinux" (the "visible" part of your livecd):

fill this directory with additional files you need, e.g. mp3s, htm files, pdfs, ...

Quote:
-rw-r--r-- 1 root root 7351708 25. Mär 15:17 2.6.20-livecd-x86-r10.patch
-rw-r--r-- 1 root root 43301 4. Mär 13:01 atl1-2.0.7-linux-2.6.20-standalone.tar.gz
-rw-r--r-- 1 root root 50342 4. Mär 11:58 config-livecd-x86
-rw-r--r-- 1 root root 21776 14. Sep 2006 Getting_Online.txt
drwxr-xr-x 2 root root 3 15. Jan 15:47 handbook-x86_files
-rw-r--r-- 1 root root 446432 15. Jan 15:47 handbook-x86.html
drwxr-xr-x 2 root root 19 4. Mär 11:57 isolinux
-rw-r--r-- 1 root root 0 14. Sep 2006 livecd
-rw-r--r-- 1 root root 6222 14. Sep 2006 README.txt
-rw-r--r-- 1 root root 266024 25. Mär 11:49 reiserfsprogs-3.6.20.tbz2
-rw-r--r-- 1 root root 1915 25. Mär 11:40 release.txt
drwxr-xr-x 2 root root 4 25. Mär 23:34 xorg


the only necessary directory is "isolinux"

(probably also the file called "livecd")

7) content of directory "isolinux", residing in "small-isolinux"
for this to work you need to install the package "syslinux" (-> contains isolinux)

adapted from gentoo- minimal livecd:

Quote:
-rw-r--r-- 1 root root 2048 14. Sep 2006 boot.cat
-rw-r--r-- 1 root root 476 25. Mär 19:41 boot.msg
-rw-r--r-- 1 root root 950 14. Sep 2006 F2.msg
-rw-r--r-- 1 root root 1399 14. Sep 2006 F3.msg
-rw-r--r-- 1 root root 1550 14. Sep 2006 F4.msg
-rw-r--r-- 1 root root 1269 14. Sep 2006 F5.msg
-rw-r--r-- 1 root root 1300 14. Sep 2006 F6.msg
-rw-r--r-- 1 root root 1461 14. Sep 2006 F7.msg
-rw-r--r-- 1 root root 4160424 25. Mär 22:30 gentoo
-rw-r--r-- 1 root root 3879789 25. Mär 22:30 gentoo.igz
-rw-r--r-- 1 root root 10440 25. Mär 22:36 isolinux.bin
-rw-r--r-- 1 root root 1027 4. Mär 11:57 isolinux.cfg
-rw-r--r-- 1 root root 237 4. Mär 11:57 kernels.msg
-rw-r--r-- 1 root root 99256 15. Jan 19:24 memtest86plus

_________________
https://github.com/kernelOfTruth/ZFS-for-SystemRescueCD/tree/ZFS-for-SysRescCD-4.9.0
https://github.com/kernelOfTruth/pulseaudio-equalizer-ladspa

Hardcore Gentoo Linux user since 2004 :D


Last edited by kernelOfTruth on Wed Mar 28, 2007 6:03 pm; edited 1 time in total
Back to top
View user's profile Send private message
kernelOfTruth
Watchman
Watchman


Joined: 20 Dec 2005
Posts: 6111
Location: Vienna, Austria; Germany; hello world :)

PostPosted: Sat Nov 04, 2006 9:28 pm    Post subject: Reply with quote

8) isolinux.cfg:

Code:
default gentoo-nofb
timeout 150
prompt 1
display boot.msg
F1 kernels.msg
F2 F2.msg
F3 F3.msg
F4 F4.msg
F5 F5.msg
F6 F6.msg
F7 F7.msg

#label gentoo
#  kernel gentoo
#  append root=/dev/ram0 init=/linuxrc  dokeymap looptype=squashfs loop=/image.squashfs  cdroot initrd=gentoo.igz vga=791$

label gentoo-nofb
  kernel gentoo
  append root=/dev/ram0 init=/linuxrc looptype=squashfs loop=/image.squashfs  cdroot initrd=gentoo.igz vga=792

label gentoo-irqpoll
  kernel gentoo
  append "irqpoll" root=/dev/ram0 init=/linuxrc looptype=squashfs loop=/image.squashfs  cdroot initrd=gentoo.igz vga=792

label gentoo-nomsi
  kernel gentoo
  append pci=nomsi root=/dev/ram0 init=/linuxrc looptype=squashfs loop=/image.squashfs  cdroot initrd=gentoo.igz vga=792

label gentoo-nomsiirqpoll
  kernel gentoo
  append "irqpoll" pci=nomsi root=/dev/ram0 init=/linuxrc looptype=squashfs loop=/image.squashfs  cdroot initrd=gentoo.ig$


label memtest86plus
  kernel memtest86plus


change to your needing

for custom kernel copy over kernel from "source" directory in your livecd-environment:

e.g. kernel-genkernel-x86-2.6.20-kot2 -> gentoo
initramfs-genkernel-x86-2.6.20-kot2 -> gentoo.igz

for solving kernel-module dependencies do

Code:
depmod -v `ls /lib/modules`


otherwise it looks in your build environment (= outside)

for more info on this directory, have a look at the files in your gentoo minimal livecd :wink:

9) content of "source" (where the livecd / gentoo system is located at):

Quote:
drwxr-xr-x 2 root root 126 25. Mär 17:54 bin
drwxr-xr-x 2 root root 7 25. Mär 22:30 boot
-rwxr-xr-x 1 root root 159 1. Sep 2006 chroot.sh
-rw-r--r-- 1 root root 50342 4. Mär 12:25 config-livecd
drwxr-xr-x 10 root root 1482 15. Sep 2006 dev
drwxr-xr-x 74 root root 168 25. Mär 22:32 etc
drwxr-xr-x 3 root root 4 25. Mär 14:32 home
drwxr-xr-x 10 root root 154 25. Mär 22:13 lib
drwxr-xr-x 2 root root 3 25. Mär 22:23 media
drwxr-xr-x 5 root root 6 28. Okt 12:14 mnt
drwxr-xr-x 2 root root 2 1. Sep 2006 new
drwxr-xr-x 2 root root 2 1. Sep 2006 newroot
drwxr-xr-x 6 root root 7 25. Mär 15:02 opt
drwxr-xr-x 2 root root 3 14. Feb 2006 proc
drwx------ 3 root root 17 25. Mär 14:33 root
drwxr-xr-x 2 root root 245 25. Mär 22:22 sbin
drwxr-xr-x 2 root root 3 14. Feb 2006 sys
drwxrwxrwt 3 root root 278 25. Mär 22:32 tmp
drwxr-xr-x 13 root root 14 1. Sep 2006 usr
drwxr-xr-x 10 root root 13 10. Okt 21:13 var
-rwxr-xr-x 1 root root 44 1. Sep 2006 world.sh


take care that you've created the directories newroot & new !

without them the livecd doesn't work for me

chroot.sh is for chrooting into the livecd-system (optional):

Code:
#!/bin/sh
#env-update && source /etc/profile
mount --bind /usr/portage usr/portage
chroot . /bin/bash --login
echo "unmounting usr/portage"
umount usr/portage


updating world dependencies (portage-related) [optional]:

Code:
#!/bin/sh
env-update && source /etc/profile




10) other stuff to install on the livecd:

- enable livecd useflag
- install livecd-tools
-

11) kernel-build options for genkernel

- update genkernel-dependencies to newest versions according to versions available in portage
(-> edit ebuild)

Code:
genkernel --no-clean --makeopts=-j7 --no-bootsplash --lvm2 --evms2 --dmraid --unionfs-dev --menuconfig all

(builds faster, without --no-bootsplash you can get a black screen when having a kernel built without vesafb-tng & not enabled)
_________________
https://github.com/kernelOfTruth/ZFS-for-SystemRescueCD/tree/ZFS-for-SysRescCD-4.9.0
https://github.com/kernelOfTruth/pulseaudio-equalizer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum