From 155a37effb612997ffbc33845f74904186e8cb3f Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Thu, 19 May 2011 22:37:11 +0000 Subject: merge mkdosfs patch from packages SVN (to replace mkdosfs-with-dir which requires obsolete perl-suid) --- images/make_boot_img | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'images/make_boot_img') 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"); -- cgit v1.2.1