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
  •  


Toshiba 512GB SSD Solid State Drive 2.5

Toshiba 512GB SSD Solid State Drive 2.5" SATA THNSNC512GBSJ Sun Oracle 7010845

$53.99



StarTech SAT2510BU32 2.5

StarTech SAT2510BU32 2.5" SuperSpeed USB 3.0 SSD SATA Hard Drive Enclosure

$24.99



SanDisk 2TB Ultra 3D NAND SSD, Internal Solid State Drive - SDSSDH3-2T00-G26 picture

SanDisk 2TB Ultra 3D NAND SSD, Internal Solid State Drive - SDSSDH3-2T00-G26

$149.99



Western Digital 250GB WD Blue SA510 SATA SSD, Internal M.2 2280 - WDS250G3B0B picture

Western Digital 250GB WD Blue SA510 SATA SSD, Internal M.2 2280 - WDS250G3B0B

$39.99



Patriot P210 128GB 256GB 512GB 1TB 2TB 2.5

Patriot P210 128GB 256GB 512GB 1TB 2TB 2.5" SATA 3 6GB/s Internal SSD PC/MAC Lot

$14.99



Intel DC S3510 Series 120GB SSD 2.5

Intel DC S3510 Series 120GB SSD 2.5" 6Gb/s SATA Solid State Drive SSDSC2BB120G6K

$9.99



Netac 1TB 2TB 512GB Internal SSD 2.5'' SATA III 6Gb/s Solid State Drive lot picture

Netac 1TB 2TB 512GB Internal SSD 2.5'' SATA III 6Gb/s Solid State Drive lot

$13.99



Fanxiang SSD 512GB 1TB 2TB 4TB 2.5'' SSD SATA III Internal Solid State Drive lot picture

Fanxiang SSD 512GB 1TB 2TB 4TB 2.5'' SSD SATA III Internal Solid State Drive lot

$13.99



Fanxiang 256GB 512GB 1TB 2TB 4TB Internal SSD 2.5

Fanxiang 256GB 512GB 1TB 2TB 4TB Internal SSD 2.5" SATA III 6GB/s for PC/MAC Lot

$188.09



Fanxiang 4TB 2TB 1TB SSD 550MB/s 2.5'' SATA III Internal Solid State Drive lot picture

Fanxiang 4TB 2TB 1TB SSD 550MB/s 2.5'' SATA III Internal Solid State Drive lot

$209.99