summaryrefslogtreecommitdiffstats
path: root/images/make_boot_img
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2011-04-13 09:50:18 +0000
committerAntoine Ginies <aginies@mandriva.com>2011-04-13 09:50:18 +0000
commite765ca17fcc1e3cc7d201f82e6cf71b3107bdb64 (patch)
treef377cf82b477f8d69b894cbe048506bd53e755e2 /images/make_boot_img
parent420834d91de7a138573e296844fb13a1dc66567d (diff)
downloaddrakx-backup-do-not-use-e765ca17fcc1e3cc7d201f82e6cf71b3107bdb64.tar
drakx-backup-do-not-use-e765ca17fcc1e3cc7d201f82e6cf71b3107bdb64.tar.gz
drakx-backup-do-not-use-e765ca17fcc1e3cc7d201f82e6cf71b3107bdb64.tar.bz2
drakx-backup-do-not-use-e765ca17fcc1e3cc7d201f82e6cf71b3107bdb64.tar.xz
drakx-backup-do-not-use-e765ca17fcc1e3cc7d201f82e6cf71b3107bdb64.zip
restore previous commit (due to SVN issue)
Diffstat (limited to 'images/make_boot_img')
-rwxr-xr-ximages/make_boot_img17
1 files changed, 12 insertions, 5 deletions
diff --git a/images/make_boot_img b/images/make_boot_img
index 87c333a1f..deceb07a8 100755
--- a/images/make_boot_img
+++ b/images/make_boot_img
@@ -3,6 +3,8 @@
use Config;
use FileHandle;
use MDK::Common;
+use POSIX;
+
Config->import;
my ($arch) = $Config{archname} =~ /(.*?)-/;
@@ -281,10 +283,12 @@ sub boot_img_i386 {
_ "cp -f $rdz $tmp_mnt/$short_type.rdz";
unlink $rdz;
- my $size = max(chomp_(`du -s -k $tmp_mnt`) + 50, 1440);
+ # mtools wants the image to be a power of 32
+ my $size = max((ceil(chomp_(`du -s -k $tmp_mnt`) / 32) * 32) + 64, 1440);
_ "dd if=/dev/zero of=$img bs=1k count=$size";
- _ "mkdosfs-with-dir $tmp_mnt $img";
+ _ "/sbin/mkdosfs $img";
+ _ "mcopy -i $img $tmp_mnt/* ::";
_ "syslinux $img";
_ "rm -rf $tmp_mnt";
}
@@ -775,9 +779,11 @@ sub hd_grub {
my ($grub_dir) = glob("/lib/grub/*-*");
my @grub_files = map { "$grub_dir/$_" } qw(stage1 stage2);
- my $size = 40_000 + sum(map { -s $_ } @grub_files);
- _ "dd if=/dev/zero of=$img bs=1 count=$size";
+ # mtools wants the image to be a power of 32
+ my $size = ceil((40_000 + sum(map { -s $_ } @grub_files)) / 32 / 1024) * 32;
+
+ _ "dd if=/dev/zero of=$img bs=1k count=$size";
_ "rm -rf $tmp_mnt"; mkdir $tmp_mnt;
_ "cp @grub_files $tmp_mnt";
@@ -810,7 +816,8 @@ pause .
pause HELP END
EOF
- _ "mkdosfs-with-dir $tmp_mnt $img";
+ _ "/sbin/mkdosfs $img";
+ _ "mcopy -i $img $tmp_mnt/* ::";
_ "rm -rf $tmp_mnt";
output($mapfile, "(fd0) $img\n");