#!/bin/sh FAMILIAR=familiar-0.3-mh1 KERNELVER=2.4.2-rmk1-np3-20010324 LIBMODULES=libmodules-2.4.2-rmk1-np3-20010324 #Changelog # 0.3-pre3-dw1 # First familiar-0.3-pre3 build # # 0.3-pre3-dw2 # New libmodules tarball, with modules.dep and correct permissions # sjohnson's xcalibrate with save/restore settings # # 0.3-pre3-dw3 # /dev/ppp and modules.conf additions for PPP # sjohnson's xcalibrate startup script # # 0.3-pre3-dw4 # One-liner just to wind curious up and encourage him to use build.sh # instead of downloading the prebuilt images # remove backupToFlash - we really don't want people trying to use it. # # 0.3-dw1 # Update to the real familiar-0.3 release # Add --no-backup-if-mismatch to the patch args # # 0.3-dw2 # Add reboot, suspend and IrDA enable/disable to blackbox menu # Add fixed wvlan_cs module - new libmodules 20010312 # Fix sa1100-rtc name # Ensure we remove 'build' and 'modules.dep' from the lib/modules dir # after installing them. # insmod ramfs.o and unix.o in /linuxrc # fix scale script to load module # Add CPU speed to blackbox menus # # 0.3-mh1 2001/03/16 # Add more mount points in /etc/fstab # Add fix for ssh start script to generate keyfiles if they do not yet exist # Set hostname to ipaq # Add new files /etc/pointercal, /root/.profile, /root/.ssh/authorized_keys # Add links for Qt/embedded, QPE and KONQ echo "Building JFFS2 image for $FAMILIAR" if [ ! -x $MKJFFS2 ]; then echo "mkfs.jffs2 not found at $MKJFFS2. Exiting" exit 1 fi if [ -e $FAMILIAR ]; then echo "File or directory \"$FAMILIAR\" already exists. Exiting" exit 1 fi if [ ! -x mkfs.jffs2 ]; then echo "mkfs.jffs2 not found. Downloading from ftp.uk.linux.org" wget ftp://ftp.uk.linux.org/pub/people/dwmw2/iPAQ/mkfs.jffs2 if [ ! -e mkfs.jffs2 ]; then echo "Download failed. Exiting" exit 1 fi chmod +x mkfs.jffs2 fi echo "Checking presence of tarballs" if [ ! -e $LIBMODULES.tar.gz ]; then # echo "Downloading $LIBMODULES.tar.gz from ftp.uk.linux.org" # wget ftp://ftp.uk.linux.org/pub/people/dwmw2/iPAQ/bits/$LIBMODULES.tar.gz echo "Downloading $LIBMODULES.tar.gz from www.chez-thomas.org" wget http://www.chez-thomas.org/gary/iPAQ/build/$LIBMODULES.tar.gz if [ ! -e $LIBMODULES.tar.gz ]; then echo "Download failed. Exiting" exit 1 fi fi if [ ! -e pppd ]; then echo "Downloading pppd binary from ftp.uk.linux.org" wget ftp://ftp.uk.linux.org/pub/people/dwmw2/iPAQ/bits/pppd if [ ! -e pppd ]; then echo "Download failed. Exiting" exit 1 fi fi if [ ! -e apm ]; then echo "Downloading apm binary from ftp.handhelds.org" wget ftp://ftp.handhelds.org/pub/linux/compaq/ipaq/v0.21/apm if [ ! -e apm ]; then echo "Download failed. Exiting" exit 1 fi fi if [ ! -e xcalibrate ]; then echo "Downloading xcalibrate binary from ftp.uk.linux.org" wget ftp://ftp.uk.linux.org/pub/people/dwmw2/iPAQ/bits/xcalibrate if [ ! -e xcalibrate ]; then echo "Download failed. Exiting" exit 1 fi fi if [ ! -e init-v0.3-src.tar.gz ]; then echo "Downloading init-v0.3-src.tar.gz from ftp.handhelds.org" wget ftp://ftp.handhelds.org/pub/linux/dists/familiar/v0.3/init-v0.3-src.tar.gz if [ ! -e init-v0.3-src.tar.gz ]; then echo "Download failed. Exiting" exit 1 fi fi if [ ! -e root-v0.3-src.tar.gz ]; then echo "Downloading root-v0.3-src.tar.gz from ftp.handhelds.org" wget ftp://ftp.handhelds.org/pub/linux/dists/familiar/v0.3/root-v0.3-src.tar.gz if [ ! -e root-v0.3-src.tar.gz ]; then echo "Download failed. Exiting" exit 1 fi fi if [ ! -e usr-v0.3-src.tar.gz ]; then echo "Downloading usr-v0.3-src.tar.gz from ftp.handhelds.org" wget ftp://ftp.handhelds.org/pub/linux/dists/familiar/v0.3/usr-v0.3-src.tar.gz if [ ! -e usr-v0.3-src.tar.gz ]; then echo "Download failed. Exiting" exit 1 fi fi echo "Verifying tarballs" if !( md5sum -c </dev/null; then echo Removal failed. Exiting. exit 1 fi fi if [ -e root-v0.3-src ]; then echo "Removing old root-v0.3-src" if ! rm -rf root-v0.3-src &>/dev/null; then echo Removal failed. Exiting. exit 1 fi fi if [ -e usr-v0.3-src ]; then echo "Removing old usr-v0.3-src" if ! rm -rf usr-v0.3-src &>/dev/null; then echo Removal failed. Exiting. exit 1 fi fi echo "Extracting init-v0.3-src.tar.gz" if ! tar xfz init-v0.3-src.tar.gz ; then echo Extraction failed. Exiting exit 1 fi echo "Extracting root-v0.3-src.tar.gz" if ! tar xfz root-v0.3-src.tar.gz ; then echo Extraction failed. Exiting exit 1 fi echo "Extracting usr-v0.3-src.tar.gz" if ! tar xfz usr-v0.3-src.tar.gz ; then echo Extraction failed. Exiting exit 1 fi mv root-v0.3-src $FAMILIAR echo "Moving /usr directory into place" rmdir $FAMILIAR/usr mv usr-v0.3-src $FAMILIAR/usr echo "Copying extra devices into place" cp -a init-v0.3-src/dev/{mtd?,mtdr?,ircomm0,tty?} $FAMILIAR/dev echo "Moving /root directory into place" rm $FAMILIAR/root mv init-v0.3-src/mnt/ramfs/root $FAMILIAR/root echo "Moving /home directory into place" rm $FAMILIAR/home mv init-v0.3-src/mnt/ramfs/home $FAMILIAR/home echo "Moving /etc directory into place" rm $FAMILIAR/etc mv init-v0.3-src/mnt/ramfs/etc $FAMILIAR/etc echo "Fixing modules.conf for PPP" cat >> $FAMILIAR/etc/modules.conf < tmp-pcmcia-config mv tmp-pcmcia-config $FAMILIAR/etc/pcmcia/config echo "Fixing /etc/modules for sa1100-rtc" cat $FAMILIAR/etc/modules | sed s/sa1100_rtc/sa1100-rtc/ > tmp-etc-modules mv tmp-etc-modules $FAMILIAR/etc/modules echo "Making symlink for /etc/network/ifstate into ramfs" ln -sf ../../mnt/ramfs/etc/network/ifstate $FAMILIAR/etc/network/ifstate mkdir -p init-v0.3-src/mnt/ramfs/etc/network touch init-v0.3-src/mnt/ramfs/etc/network/ifstate echo "Removing /mnt/ramfs/lib" rm -rf init-v0.3-src/mnt/ramfs/lib echo "Removing /mnt/ramfs/var/db" rm -rf init-v0.3-src/mnt/ramfs/var/db echo "Making tarball of /mnt/ramfs for extraction at boot" tar cfz $FAMILIAR/.ramfs.tar.gz -C init-v0.3-src/mnt/ramfs . echo "Installing new modules" rm -rf $FAMILIAR/lib/modules tar xfz $LIBMODULES.tar.gz -C $FAMILIAR chown root.root -R $FAMILIAR/lib/modules rm -f $FAMILIAR/lib/modules/modules.dep rm -f $FAMILIAR/lib/modules/build echo "Updating pppd" cp pppd $FAMILIAR/usr/sbin chown root.root $FAMILIAR/usr/sbin/pppd chmod 4755 $FAMILIAR/usr/sbin/pppd echo "Installing apm" cp apm $FAMILIAR/usr/bin chown root.root $FAMILIAR/usr/bin/apm chmod 0755 $FAMILIAR/usr/bin/apm echo "Installing xcalibrate" cp xcalibrate $FAMILIAR/usr/X11R6/bin chown root.root $FAMILIAR/usr/X11R6/bin/xcalibrate chmod 0755 $FAMILIAR/usr/X11R6/bin/xcalibrate echo "Patching /etc/init.d/x to restore touch screen settings" patch -p0 --no-backup-if-mismatch < /proc/sys/net/irda/discovery} + [exec] (Disable) {ifconfig irda0 down ; echo 0 > /proc/sys/net/irda/discovery} + [end] + [submenu] (Suspend iPAQ) + [exec] (Sure?) {/usr/bin/apm -s} + [exec] (No) {/bin/false} + [end] + [submenu] (Reboot iPAQ) + [exec] (Sure?) {/sbin/reboot} + [exec] (No) {/bin/false} + [end] [nop] [exec] (Xrefresh) {xrefresh} [end] @@ -54,8 +62,27 @@ [end] [nop] [exec] (System Settings) {sysset} - [exec] (Calibrate Touch Screen) {xcalibrate} - [exec] (Backup To Flash) {rxvt -title "Backup to Flash" -e /root/backupToFlash} + [submenu] (Touch Screen) + [exec] (Calibrate) {xcalibrate} + [exec] (Save Settings) {xcalibrate -view >/etc/xcalibrate.conf} + [exec] (Restore Settings) {xcalibrate -cal \`cat /etc/xcalibrate.conf\`} + [exec] (Delete Settings) {rm /etc/xcalibrate.conf} + [end] + [submenu] (CPU Speed) + [exec] (59 Mhz) {echo 0 > /proc/scale} + [exec] (74 Mhz) {echo 1 > /proc/scale} + [exec] (89 Mhz) {echo 2 > /proc/scale} + [exec] (103 Mhz) {echo 3 > /proc/scale} + [exec] (118 Mhz) {echo 4 > /proc/scale} + [exec] (133 Mhz) {echo 5 > /proc/scale} + [exec] (148 Mhz) {echo 6 > /proc/scale} + [exec] (162 Mhz) {echo 7 > /proc/scale} + [exec] (177 Mhz) {echo 8 > /proc/scale} + [exec] (192 Mhz) {echo 9 > /proc/scale} + [exec] (206 Mhz) {echo 10 > /proc/scale} + [exec] (OVERCLOCK to 221 Mhz) {echo 11 > /proc/scale} + [exec] (OVERCLOCK to 235 Mhz) {echo 12 > /proc/scale} + [end] [end] [workspaces] (Workspaces) [nop] EOF echo "Removing backupToFlash" rm -f $FAMILIAR/root/backupToFlash echo "Changing fstab" cat > $FAMILIAR/etc/fstab < /dev/mtdblock/3 / jffs2 defaults 0 0 ramfs /mnt/ramfs ramfs defaults 0 0 proc /proc proc defaults 0 0 devpts /dev/pts devpts mode=0622 0 0 /dev/hda1 /usr/local vfat noauto,owner,user,exec,umask=000 0 0 merkur:/ /mnt/merkur nfs noauto,nolock,bg,intr,soft,rw,user,exec,suid,rsize=8192,wsize=8192 0 0 merkur:/home /mnt/merkur/home nfs noauto,nolock,bg,intr,soft,rw,user,exec,suid,rsize=8192,wsize=8192 0 0 merkur:/opt /mnt/merkur/opt nfs noauto,nolock,bg,intr,soft,rw,user,exec,suid,rsize=8192,wsize=8192 0 0 saturn:/ /mnt/saturn nfs noauto,nolock,bg,intr,soft,rw,user,exec,suid,rsize=8192,wsize=8192 0 0 saturn:/home /mnt/saturn/home nfs noauto,nolock,bg,intr,soft,rw,user,exec,suid,rsize=8192,wsize=8192 0 0 saturn:/opt /mnt/saturn/opt nfs noauto,nolock,bg,intr,soft,rw,user,exec,suid,rsize=8192,wsize=8192 0 0 EOF echo "Patching linuxrc" patch -p0 --no-backup-if-mismatch < /dev/null 2>&1 +echo "Loading Unix socket support" +/sbin/insmod unix + +echo "Setting up RAMFS, please wait... " +/sbin/insmod ramfs +mount /mnt/ramfs +tar xfpz .ramfs.tar.gz -C /mnt/ramfs > /dev/null 2>&1 if [ ! -s /etc/inittab ] then @@ -23,17 +24,6 @@ cd /tmp exec /bin/sh fi - - -# Now we have to do a little housekeeping -rm -f /etc/mtab - -# re-create the /etc/mtab entries -echo "Recreating /etc/mtab..." -mount -f -t cramfs -o ro /dev/mtdblock/4 / -mount -f -t ramfs ramfs /mnt/ramfs -mount -f -t ramfs ramfs /dev -mount -f -t proc none /proc echo "Setting Date/Time from previous settings" /bin/date -s "\`/bin/cat /etc/lastdate\`" EOF echo "Fixing /etc/init.d/scale.sh to load cpu-scale module" patch -p0 --no-backup-if-mismatch < /proc/scale EOF echo "Fixing /etc/init.d/modutils not to recreate modules.dep on _every_ boot" patch -p0 --no-backup-if-mismatch < /dev/null -echo "done." +if [ -r /lib/modules/`uname -r`/modules.dep ]; then + echo "Not recalculating module dependencies" +else + echo -n "Calculating module dependencies... " + depmod -a > /dev/null + echo "done." +fi # Loop over every line in /etc/modules. echo -n 'Loading modules: ' EOF echo "Fixing /etc/init.d/ssh to create keyfiles if they are missing" patch -p0 --no-backup-if-mismatch < $FAMILIAR/etc/hostname echo "Creating file /etc/pointercal" cat > $FAMILIAR/etc/pointercal << EOF -23214 0 22672968 0 -16475 16612355 65536 EOF chmod 644 $FAMILIAR/etc/pointercal echo "Creating file /root/.profile" cat > $FAMILIAR/root/.profile << EOF stty erase '^h' EOF chmod 644 $FAMILIAR/root/.profile echo "Creating file /root/.ssh/authorized_keys" mkdir -p $FAMILIAR/root/.ssh cat > $FAMILIAR/root/.ssh/authorized_keys << EOF 1024 35 143985527095068390282660586917395100065862359820729871547697175205456829978397884886346966743792393902168387418456490325948123669771415321224782605521035100572702226254092410103902530172362293459473841250900005727781875536889088269930205293965240646193286980242973872611815751707702003109897471936252708124479 manfred@merkur 1024 35 121848419853302915486438393367201365626028451944728842756208062703210139677993243433227155682893684020235452683382335165729003810914358474630024230739564102460781647675132561983750967341646086246046806989215557228171284261251258237185697119334981894199752688087880759484037190717550988815789104020928680174073 manfred@saturn EOF chmod 600 $FAMILIAR/root/.ssh/authorized_keys chmod 700 $FAMILIAR/root/.ssh echo "Removing some unused files" xargs -t rm -f < $FAMILIAR.jffs2.md5sum