package-helpers-cmxsl/helpers/DATA/freedom-maker/0006-remove-nonfree-support.patch
2024-10-15 09:52:42 +00:00

237 lines
7.6 KiB
Diff

diff --git a/debian/control b/debian/control
index 1f2c207..c97d392 100644
--- a/debian/control
+++ b/debian/control
@@ -42,7 +42,7 @@ Depends:
u-boot-tools,
xz-utils
Suggests:
- virtualbox
+ debootstrap
Description: FreedomBox image builder
FreedomBox is a personal cloud server which can be installed on single board
computers and Debian machines.
diff --git a/freedommaker/builders/__init__.py b/freedommaker/builders/__init__.py
index 56c180db..139c6541 100644
--- a/freedommaker/builders/__init__.py
+++ b/freedommaker/builders/__init__.py
@@ -25,11 +25,3 @@ from . import pine64_plus
from . import pine64_lts
from . import qemu_amd64
from . import qemu_i386
-from . import raspberry_pi_2
-from . import raspberry_pi_3
-from . import raspberry_pi_3_b_plus
-from . import raspberry_pi_64bit
-from . import raspberry_pi_with_uboot
-from . import vagrant
-from . import virtualbox_amd64
-from . import virtualbox_i386
diff --git a/freedommaker/builders/raspberry_pi_2.py b/freedommaker/builders/raspberry_pi_2.py
deleted file mode 100644
index 439444e7..00000000
--- a/freedommaker/builders/raspberry_pi_2.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# SPDX-License-Identifier: GPL-3.0-or-later
-"""
-Worker class to build Raspberry Pi 2 image.
-"""
-
-from .raspberry_pi_with_uboot import RaspberryPiWithUBoot
-
-
-class RaspberryPi2ImageBuilder(RaspberryPiWithUBoot):
- """Image builder for Raspberry Pi 2 target."""
- architecture = 'armhf'
- machine = 'raspberry2'
- kernel_flavor = 'armmp'
- flash_kernel_name = 'Raspberry Pi 2 Model B'
- u_boot_rpi_variant = 'rpi_2'
diff --git a/freedommaker/builders/raspberry_pi_3.py b/freedommaker/builders/raspberry_pi_3.py
deleted file mode 100644
index 3b9bf82b..00000000
--- a/freedommaker/builders/raspberry_pi_3.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# SPDX-License-Identifier: GPL-3.0-or-later
-"""
-Worker class to build Raspberry Pi 3 image.
-"""
-
-from .raspberry_pi_with_uboot import RaspberryPiWithUBoot
-
-
-class RaspberryPi3ImageBuilder(RaspberryPiWithUBoot):
- """Image builder for Raspberry Pi 3 target."""
- architecture = 'armhf'
- machine = 'raspberry3'
- kernel_flavor = 'armmp'
- flash_kernel_name = 'Raspberry Pi 3 Model B'
- u_boot_rpi_variant = 'rpi_3_32b'
diff --git a/freedommaker/builders/raspberry_pi_64bit.py b/freedommaker/builders/raspberry_pi_64bit.py
deleted file mode 100644
index e6a9ffa0..00000000
--- a/freedommaker/builders/raspberry_pi_64bit.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# SPDX-License-Identifier: GPL-3.0-or-later
-"""
-Worker class to build Raspberry Pi 64-bit image.
-"""
-
-from .. import library
-from ..builder import ImageBuilder
-
-
-class RaspberryPi64ImageBuilder(ImageBuilder):
- """Image builder for Raspberry Pi 64-bit target."""
- architecture = 'arm64'
- boot_loader = None
- firmware_filesystem_type = 'vfat'
- firmware_size = '256MiB'
- include_non_free_firmware = True
- kernel_flavor = 'arm64'
- machine = 'raspberry64'
- update_initramfs = False
-
- def __init__(self, arguments):
- """Add to list of packages."""
- super().__init__(arguments)
- self.packages += ['firmware-brcm80211']
-
- @classmethod
- def get_target_name(cls):
- """Return the name of the target for an image builder."""
- return getattr(cls, 'machine', None)
-
- def install_boot_loader(self, state):
- """Install the firmware onto the image."""
- uuid = library.get_uuid_of_device(state['devices']['root'])
- script = '''
-set -e
-set -x
-set -o pipefail
-
-# This will trigger installing firmware and updating initramfs.
-apt-get install raspi-firmware
-
-# Fixup cmdline.txt and set defaults
-echo "console=tty0 console=ttyS1,115200 root=UUID={uuid} rw fsck.repair=yes net.ifnames=0 rootwait" >/boot/firmware/cmdline.txt
-sed -i 's/^#ROOTPART=.*/ROOTPART=UUID={uuid}/' /etc/default/raspi-firmware
-'''.format(uuid=uuid)
- library.run_in_chroot(state, ['bash', '-c', script])
diff --git a/freedommaker/builders/raspberry_pi_with_uboot.py b/freedommaker/builders/raspberry_pi_with_uboot.py
deleted file mode 100644
index c4be09cd..00000000
--- a/freedommaker/builders/raspberry_pi_with_uboot.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# SPDX-License-Identifier: GPL-3.0-or-later
-"""
-Base worker class to build Raspberry Pi 2 and 3 images.
-"""
-
-from .. import library
-from .arm import ARMImageBuilder
-
-
-class RaspberryPiWithUBoot(ARMImageBuilder):
- """Base image builder for Raspberry Pi 2 and 3 targets."""
- include_non_free_firmware = True
- uboot_variant = None
- firmware_filesystem_type = 'vfat'
- firmware_size = '256MiB'
- u_boot_variant = 'rpi'
-
- def install_boot_loader(self, state):
- """Install the boot loader onto the image."""
- if not self.u_boot_rpi_variant:
- raise NotImplementedError
-
- firmware_package = 'raspi-firmware'
- script = '''
-set -e
-set -x
-set -o pipefail
-
-apt-get install --no-install-recommends -y dpkg-dev
-cd /tmp
-apt-get source {firmware_package}
-cp {firmware_package}*/boot/* /boot/firmware
-rm -rf {firmware_package}*
-cd /
-
-# remove unneeded firmware files
-rm -f /boot/firmware/fixup_*
-rm -f /boot/firmware/start_*
-
-# u-boot setup
-apt-get install -y u-boot-rpi
-cp /usr/lib/u-boot/{u_boot_rpi_variant}/u-boot.bin /boot/firmware/kernel.img
-cp /usr/lib/u-boot/{u_boot_rpi_variant}/u-boot.bin /boot/firmware/kernel7.img
-'''.format(firmware_package=firmware_package,
- u_boot_rpi_variant=self.u_boot_rpi_variant)
- library.run_in_chroot(state, ['bash', '-c', script])
diff --git a/freedommaker/builders/vagrant.py b/freedommaker/builders/vagrant.py
deleted file mode 100644
index 30df772b..00000000
--- a/freedommaker/builders/vagrant.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# SPDX-License-Identifier: GPL-3.0-or-later
-"""
-Worker class to build Vagrant images.
-"""
-
-import logging
-import os
-import subprocess
-
-from .. import library
-from .virtualbox_amd64 import VirtualBoxAmd64ImageBuilder
-
-logger = logging.getLogger(__name__)
-
-
-class VagrantImageBuilder(VirtualBoxAmd64ImageBuilder):
- """Image builder for Vagrant package."""
- include_contrib = True
- vagrant_extension = '.box'
-
- @classmethod
- def get_target_name(cls):
- """Return the name of the target for an image builder."""
- return 'vagrant'
-
- def build(self):
- """Run the image building process."""
- vm_file = self._replace_extension(self.image_file,
- self.vm_image_extension)
- vagrant_file = self._replace_extension(self.image_file,
- self.vagrant_extension)
-
- self.make_image()
- self.create_vm_file(self.image_file, vm_file)
- os.remove(self.image_file)
- self.vagrant_package(vm_file, vagrant_file)
- self.store_hash(vagrant_file)
-
- def vagrant_package(self, vm_file, vagrant_file):
- """Create a vagrant package from VM file."""
- command = [
- 'freedommaker/vagrant_package.py', '--distribution',
- self.arguments.distribution, '--release-components'
- ]
- command.extend(self.release_components)
- command += ['--output', vagrant_file, vm_file]
- library.run(command)
-
- def store_hash(self, vagrant_file):
- """Store the SHA-256 hash of the vagrant box file."""
- output = subprocess.check_output(['sha256sum', vagrant_file])
- result = output.decode()
- logger.info('sha256sum: %s', result)
- hash_filename = self._replace_extension(vagrant_file, '.sha256')
- with open(hash_filename, 'w') as hash_file:
- hash_file.write(result)