Other Help Topics :: editing initrd image



I had my doubts because gzip'd files usually have the .gz ending, and .img files are usually used for RAW floppy/disk images, afaik.
If they just had some odd naming conventions it doesn't matter :P

your procedure worked perfect. i fixed the problems with the terminal. thanks.

what file and command is responsible for automounting the swap partition, if it exists?

can't i just copy over the software from advanceCD to DSL, including file modes/attributes/permissions/ownership? what would be the problems?

swapon -a
when should the swapfile be initialized? where would be the optimal point to insert the swapon command?here is my rc.S:

Code Sample

#!/bin/sh

# WARNING! This file must have the executable bit set

# Disable cursor
/bin/cat /etc/civis

# Output console
CONSOLE=/dev/null

# Mount proc
/bin/echo "Mounting proc..." > $CONSOLE 2>&1
/bin/mount -t proc none /proc >/dev/null 2>/dev/null

# Mount usbdevfs
/bin/echo "Mounting usbdevfs..." > $CONSOLE 2>&1
/bin/mount -t usbdevfs none /proc/bus/usb >/dev/null 2>/dev/null

# Run syslog
/bin/echo "Running syslogd..." > $CONSOLE 2>&1
/sbin/syslogd -C >/dev/null 2>/dev/null &

# Run klogd
/bin/echo "Running klogd..." > $CONSOLE 2>&1
/sbin/klogd >/dev/null 2>/dev/null &

# Get the disk type from the kernel command line
if grep advancecd /proc/cmdline > /dev/null; then
# 0 for CDROM
DISK=0
else
if grep advanceusb /proc/cmdline > /dev/null; then
# 1 for USB
DISK=1
else
# 2 for HD
DISK=2
fi
fi

# Mount the filesystem
MNT=/disk
ID=boot/app.img
FOUND=0

# Search the CDROM
if [ $DISK -eq 0 ]; then
/bin/echo "Searching for CDROM..." > $CONSOLE 2>&1
DEVICE="hdb hdd hdc hda hde hdf hdg hdh scd0 scd1 scd2 scd3"
# Scan the devices
for DEV in $DEVICE; do
if [ -e /dev/$DEV ]; then
/bin/echo "Checking $DEV..." > $CONSOLE 2>&1
# You must specify the FS type if the /proc filesystem is not available
if /bin/mount -r -t udf /dev/$DEV $MNT >/dev/null 2>/dev/null; then
if [ -e $MNT/$ID ]; then
FOUND=1
break
else
umount $MNT
fi
fi
# You must specify the FS type if the /proc filesystem is not available
if /bin/mount -r -t iso9660 /dev/$DEV $MNT >/dev/null 2>/dev/null; then
if [ -e $MNT/$ID ]; then
FOUND=1
break
else
umount $MNT
fi
fi
fi
done
fi
# Search the USB Disk
if [ $DISK -eq 1 ]; then
/bin/echo "Searching for USB Disk..." > $CONSOLE 2>&1
DEVICE="sda1 sda sdb1 sdb sdc1 sdc sdd1 sdd"
# Wait some time to allow the recognition of the USB device
/bin/echo "Wait..." > $CONSOLE 2>&1
/bin/sleep 1
if [ ! -e /proc/scsi/usb-storage-0 ]; then
/bin/echo "Wait a bit more..." > $CONSOLE 2>&1
/bin/sleep 1
fi
if [ ! -e /proc/scsi/usb-storage-0 ]; then
/bin/echo "Wait a bit more..." > $CONSOLE 2>&1
/bin/sleep 1
fi
if [ ! -e /proc/scsi/usb-storage-0 ]; then
/bin/echo "Wait a bit more..." > $CONSOLE 2>&1
/bin/sleep 1
fi
if [ ! -e /proc/scsi/usb-storage-0 ]; then
/bin/echo "Wait a bit more..." > $CONSOLE 2>&1
/bin/sleep 1
fi
# Extra wait
/bin/sleep 1
# Scan the devices
for DEV in $DEVICE; do
if [ -e /dev/$DEV ]; then
/bin/echo "Checking $DEV..." > $CONSOLE 2>&1
# You must specify the FS type if the /proc filesystem is not available
if /bin/mount -t vfat -o sync /dev/$DEV $MNT >/dev/null 2>/dev/null; then
if [ -e $MNT/$ID ]; then
FOUND=1
break
else
umount $MNT
fi
fi
fi
done
fi
if [ $DISK -eq 2 ]; then
/bin/echo "Searching for Hard Disk..." > $CONSOLE 2>&1
DEVICE="hda1 hda2 hda3 hda4 hda5 hda6 hda7 hda8 hda9 hda10 hdb1 hdb2 hdb3 hdb4 hdb5 hdb6 hdb7 hdb8 hdb9 hdb10 hdc1 hdc2 hdc3 hdc4 hdc5 hdc6 hdc7 hdc8 hdc9 hdc10 hdd1 hdd2 hdd3 hdd4 hdd5 hdd6 hdd7 hdd8 hdd9 hdd10"
# Scan the devices
for DEV in $DEVICE; do
if [ -e /dev/$DEV ]; then
/bin/echo "Checking $DEV..." > $CONSOLE 2>&1
# You must specify the FS type if the /proc filesystem is not available
if /bin/mount -t vfat -o sync /dev/$DEV $MNT >/dev/null 2>/dev/null; then
if [ -e $MNT/$ID ]; then
FOUND=1
break
else
umount $MNT
fi
fi
fi
done
fi
if [ $FOUND -ne 1 ]; then
/bin/echo "Disk not found, aborting..."
exit 1
fi

