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
  •  


Oracle 7085209 LSI MegaRAID SAS 9361-8i 1GB Cache 12Gbps SAS/SATA PCIe RAID Card picture

Oracle 7085209 LSI MegaRAID SAS 9361-8i 1GB Cache 12Gbps SAS/SATA PCIe RAID Card

$28.20



LSI 9207-8i 8-Port SAS Non-RAID 6GBPS PCIe Host Bus Adapter picture

LSI 9207-8i 8-Port SAS Non-RAID 6GBPS PCIe Host Bus Adapter

$34.95



Cisco UCS LSI MegaRAID 9271CV-8I SAS2308 PCIe SAS Internal RAID Controller picture

Cisco UCS LSI MegaRAID 9271CV-8I SAS2308 PCIe SAS Internal RAID Controller

$28.00



LSI 9223-8I 6GBPS PCIe SAS Internal RAID Controller picture

LSI 9223-8I 6GBPS PCIe SAS Internal RAID Controller

$22.75



Inspur LSI 9300-8i Raid Card 12Gbps HBA HDD Controller High Profile IT MODE picture

Inspur LSI 9300-8i Raid Card 12Gbps HBA HDD Controller High Profile IT MODE

$15.98



LSI MegaRAID 9361-8i 12Gb PCIe 8-Port SAS/SATA RAID 1Gb w/BBU/CacheVault/License picture

LSI MegaRAID 9361-8i 12Gb PCIe 8-Port SAS/SATA RAID 1Gb w/BBU/CacheVault/License

$39.95



LSI MegaRAID 9361-8i 12Gbps PCIe 3 x8 SATA SAS 3 8 Port RAID + BBU & CacheVault picture

LSI MegaRAID 9361-8i 12Gbps PCIe 3 x8 SATA SAS 3 8 Port RAID + BBU & CacheVault

$39.00



ORICO Multi Bay RAID Hard Drive Enclosure USB 3.0/ Type-C For 2.5/3.5'' HDD SSDs picture

ORICO Multi Bay RAID Hard Drive Enclosure USB 3.0/ Type-C For 2.5/3.5'' HDD SSDs

$82.49



ACASIS 2.5/3.5 inch 2 Bay SATA USB 3.0 Hard Drive Disk HDD SSD Enclosure 4 RAID picture

ACASIS 2.5/3.5 inch 2 Bay SATA USB 3.0 Hard Drive Disk HDD SSD Enclosure 4 RAID

$58.99



Dell PERC H330 PCIe 3.0 x8 RAID Storage Controller 04Y5H1 High Profile picture

Dell PERC H330 PCIe 3.0 x8 RAID Storage Controller 04Y5H1 High Profile

$17.99