Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[howto] Gentoo Linux Livecd [last update 01/22/2007]
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4, 5, 6  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
ahaau
n00b
n00b


Joined: 19 Dec 2004
Posts: 25

PostPosted: Wed Sep 27, 2006 11:22 pm    Post subject: It helps a lot to put this howto in gentoo-wiki Reply with quote

[quote="gieltje"]
fRIOUX wrote:
Quote:
Post it to the gentoo-wiki.


It allready is there, be it in a different way see http://gentoo-wiki.com/HOWTO_build_a_LiveCD_from_scratch.

Mine was a fork of veezi's a long time ago and has it's pro's and cons against this method.
But I could always use some help if you wish to help out a bit.


http://gentoo-wiki.com/HOWTO_build_a_LiveCD_from_scratch in gentoo-wiki is not detailed enough, and doesn't work for me (unionfs, initrd),

It helps a lot to put this howto in gentoo-wiki.

I modified the linuxrc in initrd to boot my liveusb, and I found it's very easy to do initrd with instructions outlined here,

Code:

#!/bin/sh

export PATH=/bin

export CDROM=""

while [ "${CDROM}" == "" ]
do
 for x in sda1 sdb1 sdc1 sdd1
 do
  echo "Trying liveusb at ${x}..."
  sleep 10
  mount -t jfs -oro /dev/${x} /cdrom
  if [ "$?" == "0" ]
  then
    if [ -e /cdrom/livecd ]
    then
     CDROM=${x}
     break
    fi
    umount /dev/${x}
  fi
 done
 if [ "${CDROM}" != "" ]
 then
         break
 fi
done

echo "LiveCD found in /dev/${CDROM}"

mount -t squashfs -o loop /cdrom/livecd.squashfs  /static

mount -t tmpfs none  /dynamic

mount -t unionfs -o dirs=/dynamic=rw:/static=ro  unionfs  /union

cd /union

pivot_root . initrd

mount --move  /initrd/dynamic  /mnt/dynamic
mount --move   /initrd/static  /mnt/static
mount --move    /initrd/cdrom  /mnt/cdrom

mount -t proc none /proc
cat /proc/mounts > /etc/mtab
umount /proc

exec chroot . /bin/sh <<- EOF >dev/console
umount /initrd
echo "Starting init!"
exec /sbin/init
EOF
Back to top
View user's profile Send private message
Lepaca Kliffoth
l33t
l33t


Joined: 28 Apr 2004
Posts: 737
Location: Florence, Italy

PostPosted: Sun Oct 01, 2006 6:23 pm    Post subject: Reply with quote

Ok why the hell did I stop getting notifications??? Geez

Sorry guys I just found out there's a bunch of posts waiting for my attention. I will read them tomorrow.

I also wanted to let you guys know that I'm working on both this project and another unrelated one and I'm splitting time evenly between the two. While it's a long time since the last significant update, there will be a next version of this guide and it's going to be better than the current one. I know I promised an update more than once and didn't deliver anything so feel free to send me spam and hatemail :D
_________________
It isn't enough to win - everyone else must lose, and you also have to rub it in their face (maybe chop off an arm too for good measure).
Animebox!
Back to top
View user's profile Send private message
Lepaca Kliffoth
l33t
l33t


Joined: 28 Apr 2004
Posts: 737
Location: Florence, Italy

PostPosted: Mon Oct 09, 2006 8:14 am    Post subject: Re: Minor Suggestions Reply with quote

peaceful wrote:

Quote:
To get union among the other filesystems you see in menuconfig, download the source and run the patch-kernel.sh therein. Next time you run menuconfig, unionfs will be there.


It's unclear which unionfs sources should be fetched from where. First I tried fetching the sources for the latest stable unionfs through portage, but there are no stable versions in portage. Next, I googled around and found http://www.filesystems.org/project-unionfs.html

Since there seems to be specific versions of unionfs for specific versions of the kernel, I would assume that you could update the instructions to read something like:

Quote:
To get union among the other filesystems you see in menuconfig, download the appropriate version of unionfs for your kernel from the table on http://www.filesystems.org/project-unionfs.html and then untar the tarball, cd into the directory it created, and run patch-kernel.sh /usr/src/linux to patch your current kernel. Next time you run menuconfig, unionfs will be under File systems --> Miscellaneous filesystems --> Union fs support.


