DSL Ideas and Suggestions :: Live / Embeddedness



Excellent Job!

If you can afford the bw, it would be a nice download from your existing myDSL web site.

Maybe if the linux Qemu stuff was removed, it would fit on some 50MB business card CD-R disks.

For me, the Win32 qemu is more useful (and smaller too!) because I am more likely to encounter a Winbox that can't/won't boot livecd or is cumbersome to leave the native OS for a quick task.

If the chosen computer is already running Linux, chances are that the computer is already useful as-is and I would only need DSL as a "personal desktop" and USB drive is more useful than livecd for that purpose.

Just a thought.

The DSL 0.9.1 embedded/live combination cd is now available on my site: http://www.nolifeline.com/dsl-0.9.1-em.iso

I hunted around and found the smallest builds of qemu.exe and SDL.dll.  They've been compressed with upx --best.  I removed the linux embedded bit and merged qemu.bat into autorun.inf.  In order to save space, I also removed index.html and swapped the old logo.16 in (I'm sorry.  It was pretty, but it took space I needed.)  I also ditched lost+found, as I can't see how it could possibly be used.  I moved boot/isolinux/* to isolinux/* - a paltry 4k savings, but every byte counts at this point (If this is to be used by the DSL team in an offical capacity, I'd like to make it easy as possible to squeeze the remaster down.  68k is a hell of a lot easier than 1.7M).

Code Sample
Tree:
Directory of .
12/23/2004  09:33 AM               122 autorun.inf
12/23/2004  10:22 AM    <DIR>          isolinux
12/23/2004  09:29 AM    <DIR>          KNOPPIX
12/23/2004  09:40 AM    <DIR>          qemu
Directory of ./isolinux
12/14/2004  11:55 PM             2,048 boot.cat
07/25/2004  03:13 AM               110 boot.msg
11/30/2004  12:49 AM             1,592 f2
11/30/2004  12:52 AM               796 f3
07/25/2004  03:13 AM               256 german.kbd
12/23/2004  10:27 AM             9,404 isolinux.bin
12/08/2004  04:27 AM             1,993 isolinux.cfg
08/15/2004  01:31 AM           994,807 linux24
07/25/2004  03:50 AM             7,367 logo.16
12/23/2004  10:02 AM           790,567 minirt24.gz
Directory of ./KNOPPIX
12/14/2004  11:55 PM        50,158,212 KNOPPIX
Directory of ./qemu
07/11/2004  03:20 AM            65,536 bios.bin
11/14/2004  03:55 PM               512 linux_boot.bin
12/04/2004  05:49 PM           237,568 qemu.exe
06/14/2004  03:15 PM           100,864 SDL.dll
07/11/2004  03:20 AM            30,852 vgabios-cirrus.bin
             18 File(s)     52,402,606 bytes

Code Sample
ISO size:
12/23/2004  10:27 AM        52,498,432 dsl-0.9.1-em.iso (50.066M)

Code Sample
listing of autorun.inf:
[autorun]
open=qemu\qemu.exe -kernel boot/isolinux/linux24 -initrd boot/isolinux/minirt24.gz -hda KNOPPIX/KNOPPIX -L qemu

Code Sample
listing of pertinant lines of linuxrc
# last ditch - try to mount KNOPPIX ci file from /dev/hda
if test -n "$FOUND_KNOPPIX"
then
else
echo "${BLUE}Assuming you're running from QEMU${NORMAL}"
echo "${BLUE}Performing last-ditch effort to use ${MAGENTA}/dev/hda${BLUE}...${NORMAL}"
# try to mount /dev/hda as a cloop
echo "0" > /proc/sys/kernel/printk
# hey look, I figured out how to hide errors!
$INSMOD modules/cloop.o file=/dev/hda >/dev/null 2>&1
if mount -t iso9660 /dev/cloop /KNOPPIX >/dev/null 2>&1
then
FOUND_KNOPPIX="/dev/hda"
echo "${GREEN}Success!${NORMAL}"
else
# try one more time, this time directly trying to mount /dev/hda
# this is weird, 'cos it shouldn't work, but usually seems to.
if mount -t iso9660 /dev/hda /KNOPPIX >/dev/null 2>&1
then
FOUND_KNOPPIX="/dev/hda"
echo "${GREEN}Success!${NORMAL}"
else
echo "${RED}Failed..."
fi
fi
fi


All the files necessary to perform the embed mod are avaiable here.  All you have to do is extract it to it's own folder, put the isolinux stuff and KNOPPIX in the right place (omitting minirt24.gz, which is already there), and build the disc.

Ok, one more time.

embed-mods.tar.gz and dsl-0.9.1-em.iso have been changed.  

The iso now again contains the index.html; I didn't realize that removing it would be GPL violation (removal of the author ident... hehe.. oops).

Both the ISO and the embed-mods now include a custom-built version of qemu.  SDL is now statically linked and also built custom to include only those features required to run in a win32 environment.  SDL, zlib and qemu were rebuilt with no debug data.  All symbols have been stripped from the executable and it's been recompressed with UPX.

All that work saved 29k.  um.  woot.  I'm still about 30k over 50M, but I can honestly say, I've tried.  Without a remaster, I simply can't fit an electric sausage in the iso ^_^.

Meanwhile...
The ISO
The files required to modify an existing DSL ISO to be Live/Embedded

