Forum: Other Help Topics
Topic: editing initrd image
started by: tikbalang
Posted by tikbalang on Aug. 14 2008,17:01
is it possible to edit the initrd of another mini linux using DSL? i need to temporarily disable the splashscreen and edit the rc.S files of advanceCD (http://advancemame.sourceforge.net/).
Posted by curaga on Aug. 14 2008,17:19
Depends entirely on how their initrd is done. Try it
Posted by tikbalang on Aug. 14 2008,17:31
i renamed initrd.img to a .gz file and extracted only one file "initrd" using winrar. i then used winimage to open it and it did but un-editable. i can extract the files but i don't know how to pack it back. i don't know how to go about in linux.
Posted by ^thehatsrule^ on Aug. 14 2008,18:53
It's probably a standard loopback image file.
I haven't used "winimage" - you could check their help/support.
In a Linux distro, you could do something like:Code Sample |
gunzip myfile.gz # extract the gzip'd myfile (I'm having my doubts that that file is gzip'd though...) mkdir mount # create an empty temp dir for mounting mount -o loop,rw myfile mount # mount it pushd mount # edit files as necessary popd umount mount # unmount it gzip -9 myfile # gzip it back up |
It could be a better idea to ask on their site, though.
Posted by tikbalang on Aug. 15 2008,01:43
advancemame site is almost dead. the author is not responding and the few users there use mostly windows. why do you say it's not gzipped? i just used gunzip for dos and it works if i rename it to a .gz.
i'll try it when i get back home.
as a sidenote, here is what i'm trying to do with advanceCD:
1. temporarily disable bootsplash image so i can see what's going on during bootup.
2. fix the unavailability of 2nd, 3rd, etc... terminals.
3. fix the gamescripts so user settings can be used to/from hd.
Posted by ^thehatsrule^ on Aug. 15 2008,01:59
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
Posted by tikbalang on Aug. 15 2008,11:42
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?
Posted by curaga on Aug. 15 2008,13:42
swapon -a
Posted by tikbalang on Aug. 15 2008,14:40
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
|
Posted by curaga on Aug. 15 2008,15:34
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.
Posted by ^thehatsrule^ on Aug. 15 2008,18:32
Quote |
can't i just copy over the software from advanceCD to DSL, including file modes/attributes/permissions/ownership? what would be the problems? |
Depends on what parts you want to copy over. If it's just mame+frontend, it may be a better idea to get updated versions via the official upstream sites instead.
Posted by tikbalang on Aug. 16 2008,01:11
yes, mainly advmenu, advmame and whatever files missing in DSL that is needed by advmame. i already have the last and final build available.