You are not logged in.

#1 2009-01-10 00:46:56

godane
Member
From: NH, USA
Registered: 2008-02-03
Posts: 241
Website

archiso-live with slax support

I found a way to make archiso scripts work like the old arch-live. By mounting the slax ext2 initrd has root filesystem. The idea is that archiso-live will be like the older arch-live based on slax but will have the archlinux kernel instead of slax kernel.

I couldn't do this before cause the linux-live scripts would not load right in initramfs with archlinux kernel cause of missing kernel modules that would have been build in kernel with slax kernel.

I got the system working by making a aufs union with /tmpfs/initrd and /real_root folder. Anyway i think i will share the code for you to understand:

mount_tmpfs () 
{
    #if [ "x${ramdisk_size}" = "x" ]; then
        ramdisk_size="25M"
    #fi
    msg -n ":: Mounting tmpfs, size=${ramdisk_size}..."
    mount -t tmpfs -o "size=${ramdisk_size}" tmpfs /tmpfs
    msg "done."
}

# args: ext2 file image
_mnt_ext2_file()
{
    msg "::: Adding new real_root branch: ${1}"
    /bin/modprobe -q loop max_loop=255 >/dev/null 2>&1
    mkdir -p ${2}
    if ! /bin/losetup "/dev/loop${LOOP_NUM}" ${1} > /dev/null 2>&1; then
        echo "ERROR: Cannot mount loop device /dev/loop${LOOP_NUM}"
        echo "       Couldn't mount all addons"
        break
    fi
    /bin/mount -t ext2 "/dev/loop${LOOP_NUM}" ${2}
    export LOOP_NUM=$(( $LOOP_NUM + 1 ))
}

run_hook ()
{
    export LOOP_NUM="0"
    
    if [ "x${from}" != "x" ]; then
    BOOT_MOUNT="/live"
    fi
    
    if [ ! $(ls /dev/loop*) ]; then
        echo "Creating loop device nodes."
        mknod /dev/loop0 b 7 0
        mknod /dev/loop1 b 7 1
        mknod /dev/loop2 b 7 2
        mknod /dev/loop3 b 7 3
        mknod /dev/loop4 b 7 4
    fi
    
    if [ -f "${BOOT_MOUNT}/initrd" ]; then
        mount_tmpfs
        mkdir -p "/tmpfs/initrd"
               _mnt_ext2_file "${BOOT_MOUNT}/initrd" "/tmpfs/initrd"
        /bin/modprobe -q squashfs >/dev/null 2>&1
        /bin/modprobe -q sqlzma >/dev/null 2>&1
        /bin/modprobe -q unlzma >/dev/null 2>&1
        /bin/modprobe -q aufs brs=1 >/dev/null 2>&1
        /bin/mount -t aufs -o nowarn_perm,br:/tmpfs=rw aufs /real_root
        /bin/mount -t aufs -o remount,add:1:/tmpfs/initrd=ro aufs /real_root
        cp -Raf /lib/modules /real_root/lib/modules
        
        udevpid=$(/bin/minips -C udevd -o pid=)
        [ "x${udevpid}" != "x" ] && /bin/kill -9 $udevpid 2>&1 >/dev/null
        #Yep, we're bailing out here.  We don't need kinit.
        msg ":: Passing control to Archlinux Initscripts...Please Wait"
        /bin/umount /sys
        /bin/umount /proc
        exec /bin/run-init -c /dev/console /real_root /sbin/init
    fi
}

Right the moment its a ext2 filesystem of initrd on the livecd. I plan on changing it to squashfs so we can save 6mb or so. I copy the kernel modules cause i don't want anything missing even though its mostly has everything the linux-live scripts. Just don't want risk crashing the system with out some module that was build slax but not in archlinux.

Anyways i hope this helps with the development of archiso.

EDIT: Fix a typo. tmpfs can only understand M not MB for size. wink

Last edited by godane (2009-01-13 19:50:08)


I'm working on a live cds based on Archlinux. http://godane.wordpress.com/

Offline

#2 2009-01-10 15:26:34

carbonjiao
Member
Registered: 2008-11-07
Posts: 20
Website

Re: archiso-live with slax support

Thanks for your great job!


http://archlive.googlecode.com
http://archlive-pkg.googlecode.com
Live system and build scripts base on Arch GNU/Linux
基于Arch GNU/Linux的live系统及制作脚本

Offline

#3 2009-01-13 19:49:30

godane
Member
From: NH, USA
Registered: 2008-02-03
Posts: 241
Website

Re: archiso-live with slax support

I have just released the newer archiso-live with slax support.

http://godane.wordpress.com/2009/01/13/ … 2-release/

you can get the build scripts here:

http://github.com/godane/archiso-live/tree/master

I hope this helps.


I'm working on a live cds based on Archlinux. http://godane.wordpress.com/

Offline

Board footer

Powered by FluxBB