Upgrade a USB thumb drive image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've CC'ed the devel list as they might have already written a script
to do this...

I'm trying to create a USB install image like diskboot.img from and
for FC4.  The thing is, I have to replace the default kernel with a
new tree to accommodate a new RAID card and Ethernet card which isn't
supported by the standard default kernel.  I've got my upgrade drivers
in - no problems there; the kernel boots and finds the newer cards w/o
problem.  The problem seems to be with updating the diskboot.img...
I'm using a FC4-updated kernel image (2.6.12-1.1447_FC4smp).

I've created the script below to help, but I can't figure-out why the
new kernel or the installer can't find my Ethernet card...  Any tips
or suggestions on how to debug this would be great.

BTW> I'm planning to write this into a how-to once I finish for
everyone to follow as it's quite an involved process.


cp /media/cdrecorder/images/diskboot.img ~/
mkdir ~/bootwork
cd ~/bootwork
mkdir -p initrd-old initrd-new/modules diskboot-old floppy 2.6.12-1.1447_FC4smp
dd if=/dev/zero of=initrd bs=512 count=128000
/sbin/mke2fs -F -m0 initrd
dd if=/dev/zero of=floppy.img bs=512 count=128000
/sbin/mkfs.vfat floppy.img
syslinux floppy.img
mount -o loop ~/diskboot.img diskboot-old
mount -o loop floppy.img floppy
cp diskboot-old/*.msg diskboot-old/syslinux.cfg diskboot-old/splash.lss floppy/
cp /boot/vmlinuz-2.6.12-1.1447_FC4smp floppy/vmlinuz
gunzip -dc diskboot-old/initrd.img > initrd.old
cd initrd-old
cpio -i -d -m < ../initrd.old
cd -
find /lib/modules/2.6.12-1.1447_FC4smp/ -name *.ko | xargs -n 1 -I {}
cp {} 2.6.12-1.1447_FC4smp
cp -a initrd-old/bin initrd-new
cp -a initrd-old/dev initrd-new
cp -a initrd-old/etc initrd-new
cp -a initrd-old/proc initrd-new
cp -a initrd-old/sbin initrd-new
cp -a initrd-old/selinux initrd-new
cp -a initrd-old/sys initrd-new
cp -a initrd-old/tmp initrd-new
cp -a initrd-old/var initrd-new
cp -a initrd-old/modules/module-info initrd-new/modules
cp -a /lib/modules/2.6.12-1.1447_FC4smp/modules.dep initrd-new/modules
cp -a /lib/modules/2.6.12-1.1447_FC4smp/modules.pcimap initrd-new/modules

TMPFILE="pcitable.$$"
OUTFILE="pcitable"
INFILE="/lib/modules/2.6.12-1.1447_FC4smp/modules.pcimap"

# Loop through the PCI map
cat "$INFILE" | while read line; do

  MODULE=`echo "$line" | awk '{ print $1 }'`

  # Skip the comments
  if [ "$MODULE" != "#" ]; then
    VENDOR="0x"`echo "$line" | awk '{ print $2 }' | cut -c 7-`
    DEVICE="0x"`echo "$line" | awk '{ print $3 }' | cut -c 7-`
    SUBVENDOR="0x"`echo "$line" | awk '{ print $4 }' | cut -c 7-`
    SUBDEVICE="0x"`echo "$line" | awk '{ print $5 }' | cut -c 7-`
    DESCRIPTION=`modinfo "$MODULE" | grep "^description:" | cut -c 17-`

    if [ "$VENDOR" != "0xffff" ] && [ "$DEVICE" != "0xffff" ]; then
      if [ "$SUBVENDOR" == "0xffff" ] && [ "$SUBDEVICE" == "0xffff" ]; then
        # Print two IDs
        echo -ne "$VENDOR\t$DEVICE\t\"$MODULE\"" >> "$TMPFILE"
        if [ "$DESCRIPTION" != "" ]; then echo -e "\t\"$DESCRIPTION\""
>> "$TMPFILE"
        else echo >> "$TMPFILE"
        fi
      elif [ "$SUBDEVICE" == "0xffff" ]; then
        # Print three IDs
        echo -ne "$VENDOR\t$DEVICE\t$SUBVENDOR\t\"$MODULE\"" >> "$TMPFILE"
        if [ "$DESCRIPTION" != "" ]; then echo -e "\t\"$DESCRIPTION\""
>> "$TMPFILE"
        else echo >> "$TMPFILE"
        fi
      else
        # Print all four IDs
        echo -ne
"$VENDOR\t$DEVICE\t$SUBVENDOR\t$SUBDEVICE\t\"$MODULE\"" >> "$TMPFILE"
        if [ "$DESCRIPTION" != "" ]; then echo -e "\t\"$DESCRIPTION\""
>> "$TMPFILE"
        else echo >> "$TMPFILE"
        fi
      fi
    fi
  fi
done

sort "$TMPFILE" -o "$TMPFILE".sorted
uniq "$TMPFILE".sorted "$OUTFILE"
rm -f "$TMPFILE" "$TMPFILE".sorted
cp -a pcitable initrd-new/modules


find 2.6.12-1.1447_FC4smp | cpio -o -H crc | gzip -c9 > modules.cgz
cp -a modules.cgz initrd-new/modules
cd initrd-old
find . | cpio -o -H newc -O ../initrd
cd -
gzip -c9 initrd > initrd.img
cp initrd.img floppy
sync
umount floppy
umount diskboot-old
dd if=floppy.img of=/dev/sdb
cd


Thanks,
- G.

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux