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:
François Revol
2013-09-30 04:38:50 +02:00
parent 68bccdf6b4
commit 58c82e4fb7
+9
View File
@@ -1506,17 +1506,26 @@ rule BuildFloppyBootImage image : haikuLoader : archive
actions BuildFloppyBootImage1
{
haiku_loader_size=`stat -c %s "$(>[1])"`
drivers_tgz_size=`stat -c %s "$(>[2])"`
if [ $? -ne 0 ] ; then
# FreeBSD's stat command don't support -c/--format option
# and use %z specifier for file size
haiku_loader_size=`stat -f %z "$(>[1])"`
drivers_tgz_size=`stat -f %z "$(>[2])"`
fi
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
echo "Error: $(>[1]) is too big ($haiku_loader_size) to fit "
echo " before the boot archive starting at $archive_image_offset!"
exit 1
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) $(<)
# make an empty image
dd if=/dev/zero of=$(<) bs=1k count=$(FLOPPY_IMAGE_SIZE)