Will update ;)

peaceful wrote:

The only other issue I ran into so far (I'm just starting step 4) was on step 1:

Quote:
I suggest you follow Bob P's stage 1/3 method...


There's no reference to who Bob P is, or where or what his method is, or even why we ought to follow it.

I'm excited to get through the rest of the guide. Thanks for all your work!

Bob P's "one over three" installation method is the less likely to give you trouble. It's relatively old now so I don't know if anything has popped up recently but it's mostly guaranteed to produce a perfect base system. I'll try to dig up the link.
_________________
It isn't enough to win - everyone else must lose, and you also have to rub it in their face (maybe chop off an arm too for good measure).
Animebox!
Back to top
View user's profile Send private message
JasonB87
n00b
n00b


Joined: 25 Aug 2006
Posts: 11

PostPosted: Tue Dec 19, 2006 1:13 am    Post subject: Sound Reply with quote

Alrighty I was wondering if anybody has setup a livecd with sound?
Back to top
View user's profile Send private message
paluszak
Apprentice
Apprentice


Joined: 28 Jun 2004
Posts: 228
Location: Warsaw, Poland

PostPosted: Tue Dec 19, 2006 1:44 pm    Post subject: Re: Sound Reply with quote

JasonB87 wrote:
Alrighty I was wondering if anybody has setup a livecd with sound?


I haven't, but I'll try today, I don't think setting up ALSA would be an issue.

J.
Back to top
View user's profile Send private message
JasonB87
n00b
n00b


Joined: 25 Aug 2006
Posts: 11

PostPosted: Tue Dec 19, 2006 4:35 pm    Post subject: Reply with quote

Awesome I've been meaning to try myself but i've been working on a script that will detect the video card and load AIGLX if possible. It build the xorg.conf from scratch.
Back to top
View user's profile Send private message
Lepaca Kliffoth
l33t
l33t


Joined: 28 Apr 2004
Posts: 737
Location: Florence, Italy

PostPosted: Wed Dec 20, 2006 7:51 pm    Post subject: Re: Sound Reply with quote

JasonB87 wrote:
Alrighty I was wondering if anybody has setup a livecd with sound?

Just compile as modules all the soundcard drivers that are safe, the ALSA ones I mean. Debian's "discover" or similiar software (autoconf, or you can make a custom script) will take care of loading the right ones. As far as I know no configuration is needed but I don't know about those fancy 99999 channels soundcards ;)

The next version of the guide will still take some time. I still have to experiment with a lot of things. I hope the current version is good enough atm, you guys keep letting me know about your experience with it.
_________________
It isn't enough to win - everyone else must lose, and you also have to rub it in their face (maybe chop off an arm too for good measure).
Animebox!
Back to top
View user's profile Send private message
JasonB87
n00b
n00b


Joined: 25 Aug 2006
Posts: 11

PostPosted: Thu Dec 28, 2006 7:02 pm    Post subject: Reply with quote

The guide works great. I have a livecd with gnome and i wrote a crappy little script to detect the video card and set the system up to work with either AIGLX or nVidia's direct rendering stuff lol so I have beryl 1.3 installed and working. But yea the guide was the start to all of that lol. Thank you
Back to top
View user's profile Send private message
Lepaca Kliffoth
l33t
l33t


Joined: 28 Apr 2004
Posts: 737
Location: Florence, Italy

PostPosted: Thu Dec 28, 2006 9:17 pm    Post subject: Reply with quote

JasonB87 wrote:
The guide works great. I have a livecd with gnome and i wrote a crappy little script to detect the video card and set the system up to work with either AIGLX or nVidia's direct rendering stuff lol so I have beryl 1.3 installed and working. But yea the guide was the start to all of that lol. Thank you


You're welcome ;) Thanks for the feedback, it motivates me a lot.
_________________
It isn't enough to win - everyone else must lose, and you also have to rub it in their face (maybe chop off an arm too for good measure).
Animebox!
Back to top
View user's profile Send private message
STrRedWolf
n00b
n00b


Joined: 02 Sep 2002
Posts: 72

PostPosted: Mon Jan 22, 2007 2:49 pm    Post subject: Reply with quote

Whew! I think this will be a better LiveCD than all those other guides.