Ok, it took a bit of doing, but I got cbagger01's last suggestion in.
Code Sample
Changes to linuxrc:
------LINE 529, inserting 27 lines:
# last ditch - try to mount KNOPPIX ci file from /dev/hda
if test -n "$FOUND_KNOPPIX"
then
else
QEMU=""
echo
echo "${BLUE}Guess you're running from QEMU${NORMAL}"
echo "${BLUE}Performing last-ditch effort to get KNOPPIX image${NORMAL}"
# try to mount /dev/hda as a cloop
echo "0" > /proc/sys/kernel/printk
$INSMOD modules/cloop.o file=/dev/hda >/dev/null 2>&1
if mount -t iso9660 /dev/cloop /KNOPPIX >/dev/null 2>&1
then
FOUND_KNOPPIX="/dev/hda"
QEMU="TRUE"
echo "${GREEN}Success!${NORMAL}"
else
# try one more time, this time directly trying to mount /dev/hda
if mount -t iso9660 /dev/hda /KNOPPIX >/dev/null 2>&1
then
FOUND_KNOPPIX="/dev/hda"
QEMU="TRUE"
echo "${GREEN}Success!${NORMAL}"
else
echo "${RED}Failed..."
fi
fi
fi
------LINE 673, replacing 8 lines:
rm -rf /etc/ftpusers /etc/passwd /etc/shadow /etc/shadow- /etc/group \
      /etc/ppp /etc/isdn /etc/ssh /etc/ioctl.save \
      /etc/inittab /etc/network /etc/sudoers \
      /etc/init /etc/localtime /etc/dhcpc /etc/pnm2ppa.conf /etc/hosts 2>/dev/null
cp -a /KNOPPIX/etc/ftpusers /KNOPPIX/etc/passwd /KNOPPIX/etc/shadow /KNOPPIX/etc/shadow- /KNOPPIX/etc/group \
     /KNOPPIX/etc/ppp /KNOPPIX/etc/isdn /KNOPPIX/etc/ssh \
     /KNOPPIX/etc/inittab /KNOPPIX/etc/network /KNOPPIX/etc/sudoers \
     /KNOPPIX/sbin/init /KNOPPIX/etc/dhcpc /KNOPPIX/etc/hosts /etc/ 2>/dev/null
------LINE 689, inserting 10 lines
# Hey, we're in QEMU!  Let's get all cozy with the host, shall we?
if test -n "$QEMU"
then
HNAME=$(echo $CMDLINE | /usr/bin/tr ' ' '\n' | /bin/sed -n '/sysname=/s/.*=//p' | /usr/bin/tail -1)
HIP=$(echo $CMDLINE | /usr/bin/tr ' ' '\n' | /bin/sed -n '/sysip=/s/.*=//p' | /usr/bin/tail -1)
echo
echo "${BLUE}QEMU Host is ${MAGENTA}${HNAME}${BLUE} at IP ${MAGENTA}${HIP}${NORMAL}"
echo "${HIP} ${HNAME}" >> /etc/hosts
echo "${HIP} syshost" >>/etc/hosts
fi

Code Sample
Listing of rq.c
#include <winsock.h>
#include <shellapi.h>
int doit();
int doit(char* res)
{
   WSADATA wsaData;
   if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) {
       return 255;
   }
int i=0;
   char ac[80];
char ip[16];
   if (gethostname(ac, sizeof(ac)) == SOCKET_ERROR) {
       printf("Error %d when getting local host name\r\n", WSAGetLastError());
       return 1;
   }
   struct hostent *phe = gethostbyname(ac);
   if (phe == 0) {
printf("Yow! Bad host lookup!\r\n");
       return 1;
   }

   struct in_addr addr;
   memcpy(&addr, phe->h_addr_list[i], sizeof(struct in_addr));
sprintf(res, "sysname=%s sysip=%s", ac, inet_ntoa(addr));
   WSACleanup();
   return 0;
}
int main(int argc, char *argv[])
{
char hostip[95];
char* temp;
   int retval = doit(hostip);
temp=malloc(1024);
sprintf(temp, "-kernel isolinux/linux24 -initrd isolinux/minirt24.gz -hda KNOPPIX/KNOPPIX -L qemu -append \"sb=0x220,5,1,5 vga=789 %s\"", &hostip[0]);
ShellExecute(NULL, NULL, "qemu/qemu.exe", temp, NULL, SW_SHOW);
free(temp);
   return retval;
}

compile that thusly (using mingw):
Code Sample
gcc -O2 rq.c -o rq.exe -lshell32 -lwsock32
strip rq.exe
upx -9 rq.exe

It should come out to 3584 bytes.
Code Sample
listing of autorun.inf
[autorun]
open=rq.exe


Ok, now that I've posted all that, what it does:
It allows QEMU to communicate with the host PC via either it's known hostname ("punquin" in my case) or by "syshost".  You see the append line has also changed to include a definition of the emulated SB card.  I haven't tested this (I'm doing my tests from my work (WinXP) computer via rdesktop, and while textmode works fine, using a mouse is a highly wonky).  Still, seeing as the SB card isn't working at all without that line, it can't hurt to throw it in.

Wow!

I was thinking more along the line of extracting the hostname and ip adress using the batch file, but creating your own C program works too.

As for the 50.066MB ISO image, my guess is that most 50MB business card CD-R disks will work as long as your CD Burning software supports overburning.

I am going to try and use Nero to burn me a copy with my old Imation 50MB CD-Rs.

This will just be -too cool- if everything works out.

Next Page...
original here.