summaryrefslogtreecommitdiffstats
path: root/images/make_boot_img
diff options
context:
space:
mode:
authorOlivier Blin <blino@mageia.org>2011-05-19 22:37:11 +0000
committerOlivier Blin <blino@mageia.org>2011-05-19 22:37:11 +0000
commit155a37effb612997ffbc33845f74904186e8cb3f (patch)
tree15d0fc693423faab6b0affe5507c139f12dafa84 /images/make_boot_img
parent63795f4d7b5d0aad0c90b4a62ea3bd5ebee361a9 (diff)
downloaddrakx-155a37effb612997ffbc33845f74904186e8cb3f.tar
drakx-155a37effb612997ffbc33845f74904186e8cb3f.tar.gz
drakx-155a37effb612997ffbc33845f74904186e8cb3f.tar.bz2
drakx-155a37effb612997ffbc33845f74904186e8cb3f.tar.xz
drakx-155a37effb612997ffbc33845f74904186e8cb3f.zip
merge mkdosfs patch from packages SVN
(to replace mkdosfs-with-dir which requires obsolete perl-suid)
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 2cb2ba586..5b6fbc5f2 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) + 128, 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";
}
@@ -776,9 +780,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";
@@ -811,7 +817,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");