A few hints and tips:

Using Busybox in the initrd: Gentoo always builds a copy of Busybox, which is a small integrated subset of utilities. It currently lives in /bin/busybox. Instead of all those major utilities when building the initrd:
  1. Copy Busybox over into the initrd's /bin,
  2. make a /sbin for the initrd
  3. chroot /mnt/initrd /bin/busybox sh
  4. In the chroot: 'busybox --install'
    This will install all the symlinks for all the utilties we need for the initrd, and then some.
  5. Exit the chroot.
Back to top
View user's profile Send private message
Lepaca Kliffoth
l33t
l33t


Joined: 28 Apr 2004
Posts: 737
Location: Florence, Italy

PostPosted: Mon Jan 22, 2007 3:58 pm    Post subject: Reply with quote

STrRedWolf wrote:
...


You're in the guide.
_________________
It isn't enough to win - everyone else must lose, and you also have to rub it in their face (maybe chop off an arm too for good measure).
Animebox!
Back to top
View user's profile Send private message
STrRedWolf
n00b
n00b


Joined: 02 Sep 2002
Posts: 72

PostPosted: Mon Jan 22, 2007 5:05 pm    Post subject: Reply with quote

Lepaca Kliffoth wrote:
STrRedWolf wrote:
...


You're in the guide.


Thanks, but I've got some corrections: "chroot . /bin/busybox sh" gets you into the shell. Then a "busybox --install -s" will install the symlinks (otherwize they'll be hard).

There's also docs on doing a cpio/gz archive in the vanilla-sources package. I'll extract them out for the guide.
Back to top
View user's profile Send private message
Lepaca Kliffoth
l33t
l33t


Joined: 28 Apr 2004
Posts: 737
Location: Florence, Italy

PostPosted: Mon Jan 22, 2007 5:43 pm    Post subject: Reply with quote

Corrected and thanks ^^
_________________
It isn't enough to win - everyone else must lose, and you also have to rub it in their face (maybe chop off an arm too for good measure).
Animebox!
Back to top
View user's profile Send private message
STrRedWolf
n00b
n00b


Joined: 02 Sep 2002
Posts: 72

PostPosted: Mon Jan 22, 2007 9:15 pm    Post subject: Reply with quote

I couldn't get cpio/gz working, but I did get the regular version working!

So, some more updates for you:

  • These must be compiled into the kernel: ext2fs, iso9660fs, squashfs, unionfs, ramdisk block device, initrd support, loopback block device. I didn't see them be mentioned, so maybe making them explicitly mentioned may help others.
  • In /linuxrc, if you decide to go with the Busybox configuration, make sure PATH is set to /bin:/sbin or symlink /sbin to /bin in the initrd.


More as I smack headlong into them.
Back to top
View user's profile Send private message
Calandra
n00b
n00b


Joined: 05 Sep 2006
Posts: 38
Location: Gubbio (PG)

PostPosted: Tue Jan 23, 2007 8:55 am    Post subject: Reply with quote

Hi to all!

I built a livecd using gentoo-catalyst tool, so i hope not to be OT here :)

I have got a problem during the boot of my livecd:

During the boot of the latest one, at the

Code:
Copying read-write image contents to tmpfs


step, I have got a lot of error like this:

Code:
no space left on device


I did this test:

I used 2 different machine both with 512 mb of ram

1- Centrino: all was fine;
2- Sempron: error about missing space on device, during the copying image contents to tmpfs;

The livecd is built using

subarch: i686
profile: default-linux/x86/2006.1

and genkernel 3.4.5-r1

Thanks for your help

Luca
_________________
[img]http://imagegen.last.fm/basicrt10/recenttracks/2/Doktoreas.gif[/img]
Back to top
View user's profile Send private message
Lepaca Kliffoth
l33t
l33t


Joined: 28 Apr 2004
Posts: 737
Location: Florence, Italy

PostPosted: Tue Jan 23, 2007 9:36 am    Post subject: Reply with quote

Calandra wrote:
Hi to all!

I built a livecd using gentoo-catalyst tool, so i hope not to be OT here :)


