On Sunday 09 November 2014 01:16 AM, Petter Reinholdtsen wrote: > Hi. Here is a set of updated and tested patches for these bugs. I > pushed them to the freedombox build system today, and we are using it > to build btrfs images using the grub boot system. > > These patches fixes a few bugs I found during testing. >
I think we can leave the decision of how much space to reserve for GRUB installation to parted itself. This is what we are doing in the case where boot partition is not involved. Please see the attached patch. -- Sunil PS: I confirm the problem and the fix if that was ever needed.
From b129a6f09501c590b02ed6b054c83ae66d3e5198 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa <[email protected]> Date: Sun, 9 Nov 2014 10:18:43 +0530 Subject: [PATCH] Make grub installation work even with a boot partition The problem is that '0' is used instead of '0%' as starting point for boot partition. According to GNU Parted documetation when 'G' is given as unit, sensible ranges between +/- 500MB will be computed. When 'M' is given as unit, sensible ranges between +/- 500KB will be computed. Presumably when '%' is given as unit, sensible ranges between +/- 0.5% will be computed. On the other hand if no unit is given the default unit 'compact' is used which means 'M' for input. This does not allow parted to provide 1M of space at the beginning. Note that 0% will allow of leaving 1M of space at the beginning only when disk size is greater than 200M. This is fine since debootstrapping requires more than that. --- vmdebootstrap | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vmdebootstrap b/vmdebootstrap index 126475f..a32c8f4 100755 --- a/vmdebootstrap +++ b/vmdebootstrap @@ -242,10 +242,12 @@ class VmDebootstrap(cliapp.Application): self.message('Creating partitions') self.runcmd(['parted', '-s', self.settings['image'], 'mklabel', 'msdos']) + # Start at 0% instead of 0 to allow parted to leave 1MiB for + # GRUB if self.settings['bootsize'] and self.settings['bootsize'] is not '0%': bootsize = str(self.settings['bootsize'] / (1024 * 1024)) self.runcmd(['parted', '-s', self.settings['image'], - 'mkpart', 'primary', 'fat16', '0', bootsize]) + 'mkpart', 'primary', 'fat16', '0%', bootsize]) else: bootsize = '0%' self.runcmd(['parted', '-s', self.settings['image'], -- 2.1.1
signature.asc
Description: OpenPGP digital signature