# Create a simbolic link at the device
/bin/ln -s /dev/$DEV /dev/disk

# Mount the image
/bin/echo "Mounting the application disk..." > $CONSOLE 2>&1
/bin/mount -r -t iso9660 $MNT/boot/app.img /app -o loop >/dev/null 2>/dev/null

# Customize
CUSTOM=0
if [ -e /arcade/advmame.rc ]; then
/bin/echo "Customizing AdvanceMAME..." > $CONSOLE 2>&1
/bin/cp /arcade/advmame.rc /etc
CUSTOM=1
fi
if [ -e /arcade/advmess.rc ]; then
/bin/echo "Customizing AdvanceMESS..." > $CONSOLE 2>&1
/bin/cp /arcade/advmess.rc /etc
CUSTOM=1
fi
if [ -e /arcade/advmenu.rc ]; then
/bin/echo "Customizing AdvanceMENU..." > $CONSOLE 2>&1
/bin/cp /arcade/advmenu.rc /etc
CUSTOM=1
fi
if [ -e /arcade/advcd.rc ]; then
/bin/echo "Customizing AdvanceCD..." > $CONSOLE 2>&1
/bin/cp /arcade/advcd.rc /etc
CUSTOM=1
fi

KERNEL=`/bin/uname -r`

/bin/echo "Detecting PCI hardware..." > $CONSOLE 2>&1
for module in $(/usr/sbin/pcimodules --mapfile /lib/modules/$KERNEL/modules.pcimap); do
/bin/echo "Loading $module..." > $CONSOLE 2>&1
/sbin/modprobe -q "$module" >/dev/null 2>/dev/null
done

/bin/echo "Detecting USB hardware..." > $CONSOLE 2>&1
for device in /proc/bus/usb/*/*; do
if [ -e $device ]; then
for module in $(/usr/sbin/usbmodules --device $device); do
/bin/echo "Loading $module..." > $CONSOLE 2>&1
modprobe -q "$module" >/dev/null 2>/dev/null
done
fi
done

/bin/echo "Detecting PnP hardware..." > $CONSOLE 2>&1
for module in $(/usr/sbin/isapnpmodules); do
/bin/echo "Loading $module..." > $CONSOLE 2>&1
modprobe -q "$module" >/dev/null 2>/dev/null
done

#/bin/echo "Detecting not PnP hardware..." > $CONSOLE 2>&1
#OLDHW="ns558 analog"
#for module in $OLDHW; do
# /bin/echo "Loading $module..." > $CONSOLE 2>&1
# modprobe -q "$module" >/dev/null 2>/dev/null
#done

# Set the volume
/usr/bin/amixer sset Master 75% unmute >/dev/null 2>/dev/null
/usr/bin/amixer sset "Master Mono" 100% unmute >/dev/null 2>/dev/null
/usr/bin/amixer sset PCM 100% unmute >/dev/null 2>/dev/null
/usr/bin/amixer sset Headphone 100% unmute >/dev/null 2>/dev/null

if /bin/grep run /etc/advcd.rc > /dev/null; then
# Create the game startup script
/bin/grep run /etc/advcd.rc | /bin/awk '{ print gensub("^run *","","") }' > /tmp/advlogin.sh
/bin/chmod a+x /tmp/advlogin.sh
else
# Create the menu startup script
/bin/echo /app/root/advmenu > /tmp/advlogin.sh
/bin/chmod a+x /tmp/advlogin.sh
fi

# Run external script
if [ -e /arcade/advcd.sh ]; then
/bin/echo "Customizing AdvanceCD..." > $CONSOLE 2>&1
/bin/sh /arcade/advcd.sh > $CONSOLE 2>&1
CUSTOM=1
fi

/bin/echo "Loading..." > $CONSOLE 2>&1


Seems there isn't automatic detection for swap partitions.
So, if you only plan on using that on one computer and know the swap partition, put
swapon /dev/hdXY

right after mounting proc. On the other hand, if autodetection is needed, it might be best to ask the developer.

Next Page...
original here.