diff options
author | James Valleroy <jvalleroy@mailbox.org> | 2015-01-10 18:19:36 -0500 |
---|---|---|
committer | James Valleroy <jvalleroy@mailbox.org> | 2015-01-10 18:19:36 -0500 |
commit | a13b68fd5f0ee086bcc65b4f596f6b4c2d9a6586 (patch) | |
tree | 2b9b2315faca7a0675c0ff3936d72c0c3760032b | |
parent | 0569813436e7b7c283dc827bba15ec54667f1ddb (diff) | |
parent | b2933f6a7b66a55519f6e453ba7b101378771947 (diff) |
Merge pull request #4 from jvalleroy/master
Update vmdebootstrap patches, enable DHCP, install beaglebone u-boot into bootoffset space.
-rwxr-xr-x | bin/fetch-new-vmdebootstrap | 1 | ||||
-rwxr-xr-x | bin/freedombox-customize | 11 | ||||
-rwxr-xr-x | bin/mk_freedombox_image | 5 | ||||
-rw-r--r-- | vendor-patches/vmdebootstrap/01-debootstrap-dist-bts-767806.patch | 13 | ||||
-rw-r--r-- | vendor-patches/vmdebootstrap/02-parted-grub-space-bootspace-bts-767913.patch | 26 | ||||
-rw-r--r-- | vendor-patches/vmdebootstrap/03-roottype-btrfs-bts-741223.patch | 78 |
6 files changed, 45 insertions, 89 deletions
diff --git a/bin/fetch-new-vmdebootstrap b/bin/fetch-new-vmdebootstrap index db044bf..d9aedf5 100755 --- a/bin/fetch-new-vmdebootstrap +++ b/bin/fetch-new-vmdebootstrap @@ -7,6 +7,7 @@ else git clone git://git.liw.fi/vmdebootstrap vendor/vmdebootstrap fi cd vendor/vmdebootstrap +git checkout tags/vmdebootstrap-0.6 for f in ../../vendor-patches/vmdebootstrap/* ; do patch -p1 < $f done diff --git a/bin/freedombox-customize b/bin/freedombox-customize index 06cd706..4408080 100755 --- a/bin/freedombox-customize +++ b/bin/freedombox-customize @@ -50,6 +50,7 @@ disable_eatmydata_override() { use_eatmydata=true rootdir="$1" +image=$(pwd)/"$2" cd "$rootdir" echo info: building $MACHINE for $ARCHITECTURE to $DESTINATION @@ -105,6 +106,16 @@ rm $rootdir/usr/sbin/policy-rc.d chroot $rootdir /usr/lib/freedombox/setup 2>&1 | \ tee $rootdir/var/log/freedombox-setup.log +# copy u-boot to beginning of image +case "$MACHINE" in + beaglebone) + dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/MLO of="$image" \ + count=1 seek=1 conv=notrunc bs=128k + dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/u-boot.img of="$image" \ + count=2 seek=1 conv=notrunc bs=384k + ;; +esac + if $use_eatmydata ; then disable_eatmydata_override fi diff --git a/bin/mk_freedombox_image b/bin/mk_freedombox_image index b550bb5..5d1d7db 100755 --- a/bin/mk_freedombox_image +++ b/bin/mk_freedombox_image @@ -75,8 +75,9 @@ case "$MACHINE" in extra_pkgs="$beaglebone_pkgs" extra_opts="\ --variant minbase \ + --bootoffset=2mib \ --bootsize 128M \ - --boottype vfat \ + --boottype ext2 \ --no-kernel \ --no-extlinux \ --foreign /usr/bin/qemu-arm-static \ @@ -85,7 +86,6 @@ case "$MACHINE" in virtualbox) extra_opts="\ --grub \ - --enable-dhcp \ " ;; esac @@ -133,5 +133,6 @@ sudo -H \ --arch $ARCHITECTURE \ --roottype btrfs \ --distribution $SUITE \ + --enable-dhcp \ $extra_opts \ $pkgopts diff --git a/vendor-patches/vmdebootstrap/01-debootstrap-dist-bts-767806.patch b/vendor-patches/vmdebootstrap/01-debootstrap-dist-bts-767806.patch deleted file mode 100644 index 1ecc193..0000000 --- a/vendor-patches/vmdebootstrap/01-debootstrap-dist-bts-767806.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/vmdebootstrap b/vmdebootstrap -index 126475f..cc5d380 100755 ---- a/vmdebootstrap -+++ b/vmdebootstrap -@@ -289,7 +289,7 @@ class VmDebootstrap(cliapp.Application): - self.runcmd(['mkfs', '-t', type, device]) - - def debootstrap(self, rootdir): -- self.message('Debootstrapping') -+ self.message('Debootstrapping %s' % self.settings['distribution']) - - if self.settings['foreign']: - necessary_packages = [] diff --git a/vendor-patches/vmdebootstrap/02-parted-grub-space-bootspace-bts-767913.patch b/vendor-patches/vmdebootstrap/02-parted-grub-space-bootspace-bts-767913.patch deleted file mode 100644 index 8756aa0..0000000 --- a/vendor-patches/vmdebootstrap/02-parted-grub-space-bootspace-bts-767913.patch +++ /dev/null @@ -1,26 +0,0 @@ -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'], -@@ -486,6 +487,7 @@ class VmDebootstrap(cliapp.Application): - self.runcmd(['chroot', rootdir, 'update-grub']) - self.runcmd(['chroot', rootdir, 'grub-install', install_dev]) - except cliapp.AppException as e: -+ self.message(str(e)) - self.message("Failed. Is grub2-common installed? Using extlinux.") - self.runcmd(['umount', os.path.join(rootdir, 'sys')]) - self.runcmd(['umount', os.path.join(rootdir, 'proc')]) diff --git a/vendor-patches/vmdebootstrap/03-roottype-btrfs-bts-741223.patch b/vendor-patches/vmdebootstrap/03-roottype-btrfs-bts-741223.patch index 75b7a60..53cbb58 100644 --- a/vendor-patches/vmdebootstrap/03-roottype-btrfs-bts-741223.patch +++ b/vendor-patches/vmdebootstrap/03-roottype-btrfs-bts-741223.patch @@ -1,29 +1,10 @@ diff --git a/vmdebootstrap b/vmdebootstrap -index 126475f..4818f2b 100755 +index 500fa77..f08a0cc 100755 --- a/vmdebootstrap +++ b/vmdebootstrap -@@ -39,6 +39,9 @@ class VmDebootstrap(cliapp.Application): - self.settings.boolean(['verbose'], 'report what is going on') - self.settings.string(['image'], 'put created disk image in FILE', - metavar='FILE') -+ self.settings.string(['roottype'], -+ 'specify file system type for /', -+ default='ext4') - self.settings.bytesize(['size'], - 'create a disk image of size SIZE (%default)', - metavar='SIZE', -@@ -129,7 +132,7 @@ class VmDebootstrap(cliapp.Application): - - try: - rootdev = None -- roottype = 'ext4' -+ roottype = self.settings['roottype'] - bootdev = None - boottype = None - rootdir = None -@@ -141,6 +144,25 @@ class VmDebootstrap(cliapp.Application): +@@ -192,6 +195,25 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth (rootdev, bootdev) = self.setup_kpartx() - self.mkfs(rootdev, type=roottype) + self.mkfs(rootdev, fstype=roottype) rootdir = self.mount(rootdev) + rootfsdir = rootdir + if 'btrfs' == roottype: @@ -47,7 +28,7 @@ index 126475f..4818f2b 100755 if bootdev: if self.settings['boottype']: boottype = self.settings['boottype'] -@@ -168,9 +191,9 @@ class VmDebootstrap(cliapp.Application): +@@ -219,9 +241,9 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth if self.settings['image']: if self.settings['grub']: @@ -59,8 +40,8 @@ index 126475f..4818f2b 100755 self.append_serial_console(rootdir) self.optimize_image(rootdir) if self.settings['squash']: -@@ -221,13 +244,19 @@ class VmDebootstrap(cliapp.Application): - logging.debug('mkdir %s' % dirname) +@@ -274,13 +296,19 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth + logging.debug('mkdir %s', dirname) return dirname - def mount(self, device, path=None): @@ -79,20 +60,19 @@ index 126475f..4818f2b 100755 + cmd.append(mount_point) + self.runcmd(cmd) self.mount_points.append(mount_point) - logging.debug('mounted %s on %s' % (device, mount_point)) + logging.debug('mounted %s on %s', device, mount_point) return mount_point -@@ -300,7 +328,10 @@ class VmDebootstrap(cliapp.Application): +@@ -382,6 +410,9 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth if self.settings['grub']: - necessary_packages.append('grub2') + include.append('grub2') + if 'btrfs' == self.settings['roottype']: -+ necessary_packages.append('btrfs-tools') ++ include.append('btrfs-tools') + - include = self.settings['package'] - if not self.settings['no-kernel']: if self.settings['arch'] == 'i386': -@@ -380,7 +412,12 @@ class VmDebootstrap(cliapp.Application): + kernel_arch = '486' +@@ -461,7 +492,12 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth fstab = os.path.join(rootdir, 'etc', 'fstab') with open(fstab, 'w') as f: f.write('proc /proc proc defaults 0 0\n') @@ -106,7 +86,7 @@ index 126475f..4818f2b 100755 if bootdevstr: f.write('%s /boot %s errors=remount-ro 0 2\n' % (bootdevstr, boottype)) -@@ -473,7 +510,8 @@ class VmDebootstrap(cliapp.Application): +@@ -555,7 +591,8 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth with open(inittab, 'a') as f: f.write('\nS0:23:respawn:%s\n' % serial_command) @@ -116,7 +96,7 @@ index 126475f..4818f2b 100755 self.message("Configuring grub2") # rely on kpartx using consistent naming to map loop0p1 to loop0 install_dev = os.path.join('/dev', os.path.basename(rootdev)[:-2]) -@@ -492,9 +529,9 @@ class VmDebootstrap(cliapp.Application): +@@ -573,9 +610,9 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth self.runcmd(['umount', os.path.join(rootdir, 'sys')]) self.runcmd(['umount', os.path.join(rootdir, 'proc')]) self.runcmd(['umount', os.path.join(rootdir, 'dev')]) @@ -128,16 +108,16 @@ index 126475f..4818f2b 100755 if not os.path.exists("/usr/bin/extlinux"): self.message("extlinux not installed, skipping.") return -@@ -521,7 +558,7 @@ class VmDebootstrap(cliapp.Application): +@@ -602,7 +639,7 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth '-s', 'UUID', rootdev]) uuid = out.splitlines()[0].strip() - conf = os.path.join(rootdir, 'extlinux.conf') + conf = os.path.join(rootfsdir, 'extlinux.conf') - logging.debug('configure extlinux %s' % conf) - f = open(conf, 'w') - f.write(''' -@@ -530,7 +567,7 @@ timeout 1 + logging.debug('configure extlinux %s', conf) + kserial = 'console=ttyS0,115200' if self.settings['serial-console'] else '' + extserial = 'serial 0 115200' if self.settings['serial-console'] else '' +@@ -612,13 +649,14 @@ timeout 1 label linux kernel %(kernel)s @@ -145,15 +125,17 @@ index 126475f..4818f2b 100755 +append initrd=%(initrd)s root=UUID=%(uuid)s ro %(kserial)s %(rootflags)s %(extserial)s ''' % { - 'kernel': kernel_image, -@@ -538,11 +575,12 @@ append initrd=%(initrd)s root=UUID=%(uuid)s ro %(kserial)s - 'uuid': uuid, - 'kserial': - 'console=ttyS0,115200' if self.settings['serial-console'] else '', -+ 'rootflags': 'rootfsflags=subvol=@' if 'btrfs' == self.settings['roottype'] else '', - 'extserial': 'serial 0 115200' if self.settings['serial-console'] else '', - }) - f.close() + 'kernel': kernel_image, # pylint: disable=bad-continuation + 'initrd': initrd_image, # pylint: disable=bad-continuation + 'uuid': uuid, # pylint: disable=bad-continuation + 'kserial': kserial, # pylint: disable=bad-continuation ++ 'rootflags': 'rootfsflags=subvol=@' if 'btrfs' == self.settings['roottype'] else '', # pylint: disable=bad-continuation + 'extserial': extserial, # pylint: disable=bad-continuation + } # pylint: disable=bad-continuation + logging.debug("extlinux config:\n%s", msg) +@@ -629,7 +667,7 @@ append initrd=%(initrd)s root=UUID=%(uuid)s ro %(kserial)s + f = open(conf, 'w') + f.write(msg) - self.runcmd(['extlinux', '--install', rootdir]) + self.runcmd(['extlinux', '--install', rootfsdir]) |