From: rivers@ponds.uucp (Thomas David Rivers) Subject: Re: Linux installing bootimage Date: 5 Mar 1992 11:05:03 GMT
I run the following little shell script (on another unix box, or
on a pre-installed Linux box) to change the hard disk boot.
This is basically the mechanism many people employ to alter
binary files; other than one of the many public-domain binary editors.
In this example, "oldimage" is the source image, the new, patched
image will be in the file "newimage". The script sets the boot device's
major number to 3, and its minor number to 1. (The echo line is
reversed because of the endian-ness of a 386.)
The idea behind this is to copy all of the file (1 byte at a time)
until you get to the 508th byte. Copy two bytes to /dev/null.
Echo the two replacement bytes, then copy the remainder of the
file.
e.g.:
{ dd ibs=1 obs=1 count=508
dd bs=1 count=2 of=/dev/null
echo '\001\003\c'
dd bs=16k
} < oldimage > newimage
- Dave Rivers -
- rivers@ponds.uucp -