Make sure the boot driver tgz doesn't overflow the boot floppy
At least on 68k it does. Seems to be ok on x86, for now...
This commit is contained in:
@@ -1506,17 +1506,26 @@ rule BuildFloppyBootImage image : haikuLoader : archive
|
|||||||
actions BuildFloppyBootImage1
|
actions BuildFloppyBootImage1
|
||||||
{
|
{
|
||||||
haiku_loader_size=`stat -c %s "$(>[1])"`
|
haiku_loader_size=`stat -c %s "$(>[1])"`
|
||||||
|
drivers_tgz_size=`stat -c %s "$(>[2])"`
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
# FreeBSD's stat command don't support -c/--format option
|
# FreeBSD's stat command don't support -c/--format option
|
||||||
# and use %z specifier for file size
|
# and use %z specifier for file size
|
||||||
haiku_loader_size=`stat -f %z "$(>[1])"`
|
haiku_loader_size=`stat -f %z "$(>[1])"`
|
||||||
|
drivers_tgz_size=`stat -f %z "$(>[2])"`
|
||||||
fi
|
fi
|
||||||
archive_image_offset=`echo "$(ARCHIVE_IMAGE_OFFSET) * 1024" | bc`
|
archive_image_offset=`echo "$(ARCHIVE_IMAGE_OFFSET) * 1024" | bc`
|
||||||
|
floppy_tgz_size=\
|
||||||
|
`echo "($(FLOPPY_IMAGE_SIZE) - $(ARCHIVE_IMAGE_OFFSET)) * 1024" | bc`
|
||||||
if [ $haiku_loader_size -gt $archive_image_offset ] ; then
|
if [ $haiku_loader_size -gt $archive_image_offset ] ; then
|
||||||
echo "Error: $(>[1]) is too big ($haiku_loader_size) to fit "
|
echo "Error: $(>[1]) is too big ($haiku_loader_size) to fit "
|
||||||
echo " before the boot archive starting at $archive_image_offset!"
|
echo " before the boot archive starting at $archive_image_offset!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if [ $drivers_tgz_size -gt $floppy_tgz_size ] ; then
|
||||||
|
echo "Error: $(>[2]) is too big ($drivers_tgz_size) to fit "
|
||||||
|
echo " in the boot floppy ($floppy_tgz_size)!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
$(RM) $(<)
|
$(RM) $(<)
|
||||||
# make an empty image
|
# make an empty image
|
||||||
dd if=/dev/zero of=$(<) bs=1k count=$(FLOPPY_IMAGE_SIZE)
|
dd if=/dev/zero of=$(<) bs=1k count=$(FLOPPY_IMAGE_SIZE)
|
||||||
|
|||||||
Reference in New Issue
Block a user