[Vmdebootstrap-devel] Bug#858231: vmdebootstrap: bootoffset is not respected when bootsize is not set

Sunil Mohan Adapa sunil at medhas.org
Mon Mar 20 06:12:05 UTC 2017


Package: vmdebootstrap
Version: 1.7-1
Severity: normal
Tags: patch

Dear Maintainer,

When --bootoffset is specified without --bootsize, --bootoffset parameter is
ignored.  This is desired when building custom partitions ahead of the root
partition.  We wanted this when building /boot/firmware partition for Raspberry
Pi images.

Note that the current documentation describes the parameter as "Space to leave
at start of the image for bootloader".  So the parameter is about leaving space
for boot loader at the beginning and the user may expect this to work even when
a separate boot partition does not exist.

The attached patch should fix the problem.

Thank you,

--
Sunil



-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_IN, LC_CTYPE=en_IN (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages vmdebootstrap depends on:
ii  debootstrap         1.0.88
ii  kpartx              0.6.4-3
ii  libjs-sphinxdoc     1.4.9-2
ii  parted              3.2-17
ii  python-cliapp       1.20160724-2
ii  python-distro-info  0.14
ii  python2.7           2.7.13-2
pn  python:any          <none>
ii  qemu-utils          1:2.8+dfsg-3

Versions of packages vmdebootstrap recommends:
ii  dosfstools        4.1-1
ii  extlinux          3:6.03+dfsg-14.1
ii  grub2-common      2.02~beta3-5
ii  python-guestfs    1:1.34.4-1
ii  qemu-system       1:2.8+dfsg-3
ii  qemu-user-static  1:2.8+dfsg-3
ii  squashfs-tools    1:4.3-3+b1

Versions of packages vmdebootstrap suggests:
ii  cmdtest       0.27-1
pn  mbr           <none>
pn  pandoc        <none>
pn  u-boot:armhf  <none>

-- no debconf information
-------------- next part --------------
>From cc4c5703cd2c6f1e9a1759d0a8ac2db0f8fc4109 Mon Sep 17 00:00:00 2001
From: Sunil Mohan Adapa <sunil at medhas.org>
Date: Mon, 20 Mar 2017 10:55:31 +0530
Subject: [PATCH] Use bootoffset even when boot partition is not present

When --bootoffset is specified without --bootsize, --bootoffset
parameter is ignored.  This is desired when building custom partitions
ahead of the root partition.  We wanted this when building
/boot/firmware partition for Raspberry Pi images.

Note that the current documentation describes the parameter as "Space
to leave at start of the image for bootloader".  So the parameter is
about leaving space for boot loader at the beginning and the user may
expect this to work even when a separate boot partition does not
exist.
---
 bin/vmdebootstrap | 2 +-
 doc/overview.rst  | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/bin/vmdebootstrap b/bin/vmdebootstrap
index d9a697d..cfe1f90 100755
--- a/bin/vmdebootstrap
+++ b/bin/vmdebootstrap
@@ -458,7 +458,7 @@ class VmDebootstrap(cliapp.Application):  # pylint: disable=too-many-public-meth
         # no boot partition
         else:
             runcmd(['parted', '-s', self.settings['image'],
-                    'mkpart', 'primary', '0%', extent])
+                    'mkpart', 'primary', str(partoffset), extent])
 
         # whatever we create, something needs the boot flag
         runcmd(['parted', '-s', self.settings['image'],
diff --git a/doc/overview.rst b/doc/overview.rst
index 43693f2..a7d0517 100644
--- a/doc/overview.rst
+++ b/doc/overview.rst
@@ -106,7 +106,9 @@ Options
                        installed kernel.
  --boottype=FSTYPE     Filesystem to use for the /boot partition. (default ext2)
  --bootflag=FLAG       Flag to set on the first partition. (default none)
- --bootoffset=SIZE     Space to leave at start of the image for bootloader
+ --bootoffset=SIZE     Space to leave at start of the image for bootloader.
+                       Applicable even when separate boot partition is not
+                       requested.  Ignored when using UEFI.
  --roottype=FSTYPE     Filesystem to use for the / (root) partition. (default ext4)
  --part-type=PART-TYPE
                        Partition type to use for this image. (default msdos)
-- 
2.11.0



More information about the Vmdebootstrap-devel mailing list