Apri un thread sotto Other Things Gentoo oppure cerca un thread su Catalyst, questo thread non c'entra nulla :p
_________________
It isn't enough to win - everyone else must lose, and you also have to rub it in their face (maybe chop off an arm too for good measure).
Animebox!
Back to top
View user's profile Send private message
Lepaca Kliffoth
l33t
l33t


Joined: 28 Apr 2004
Posts: 737
Location: Florence, Italy

PostPosted: Tue Jan 23, 2007 9:47 am    Post subject: Reply with quote

STrRedWolf wrote:
I couldn't get cpio/gz working, but I did get the regular version working!

So, some more updates for you:

  • These must be compiled into the kernel: ext2fs, iso9660fs, squashfs, unionfs, ramdisk block device, initrd support, loopback block device. I didn't see them be mentioned, so maybe making them explicitly mentioned may help others.

That's covered in the kernel configuration section.
Quote:
Make sure you choose "Y" for ext2, squashfs and iso9660 filesystem support; you also need initrd support and you should make the default initrd size more than 9 megabytes.
<etc, etc, there's more>


STrRedWolf wrote:
  • In /linuxrc, if you decide to go with the Busybox configuration, make sure PATH is set to /bin:/sbin or symlink /sbin to /bin in the initrd.


    More as I smack headlong into them.

  • Touching the linuxrc script may lead to premature death. I changed your addition so that it tells to symlink bin to sbin, check it.
    _________________
    It isn't enough to win - everyone else must lose, and you also have to rub it in their face (maybe chop off an arm too for good measure).
    Animebox!
    Back to top
    View user's profile Send private message
    pjf02536
    n00b
    n00b


    Joined: 29 May 2005
    Posts: 5
    Location: Massachusetts, USA

    PostPosted: Thu Feb 01, 2007 3:30 am    Post subject: Reply with quote

    TIPS:
    for 2.6.18 kernels (probably others too) using busybox in initrd

    loop devices
    make sure you have a /dev/loop/x directory
    Code:
          cd /dev/
          mkdir loop
          cd loop
          for i in 0 1 2 3 4 5 6 7; do mknod loop$i b 7 $i; done


    or you can't mount squashfs ....

    linuxrc tweaks

    use
    #!/bin/busybox sh (as symlinks aren't happy till we have a shell)
    (note there are fewer library requirements 3 as i recall)

    change "mount --move" to "mount -o move ..."

    Build Tip:

    make a $LIVEDIR/initrd directory and work from there
    when you are happy run this script to make your init. be sure to make a /mnt/initrd directory.

    build-init script
    Code:

    #!/bin/bash

    export LIVEDIR=`pwd`

    echo "making initrd from directory"
    echo "  ... removing old initrd "
    # Remove loop
        losetup -d /dev/loop0
        rm boot/isolinux/initrd

    echo "Making a new init ..."
        dd if=/dev/zero of=${LIVEDIR}/boot/isolinux/initrd bs=1M count=8

    echo " Setting up new init"
    # make sure loop is usable
        modprobe loop
        losetup /dev/loop0 ${LIVEDIR}/boot/isolinux/initrd
        mkfs.ext2 /dev/loop0


    echo"Mount it to work on it:"
        mount /dev/loop0 /mnt/initrd
        cp -av initrd /mnt/

    echo "To remove init mount:"
        umount /mnt/initrd


    ok here is the modified linuxrc script, I added a few echos so we can follow it on boot
    Code:

    #!/bin/busybox sh

    export PATH=/bin

    for x in hda hdb hdc hdd
    do
       mount -t iso9660 /dev/${x} /cdrom
       if [ "$?" == "0" ]
       then
          CDROM=${x}
          break
       fi
    done

    if [ "${CDROM}" == "" ]
    then
       echo "FATAL --- LIVECD NOT FOUND"
       exec /bin/busybox sh
       exit
    fi

    echo "LiveCD found in /dev/${CDROM}"

    echo " Setting loop for Squashed FS"
    losetup /dev/loop0 /cdrom/livecd.squashfs
    mount -t squashfs -o loop /cdrom/livecd.squashfs  /static

    echo " Mounting dynamic fs"
    mount -t tmpfs -o size=300 none  /dynamic

    echo " Creating a perfect union"
    mount -t unionfs  -o dirs=/dynamic=rw:/static=ro  unionfs  /union

    cd /union

    echo " and making the union the ROOT FS"
    pivot_root . initrd


    echo " Moving mountpoints around , dynamic static and CD"
    mount -o move  /initrd/dynamic  /mnt/dynamic
    mount -o move   /initrd/static  /mnt/static
    mount -o move    /initrd/cdrom  /mnt/cdrom

    echo " Mounting a proc to make an mtab"
    mount -t proc none /proc
    cat /proc/mounts > /etc/mtab
    umount /proc

    echo "FINALLY starting a new session"
    exec chroot . '/bin/bash' <<- EOF > dev/console 2>&1
    umount /initrd
    echo "Starting init!"
    exec /sbin/init
    EOF
    Back to top
    View user's profile Send private message
    ahaau
    n00b
    n00b


    Joined: 19 Dec 2004
    Posts: 25

    PostPosted: Tue Feb 06, 2007 10:49 pm    Post subject: can we detect the livecd/liveUSB partition by UUID? Reply with quote

    instead of search within a list, say, hd[a-d]?

    the logic device name depends on the booting box/kernel.
    Back to top
    View user's profile Send private message
    JeliJami
    Veteran
    Veteran


    Joined: 17 Jan 2006
    Posts: 1086
    Location: Belgium

    PostPosted: Mon Feb 19, 2007 5:07 pm    Post subject: Reply with quote

    hwsetup segfaults:
    Code:
    # hwsetup
    Trying method 1......using /sys/bus/pci...OK
    Decided to use Linux-sysfs
    Segmentation fault
    # ls -l /etc/sysconfig/
    total 0

    This leaves me with an empty Driver for the video card (via), hence "no screens found"
    _________________
    Unanswered Post Initiative | Search | FAQ
    Former username: davjel
    Back to top
    View user's profile Send private message
    modified_bessel
    Tux's lil' helper
    Tux's lil' helper


    Joined: 16 Jul 2004
    Posts: 101
    Location: Cote d'Azur, France

    PostPosted: Wed Feb 28, 2007 12:51 pm    Post subject: Reply with quote

    I would like to use aufs instead of unionfs in your method; however, aufs loads in as a kernel module, and is not compiled into the kernel. Do you see major problems with this? Thanks.
    Back to top
    View user's profile Send private message
    mistik1
    n00b
    n00b


    Joined: 03 Dec 2006
    Posts: 6

    PostPosted: Wed Mar 14, 2007 8:14 pm    Post subject: Extracting and building an initramfs Reply with quote

    I noticed that some guys in this thread wanted to be able to use and initramfs vs initrd and since I am working with initramfs only I wrote a little script to help me to work on my initramfs.
    I save this as mkinitramfs.sh
    Code:

    #!/bin/bash
    if [[ "${DEBUG}" ]]; then
       set -x
    fi
    DIRBASE=INITRAMFS
    tempdir=${ITEMP:-$PWD}
    WORKDIR=${tempdir}/${DIRBASE}

    # utility functions
    usage() {
       echo "Usage: ${0##*/} [-e initramfs]|[-m initramfs]"
       echo -e "\t-e </full/path/to/initramfs-image> "
       echo -e "\t-m </full/path/to/destination/image>"
       echo -e "\t-e for extract and -m for make image"
    }

    if [[ $# -lt 1 ]]; then
       echo "Nothing to do exiting......."
       exit
    fi
    while getopts "e:m:" args; do
       case $args in
          e)
          # Extract initramfs
             IMAGE=${OPTARG}
             [[ -d ${WORKDIR} ]] && rm -rf ${WORKDIR}
             mkdir -p ${WORKDIR}
             pushd ${WORKDIR} >/dev/null
             zcat ${IMAGE}|cpio -i -d -H newc --no-absolute-filenames
             popd >/dev/null
             break
          ;;
          m)
          # Make initramfs
             DESTIMAGE=${OPTARG}
             if [[ -d ${WORKDIR}/lib ]]; then
                pushd ${WORKDIR} >/dev/null
                find . | cpio -o -H newc | gzip > ${DESTIMAGE}
                popd >/dev/null
             else
                echo "${WORKDIR} does not appear to be valid"
                echo "Doing Nothing"
                exit 1
             fi
             break
          ;;
          \?)
             usage
             exit 1 ;;
          *)
             echo "Invalid Argument"
             usage
             exit 1 ;;
       esac
    done

    If you use genkernel to create your initramfs you can extract it by just running the script like this.
    Code:
    mkiniramfs.sh -e /path/to/initramfs

    If you have not set and ITEMP variable it will extract the initramfs to ${PWD}/INITRAMFS
    You can then
    Code:
    # cd INITRAMFS
    #Do all your mods then
    cd ../
    mkinitramfs -m /path/to/new/initramfs

    Thats about it you would now have a new initramfs in /path/to/new/

    Hope this helps someone out there.
    _________________
    Dell Inspiron 1501
    AMD Turion X2 1600 MHZ, 1Gig RAM, 60 GB HDD, ATI Xpress 200M
    Back to top
    View user's profile Send private message
    JDGBOLT
    n00b
    n00b


    Joined: 04 Dec 2004
    Posts: 14

    PostPosted: Tue Apr 24, 2007 3:39 am    Post subject: Rewritten linuxrc script Reply with quote

    I initially started off with the linuxrc file that was in the post, and found it wasn't doing exactly what I wanted to, so I took the script as a base and completely rewrote it to be more modular, I wanted a initrd that I could easily just drop files into, which I created in the images folder on my livecd, and made the script check for the presence of the images directory so that it won't mistake another cdrom for its own. Also had to work around some of the stupidness of the beyond sources that I am currently using for my kernel. You may notice that it looks somewhat like genkernel, I worked with hacking away at genkernel a while ago to get an initrd that would boot my encrypted/lvm filesystems, and kind of liked the modular way of doing things, found it easier to read in a sense and be able to tell what is going wrong. There is plenty of output from this initrd, mostly because I wanted to tell what it was doing in case I made a mistake with typing it up. Also you will notice that I don't unmount the initrd here, whenever I tried it it would say it was busy, so decided to forego it, since it is not really hurting anything. Here are the two scripts:

    /linuxrc
    Code:

    #!/bin/ash
    export PATH=/bin:/sbin >/dev/null 2>&1
    echo "Remounting initrd read-write..."
    mount -o remount,rw / >/dev/null 2>&1
    echo "Loading modular scripts..."
    . /etc/initrd.scripts

    echo "Executing startMdev..."
    startMdev

    echo "Executing findCDRom..."
    findCDRom

    echo "Executing findImages..."
    findImages

    echo "Executing mountImages..."
    mountImages

    echo "Executing mountTmpfs..."
    mountTmpfs

    echo "Executing mountUnion"
    mountUnion

    echo "Executing makeUnionMount"
    makeUnionMount

    echo "Executing pivotRoot"
    pivotRoot

    echo "Executing mountUnionMount"
    mountUnionMount

    echo "Chrooting..."
    exec chroot . /bin/sh <<- EOF >dev/console

    echo "Starting init!"
    exec /sbin/init
    EOF

    And here is the /etc/initrd.scripts , yes, the name taken directly from genkernel, used part of it as a base:
    Code:

    #!/bin/ash

    runShell() {
            /bin/ash
    }

    startMdev() {
            echo "Populating device nodes with mdev busybox udev replacement..."
            mount /sys
            mount /proc
            mdev -s
            umount /sys
            umount /proc
    }

    findCDRom() {
            echo "Finding CD-ROM device..."
            for x in $(ls /dev/hd*)
            do
                    mount -t iso9660 ${x} /cdrom > /dev/null 2>&1
                    if [ "$?" == 0 ]
                    then
                            if [ -d /cdrom/images ]
                            then
                                    CDROM=${x}
                                    break
                            else
                                    umount /cdrom
                            fi
                    fi
            done
            if [ "${CDROM}" == "" ]
            then
                    for x in $(ls /dev/sr*)
                    do
                            mount -t iso9660 ${x} /cdrom >/dev/null 2>&1
                            if [ "$?" == "0" ]
                            then
                                    if [ -d /cdrom/images ]
                                    then
                                            CDROM=${x}
                                            break
                                    else
                                            umount /cdrom
                                    fi
                            fi
                    done
            fi
            if [ "$CDROM}" == "" ]
            then
                    echo "Cannot find LiveCD, running shell..."
                    runShell()
                    exit
            fi
            echo "LiveCD found at ${CDROM}..."
    }

    findImages() {
            echo "Finding read-only squashfs disk images..."
            for x in $(cd /cdrom/images && ls)
            do
                    echo "Found disk image ${x}..."
            done
    }

    mountImages() {
            echo "Mounting read-only squashfs disk images..."
            loopCount=0
            for x in $(cd /cdrom/images && ls)
            do
                    echo "Mounting disk image ${x}..."
                    losetup /dev/loop${loopCount} /cdrom/images/${x}
                    mkdir /mnt/${x}
                    mount -t squashfs /dev/loop${loopCount} /mnt/${x}
                    loopCount=$(($loopCount + 1))
            done
    }
    mountTmpfs() {
            echo "Mounting read-write ramdisk..."
            mkdir /ramdisk
            mount -t tmpfs ramdisk /ramdisk
    }

    mountUnion() {
            echo "Creating argument list for mounting the unionfs..."
            UNIONARGS="dirs=/ramdisk=rw"
            for x in $(cd /mnt && ls)
            do
                    UNIONARGS="$UNIONARGS:/mnt/${x}=ro"
            done
            echo "Unionfs arguments is ${UNIONARGS}"
            mount -t unionfs -o ${UNIONARGS} unionfs /union
            echo "Unionfs mounted at /union with arguments ${UNIONARGS}..."
    }

    makeUnionMount() {
            echo "Creating mountpoints for squashfs branches in unionfs root"
            cd /union
            for x in $(cd /mnt && ls)
            do
                    echo "Making mountpoint var/.${x}"
                    mkdir var/.${x}
            done
            mkdir mnt/livecd
            mkdir var/.ramdisk
            mkdir var/.initrd
    }

    pivotRoot() {
            echo "Chrooting into UnionFS Environment..."
            cd /union
            pivot_root . var/.initrd
    }

    mountUnionMount() {
            echo "Moving squashfs branches into union..."
            for x in $(cd /var/.initrd/mnt && ls)
            do
                    echo "Changing branch /var/.initrd/mnt/${x} to /var/.${x}"
                    mount -o move /var/.initrd/mnt/${x} /var/.${x}
            done
            echo "Moving ramdisk branch into union..."
            mount -o move /var/.initrd/ramdisk /var/.ramdisk
            echo "Moving livecd branch into union..."
            mount -o move /var/.initrd/cdrom /mnt/livecd
            echo "Creating mtab with updated mountpoints..."
            mount -t proc none /proc
            cat /proc/mounts > /dev/mtab
            umount /proc
    }

    There might be mistakes in it or doing things the hard way, but, well, this is like the third shell script that I have ever wrote, so cut me some slack. There are a number of enhancements to it, such as using mdev in order to get the device nodes so I don't have to do them all manually, multiple squashfs support, so I can just add files to the cd by putting them into separate squashfs images. I am doing this because I am building this livecd for a project, and there is a piece of it that is subject to change, but I don't want to be generating the main squashfs every time there is a change. I will be switching this over to using aufs, and with this, it is just a simple change of a couple lines. When it boots up, it moves the mounted squashfs directories into /var/.squashfs-name, and I just set it up so I have a 01-root 02..., so I can easily tell it what order to lay everything out. I may at a later point in time modify it to be able to have a disk image that it can look for in the root of another hard drive to be able to keep the changes to it. Let me know if any of you find it particularly useful.

    JDGBOLT
    Back to top
    View user's profile Send private message
    JDGBOLT
    n00b
    n00b


    Joined: 04 Dec 2004
    Posts: 14

    PostPosted: Thu Apr 26, 2007 5:23 pm    Post subject: Fixing the rebooting issue... Reply with quote

    It is possible to fix the rebooting issue by emerging livecd-tools, and editing the /sbin/livecd-functions.sh file, there is I think near the end a RC_UNMOUNT variable that it sets, I added /var/.* to the end of the argument and now the system goes down peacefully. Since in /etc/init.d/halt.sh it sources the livecd.functions file and looks for that RC_UNMOUNT variable, which tells it what not to try to unmount. A slightly more clean way of handling it than hacking away at the halt.sh file.

    JDGBOLT
    Back to top
    View user's profile Send private message
    Display posts from previous:   
    Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
    Goto page Previous  1, 2, 3, 4, 5, 6
    Page 6 of 6

     
    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