Re: patch-floppy-image.pl
Hi,
> I´m searching for that perl script patch-floppy-image.pl which the
> installation manual of debian linuxppc mentions but I can´t find it anymore
> at the cvs.debian site. Does anyone have this script yet?? If yes, please,
> can you send it to me?
Not long ago I was also looking for it, it is attached. I found via
www.archive.org. There I searched for the URL where patch-floppy-image.pl was
located once and found it!
> Thanks!!!
> Clovis
you're welcome,
Holger
#!/usr/bin/perl -w
# patches powerpc hfs-boot-floppy.img with desired boot arguments
# for example, to create a boot floppy for a /dev/hda8 root:
# ./patch-floppy-image.pl 'root=/dev/hda8' boot-floppy-hfs.img > boot-hfs-hda8.img
# another example, add video=ofonly to the archive floppy image
# ./patch-floppy-image.pl 'root=0200 load_ramdisk=1 prompt_ramdisk=1 video=ofonly' boot-floppy-hfs.img > boot-video-ofonly.img
# We have 98 characters to work with in the floppy's System CMDL resource
# (Always maintain the right number of bytes in the floppy image)
my $absolute_max_length = 98;
# $current must be the same as what is currently inside
# boot-floppies/powerpc-specials/miBoot/System.bin.
my $current = "root=0200 load_ramdisk=1 prompt_ramdisk=1 adb_buttons=103,111 video=ofonly ";
# I think it's a good idea to maintain "adb_buttons=103,111 "
# $maintain can be changed as needed; your boot arguments will be appended to it.
my $maintain = "adb_buttons=103,111 ";
my $pad_len = $absolute_max_length - length( $maintain );
my $new_arguments = shift;
if ( length( $new_arguments ) > $pad_len ) {
die "arguments longer than $pad_len characters; aborting"
}
$new_arguments = pack( "A$pad_len" , $new_arguments );
my $subst = $maintain . $new_arguments;
while (<>) { s|$current|$subst|; print }
Reply to: