Results 1 to 1 of 1

Thread: Minimal patch of init for 64-bits and squashfs+cloop

  1. #1
    Senior Member registered user
    Join Date
    Sep 2006
    Posts
    802

    Minimal patch of init for 64-bits and squashfs+cloop

    I have tried to find the minimal set of modifications to minirt init to achieve

    1. Full 64-bits handling
    2. Use of cloop and squashfs transparently for end users

    There are quite a few potential and actual problems with full 64-bits systems, as many details have clearly not been fully handled yet. And the main init tool, busybox, behaves like a somewhat erratically moving target in this respect: I can successfully use vs 1.17 from the Debian package, but neither 1.18 precompiled nor custom compiled seems to work for init.

    The major modifications to minirt are

    • Use 64-bits busybox - 1.17 from deb package (installed in /bin/busybox)
    • Copy over 64-bits dev from running system
    • Patch init script as needed

    The main problem with 64 vs 32 bits init, is that no busybox version has been able to run programs adequately off /UNIONFS, and standard 6.4.4 init simply chains into /sbin/init. This hasn't been possible with the available busyboxes, but chroot works relatively fine.

    Handling squashfs, while keeping the multi-mount option for KNOPPIX[0-7] and the same numbering scheme as the cloops, necessitates that the KNOPPIX-DATA mount be moved from /dev/loop0 to somewhere else. It seems that we may have problems with loops above 9, so I moved it to /dev/loop8 and reduced the multi-mount options for KNOPPIX from 0-7 accordingly. (It's still possible to create an odd crash in a corner case, but anyone getting there should know the way out..)

    By adding the cheatcode "squashfs", squashfs will be mounted, and it is possible to have cloop (KNOPPIX) and squashfs (KNOPPIX.sq) images in the same KNOPPIX directory, if one wants to. But any booting will use only one of the types.

    I have tried out a "uni-minirt" common for 32- and 64-bits, but so far, it seems like the best thing to do is keep them separate. From past confusion, I have learnt to name each minirt.gz version separately, the attached init. for example belongs to a version called minirt_sq_2.gz, compressed from a directory called 64patch_1.

    Here is the diff of original and patched init. mountknoppix() is thoroughly changed, and findknoppix() is modified to look for KNOPPIX.sq.

    Code:
    diff init init644.org > patch_64_squash.txt
    156c156
    <   if [ -r /mnt-system/"$knoppix_dir"/KNOPPIX$knoppix_ext ]; then
    ---
    >   if [ -r /mnt-system/"$knoppix_dir"/KNOPPIX ]; then
    316,324d315
    < 
    < # Setup extension for squashfs
    < if checkbootparam "squashfs" ; then 
    <   knoppix_ext=".sq" ; usecloop=0 ;
    < else
    <   usecloop=1   
    < fi     
    < 
    < 
    586c577
    <  [ -b /dev/loop8 ]    || mknod -m 755 /dev/loop8 b 7 8
    ---
    >  [ -b /dev/loop0 ]    || mknod -m 755 /dev/loop0 b 7 0
    606,608c597,599
    <   losetup -d /dev/loop8 2>/dev/null
    <   runknoppixlib /sbin/losetup -p 0 -e aes -k 256 /dev/loop8 /mnt-system/"$knoppix_dir"/knoppix-data.aes </tmp/knoppix.pw; rc="$?"; rm -f /tmp/knoppix.pw
    <   runknoppixlib /sbin/mke2fs -F -m 0 /dev/loop8
    ---
    >   losetup -d /dev/loop0 2>/dev/null
    >   runknoppixlib /sbin/losetup -p 0 -e aes -k 256 /dev/loop0 /mnt-system/"$knoppix_dir"/knoppix-data.aes </tmp/knoppix.pw; rc="$?"; rm -f /tmp/knoppix.pw
    >   runknoppixlib /sbin/mke2fs -F -m 0 /dev/loop0
    610c601
    <   mount -t ext2 -o rw /dev/loop8 /KNOPPIX-DATA && return 0
    ---
    >   mount -t ext2 -o rw /dev/loop0 /KNOPPIX-DATA && return 0
    627c618
    <    [ -b /dev/loop8 ]    || mknod -m 755 /dev/loop8 b 7 8
    ---
    >    [ -b /dev/loop0 ]    || mknod -m 755 /dev/loop0 b 7 0
    642c633
    <       if runknoppixlib /sbin/losetup -e aes -k 256 /dev/loop8 "$img"; then
    ---
    >       if runknoppixlib /sbin/losetup -e aes -k 256 /dev/loop0 "$img"; then
    644,645c635,636
    <        runknoppixlib /sbin/e2fsck -y /dev/loop8 >/dev/null 2>&1
    <        mount -t ext2 -o rw /dev/loop8 /KNOPPIX-DATA && return 0
    ---
    >        runknoppixlib /sbin/e2fsck -y /dev/loop0 >/dev/null 2>&1
    >        mount -t ext2 -o rw /dev/loop0 /KNOPPIX-DATA && return 0
    648c639
    <       losetup -d /dev/loop8 >/dev/null 2>&1
    ---
    >       losetup -d /dev/loop0 >/dev/null 2>&1
    655c646
    <      losetup -d /dev/loop8 >/dev/null 2>&1
    ---
    >      losetup -d /dev/loop0 >/dev/null 2>&1
    665d655
    < 
    668,670c658,659
    <  if [[ $usecloop = 1 ]]; then
    <    grep -q cloop /proc/devices || insmod /mnt-system/"$knoppix_dir"/modules/cloop.ko preload=32 || return 2
    <  fi
    ---
    >  [ -b /dev/cloop ] || mknod -m 644 /dev/cloop b 240 0
    >  grep -q cloop /proc/devices     || insmod /mnt-system/"$knoppix_dir"/modules/cloop.ko preload=32 || return 2
    672,674c661,663
    <  for k in /mnt-system/"$knoppix_dir"/[Kk][Nn][Oo][Pp][Pp][Ii][Xx]$knoppix_ext \
    <           /mnt-system/"$knoppix_dir"/[Kk][Nn][Oo][Pp][Pp][Ii][Xx][0-7]$knoppix_ext; do
    <   [[ -r "$k" ]] || continue
    ---
    >  for k in /mnt-system/"$knoppix_dir"/[Kk][Nn][Oo][Pp][Pp][Ii][Xx] \
    >           /mnt-system/"$knoppix_dir"/[Kk][Nn][Oo][Pp][Pp][Ii][Xx][0-9]; do
    >   [ -r "$k" ] || continue
    676,682c665,666
    <   if [[ $count = 0 ]]; then
    <     dir=/KNOPPIX
    <     if [[ $usecloop = 1 ]]; then
    <       dev=/dev/cloop ; 
    <     else
    <       dev=/dev/loop0 ; 
    <     fi
    ---
    >   if [ $count = 0 ]; then
    >    dev=/dev/cloop ; dir=/KNOPPIX
    684,689c668,670
    <     dir=/KNOPPIX$count
    <     if [[ $usecloop = 1 ]]; then
    <       dev=/dev/cloop$count ;  
    <     else
    <       dev=/dev/loop$count ; 
    <     fi
    ---
    >    dev=/dev/cloop$count ; dir=/KNOPPIX$count
    >    [ -b $dev ] || mknod -m 644 $dev b 240 $count
    >    [ -d $dir ] || mkdir -m 755 $dir
    691,703c672
    < #  Set up and mount
    <   [[ -d $dir ]] || mkdir -m 755 $dir ; mntsuccess=1;
    <   if [[ $usecloop = 1 ]]; then
    <     [[ -b $dev ]] || mknod -m 644 $dev b 240 $count 
    <     (losetup  $dev $k >/dev/null 2>&1 && mount -r -t iso9660 $dev $dir >/dev/null 2>&1)||mntsuccess=0
    <     echo "mntsuccess cloop: $mntsuccess"
    <   else
    <     [[ -b $dev ]] || mknod -m 755 $dev b 7 $count    
    <     (losetup  $dev $k >/dev/null 2>&1 && mount -r -t squashfs $dev $dir >/dev/null 2>&1)||mntsuccess=0
    <     echo "mntsuccess squashfs: $mntsuccess"
    <   fi
    < # Something went wrong, we unmount all loop-mounts
    <   if [[ $mntsuccess = 0 ]]; then
    ---
    >   if ! losetup $dev $k >/dev/null 2>&1 || ! mount -r -t iso9660 $dev $dir >/dev/null 2>&1; then
    705c674
    <    echo -n -e "\n\r${RED}${BROKENIMAGE}: $k ${ON} "; mount | grep /mnt-system; dmesg | tail | grep 'c*loop'; echo -n "${NORMAL}"
    ---
    >    echo -n -e "\n\r${RED}${BROKENIMAGE}: $k ${ON} "; mount | grep /mnt-system; dmesg | tail | grep cloop; echo -n "${NORMAL}"
    707c676
    <    for dev in /dev/cloop* /dev/loop*; do
    ---
    >    for dev in /dev/cloop*; do
    718,719d686
    < 
    < 
    764c731
    < mount --bind /UNIONFS/home /home
    ---
    > /bin/mount --bind /UNIONFS/home /home
    813,818c780
    < 
    < for d in mnt-system KNOPPIX-DATA ramdisk; do
    <         [ -d /UNIONFS/"$d" ] ||  mkdir /UNIONFS/"$d"
    <         mount --bind /"$d" /UNIONFS/"$d"
    < done
    < exec chroot /UNIONFS /sbin/init "$@" </dev/console >/dev/console 2>&1
    ---
    > exec /sbin/init "$@" </dev/console >/dev/console 2>&1
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


A-Tech 8GB DDR3 1600 PC3-12800 Laptop SODIMM 204-Pin Memory RAM PC3L DDR3L 1x 8G picture

A-Tech 8GB DDR3 1600 PC3-12800 Laptop SODIMM 204-Pin Memory RAM PC3L DDR3L 1x 8G

$13.99



HyperX FURY RAM DDR4 16GB 8GB 32GB 4GB 3200 2666 2400 2133 Desktop Memory DIMM picture

HyperX FURY RAM DDR4 16GB 8GB 32GB 4GB 3200 2666 2400 2133 Desktop Memory DIMM

$9.64



A-Tech 8GB PC3-12800 Desktop DDR3 1600 MHz Non ECC 240-Pin DIMM Memory RAM 1x 8G picture

A-Tech 8GB PC3-12800 Desktop DDR3 1600 MHz Non ECC 240-Pin DIMM Memory RAM 1x 8G

$13.99



32GB ECC DDR3 RAM 2x16GB PC3L-12800R Desktop/Server Memory picture

32GB ECC DDR3 RAM 2x16GB PC3L-12800R Desktop/Server Memory

$11.99



HyperX FURY DDR3 8GB 16GB 32GB 1600 MHz PC3-12800 Desktop RAM Memory DIMM 240pin picture

HyperX FURY DDR3 8GB 16GB 32GB 1600 MHz PC3-12800 Desktop RAM Memory DIMM 240pin

$15.90



Samsung 16GB (4x4GB) 1Rx8 PC3-12800U 1600Mhz DDR3 RAM Memory M378B5273DH0-CK0 picture

Samsung 16GB (4x4GB) 1Rx8 PC3-12800U 1600Mhz DDR3 RAM Memory M378B5273DH0-CK0

$14.00



Team T-FORCE VULCAN Z 32GB (2 x 16GB) PC RAM DDR4 3200 (PC4 25600) Memory picture

Team T-FORCE VULCAN Z 32GB (2 x 16GB) PC RAM DDR4 3200 (PC4 25600) Memory

$54.99



Crucial DDR3L 16GB 1600 2x 8GB PC3-12800 Laptop SODIMM Memory RAM PC3 16G DDR3 picture

Crucial DDR3L 16GB 1600 2x 8GB PC3-12800 Laptop SODIMM Memory RAM PC3 16G DDR3

$13.50



Lot Of 10 Mixed Samsung 16GB 2Rx4 PC4-2133P RDIMM DDR4-17000 ECC Server Memory picture

Lot Of 10 Mixed Samsung 16GB 2Rx4 PC4-2133P RDIMM DDR4-17000 ECC Server Memory

$149.99



32GB 16GB 8GB DDR3 2400MHz G.Skill Ripjaws DIMM Overclock Gaming Memory RAM LOT picture

32GB 16GB 8GB DDR3 2400MHz G.Skill Ripjaws DIMM Overclock Gaming Memory RAM LOT

$69.99