├── .dockerignore ├── linux-liquorix └── debian │ ├── compat │ ├── templates │ ├── control.main.in │ ├── image-dbg.lintian-override.in │ ├── image.bug │ │ ├── include-0version │ │ ├── include-1cmdline │ │ ├── include-usb │ │ ├── include-pci │ │ ├── include-modules │ │ ├── control │ │ ├── presubj │ │ ├── include-dmesg │ │ ├── script │ │ ├── include-model │ │ ├── include-1tainted │ │ ├── include-pstore │ │ └── include-network │ ├── control.image-dbg.in │ ├── image.prerm.in │ ├── image.preinst.in │ ├── control.headers.in │ ├── headers.postinst.in │ ├── control.source.in │ ├── image.postinst.in │ ├── image.postrm.in │ └── control.image.in │ ├── source │ ├── format │ └── options │ ├── config │ ├── config │ ├── kernelarch-x86 │ │ └── config │ ├── amd64 │ │ ├── none │ │ │ └── defines │ │ └── defines │ ├── README │ └── defines │ ├── bin │ ├── debian_linux │ ├── no-depmod │ ├── update-bug-taint-list │ ├── uscan-hook │ ├── kconfig.py │ └── gencontrol.py │ ├── lib │ └── python │ │ └── debian_linux │ │ ├── __init__.py │ │ ├── abi.py │ │ ├── kconfig.py │ │ ├── firmware.py │ │ ├── utils.py │ │ ├── config.py │ │ └── gencontrol.py │ ├── po │ ├── POTFILES.in │ └── templates.pot │ ├── rules.defs │ ├── patches │ ├── series │ └── debian │ │ ├── uname-version-timestamp.patch │ │ ├── kernelvariables.patch │ │ └── version.patch │ ├── copyright │ ├── README.Debian │ ├── README.source │ ├── rules │ ├── scripts │ └── dfsg-prune │ └── rules.real ├── configs └── .dput.cf ├── scripts ├── debian │ ├── common_bootstrap.sh │ ├── docker_build-binary_debian.sh │ ├── docker_submit-ppa-sources.sh │ ├── docker_build-source_all.sh │ ├── docker_build-source.sh │ ├── docker_build-binary.sh │ ├── Dockerfile │ ├── container_build-source.sh │ ├── make-ppa-packages.sh │ ├── container_dput-to-ppa.sh │ ├── docker_bootstrap.sh │ ├── repo_add-debian-packages.sh │ ├── container_build-binary.sh │ ├── delete-ppa-packages.py │ ├── docker_bootstrap-image.sh │ └── env.sh ├── archlinux │ ├── common_bootstrap.sh │ ├── docker_build-binary_archlinux.sh │ ├── env.sh │ ├── docker_build-binary.sh │ ├── docker_bootstrap.sh │ ├── container_build-binary.sh │ ├── Dockerfile │ └── docker_bootstrap-image.sh ├── make-debian-release.sh ├── zk-cut-release.sh ├── pull-stable-queue.sh ├── zk-update-assets.sh └── install-liquorix.sh ├── .github └── workflows │ └── lint.yml ├── .gitignore ├── README.md └── LICENSE /.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /linux-liquorix/debian/compat: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/control.main.in: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /linux-liquorix/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /linux-liquorix/debian/config/config: -------------------------------------------------------------------------------- 1 | # unused for now. 2 | -------------------------------------------------------------------------------- /linux-liquorix/debian/bin/debian_linux: -------------------------------------------------------------------------------- 1 | ../lib/python/debian_linux -------------------------------------------------------------------------------- /linux-liquorix/debian/config/kernelarch-x86/config: -------------------------------------------------------------------------------- 1 | # unused for now 2 | -------------------------------------------------------------------------------- /linux-liquorix/debian/lib/python/debian_linux/__init__.py: -------------------------------------------------------------------------------- 1 | # Module 2 | -------------------------------------------------------------------------------- /linux-liquorix/debian/source/options: -------------------------------------------------------------------------------- 1 | compression = "xz" 2 | compression-level = 3 3 | -------------------------------------------------------------------------------- /linux-liquorix/debian/config/amd64/none/defines: -------------------------------------------------------------------------------- 1 | [base] 2 | flavours: 3 | liquorix-amd64 4 | 5 | -------------------------------------------------------------------------------- /linux-liquorix/debian/po/POTFILES.in: -------------------------------------------------------------------------------- 1 | [type: gettext/rfc822deb] templates/temp.image.plain/templates 2 | -------------------------------------------------------------------------------- /configs/.dput.cf: -------------------------------------------------------------------------------- 1 | [liquorix] 2 | fqdn = ppa.launchpad.net 3 | method = ftp 4 | incoming = ~damentz/ubuntu/liquorix/ 5 | login = anonymous 6 | allow_unsigned_uploads = 0 7 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image-dbg.lintian-override.in: -------------------------------------------------------------------------------- 1 | # Kernel dbg packages contain a full image with debug data 2 | linux-image-@abiname@@localversion@-dbgsym: dbg-package-missing-depends 3 | -------------------------------------------------------------------------------- /linux-liquorix/debian/rules.defs: -------------------------------------------------------------------------------- 1 | include /usr/share/dpkg/default.mk 2 | 3 | BUILD_DIR = debian/build 4 | STAMPS_DIR = debian/stamps 5 | DISTRIBUTOR := liquorix 6 | 7 | -include debian/rules.defs.local 8 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.bug/include-0version: -------------------------------------------------------------------------------- 1 | add_0version() { 2 | echo '** Version:' >&3 3 | cat /proc/version >&3 4 | echo >&3 5 | } 6 | 7 | ask_0version() { 8 | true 9 | } 10 | -------------------------------------------------------------------------------- /linux-liquorix/debian/patches/series: -------------------------------------------------------------------------------- 1 | # zen patches 2 | zen/v6.17.13-lqx1.patch 3 | 4 | # debian specific patches. 5 | debian/version.patch 6 | debian/uname-version-timestamp.patch 7 | debian/kernelvariables.patch 8 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.bug/include-1cmdline: -------------------------------------------------------------------------------- 1 | add_1cmdline() { 2 | echo '** Command line:' >&3 3 | cat /proc/cmdline >&3 4 | echo >&3 5 | } 6 | 7 | ask_1cmdline() { 8 | true 9 | } 10 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/control.image-dbg.in: -------------------------------------------------------------------------------- 1 | Package: linux-image-@abiname@@localversion@-dbgsym 2 | Depends: ${misc:Depends} 3 | Section: debug 4 | Priority: extra 5 | Description: Debug symbols for linux-image-@abiname@@localversion@ 6 | -------------------------------------------------------------------------------- /linux-liquorix/debian/config/README: -------------------------------------------------------------------------------- 1 | Config files 2 | ============ 3 | 4 | Config files are included in the following order: 5 | - config 6 | - kernelarch-%kernel-arch/config 7 | - %arch/config 8 | - %arch/config.%flavour 9 | - featureset-%featureset/config 10 | - %arch/%featureset/config 11 | - %arch/%featureset/config.%flavour 12 | 13 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.bug/include-usb: -------------------------------------------------------------------------------- 1 | add_usb() { 2 | echo '** USB devices:' >&3 3 | lsusb >&3 2>/dev/null || echo 'not available' >&3 4 | echo >&3 5 | } 6 | 7 | ask_usb() { 8 | # This information shouldn't vary much between kernel versions, so 9 | # include it anyway. 10 | test $same_system = nop || add_usb 11 | } 12 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.bug/include-pci: -------------------------------------------------------------------------------- 1 | add_pci() { 2 | echo '** PCI devices:' >&3 3 | lspci -nnvv >&3 2>/dev/null || echo 'not available' >&3 4 | echo >&3 5 | } 6 | 7 | ask_pci() { 8 | # This information shouldn't vary much between kernel versions, so 9 | # include it anyway. 10 | test $same_system = nop || add_pci 11 | } 12 | 13 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.bug/include-modules: -------------------------------------------------------------------------------- 1 | add_modules() { 2 | echo '** Loaded modules:' >&3 3 | # List modules along with any taint flags. 4 | # We should be able to tell cut to use an empty output delimiter, but 5 | # currently (coreutils 8.13-3) this results in null bytes in the output. 6 | cut -d' ' -f1,7 /proc/modules | sed 's/ //' >&3 7 | echo >&3 8 | } 9 | 10 | ask_modules() { 11 | true 12 | } 13 | 14 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.prerm.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | version=@abiname@@localversion@ 4 | image_path=/boot/@image-stem@-$version 5 | 6 | if [ "$1" != remove ]; then 7 | exit 0 8 | fi 9 | 10 | linux-check-removal $version 11 | 12 | if [ -d /etc/kernel/prerm.d ]; then 13 | DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \ 14 | --arg=$image_path /etc/kernel/prerm.d 15 | fi 16 | 17 | exit 0 18 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.bug/control: -------------------------------------------------------------------------------- 1 | Submit-As: src:linux-liquorix 2 | Package-Status: firmware-amd-graphics firmware-atheros firmware-bnx2 firmware-bnx2x firmware-brcm80211 firmware-cavium firmware-intelwimax firmware-intel-sound firmware-ipw2x00 firmware-ivtv firmware-iwlwifi firmware-libertas firmware-linux-nonfree firmware-misc-nonfree firmware-myricom firmware-netxen firmware-qlogic firmware-realtek firmware-samsung firmware-siano firmware-ti-connectivity 3 | -------------------------------------------------------------------------------- /scripts/debian/common_bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | if [[ ! -f "$dir_base/$package_source" ]]; then 9 | echo "[WARN ] Missing source file: $dir_base/$package_source, downloading now." 10 | wget -O "$dir_base/$package_source" "https://cdn.kernel.org/pub/linux/kernel/v${version_major}.x/linux-${version_kernel}.tar.xz" 11 | fi 12 | -------------------------------------------------------------------------------- /scripts/archlinux/common_bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | # Always make sure we have the latest version. Actual file size is 9 | if [[ -f "$dir_base/$package_source" ]]; then 10 | rm -fv "$dir_base/$package_source" 11 | fi 12 | 13 | wget -O "$dir_base/$package_source" \ 14 | "https://github.com/damentz/linux-lqx/archive/refs/heads/master.zip" 15 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.bug/presubj: -------------------------------------------------------------------------------- 1 | Please ensure that you are currently running the kernel version that you 2 | are reporting on. This will allow your bug report to include useful 3 | diagnostic information about the running kernel. 4 | 5 | If you are reporting that the kernel fails to boot, please use a digital 6 | camera, serial console or netconsole to record the boot messages and 7 | attach these to your report. You can use the kernel parameter 8 | 'boot_delay=1000' to slow down the boot messages. 9 | -------------------------------------------------------------------------------- /linux-liquorix/debian/config/amd64/defines: -------------------------------------------------------------------------------- 1 | [base] 2 | featuresets: 3 | none 4 | flavours: 5 | liquorix-amd64 6 | kernel-arch: x86 7 | 8 | [build] 9 | debug-info: false 10 | image-file: arch/x86/boot/bzImage 11 | 12 | [image] 13 | bootloaders: grub-pc extlinux grub-efi-amd64 14 | configs: 15 | install-stem: vmlinuz 16 | suggests: crda 17 | 18 | [liquorix-amd64_description] 19 | hardware: 64-bit PCs 20 | hardware-long: PCs with AMD64 or Intel 64 processors 21 | 22 | [liquorix-amd64_image] 23 | configs: 24 | kernelarch-x86/config-arch-64 25 | -------------------------------------------------------------------------------- /linux-liquorix/debian/config/defines: -------------------------------------------------------------------------------- 1 | [abi] 2 | abiname: 13-1 3 | 4 | [base] 5 | arches: 6 | amd64 7 | compiler: gcc 8 | featuresets: 9 | none 10 | 11 | [description] 12 | part-long-up: This kernel is not suitable for SMP (multi-processor, 13 | multi-core or hyper-threaded) systems. 14 | 15 | [image] 16 | initramfs-generators: initramfs-tools initramfs-fallback 17 | type: plain 18 | 19 | [relations] 20 | # compilers 21 | gcc: gcc 22 | 23 | # initramfs-generators 24 | initramfs-fallback: linux-initramfs-tool 25 | initramfs-tools: initramfs-tools 26 | -------------------------------------------------------------------------------- /linux-liquorix/debian/bin/no-depmod: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | # This is a dummy substitute for depmod. Since we run depmod during 6 | # postinst, we do not need or want to package the files that it 7 | # generates. 8 | 9 | if [ "x$1" = x-V ]; then 10 | # Satisfy version test 11 | echo 'not really module-init-tools' 12 | elif [ "x$1" = x-b -a "${2%/depmod.??????}" != "$2" ]; then 13 | # Satisfy test of short kernel versions 14 | mkdir -p "$2/lib/modules/$3" 15 | touch "$2/lib/modules/$3/modules.dep" 16 | else 17 | echo 'skipping depmod' 18 | fi 19 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.preinst.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | version=@abiname@@localversion@ 4 | image_path=/boot/@image-stem@-$version 5 | 6 | if [ "$1" = abort-upgrade ]; then 7 | exit 0 8 | fi 9 | 10 | if [ "$1" = install ]; then 11 | # Create a flag file for postinst 12 | mkdir -p /lib/modules/$version 13 | touch /lib/modules/$version/.fresh-install 14 | fi 15 | 16 | if [ -d /etc/kernel/preinst.d ]; then 17 | DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \ 18 | --arg=$image_path /etc/kernel/preinst.d 19 | fi 20 | 21 | exit 0 22 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/control.headers.in: -------------------------------------------------------------------------------- 1 | Package: linux-headers-@abiname@@localversion@ 2 | Depends: ${shlibs:Depends}, ${misc:Depends}, libelf-dev 3 | Conflicts: vhba-dkms 4 | Description: Header files for Linux @abiname@@localversion@ 5 | This package provides the architecture-specific kernel header files 6 | for Linux kernel @abiname@@localversion@, generally 7 | used for building out-of-tree kernel modules. These files are going to be 8 | installed into /usr/src/linux-headers-@abiname@@localversion@, and can 9 | be used for building modules that load into the kernel provided by the 10 | linux-image-@abiname@@localversion@ package. 11 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/headers.postinst.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # Author: Michael Gilbert 3 | # Origin: Stripped down version of the linux-headers postinst from Ubuntu's 4 | # 2.6.32-14-generic kernel, which was itself derived from a 5 | # Debian linux-image postinst script. 6 | 7 | $|=1; 8 | my $version = "@abiname@@localversion@"; 9 | 10 | if (-d "/etc/kernel/header_postinst.d") { 11 | system ("run-parts --report --exit-on-error --arg=$version " . 12 | "/etc/kernel/header_postinst.d") && 13 | die "Failed to process /etc/kernel/header_postinst.d"; 14 | } 15 | 16 | exit 0; 17 | 18 | __END__ 19 | -------------------------------------------------------------------------------- /scripts/archlinux/docker_build-binary_archlinux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | declare -i processes_default=2 9 | declare -i processes=${1:-${processes_default}} 10 | declare -a args=() 11 | 12 | declare distro='' 13 | 14 | for arch in 'amd64'; do 15 | distro='archlinux' 16 | for release in "${releases[@]}"; do 17 | args+=("$arch" "$distro" "$release") 18 | done 19 | done 20 | 21 | echo "[DEBUG] $0, args:" "${args[@]}" 22 | for item in "${args[@]}"; do 23 | echo "$item" 24 | done | xargs -n3 -P "$processes" "$dir_scripts/docker_build-binary.sh" 25 | -------------------------------------------------------------------------------- /scripts/debian/docker_build-binary_debian.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | declare -i processes_default=2 9 | declare -i processes=${1:-${processes_default}} 10 | declare -i build=${2:-${version_build}} 11 | declare -a args=() 12 | 13 | declare distro='' 14 | 15 | for arch in 'amd64'; do 16 | distro='debian' 17 | for release in "${releases_debian[@]}"; do 18 | args+=("$arch" "$distro" "$release" "$build") 19 | done 20 | done 21 | 22 | echo "[DEBUG] $0, args:" "${args[@]}" 23 | for item in "${args[@]}"; do 24 | echo "$item" 25 | done | xargs -n4 -P "$processes" "$dir_scripts/docker_build-binary.sh" 26 | -------------------------------------------------------------------------------- /scripts/debian/docker_submit-ppa-sources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | declare -i build=${1:-${version_build}} 9 | declare distro='ubuntu' 10 | 11 | for release in "${releases_ubuntu[@]}"; do 12 | echo "[INFO ] Uploading sources for $distro/$release" 13 | docker run --net='host' \ 14 | --rm \ 15 | --tmpfs /build:exec \ 16 | --env LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libeatmydata.so \ 17 | -v "$dir_base":/liquorix-package \ 18 | -t "liquorix_$source_arch/$source_distro/$source_release" \ 19 | /liquorix-package/scripts/debian/container_dput-to-ppa.sh \ 20 | "$distro" \ 21 | "$release" \ 22 | "$build" 23 | done 24 | -------------------------------------------------------------------------------- /scripts/debian/docker_build-source_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | declare -i processes_default=2 9 | declare -i processes=${1:-"$processes_default"} 10 | declare -i build=${2:-${version_build}} 11 | declare -a args=() 12 | 13 | declare distro='' 14 | 15 | distro='ubuntu' 16 | for release in "${releases_ubuntu[@]}"; do 17 | args+=("$distro" "$release" "$build") 18 | done 19 | 20 | distro='debian' 21 | for release in "${releases_debian[@]}"; do 22 | args+=("$distro" "$release" "$build") 23 | done 24 | 25 | echo "[DEBUG] $0, args:" "${args[@]}" 26 | for item in "${args[@]}"; do 27 | echo "$item" 28 | done | xargs -n3 -P "$processes" "$dir_scripts/docker_build-source.sh" 29 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.bug/include-dmesg: -------------------------------------------------------------------------------- 1 | add_dmesg() { 2 | local got_log= 3 | echo '** Kernel log:' >&3 4 | if [ "$(cat /proc/sys/kernel/dmesg_restrict)" = 0 ]; then 5 | dmesg > >(tail -n 100 >&3) && got_log=y 6 | elif command -v sudo >/dev/null; then 7 | yesno "Use sudo to read the kernel log? " yep 8 | if [ "$REPLY" = yep ]; then 9 | sudo dmesg > >(tail -n 100 >&3) && got_log=y 10 | fi 11 | fi 12 | test "$got_log" || echo 'Unable to read kernel log; any relevant messages should be attached' >&3 13 | echo >&3 14 | } 15 | 16 | ask_dmesg() { 17 | # Remind the user to attach the kernel log. This should also trigger 18 | # a reminder in some MUAs if the user tries to send without it. 19 | echo '** Kernel log: boot messages should be attached' >&3 20 | echo >&3 21 | } 22 | -------------------------------------------------------------------------------- /scripts/make-debian-release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=debian/env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/debian/env.sh" 7 | 8 | 9 | declare build=${1:-${version_build}} 10 | 11 | declare -i procs=0 12 | if command -v nproc > /dev/null 2>&1; then 13 | procs=$(( $(nproc) / 2 )) 14 | fi 15 | 16 | if [[ $procs -lt 2 ]]; then 17 | procs=2 18 | fi 19 | 20 | "$dir_scripts"/docker_bootstrap.sh "$procs" 21 | "$dir_scripts"/docker_build-source_all.sh "$procs" "$build" 22 | 23 | "$dir_scripts"/delete-ppa-packages.py 24 | "$dir_scripts"/docker_submit-ppa-sources.sh "$build" 25 | 26 | # We build only one kernel at a time since each build uses all CPU resources 27 | "$dir_scripts"/docker_build-binary_debian.sh 1 "$build" 28 | 29 | "$dir_scripts"/repo_add-debian-packages.sh "$build" 30 | -------------------------------------------------------------------------------- /scripts/zk-cut-release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | declare ev=${1:-lqx1} 6 | if [[ ! -f "Makefile" ]]; then 7 | echo "[ERROR] Makefile for Linux not in current directory!" 8 | exit 1 9 | fi 10 | 11 | sed -r -i "s/^EXTRAVERSION = .*/EXTRAVERSION = -${ev}/" Makefile 12 | 13 | declare -i kv=$(grep -E '^VERSION = ' Makefile | sed -r 's/^VERSION = //') 14 | declare -i kpl=$(grep -E '^PATCHLEVEL = ' Makefile | sed -r 's/^PATCHLEVEL = //') 15 | declare -i ksl=$(grep -E '^SUBLEVEL = ' Makefile | sed -r 's/^SUBLEVEL = //') 16 | 17 | tag="v$kv.$kpl.$ksl-$ev" 18 | 19 | git_message="Cut $tag" 20 | if [[ "$tag" =~ zen ]]; then 21 | git_message="Linux ZEN kernel $tag" 22 | fi 23 | 24 | git add Makefile 25 | git commit -m "$git_message" 26 | git tag -s "$tag" -m "$git_message" 27 | git push origin "$tag" 28 | 29 | echo -e "\n" 30 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | jobs: 8 | 9 | bash: 10 | name: Lint Bash 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | - name: Run ShellCheck 15 | run: | 16 | find . -type f -name "*.sh" -print0 |\ 17 | xargs -0 shellcheck -S error 18 | 19 | ruff: 20 | name: Lint Python 21 | runs-on: ubuntu-latest 22 | steps: 23 | - uses: actions/checkout@v4 24 | - uses: actions/setup-python@v5 25 | - name: Install python dependencies 26 | run: | 27 | python -m pip install --upgrade pip 28 | pip install ruff black 29 | 30 | - name: Run ruff 31 | run: ruff check --output-format=github 32 | 33 | - name: Run black 34 | run: black --check --diff . 35 | -------------------------------------------------------------------------------- /scripts/archlinux/env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dir_script="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 4 | package_name='linux-lqx' 5 | package_source="$package_name.zip" 6 | package_maintainer="Steven Barrett " 7 | 8 | dir_base="${dir_script%/*/*}" 9 | dir_package="$dir_base/$package_name" 10 | dir_build="/build" 11 | dir_scripts="$dir_base/scripts/archlinux" 12 | dir_artifacts="$dir_base/artifacts" 13 | 14 | source_arch='amd64' 15 | source_distro='archlinux' 16 | source_release='latest' 17 | 18 | repo_name="liquorix" 19 | repo_file="$repo_name.db.tar.zst" 20 | 21 | # stable => stretch, testing => buster, unstable => sid 22 | releases=('latest') 23 | 24 | # Now that we're sure this system is compatible with the bootstrap script, lets 25 | # set all the variables needed to proceed. 26 | build_user="builder" 27 | 28 | schedtool='schedtool -D -n19 -e' 29 | -------------------------------------------------------------------------------- /linux-liquorix/debian/bin/update-bug-taint-list: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eu 2 | 3 | temp="$(mktemp)" 4 | trap 'rm -f "$temp"' EXIT 5 | 6 | # Copy everything above the existing flag checks. 7 | sed -rne '/^ +_check /q; p' \ 8 | < debian/templates/image.bug/include-1tainted >"$temp" 9 | 10 | # Generate flag checks from the table in tainted-kernels.rst. We 11 | # could alternatively extract them from sysctl/kernel.rst or in the C 12 | # sources, but this is easy to find and parse and is likely to have 13 | # the most useful descriptions. 14 | sed -rne '/^Bit +Log +Number +Reason/,/^$/ { 15 | s/^ *([0-9]+) +.\/(.) +[0-9]+ +(.*)/ _check \1 \2 '\''\3'\''/p 16 | }' \ 17 | < Documentation/admin-guide/tainted-kernels.rst >>"$temp" 18 | 19 | # Copy everything below the existing flag checks. 20 | sed -rne '/^ +echo "\*\* Tainted:/,$p' \ 21 | < debian/templates/image.bug/include-1tainted >>"$temp" 22 | 23 | # Update the bug script in-place. 24 | cp "$temp" debian/templates/image.bug/include-1tainted 25 | -------------------------------------------------------------------------------- /scripts/debian/docker_build-source.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | declare distro=${1:-} 9 | declare release=${2:-} 10 | declare build=${3:-${version_build}} 11 | 12 | declare -i fail=0 13 | 14 | if [[ -z "$distro" ]]; then 15 | echo "[ERROR] No distribution set!" 16 | fail=1 17 | fi 18 | 19 | if [[ -z "$release" ]]; then 20 | echo "[ERROR] No release set!" 21 | fail=1 22 | fi 23 | 24 | if [[ $fail -eq 1 ]]; then 25 | echo "[ERROR] Encountered a fatal error, cannot continue!" 26 | exit 1 27 | fi 28 | 29 | docker run --net='host' \ 30 | --rm \ 31 | --tmpfs /build:exec \ 32 | --ulimit nofile=524288:524288 \ 33 | -v $dir_base:/liquorix-package \ 34 | -t "liquorix_$source_arch/$source_distro/$source_release" \ 35 | /liquorix-package/scripts/debian/container_build-source.sh \ 36 | $distro \ 37 | $release \ 38 | $build 39 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/control.source.in: -------------------------------------------------------------------------------- 1 | Section: kernel 2 | Priority: optional 3 | Maintainer: Steven Barrett 4 | Standards-Version: 3.9.8 5 | Build-Depends: 6 | debhelper, 7 | cpio, 8 | python3-six, 9 | bc, 10 | bison, 11 | libelf-dev, 12 | libpfm4-dev, 13 | libssl-dev, 14 | flex, 15 | xz-utils, 16 | zstd, 17 | pahole | dwarves:native, 18 | pkgconf | pkg-config, 19 | systemtap-sdt-dev, 20 | # cpupower dependencies 21 | libcap-dev, 22 | libpci-dev, 23 | # perf dependencies 24 | asciidoctor, 25 | libaudit-dev, 26 | libbabeltrace-dev, 27 | libbabeltrace-dev | libbabeltrace-ctf-dev, 28 | libdw-dev, 29 | libiberty-dev, 30 | libnewt-dev, 31 | libnuma-dev, 32 | libperl-dev, 33 | libtraceevent-dev, 34 | libunwind-dev, 35 | python3-dev, 36 | python3-setuptools 37 | Homepage: http://www.liquorix.net/ 38 | Vcs-Browser: https://github.com/damentz/liquorix-package 39 | Vcs-Git: https://github.com/damentz/liquorix-package.git 40 | -------------------------------------------------------------------------------- /scripts/archlinux/docker_build-binary.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | declare arch=${1:-} 9 | declare distro=${2:-} 10 | declare release=${3:-} 11 | 12 | declare -i fail=0 13 | 14 | if [[ -z "$arch" ]]; then 15 | echo "[ERROR] No architecture set!" 16 | fail=1 17 | fi 18 | 19 | if [[ -z "$distro" ]]; then 20 | echo "[ERROR] No distribution set!" 21 | fail=1 22 | fi 23 | 24 | if [[ -z "$release" ]]; then 25 | echo "[ERROR] No release set!" 26 | fail=1 27 | fi 28 | 29 | if [[ $fail -eq 1 ]]; then 30 | echo "[ERROR] Encountered a fatal error, cannot continue!" 31 | exit 1 32 | fi 33 | 34 | echo "[DEBUG] dir_base: $dir_base" 35 | docker run --net='host' \ 36 | --rm \ 37 | -v "$dir_base":/liquorix-package \ 38 | -t "liquorix_$arch/$distro/$release" \ 39 | /liquorix-package/scripts/archlinux/container_build-binary.sh \ 40 | "$arch" \ 41 | "$distro" \ 42 | "$release" 43 | -------------------------------------------------------------------------------- /scripts/debian/docker_build-binary.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | declare arch=${1:-} 9 | declare distro=${2:-} 10 | declare release=${3:-} 11 | declare build=${4:-${version_build}} 12 | 13 | declare -i fail=0 14 | 15 | if [[ -z "$arch" ]]; then 16 | echo "[ERROR] No architecture set!" 17 | fail=1 18 | fi 19 | 20 | if [[ -z "$distro" ]]; then 21 | echo "[ERROR] No distribution set!" 22 | fail=1 23 | fi 24 | 25 | if [[ -z "$release" ]]; then 26 | echo "[ERROR] No release set!" 27 | fail=1 28 | fi 29 | 30 | if [[ $fail -eq 1 ]]; then 31 | echo "[ERROR] Encountered a fatal error, cannot continue!" 32 | exit 1 33 | fi 34 | 35 | docker run --net='host' \ 36 | --rm \ 37 | --ulimit nofile=524288:524288 \ 38 | -v $dir_base:/liquorix-package \ 39 | -t "liquorix_$arch/$distro/$release" \ 40 | /liquorix-package/scripts/debian/container_build-binary.sh \ 41 | $arch \ 42 | $distro \ 43 | $release \ 44 | $build 45 | -------------------------------------------------------------------------------- /scripts/debian/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG ARCH 2 | ARG DISTRO 3 | ARG RELEASE 4 | 5 | FROM $ARCH/$DISTRO:$RELEASE 6 | 7 | ARG DEFAULT 8 | ARG PUBLIC 9 | ARG SECRET 10 | 11 | ENV DEBIAN_FRONTEND=noninteractive 12 | RUN apt-get update &&\ 13 | apt-get install eatmydata -y &&\ 14 | apt-get clean &&\ 15 | rm -rfv /var/lib/apt/lists/* 16 | 17 | ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libeatmydata.so 18 | RUN apt-get update &&\ 19 | apt-get dist-upgrade -y &&\ 20 | apt-get install -y \ 21 | build-essential \ 22 | devscripts \ 23 | equivs \ 24 | wget \ 25 | gnupg \ 26 | schedtool &&\ 27 | apt-get clean &&\ 28 | rm -rfv /var/lib/apt/lists/* 29 | 30 | RUN echo "$PUBLIC" | gpg --import &&\ 31 | echo "$SECRET" | gpg --import &&\ 32 | echo "default-key $DEFAULT" > ~/.gnupg/gpg.conf 33 | 34 | RUN if command -v sq; then \ 35 | sq pki link add --cert "$DEFAULT" --userid \ 36 | "$(gpg --list-keys --with-colons $DEFAULT | grep ^uid | cut -d: -f10)" &&\ 37 | sq pki link authorize --cert "$DEFAULT" --all --unconstrained; \ 38 | fi 39 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.postinst.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | version=@abiname@@localversion@ 4 | image_path=/boot/@image-stem@-$version 5 | 6 | if [ "$1" != configure ]; then 7 | exit 0 8 | fi 9 | 10 | depmod $version 11 | 12 | if [ -f /lib/modules/$version/.fresh-install ]; then 13 | change=install 14 | else 15 | change=upgrade 16 | fi 17 | linux-update-symlinks $change $version $image_path 18 | rm -f /lib/modules/$version/.fresh-install 19 | 20 | if [ -d /etc/kernel/postinst.d ]; then 21 | DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \ 22 | --arg=$image_path /etc/kernel/postinst.d 23 | fi 24 | 25 | # Add tools to PATH if binaries exist in kernel headers 26 | mkdir -p /etc/profile.d 27 | cat <<'EOF' > /etc/profile.d/liquorix-tools.sh 28 | for tool in perf/perf \ 29 | power/cpupower/cpupower \ 30 | power/x86/turbostat/turbostat \ 31 | power/x86/x86_energy_perf_policy/x86_energy_perf_policy; do 32 | KERNEL_TOOL_PATH="/usr/src/linux-headers-$(uname -r)/tools/$tool" 33 | test -f "$KERNEL_TOOL_PATH" && PATH="${KERNEL_TOOL_PATH%/*}:$PATH" 34 | done 35 | EOF 36 | 37 | exit 0 38 | -------------------------------------------------------------------------------- /scripts/debian/container_build-source.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | declare distro=${1:-} 9 | declare release=${2:-} 10 | declare build=${3:-${version_build}} 11 | declare dir_build="/build" 12 | declare dir_artifacts="$dir_artifacts/$distro/$release" 13 | 14 | declare -i fail=0 15 | 16 | if [[ -z "$distro" ]]; then 17 | echo "[ERROR] No distribution set!" 18 | fail=1 19 | fi 20 | 21 | if [[ -z "$release" ]]; then 22 | echo "[ERROR] No release set!" 23 | fail=1 24 | fi 25 | 26 | if [[ $fail -eq 1 ]]; then 27 | echo "[ERROR] Encountered a fatal error, cannot continue!" 28 | exit 1 29 | fi 30 | 31 | prepare_env 32 | 33 | # We need to update our lists to we can install dependencies correctly 34 | apt-get update 35 | 36 | version="$(get_release_version $distro $release $build)" 37 | 38 | echo "[INFO ] Building source package for $release" 39 | build_source_package "$release" "$version" 40 | 41 | echo "[INFO ] Copying sources to bind mount: $dir_artifacts/" 42 | mkdir -p "$dir_artifacts" 43 | cp -arv "$dir_build/"*$version* "$dir_artifacts/" -------------------------------------------------------------------------------- /linux-liquorix/debian/bin/uscan-hook: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # This script is invoked by uscan after downloading a new tarball 5 | 6 | if [ "x$1" != "x--upstream-version" ] || [ $# != 3 ]; then 7 | echo "invalid arguments: $*" >&2 8 | exit 2 9 | fi 10 | 11 | version="$2" 12 | filename="$3" 13 | 14 | rm -f "$filename" "../linux-${2}.tar.xz" 15 | pruned_tarball="$(./debian/scripts/dfsg-prune ${version}-1 ${version} | awk '/^COMPLETED:/{print $2}')" 16 | if [ -n "${pruned_tarball}" ] && [ -w "${pruned_tarball}" ]; then 17 | # write to ../tarballs/, if it exists - ../ otherwise 18 | if [ -d "../tarballs" ]; then 19 | mv "${pruned_tarball}" "../tarballs/" 20 | ln -fs "tarballs/$(basename ${pruned_tarball})" "../" 21 | elif [ -d "../_tarballs" ]; then 22 | mv "${pruned_tarball}" "../_tarballs/" 23 | ln -fs "_tarballs/$(basename ${pruned_tarball})" "../" 24 | else 25 | mv "${pruned_tarball}" "../" 26 | fi 27 | dch -v "$version-1" 'New upstream release' 28 | tar -xJf "../$(basename ${pruned_tarball})" --strip 1 29 | QUILT_PATCHES='debian/patches' QUILT_PC=.pc quilt push --quiltrc - -a -q --fuzz=0 30 | else 31 | echo "failed to prune upstream tarball" >&2 32 | exit 3 33 | fi 34 | 35 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.postrm.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | version=@abiname@@localversion@ 4 | image_path=/boot/@image-stem@-$version 5 | 6 | rm -f /lib/modules/$version/.fresh-install 7 | 8 | if [ "$1" != upgrade ] && command -v linux-update-symlinks >/dev/null; then 9 | linux-update-symlinks remove $version $image_path 10 | fi 11 | 12 | if [ -d /etc/kernel/postrm.d ]; then 13 | DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \ 14 | --arg=$image_path /etc/kernel/postrm.d 15 | fi 16 | 17 | if [ "$1" = purge ]; then 18 | for extra_file in modules.dep modules.isapnpmap modules.pcimap \ 19 | modules.usbmap modules.parportmap \ 20 | modules.generic_string modules.ieee1394map \ 21 | modules.ieee1394map modules.pnpbiosmap \ 22 | modules.alias modules.ccwmap modules.inputmap \ 23 | modules.symbols modules.ofmap \ 24 | modules.seriomap modules.\*.bin \ 25 | modules.softdep modules.devname; do 26 | eval rm -f /lib/modules/$version/$extra_file 27 | done 28 | rm -rf /lib/modules/$version || true 29 | fi 30 | 31 | exit 0 32 | -------------------------------------------------------------------------------- /scripts/debian/make-ppa-packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | version_build="1" 8 | dir_build="$dir_base/ppa" 9 | 10 | if [[ -n "$1" ]]; then 11 | echo "[INFO ] Build version overridden to: $1" 12 | version_build="$1" 13 | fi 14 | 15 | echo "[DEBUG] package_name: $package_name" 16 | echo "[DEBUG] package_source: $package_source" 17 | echo "[DEBUG] dir_script: $dir_script" 18 | echo "[DEBUG] dir_base: $dir_base" 19 | echo "[DEBUG] dir_package: $dir_package" 20 | echo "[DEBUG] dir_build: $dir_build" 21 | echo "[DEBUG] releases_ubuntu:" "${releases_ubuntu[@]}" 22 | 23 | prepare_env 24 | 25 | for release_name in "${releases_ubuntu[@]}"; do 26 | declare release_version="$(get_release_version ubuntu $release_name $version_build)" 27 | 28 | echo "[INFO ] Building source package for $release" 29 | build_source_package "$release_name" "$release_version" 30 | 31 | echo "[INFO ] Uploading packages to Launchpad PPA" 32 | dput 'liquorix' "${dir_build}/${package_name}_${release_version}_source.changes" || 33 | { echo "[ERROR] dput failed to push package!"; } 34 | done 35 | -------------------------------------------------------------------------------- /linux-liquorix/debian/bin/kconfig.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | import optparse 4 | import re 5 | 6 | from debian_linux.kconfig import KconfigFile 7 | 8 | 9 | def merge(output, configs, overrides): 10 | kconfig = KconfigFile() 11 | for c in configs: 12 | kconfig.read(open(c)) 13 | for key, value in overrides.items(): 14 | kconfig.set(key, value) 15 | open(output, "w").write(str(kconfig)) 16 | 17 | 18 | def opt_callback_dict(option, opt, value, parser): 19 | match = re.match(r"^\s*(\S+)=(\S+)\s*$", value) 20 | if not match: 21 | raise optparse.OptionValueError("not key=value") 22 | dest = option.dest 23 | data = getattr(parser.values, dest) 24 | data[match.group(1)] = match.group(2) 25 | 26 | 27 | if __name__ == "__main__": 28 | parser = optparse.OptionParser(usage="%prog [OPTION]... FILE...") 29 | parser.add_option( 30 | "-o", 31 | "--override", 32 | action="callback", 33 | callback=opt_callback_dict, 34 | default={}, 35 | dest="overrides", 36 | help="Override option", 37 | type="string", 38 | ) 39 | options, args = parser.parse_args() 40 | 41 | merge(args[0], args[1:], options.overrides) 42 | -------------------------------------------------------------------------------- /linux-liquorix/debian/patches/debian/uname-version-timestamp.patch: -------------------------------------------------------------------------------- 1 | From: Ben Hutchings 2 | Subject: Make mkcompile_h accept an alternate timestamp string 3 | Date: Tue, 12 May 2015 19:29:22 +0100 4 | Forwarded: not-needed 5 | 6 | We want to include the Debian version in the utsname::version string 7 | instead of a full timestamp string. However, we still need to provide 8 | a standard timestamp string for gen_initramfs_list.sh to make the 9 | kernel image reproducible. 10 | 11 | Make mkcompile_h use $KBUILD_BUILD_VERSION_TIMESTAMP in preference to 12 | $KBUILD_BUILD_TIMESTAMP. 13 | 14 | Index: linux-liquorix/init/Makefile 15 | =================================================================== 16 | --- linux-liquorix.orig/init/Makefile 17 | +++ linux-liquorix/init/Makefile 18 | @@ -30,7 +30,7 @@ preempt-flag-$(CONFIG_PREEMPT_DYNAMIC) : 19 | preempt-flag-$(CONFIG_PREEMPT_RT) := PREEMPT_RT 20 | 21 | build-version = $(or $(KBUILD_BUILD_VERSION), $(build-version-auto)) 22 | -build-timestamp = $(or $(KBUILD_BUILD_TIMESTAMP), $(build-timestamp-auto)) 23 | +build-timestamp = $(or $(KBUILD_BUILD_VERSION_TIMESTAMP), $(KBUILD_BUILD_TIMESTAMP), $(build-timestamp-auto)) 24 | 25 | # Maximum length of UTS_VERSION is 64 chars 26 | filechk_uts_version = \ 27 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.bug/script: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | PATH=/sbin:/bin:/usr/sbin:/usr/bin 5 | 6 | dir="$(dirname $0)" 7 | 8 | . "$dir"/info 9 | 10 | for file in "$dir"/include-*; do 11 | name="$(echo $file | sed -e 's,^.*/include-,,')" 12 | hooks+=($name) 13 | . "$file" 14 | done 15 | 16 | if [ "$RELEASE" == "$(uname -r)" ]; then 17 | running_ver="$(uname -v)" 18 | running_ver="${running_ver#* $DISTRIBUTOR }" 19 | running_ver="${running_ver%% *}" 20 | if [ "$running_ver" != "$SOURCEVERSION" ]; then 21 | cat <= 4.3~), ${misc:Depends} 3 | Recommends: ${kernel:Recommends}, 4 | firmware-linux-free | linux-firmware, 5 | firmware-linux-nonfree | linux-firmware 6 | Provides: wireguard-modules (= 1.0.0) 7 | Suggests: linux-doc-@version@ 8 | Description: Linux @upstreamversion@ for @class@ 9 | The Linux kernel @upstreamversion@ and modules for use on @longclass@. 10 | 11 | Package: linux-image@localversion@ 12 | Section: metapackages 13 | Priority: extra 14 | Depends: linux-image-@abiname@@localversion@ (= ${binary:Version}), ${misc:Depends} 15 | Recommends: linux-headers@localversion@ (= ${binary:Version}) 16 | Description: Linux image for liquorix on @class@ 17 | This metapackage depends on the latest binary image for Linux kernel on 18 | @longclass@ machines for liquorix. 19 | 20 | Package: linux-headers@localversion@ 21 | Section: metapackages 22 | Provides: linux-headers 23 | Priority: extra 24 | Depends: linux-headers-@abiname@@localversion@ (= ${binary:Version}), ${misc:Depends} 25 | Description: Linux headers for liquorix on @class@ 26 | This metapackage depends on the latest binary image for Linux kernel on 27 | @longclass@ machines for liquorix. 28 | 29 | -------------------------------------------------------------------------------- /scripts/debian/container_dput-to-ppa.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | # Redefine prepare_env with only the necessary operations required to save time. 9 | function prepare_env { 10 | echo "[INFO ] Preparing build directory: $dir_build" 11 | mkdir -p "$dir_build" 12 | if [[ -d "$dir_build/$package_name" ]]; then 13 | echo "[INFO ] Removing $dir_build/$package_name" 14 | rm -rf "$dir_build/$package_name" 15 | fi 16 | 17 | if [[ ! -L "$dir_build/$package_source" ]]; then 18 | echo "[INFO ] Missing symlink: $dir_build/$package_source, creating" 19 | ln -sf "$dir_base/$package_source" "$dir_build/$package_source" 20 | fi 21 | } 22 | 23 | declare distro=${1:-} 24 | declare release=${2:-} 25 | declare build=${3:-} 26 | 27 | declare version="$(get_release_version $distro $release $build)" 28 | declare conf_dput="$dir_base/configs/.dput.cf" 29 | declare dir_build="/build" 30 | declare dir_artifacts="$dir_artifacts/$distro/$release" 31 | 32 | prepare_env 33 | 34 | cd "$dir_build" 35 | cp -av "$dir_artifacts/${package_name}_${version}"* ./ 36 | 37 | dput --config "$conf_dput" 'liquorix' "${package_name}_${version}_source.changes" -------------------------------------------------------------------------------- /scripts/archlinux/docker_bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | # Bootstrap common prerequisites 9 | "$dir_scripts"/common_bootstrap.sh 10 | 11 | cd "$dir_scripts" 12 | 13 | if ! command -v docker > /dev/null; then 14 | echo "[ERROR] Docker is not installed, cannot continue!" 15 | exit 1 16 | fi 17 | 18 | declare -i processes_default=2 19 | declare -i processes=${1:-"$processes_default"} 20 | 21 | if [[ $processes -eq $processes_default ]]; then 22 | echo "[INFO ] Using default process count, $processes" 23 | else 24 | echo "[INFO ] Using override process count, $processes" 25 | fi 26 | 27 | # Build arguments to bootstrap images in parallel 28 | declare -a architectures=('amd64') 29 | declare -a distros=('archlinux') 30 | declare -a releases=('latest') 31 | declare -a args=() 32 | for arch in "${architectures[@]}"; do 33 | for distro in "${distros[@]}"; do 34 | for release in "${releases[@]}"; do 35 | args+=("$arch" "$distro" "$release") 36 | done 37 | done 38 | done 39 | 40 | # Then pass them into docker_bootstrap-image.sh with xargs 41 | for item in "${args[@]}"; do 42 | echo "$item" 43 | done | xargs -n3 -P "$processes" "$dir_scripts/docker_bootstrap-image.sh" 44 | -------------------------------------------------------------------------------- /scripts/debian/docker_bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | # Bootstrap common prerequisites 9 | "$dir_scripts"/common_bootstrap.sh 10 | 11 | cd "$dir_scripts" 12 | 13 | if ! command -v docker > /dev/null; then 14 | echo "[ERROR] Docker is not installed, cannot continue!" 15 | exit 1 16 | fi 17 | 18 | declare -i processes_default=2 19 | declare -i processes=${1:-"$processes_default"} 20 | 21 | if [[ $processes -eq $processes_default ]]; then 22 | echo "[INFO ] Using default process count, $processes" 23 | else 24 | echo "[INFO ] Using override process count, $processes" 25 | fi 26 | 27 | # Build arguments to bootstrap images in parallel 28 | declare -a architectures=('amd64') 29 | declare -a distros=('debian' 'ubuntu') 30 | declare -a args=() 31 | for arch in "${architectures[@]}"; do 32 | for distro in "${distros[@]}"; do 33 | declare -a releases=() 34 | if [[ "$distro" == 'debian' ]]; then 35 | releases=("${releases_debian[@]}") 36 | elif [[ "$distro" == 'ubuntu' ]]; then 37 | releases=("${releases_ubuntu[@]}") 38 | fi 39 | 40 | for release in "${releases[@]}"; do 41 | args+=("$arch" "$distro" "$release") 42 | done 43 | done 44 | done 45 | 46 | # Then pass them into docker_bootstrap-image.sh with xargs 47 | for item in "${args[@]}"; do 48 | echo "$item" 49 | done | xargs -n3 -P "$processes" "$dir_scripts/docker_bootstrap-image.sh" 50 | -------------------------------------------------------------------------------- /scripts/debian/repo_add-debian-packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | declare -i build=${1:-${version_build}} 9 | declare repo_local_path="${liquorix_repo:-${HOME}/www/debian/}" 10 | echo "[DEBUG] build: $build" 11 | echo "[DEBUG] repo_local_path: $repo_local_path" 12 | 13 | if [[ ! -d "$repo_local_path" ]]; then 14 | "[ERROR] Debian repository path $repo_local_path doesn't exist! Not including changes." 15 | exit 1 16 | fi 17 | 18 | for arch in 'amd64'; do 19 | distro='debian' 20 | for release in "${releases_debian[@]}"; do 21 | cd "$dir_artifacts/$distro/$release" 22 | changes="${package_name}_${version_package}.${build}~${release}_${arch}.changes" 23 | 24 | echo "[INFO ] Including $changes to repo at $repo_local_path" 25 | reprepro -b "$repo_local_path" include "$release" "$changes" 26 | done 27 | done 28 | 29 | declare repo_server_name="${liquorix_server_name:-localhost}" 30 | declare repo_server_path="${liquorix_server_repo:-/var/www/debian/}" 31 | echo "[DEBUG] repo_server_name: $repo_server_name" 32 | echo "[DEBUG] repo_server_path: $repo_server_path" 33 | 34 | if [[ "$repo_server_name" == "localhost" ]]; then 35 | echo "[ERROR] Remote server not configured, not syncing" 36 | exit 1 37 | fi 38 | 39 | echo "[INFO ] Syncing $repo_local_path to $repo_server_name:$repo_server_path" 40 | rsync --progress -ahvz --delete "$repo_local_path" -e ssh "$repo_server_name":"$repo_server_path" 41 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.bug/include-model: -------------------------------------------------------------------------------- 1 | grep_model() { 2 | case "$(uname -m)" in 3 | alpha) 4 | egrep '^(system (type|variation|revision)|platform string)\b' /proc/cpuinfo 5 | ;; 6 | arm*) 7 | egrep '^(Processor|Hardware|Revision)\b' /proc/cpuinfo 8 | ;; 9 | i386|ia64|x86_64) 10 | local found= 11 | for name in {sys,product,chassis,bios,board}_{vendor,name,version}; do 12 | if [ -f /sys/class/dmi/id/$name ]; then 13 | echo -n "$name: " 14 | cat /sys/class/dmi/id/$name 15 | found=y 16 | fi 17 | done 18 | test -n "$found" 19 | ;; 20 | mips|mips64) 21 | egrep '^(system type|cpu model)\b' /proc/cpuinfo 22 | ;; 23 | parisc|parisc64) 24 | egrep '^(model|[hs]version)\b' /proc/cpuinfo 25 | ;; 26 | ppc|ppc64|ppc64le) 27 | egrep -i '^(board|machine|model|motherboard|platform|revision|vendor)\b' /proc/cpuinfo 28 | ;; 29 | s390|s390x) 30 | egrep '^processor\b' /proc/cpuinfo 31 | ;; 32 | sparc|sparc64) 33 | egrep '^(cpu|fpu|pmu|prom|type)\b' /proc/cpuinfo 34 | ;; 35 | sh4|sh4a) 36 | egrep '^(machine|cpu)\b' /proc/cpuinfo 37 | ;; 38 | *) 39 | false 40 | ;; 41 | esac 42 | 43 | # Device Tree model 44 | if [ -r /proc/device-tree/model ]; then 45 | echo "Device Tree model:" $(cat /proc/device-tree/model) 46 | fi 47 | } 48 | 49 | add_model() { 50 | local found= 51 | echo '** Model information' >&3 52 | grep_model >&3 2>/dev/null || echo "not available" >&3 53 | echo >&3 54 | } 55 | 56 | ask_model() { 57 | # This is still valid as long as the bug is being reported on the same 58 | # system. 59 | test $same_system = nop || add_model 60 | } 61 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.bug/include-1tainted: -------------------------------------------------------------------------------- 1 | _check() { 2 | if [ $(($tainted & 1<<$1)) -ne 0 ]; then 3 | result_short="$result_short$2" 4 | result_long="$result_long * $3\n" 5 | fi 6 | } 7 | 8 | add_1tainted() { 9 | tainted=$(cat /proc/sys/kernel/tainted) 10 | if [ "$tainted" -gt 0 ]; then 11 | local result_short result_long 12 | # Use debian/bin/update-bug-taint-list to update this 13 | _check 0 P 'proprietary module was loaded' 14 | _check 1 F 'module was force loaded' 15 | _check 2 S 'SMP kernel oops on an officially SMP incapable processor' 16 | _check 3 R 'module was force unloaded' 17 | _check 4 M 'processor reported a Machine Check Exception (MCE)' 18 | _check 5 B 'bad page referenced or some unexpected page flags' 19 | _check 6 U 'taint requested by userspace application' 20 | _check 7 D 'kernel died recently, i.e. there was an OOPS or BUG' 21 | _check 8 A 'ACPI table overridden by user' 22 | _check 9 W 'kernel issued warning' 23 | _check 10 C 'staging driver was loaded' 24 | _check 11 I 'workaround for bug in platform firmware applied' 25 | _check 12 O 'externally-built ("out-of-tree") module was loaded' 26 | _check 13 E 'unsigned module was loaded' 27 | _check 14 L 'soft lockup occurred' 28 | _check 15 K 'kernel has been live patched' 29 | _check 16 X 'auxiliary taint, defined for and used by distros' 30 | _check 17 T 'kernel was built with the struct randomization plugin' 31 | echo "** Tainted: $result_short ($tainted)" >&3 32 | printf "$result_long" >&3 33 | else 34 | echo '** Not tainted' >&3 35 | fi 36 | echo >&3 37 | } 38 | 39 | ask_1tainted() { 40 | true 41 | } 42 | -------------------------------------------------------------------------------- /scripts/pull-stable-queue.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | function usage() { echo "Usage: $0 [directory] "; } 6 | 7 | if [[ -z "$1" ]] || [[ ! -d "$1" ]]; then 8 | echo "[ERROR] '$1' is an invalid directory." 9 | usage 10 | exit 1 11 | fi 12 | 13 | remote='linux-stable' 14 | if [[ -z "$2" ]]; then 15 | echo "[WARN ] '$2' is an invalid remote, defaulting to '$remote'" 16 | else 17 | echo "[INFO ] Setting remote to '$2'" 18 | remote="$2" 19 | fi 20 | 21 | if [[ ! -d ".git" ]]; then 22 | echo "[ERROR] Not in a git repository!" 23 | exit 1 24 | fi 25 | 26 | branch="$(git branch | grep -E '^\* [0-9]+\.[0-9]+/upstream-updates-next')" 27 | version="$(echo "$branch" | grep -Eo '[0-9]+\.[0-9]+')" 28 | queue="$1/queue-$version" 29 | 30 | if [[ "$branch" =~ upstream-updates-next ]]; then 31 | echo "[INFO ] branch is valid" 32 | else 33 | echo "[ERROR] branch, $branch, is invalid" 34 | exit 1 35 | fi 36 | 37 | if [[ "$version" =~ [0-9]+\.[0-9]+ ]]; then 38 | echo "[INFO ] version is valid" 39 | else 40 | "[ERROR] version, $version, is invalid" 41 | exit 1 42 | fi 43 | 44 | echo "[INFO ] fetching latest changes" 45 | git fetch "$remote" 46 | 47 | echo "[INFO ] resetting repository" 48 | git reset --hard "$remote/linux-$version.y" 49 | 50 | echo "[INFO ] cleaning repository" 51 | git clean -xdf 52 | 53 | echo "[INFO ] checking if, $queue, exists" 54 | stat "$queue" &> /dev/null 55 | if [[ "$?" -ne 0 ]]; then 56 | echo "[ERROR] folder, $queue, does not exist" 57 | exit 1 58 | fi 59 | 60 | echo "[INFO ] merging from stable queue" 61 | for file in $(cat "$queue/series"); do 62 | git am -3 "$queue/$file" 63 | done 64 | 65 | exit 0 66 | -------------------------------------------------------------------------------- /linux-liquorix/debian/lib/python/debian_linux/abi.py: -------------------------------------------------------------------------------- 1 | class Symbol(object): 2 | def __init__(self, name, namespace, module, version, export): 3 | self.name, self.namespace, self.module = name, namespace, module 4 | self.version, self.export = version, export 5 | 6 | def __eq__(self, other): 7 | if not isinstance(other, Symbol): 8 | return NotImplemented 9 | 10 | # Symbols are resolved to modules by depmod at installation/ 11 | # upgrade time, not compile time, so moving a symbol between 12 | # modules is not an ABI change. Compare everything else. 13 | if self.name != other.name: 14 | return False 15 | if self.namespace != other.namespace: 16 | return False 17 | if self.version != other.version: 18 | return False 19 | if self.export != other.export: 20 | return False 21 | 22 | return True 23 | 24 | def __ne__(self, other): 25 | ret = self.__eq__(other) 26 | if ret is NotImplemented: 27 | return ret 28 | return not ret 29 | 30 | 31 | class Symbols(dict): 32 | def __init__(self, file=None): 33 | if file: 34 | self.read(file) 35 | 36 | def read(self, file): 37 | for line in file: 38 | version, name, module, export, namespace = line.strip("\r\n").split("\t") 39 | self[name] = Symbol(name, namespace, module, version, export) 40 | 41 | def write(self, file): 42 | for s in sorted(self.values(), key=lambda i: i.name): 43 | file.write( 44 | "%s\t%s\t%s\t%s\t%s\n" 45 | % (s.version, s.name, s.module, s.export, s.namespace) 46 | ) 47 | -------------------------------------------------------------------------------- /scripts/archlinux/container_build-binary.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | declare arch=${1:-} 9 | declare distro=${2:-} 10 | declare release=${3:-} 11 | 12 | declare dir_artifacts="$dir_artifacts/$distro/$release" 13 | 14 | declare -i fail=0 15 | 16 | if [[ -z "$arch" ]]; then 17 | echo "[ERROR] No architecture set!" 18 | fail=1 19 | fi 20 | 21 | if [[ -z "$distro" ]]; then 22 | echo "[ERROR] No distribution set!" 23 | fail=1 24 | fi 25 | 26 | if [[ -z "$release" ]]; then 27 | echo "[ERROR] No release set!" 28 | fail=1 29 | fi 30 | 31 | if [[ $fail -eq 1 ]]; then 32 | echo "[ERROR] Encountered a fatal error, cannot continue!" 33 | exit 1 34 | fi 35 | 36 | echo "[INFO ] Preparing build directory: $dir_build" 37 | sudo mkdir -vp "$dir_build" 38 | sudo chown -R "$build_user":"$build_user" "$dir_build" 39 | cd "$dir_build" 40 | 41 | unzip -j "$dir_base/$package_source" 42 | 43 | echo "[INFO ] Building binary package for $release" 44 | export PACKAGER="$package_maintainer" 45 | $schedtool makepkg --sign -s 46 | 47 | echo "[INFO ] Copying binary packages to bind mount: $dir_artifacts/" 48 | if [[ -d "$dir_artifacts" ]]; then 49 | echo "[INFO ] Removing existing artifacts first" 50 | sudo rm -fv "$dir_artifacts"/* 51 | fi 52 | 53 | sudo mkdir -vp "$dir_artifacts" 54 | sudo chown -R "$build_user":"$build_user" "$dir_artifacts" 55 | cp -arv "$dir_build/"*.pkg.tar* "$dir_artifacts/" 56 | 57 | echo "[INFO ] Creating AUR repository" 58 | cd "$dir_artifacts" 59 | repo-add $repo_file *.pkg.tar.zst 60 | tar --remove-files -cf "$repo_name.tar" -- *.pkg.tar* *.db* *.files* 61 | 62 | ls -ltrh 63 | -------------------------------------------------------------------------------- /scripts/archlinux/Dockerfile: -------------------------------------------------------------------------------- 1 | 2 | ARG ARCH 3 | ARG DISTRO 4 | ARG RELEASE 5 | 6 | FROM $ARCH/$DISTRO:base-devel 7 | 8 | RUN echo 'Server = https://mirrors.kernel.org/archlinux/$repo/os/$arch' \ 9 | > /etc/pacman.d/mirrorlist &&\ 10 | pacman -Syyu \ 11 | base-devel \ 12 | bc \ 13 | cpio \ 14 | fakeroot \ 15 | git \ 16 | gnupg \ 17 | inetutils \ 18 | kmod \ 19 | libeatmydata \ 20 | libelf \ 21 | openssh \ 22 | pacman-contrib \ 23 | pahole \ 24 | python \ 25 | rust \ 26 | rust-bindgen \ 27 | rust-src \ 28 | schedtool \ 29 | sudo \ 30 | unzip \ 31 | wget \ 32 | zstd \ 33 | --noconfirm \ 34 | --needed &&\ 35 | rm -rf /var/cache/pacman 36 | 37 | ENV LD_PRELOAD=/usr/lib/libeatmydata.so 38 | 39 | RUN sed -r -i.bak 's/^#?MAKEFLAGS.*/MAKEFLAGS="-j$(nproc)"/' /etc/makepkg.conf &&\ 40 | sed -r -i.bak 's/^PKGEXT.*/PKGEXT=".pkg.tar.zst"/' /etc/makepkg.conf &&\ 41 | sed -r -i.bak 's/^SRCEXT.*/SRCEXT=".src.tar.zst"/' /etc/makepkg.conf &&\ 42 | sed -r -i.bak 's/^BUILDENV.*/BUILDENV=(fakeroot !distcc !color !ccache check !sign)/' /etc/makepkg.conf &&\ 43 | useradd -ms /bin/bash builder && mkdir -p /etc/sudoers.d &&\ 44 | echo 'builder ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/10-builder 45 | 46 | USER builder 47 | WORKDIR /home/builder 48 | ARG DEFAULT 49 | ARG PUBLIC 50 | ARG SECRET 51 | RUN mkdir -m700 ~/.gnupg &&\ 52 | echo 'keyserver hkps://keys.openpgp:443' > ~/.gnupg/dirmngr.conf &&\ 53 | gpg --locate-keys torvalds@kernel.org gregkh@kernel.org &&\ 54 | echo "$PUBLIC" | gpg --import &&\ 55 | echo "$SECRET" | gpg --import &&\ 56 | echo "default-key $DEFAULT" >> ~/.gnupg/gpg.conf 57 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Debian autogenerated files 2 | /linux-liquorix/debian/lib/python/debian_linux/*.pyc 3 | /linux-liquorix/debian/linux-* 4 | /linux-liquorix/debian/po/*.po 5 | /linux-liquorix/debian/rules.gen 6 | /linux-liquorix/debian/config.defines.dump 7 | /linux-liquorix/debian/control 8 | /linux-liquorix/debian/control.md5sum 9 | /linux-liquorix/.pc 10 | 11 | # Debian version control and artifacts 12 | /*.tar.* 13 | /*.dsc 14 | /*.build* 15 | /*.changes 16 | 17 | # Linux autogenerated files 18 | /linux-liquorix/tags 19 | /linux-liquorix/TAGS 20 | /linux-liquorix/linux 21 | /linux-liquorix/vmlinux 22 | /linux-liquorix/vmlinux.32 23 | /linux-liquorix/vmlinux-gdb.py 24 | /linux-liquorix/vmlinuz 25 | /linux-liquorix/System.map 26 | /linux-liquorix/Module.markers 27 | 28 | # Linux top level folders and files 29 | /linux-liquorix/arch 30 | /linux-liquorix/block 31 | /linux-liquorix/certs 32 | /linux-liquorix/COPYING 33 | /linux-liquorix/CREDITS 34 | /linux-liquorix/crypto 35 | /linux-liquorix/Documentation 36 | /linux-liquorix/drivers 37 | /linux-liquorix/firmware 38 | /linux-liquorix/fs 39 | /linux-liquorix/include 40 | /linux-liquorix/init 41 | /linux-liquorix/ipc 42 | /linux-liquorix/Kbuild 43 | /linux-liquorix/Kconfig 44 | /linux-liquorix/kernel 45 | /linux-liquorix/lib 46 | /linux-liquorix/MAINTAINERS 47 | /linux-liquorix/Makefile 48 | /linux-liquorix/mm 49 | /linux-liquorix/net 50 | /linux-liquorix/README 51 | /linux-liquorix/REPORTING-BUGS 52 | /linux-liquorix/samples 53 | /linux-liquorix/scripts 54 | /linux-liquorix/security 55 | /linux-liquorix/sound 56 | /linux-liquorix/tools 57 | /linux-liquorix/usr 58 | /linux-liquorix/virt 59 | 60 | # Linux hidden files 61 | /linux-liquorix/.get_maintainer.ignore 62 | /linux-liquorix/.mailmap 63 | /linux-liquorix/.gitignore 64 | 65 | # Temporary build folders 66 | /ppa 67 | /build 68 | /debs 69 | /artifacts 70 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.bug/include-pstore: -------------------------------------------------------------------------------- 1 | _add_pstore_log() { 2 | if [ $# -le 3 ]; then 3 | return 4 | fi 5 | 6 | local backend="$1" 7 | local event="$2" 8 | local date="$3" 9 | 10 | yesno "Include log of $event at $(date -d @$date +%c) stored by $backend?" yep 11 | if [ $REPLY != yep ]; then 12 | return 13 | fi 14 | 15 | echo >&3 16 | echo "*** Log of $event at $(date -d @$date -Iseconds) from $backend" >&3 17 | 18 | shift 3 19 | for file in "$@"; do 20 | tail -n +2 "$file" | sed 's/^<.>//' >&3 21 | done 22 | } 23 | 24 | add_pstore() { 25 | local backend 26 | local i 27 | local j 28 | local file 29 | local date 30 | local head 31 | local event 32 | local log_files 33 | 34 | if ! mountpoint -q /sys/fs/pstore; then 35 | return 0 36 | fi 37 | 38 | set -- /sys/fs/pstore/dmesg-*-1 39 | backend=${1#*/dmesg-} 40 | backend=${backend%-1} 41 | if [ "$backend" = '*' ]; then 42 | return 0 43 | fi 44 | 45 | i=1 46 | while [ -f /sys/fs/pstore/dmesg-$backend-$i ]; do 47 | file=/sys/fs/pstore/dmesg-$backend-$i 48 | head="$(head -1 "$file")" 49 | 50 | # Is this the first part of a log? 51 | if [ "x${head% Part1}" != "x$head" ]; then 52 | # Flush previous log, if any 53 | _add_pstore_log "$backend" "$event" "$date" $log_files 54 | 55 | event="${head% Part1}" 56 | date=$(stat -c %Y $file) 57 | log_files= 58 | j=1 59 | fi 60 | 61 | if [ "x$head" = "x$event Part$j" ]; then 62 | # Each part is prepended to the list, because they're numbered 63 | # backward in log history 64 | log_files="$file $log_files" 65 | j=$((j + 1)) 66 | fi 67 | 68 | i=$((i + 1)) 69 | done 70 | 71 | # Flush last log, if any 72 | _add_pstore_log "$backend" "$event" "$date" $log_files 73 | } 74 | 75 | ask_pstore() { 76 | add_pstore 77 | } 78 | -------------------------------------------------------------------------------- /linux-liquorix/debian/templates/image.bug/include-network: -------------------------------------------------------------------------------- 1 | _list_etc_network_interfaces() { 2 | local file 3 | 4 | for file in /etc/network/interfaces /etc/network/interfaces.d/*; do 5 | if ! [ -f "$file" ]; then 6 | continue 7 | fi 8 | case "${file##*/}" in 9 | *[^-a-zA-Z0-9_]*) 10 | continue 11 | ;; 12 | esac 13 | echo "$file" 14 | done 15 | } 16 | 17 | _add_etc_network_interfaces() { 18 | local file 19 | test -f /etc/network/interfaces || return 0 20 | 21 | echo '** Network interface configuration:' >&3 22 | 23 | while read file; do 24 | if ! [ -r "$file" ]; then 25 | echo "*** $file: unreadable" >&3 26 | echo >&3 27 | continue 28 | fi 29 | echo "*** $file:" >&3 30 | # Hide passwords/keys 31 | awk '$1 ~ /key|pass|^wpa-(anonymous|identity|phase|pin|private|psk)/ { gsub(".", "*", $2); } 32 | $1 == "ethtool-wol" { gsub(".", "*", $3); } 33 | !/^[[:space:]]*\#/ { print; } 34 | ' <"$file" >&3 35 | echo >&3 36 | done < <(_list_etc_network_interfaces) 37 | } 38 | 39 | add_network() { 40 | yesno "Include network configuration and status from this computer? " nop 41 | test $REPLY = yep || return 0 42 | 43 | _add_etc_network_interfaces 44 | echo '** Network status:' >&3 45 | if command -v ip >/dev/null; then 46 | echo '*** IP interfaces and addresses:' >&3 47 | ip address show >&3 48 | echo >&3 49 | fi 50 | echo '*** Device statistics:' >&3 51 | cat /proc/net/dev >&3 52 | echo >&3 53 | if command -v netstat >/dev/null; then 54 | echo '*** Protocol statistics:' >&3 55 | netstat -s >&3 || true 56 | echo >&3 57 | fi 58 | echo >&3 59 | } 60 | 61 | ask_network() { 62 | test $same_system = yep || return 0 63 | test -f /etc/network/interfaces || return 0 64 | 65 | yesno "Include network configuration from this computer? " nop 66 | test $REPLY = yep || return 0 67 | 68 | _add_etc_network_interfaces 69 | } 70 | -------------------------------------------------------------------------------- /linux-liquorix/debian/copyright: -------------------------------------------------------------------------------- 1 | This is the liquorix prepackaged version of the Linux kernel. 2 | It was downloaded from http://ftp.kernel.org/pub/linux/kernel/. 3 | 4 | Copyright: 5 | 6 | Copyright (C) 1991-2009 Linus Torvalds 7 | and many others 8 | 9 | The linux-2.6 package is currently maintained by the 10 | Debian Kernel Team 11 | © 1997-2004 Herbert Xu 12 | © 2005 Andres Salomon 13 | © 2005-2010 Bastian Blank 14 | © 2005-2006 Simon Horman 15 | © 2005-2007 Sven Luther 16 | © 2005-2008 Frederik Schüler 17 | © 2005-2010 Maximilian Attems 18 | © 2005-2007 Kyle McMartin 19 | © 2005-2010 Dann Frazier 20 | © 2005-2007 Jurij Smakov 21 | © 2005-2008 Christian T. Steigies 22 | © 2005-2006 Jonas Smedegaard 23 | © 2005-2007 Norbert Tretkowski 24 | © 2006-2010 Martin Michlmayr 25 | © 2006 Thiemo Seufer 26 | © 2006-2008 Aurelien Jarno 27 | © 2007 Emanuele Rocca 28 | © 2007-2008 Gordon Farquharson 29 | © 2006-2007 Rod Whitby 30 | © 2006-2007 Steve Langasek 31 | 32 | License: 33 | 34 | This package is free software; you can redistribute it and/or modify 35 | it under the terms of the GNU General Public License version 2 as 36 | published by the Free Software Foundation. 37 | 38 | This package is distributed in the hope that it will be useful, 39 | but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | GNU General Public License for more details. 42 | 43 | You should have received a copy of the GNU General Public License 44 | along with this package; if not, write to the Free Software 45 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 46 | 47 | On Debian systems, the complete text of the GNU General Public License version 48 | 2 can be found in `/usr/share/common-licenses/GPL-2'. 49 | -------------------------------------------------------------------------------- /scripts/zk-update-assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | declare ev=${1:-lqx1} 6 | if [[ ! -f "Makefile" ]]; then 7 | echo "[ERROR] Makefile for Linux not in current directory!" 8 | exit 1 9 | fi 10 | 11 | if [[ -z "${GH_ASSET_TOKEN:-}" ]]; then 12 | echo "[ERROR] No GitHub API token found under GH_ASSET_TOKEN!" 13 | exit 1 14 | fi 15 | 16 | declare -i kv=$(grep -E '^VERSION = ' Makefile | sed -r 's/^VERSION = //') 17 | declare -i kpl=$(grep -E '^PATCHLEVEL = ' Makefile | sed -r 's/^PATCHLEVEL = //') 18 | declare -i ksl=$(grep -E '^SUBLEVEL = ' Makefile | sed -r 's/^SUBLEVEL = //') 19 | 20 | tag="v$kv.$kpl.$ksl-$ev" 21 | tag_commit="$(git rev-list -n1 "$tag")" 22 | tag_patch_file="${tag}.patch.xz" 23 | tag_patch_dir="../" 24 | 25 | # zen-kernel repo is under an organization, not user, so it must be specified 26 | # by its unique ID 27 | declare -i repository_id=2465166 28 | release_data='{"tag_name": "'"$tag"'", "tag_commitish": "'"$tag_commit"'"}' 29 | 30 | git diff "v$kv.$kpl" "$tag" | xz -9 > "$tag_patch_dir/$tag_patch_file" 31 | gpg --output "$tag_patch_dir/$tag_patch_file.sig" \ 32 | --detach-sign "$tag_patch_dir/$tag_patch_file" 33 | 34 | echo "[INFO ] Making release and getting release ID" 35 | release_id=$( 36 | curl -X POST -H "Authorization: token ${GH_ASSET_TOKEN:-}" \ 37 | --data "$release_data" "https://api.github.com/repositories/$repository_id/releases" |\ 38 | python -c "import sys, json; print(json.load(sys.stdin)['id']);" 39 | ) 40 | 41 | echo "" 42 | echo "" 43 | echo "[DEBUG] release_id: $release_id" 44 | echo "[INFO ] Uploading $tag_patch_file" 45 | curl -X POST -H "Content-Type:application/x-xz" \ 46 | -H "Authorization: token ${GH_ASSET_TOKEN:-}" \ 47 | --data-binary @"${tag_patch_dir}/${tag_patch_file}" \ 48 | "https://uploads.github.com/repositories/$repository_id/releases/$release_id/assets?name=$tag_patch_file" 49 | 50 | echo "" 51 | echo "" 52 | echo "[INFO ] Uploading $tag_patch_file.sig" 53 | curl -X POST -H "Content-Type:application/octet-stream" \ 54 | -H "Authorization: token ${GH_ASSET_TOKEN:-}" \ 55 | --data-binary @"${tag_patch_dir}/${tag_patch_file}.sig" \ 56 | "https://uploads.github.com/repositories/$repository_id/releases/$release_id/assets?name=$tag_patch_file.sig" 57 | 58 | echo -e "\n" 59 | -------------------------------------------------------------------------------- /scripts/debian/container_build-binary.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | function prepare_env { 9 | echo "[INFO ] Preparing build directory: $dir_build" 10 | mkdir -p "$dir_build" 11 | if [[ -d "$dir_build/$package_name" ]]; then 12 | echo "[INFO ] Removing $dir_build/$package_name" 13 | rm -rf "$dir_build/$package_name" 14 | fi 15 | 16 | echo "[INFO ] Creating folder $package_name in $dir_build/" 17 | mkdir -pv "$dir_build/$package_name" 18 | 19 | echo "[INFO ] Copying source packages to $dir_build/" 20 | cp -arv "$dir_artifacts/"*${version}.* "$dir_build/" 21 | 22 | if [[ ! -L "$dir_build/$package_source" ]]; then 23 | echo "[INFO ] Missing symlink: $dir_build/$package_source, creating" 24 | ln -sf "$dir_base/$package_source" "$dir_build/$package_source" 25 | fi 26 | 27 | cd "$dir_build" 28 | 29 | echo "[INFO ] Extracting source package to $dir_build/$package_name-$version_kernel" 30 | dpkg-source -x "${package_name}_${version}.dsc" 31 | } 32 | 33 | declare arch=${1:-} 34 | declare distro=${2:-} 35 | declare release=${3:-} 36 | declare build=${4:-${version_build}} 37 | declare version="$(get_release_version $distro $release $build)" 38 | 39 | declare dir_build="/build" 40 | declare dir_artifacts="$dir_artifacts/$distro/$release" 41 | 42 | declare -i fail=0 43 | 44 | if [[ -z "$arch" ]]; then 45 | echo "[ERROR] No architecture set!" 46 | fail=1 47 | fi 48 | 49 | if [[ -z "$distro" ]]; then 50 | echo "[ERROR] No distribution set!" 51 | fail=1 52 | fi 53 | 54 | if [[ -z "$release" ]]; then 55 | echo "[ERROR] No release set!" 56 | fail=1 57 | fi 58 | 59 | if [[ $fail -eq 1 ]]; then 60 | echo "[ERROR] Encountered a fatal error, cannot continue!" 61 | exit 1 62 | fi 63 | 64 | prepare_env 65 | 66 | # We need to update our lists to we can install dependencies correctly 67 | apt-get update 68 | 69 | cd "$dir_build/$package_name-$version_kernel" 70 | mk-build-deps -ir -t 'apt-get -y' 71 | 72 | echo "[INFO ] Building binary package for $release" 73 | $schedtool dpkg-buildpackage --build=binary 74 | 75 | echo "[INFO ] Copying binary packages to bind mount: $dir_artifacts/" 76 | mkdir -p "$dir_artifacts" 77 | 78 | cp -arv "$dir_build/"*${version}_${arch}* "$dir_artifacts/" -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Liquorix Package 2 | 3 | [![license](https://img.shields.io/github/license/damentz/liquorix-package.svg)](LICENSE) 4 | 5 | This repository contains the Debian package to build Liquorix for both Debian and Ubuntu, and scripts for Debian, Ubuntu, and Arch Linux. 6 | 7 | ## Prerequisites 8 | 9 | The following software must be installed. 10 | 11 | 1. Docker 12 | 2. GnuPG 13 | 14 | GnuPG must be configured with a `default-key` line defined in `~/.gnupg/gpg.conf`. Consult the GnuPG manual for more information if you're unsure what to put here. But if you're creating a temporary signing key for the purposes of building, follow these steps: 15 | 16 | 1. Execute `gpg --full-gen-key` and follow prompts 17 | 2. Run `gpg --list-secret-keys` to produce a list of keys you own the secrets to 18 | 3. Create `~/.gnupg/gpg.conf` and add `default-key EXAMPLE1234...`, where the example is your key from the previous output 19 | 20 | ## Usage 21 | 22 | ### Bootstrap Docker Images 23 | 24 | Before any builds can be executed, the prepared docker images must be bootstrapped. To bootstrap all supported images, execute: 25 | 26 | ```shell 27 | ./scripts/debian/docker_bootstrap.sh 28 | ``` 29 | 30 | Subsequent executions of `docker_bootstrap.sh` will update the existing images rather than performing a full build. 31 | 32 | ### Build Source and Binary Packages 33 | 34 | The `debian/docker_build-source.sh` script require two operands, the distribution and release. For example, to build for Ubuntu Focal, you would execute below: 35 | 36 | ```shell 37 | ./scripts/debian/docker_build-source.sh debian bookworm 38 | ``` 39 | 40 | Once complete, you need to build the binary: 41 | 42 | ```shell 43 | ./scripts/debian/docker_build-binary.sh amd64 debian bookworm 44 | ``` 45 | 46 | If the build completes successfully, the build for Debian Bookworm will be found under `artifacts/debian/bookworm`. 47 | 48 | At this time, only AMD64 is supported and is the only architecture that will build successfully. 49 | 50 | ### Package Signing 51 | 52 | If you run into trouble with errors for signing or don't desire signed packages, look for instances in the scripts folder of `dpkg-buildpackage` and add the `--no-sign` flag to all lines. 53 | 54 | For example, from the root of this project, execute the following script to find all instances and edit each file as necessary: 55 | 56 | ```shell 57 | find scripts/ -type f | xargs grep -H 'dpkg-buildpackage' 58 | ``` 59 | 60 | If signing is desired, make sure to update the changelog with `dch -i --auto-nmu` and set the author to match your signing key you set up with GnuPG. 61 | 62 | ## Contributing 63 | 64 | PRs accepted. 65 | -------------------------------------------------------------------------------- /linux-liquorix/debian/README.Debian: -------------------------------------------------------------------------------- 1 | linux-liquorix 2 | ------------------------ 3 | 4 | Patches 5 | ------- 6 | liquorix applies small changes and upstream backports to the kernel source. 7 | These are split up into separated patches addressing individual problems. 8 | Each of the patch files contains a description and mentions the author. The 9 | patches can be found at: 10 | https://github.com/zen-kernel/zen-kernel 11 | 12 | Config Files 13 | ------------ 14 | The .config files used to build the various linux-image files are dynamically 15 | generated during the linux-liquorix package build. See the source package for 16 | details. Each linux-image-* package provides the complete .config file that 17 | was used to generate it. This file is installed in /boot. 18 | Additionally the configuration of the currently running kernel is stored under 19 | /proc/config.gz in gzipped form. 20 | 21 | Scope of security support 22 | ------------------------- 23 | Security support is provided not only for the binary builds, but also 24 | for the full source package, allowing for locally customized kernels. 25 | However, kernel options that are not enabled in official liquorix builds are 26 | given a lower priority for security support. Options marked as BROKEN 27 | or EXPERIMENTAL are of very low priority, and should not be enabled in 28 | customized builds for a security-sensitive environment. 29 | 30 | Building custom kernel binary packages 31 | -------------------------------------- 32 | We recommend using the 'make deb-pkg' target provided by the upstream 33 | kernel source. 34 | 35 | Rebuilding official binary packages 36 | ----------------------------------- 37 | You can build specific kernel binary packages using the targets in 38 | debian/rules.gen, which have names of the form: 39 | binary-arch___ 40 | 41 | Example: 42 | fakeroot make -f debian/rules.gen binary-arch_i386_none_686 43 | 44 | Rebuilding Adaptec AIC7xxx/79xx firmware 45 | ---------------------------------------- 46 | You can rebuild the firmware for the Adaptec AIC7xxx/79xx SCSI Adapters. To 47 | do so you need to set AIC7XXX_BUILD_FIRMWARE/AIC79XX_BUILD_FIRMWARE config 48 | options. Note that this requires one to have the development packages for 49 | berkelydb (libdb4.2-dev) installed. 50 | 51 | Non-free bits removed 52 | --------------------- 53 | See the patches under debian/patches/dfsg/ 54 | 55 | Further information 56 | ------------------- 57 | [be aware that there are some packaging differences between liquorix and Debian] 58 | Debian Linux Kernel Handbook: http://kernel-handbook.alioth.debian.org 59 | Debian Wiki: http://wiki.debian.org/DebianKernel 60 | -------------------------------------------------------------------------------- /linux-liquorix/debian/README.source: -------------------------------------------------------------------------------- 1 | Updating the upstream source 2 | ============================ 3 | 4 | 1) For creating the dfsg-pruned upstream source, the get-orig-source target 5 | of debian/rules can be used, it extracts the upstream version from 6 | debian/changelog. 7 | 8 | 3) Unpack linux-liquorix-.orig.tar.gz, cd into the new directory, 9 | and do a 'svn export' to get the debian/ subdirectory. 10 | 11 | Applying patches to the liquorix kernel tree 12 | ========================================== 13 | 14 | The liquorix kernel packaging uses Debian source format "3.0 quilt" as patching 15 | system: 16 | 17 | Patches are stored below debian/patches, loosely sorted in bugfix/, 18 | features/, debian/, dfsg/ and upstream. Patches are in the standard kernel 19 | patch format. 20 | 21 | The order and the selection of patches which are applied during build 22 | time is specified in debian/patches/series. 23 | 24 | Kernel config files 25 | =================== 26 | Configuration files are constructed dynamically from a number of config 27 | files, as listed in debian/config//defines. 28 | 29 | Control file 30 | ============ 31 | The master control file debian/control must be generated before 32 | the package is uploaded. debian/rules contains the debian/control 33 | target, which generates the control file by invoking the 34 | debian/bin/gencontrol.py script, which combines the templates from 35 | the templates directory and architecture-specific defines file to 36 | produce the debian/control file. Note that this target is intentionally 37 | made to fail with a non-zero exit code to make sure that it is never 38 | run during an automatic build. The following variables are substituted 39 | into the templates: 40 | 41 | @version@ Upstream kernel version, for example 2.6.11. 42 | @arch@ The Debian arch name, such as powerpc or i386. 43 | @flavour@ The build flavour, such as 686 or k7-smp. 44 | @class@ The CPU/architecture class; displayed in synopsis. It should 45 | be fairly short, as the synopsis is supposed to be <80 chars. 46 | It should be in the form "foo class", and will show up in the 47 | description as "foo class machines". 48 | @longclass@ The CPU/architecture class; displayed in the extended 49 | description. The same rules apply as in @class@. If 50 | this is unset, it will default to @class@. 51 | @desc@ (Potentially) multi-line verbiage that's appended to 52 | -image descriptions. 53 | @abiname@ Current abiname, a single digit. 54 | 55 | Normally, the arch-specific contents should be controlled by 56 | adjusting the corresponding defines file. 57 | -------------------------------------------------------------------------------- /scripts/debian/delete-ppa-packages.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | from launchpadlib.launchpad import Launchpad 5 | 6 | 7 | def delete_source(launchpad, entry): 8 | """ 9 | Delete source package if no non-superseded published binaries are found. 10 | """ 11 | 12 | obj = launchpad.load(entry["self_link"]) 13 | binaries = obj.getPublishedBinaries() 14 | 15 | no_binaries = True 16 | for binary_entry in binaries.entries: 17 | if not delete_binary(launchpad, binary_entry): 18 | no_binaries = False 19 | 20 | if no_binaries: 21 | print("[INFO ] Deleting superseded source: " + entry["display_name"]) 22 | obj.requestDeletion(removal_comment="Automated removal of superseded package.") 23 | else: 24 | print( 25 | "[WARN ] Published binaries still exist for source, not deleting sources." 26 | ) 27 | 28 | return 29 | 30 | 31 | def delete_binary(launchpad, entry): 32 | """ 33 | Delete package if not already removed. 34 | 35 | This method returns True if package is deleted successfully or already deleted. 36 | """ 37 | 38 | if entry["status"] == "Deleted": 39 | return True 40 | 41 | print("[INFO ] Deleting superseded binary: " + entry["display_name"]) 42 | obj = launchpad.load(entry["self_link"]) 43 | obj.requestDeletion(removal_comment="Automated removal of superseded package.") 44 | 45 | return True 46 | 47 | 48 | def main(): 49 | """Find and delete superseded packages in Liquorix PPA""" 50 | cachedir = os.path.expanduser("~/.launchpadlib/cache") 51 | launchpad = Launchpad.login_with( 52 | "Liquorix", "production", cachedir, version="devel" 53 | ) 54 | ppa = launchpad.me.getPPAByName(name="liquorix") 55 | 56 | # We can either delete superseded sources or binaries. Sources supersede 57 | # immediately while binaries only superseded after a new binary has been 58 | # published. This works in our favor since we only want to delete the 59 | # package if there's a new version available for download. 60 | # 61 | # However, I've found that even though you may delete the superseded 62 | # binaries, they get stuck in the PPA until the package is removed 63 | # through the published source. So in that case, this script will 64 | # find superseded sources, attempt to delete any superseded binaries in 65 | # the process. If any binaries that can't be removed are found, then 66 | # the sources will not be deleted. 67 | sources = ppa.getPublishedSources(status="Superseded") 68 | 69 | for source_entry in sources.entries: 70 | delete_source(launchpad, source_entry) 71 | 72 | print("[INFO ] Script complete!") 73 | 74 | 75 | if __name__ == "__main__": 76 | main() 77 | -------------------------------------------------------------------------------- /linux-liquorix/debian/patches/debian/kernelvariables.patch: -------------------------------------------------------------------------------- 1 | From: Bastian Blank 2 | Subject: kbuild: Make the toolchain variables easily overwritable 3 | Date: Sun, 22 Feb 2009 15:39:35 +0100 4 | Forwarded: not-needed 5 | 6 | Allow make variables to be overridden for each flavour by a file in 7 | the build tree, .kernelvariables. 8 | 9 | We currently use this for ARCH, KERNELRELEASE, CC, and in some cases 10 | also CROSS_COMPILE, KCFLAGS. 11 | 12 | This file can only be read after we establish the build tree, and all 13 | use of $(ARCH) needs to be moved after this. 14 | 15 | [bwh: Updated for 5.3: include .kernelvariables from current directory 16 | rather than using undefined $(obj).] 17 | 18 | [carnil: Update for 6.13: Include .kernelvariables from $(objtree).] 19 | --- 20 | Index: linux-liquorix/Makefile 21 | =================================================================== 22 | --- linux-liquorix.orig/Makefile 23 | +++ linux-liquorix/Makefile 24 | @@ -402,36 +402,6 @@ include $(srctree)/scripts/subarch.inclu 25 | # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile 26 | ARCH ?= $(SUBARCH) 27 | 28 | -# Architecture as present in compile.h 29 | -UTS_MACHINE := $(ARCH) 30 | -SRCARCH := $(ARCH) 31 | - 32 | -# Additional ARCH settings for x86 33 | -ifeq ($(ARCH),i386) 34 | - SRCARCH := x86 35 | -endif 36 | -ifeq ($(ARCH),x86_64) 37 | - SRCARCH := x86 38 | -endif 39 | - 40 | -# Additional ARCH settings for sparc 41 | -ifeq ($(ARCH),sparc32) 42 | - SRCARCH := sparc 43 | -endif 44 | -ifeq ($(ARCH),sparc64) 45 | - SRCARCH := sparc 46 | -endif 47 | - 48 | -# Additional ARCH settings for parisc 49 | -ifeq ($(ARCH),parisc64) 50 | - SRCARCH := parisc 51 | -endif 52 | - 53 | -export cross_compiling := 54 | -ifneq ($(SRCARCH),$(SUBARCH)) 55 | -cross_compiling := 1 56 | -endif 57 | - 58 | KCONFIG_CONFIG ?= .config 59 | export KCONFIG_CONFIG 60 | 61 | @@ -563,6 +533,35 @@ RUSTFLAGS_KERNEL = 62 | AFLAGS_KERNEL = 63 | LDFLAGS_vmlinux = 64 | 65 | +-include $(objtree)/.kernelvariables 66 | + 67 | +# Architecture as present in compile.h 68 | +UTS_MACHINE := $(ARCH) 69 | +SRCARCH := $(ARCH) 70 | + 71 | +# Additional ARCH settings for x86 72 | +ifeq ($(ARCH),i386) 73 | + SRCARCH := x86 74 | +endif 75 | +ifeq ($(ARCH),x86_64) 76 | + SRCARCH := x86 77 | +endif 78 | + 79 | +# Additional ARCH settings for sparc 80 | +ifeq ($(ARCH),sparc64) 81 | + SRCARCH := sparc 82 | +endif 83 | + 84 | +# Additional ARCH settings for parisc 85 | +ifeq ($(ARCH),parisc64) 86 | + SRCARCH := parisc 87 | +endif 88 | + 89 | +# Additional ARCH settings for sh 90 | +ifeq ($(ARCH),sh64) 91 | + SRCARCH := sh 92 | +endif 93 | + 94 | # Use USERINCLUDE when you must reference the UAPI directories only. 95 | USERINCLUDE := \ 96 | -I$(srctree)/arch/$(SRCARCH)/include/uapi \ 97 | -------------------------------------------------------------------------------- /linux-liquorix/debian/lib/python/debian_linux/kconfig.py: -------------------------------------------------------------------------------- 1 | from collections import OrderedDict 2 | 3 | __all__ = ("KconfigFile",) 4 | 5 | 6 | class KConfigEntry(object): 7 | __slots__ = "name", "value", "comments" 8 | 9 | def __init__(self, name, value, comments=None): 10 | self.name, self.value = name, value 11 | self.comments = comments or [] 12 | 13 | def __eq__(self, other): 14 | return self.name == other.name and self.value == other.value 15 | 16 | def __hash__(self): 17 | return hash(self.name) | hash(self.value) 18 | 19 | def __repr__(self): 20 | return "<{}({!r}, {!r}, {!r})>".format( 21 | self.__class__.__name__, self.name, self.value, self.comments 22 | ) 23 | 24 | def __str__(self): 25 | return "CONFIG_{}={}".format(self.name, self.value) 26 | 27 | def write(self): 28 | for comment in self.comments: 29 | yield "#. " + comment 30 | yield str(self) 31 | 32 | 33 | class KConfigEntryTristate(KConfigEntry): 34 | __slots__ = () 35 | 36 | VALUE_NO = False 37 | VALUE_YES = True 38 | VALUE_MOD = object() 39 | 40 | def __init__(self, name, value, comments=None): 41 | if value == "n" or value is None: 42 | value = self.VALUE_NO 43 | elif value == "y": 44 | value = self.VALUE_YES 45 | elif value == "m": 46 | value = self.VALUE_MOD 47 | else: 48 | raise NotImplementedError 49 | super(KConfigEntryTristate, self).__init__(name, value, comments) 50 | 51 | def __str__(self): 52 | if self.value is self.VALUE_MOD: 53 | return "CONFIG_{}=m".format(self.name) 54 | if self.value: 55 | return "CONFIG_{}=y".format(self.name) 56 | return "# CONFIG_{} is not set".format(self.name) 57 | 58 | 59 | class KconfigFile(OrderedDict): 60 | def __str__(self): 61 | ret = [] 62 | for i in self.str_iter(): 63 | ret.append(i) 64 | return "\n".join(ret) + "\n" 65 | 66 | def read(self, f): 67 | for line in iter(f.readlines()): 68 | line = line.strip() 69 | if line.startswith("CONFIG_"): 70 | i = line.find("=") 71 | option = line[7:i] 72 | value = line[i + 1 :] 73 | self.set(option, value) 74 | elif line.startswith("# CONFIG_"): 75 | option = line[9:-11] 76 | self.set(option, "n") 77 | elif line.startswith("#") or not line: 78 | pass 79 | else: 80 | raise RuntimeError("Can't recognize %s" % line) 81 | 82 | def set(self, key, value): 83 | if value in ("y", "m", "n"): 84 | entry = KConfigEntryTristate(key, value) 85 | else: 86 | entry = KConfigEntry(key, value) 87 | self[key] = entry 88 | 89 | def str_iter(self): 90 | for key, value in self.items(): 91 | yield str(value) 92 | -------------------------------------------------------------------------------- /linux-liquorix/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | SHELL := sh -e 4 | DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) 5 | SOURCE := $(shell dpkg-parsechangelog | sed -ne 's,^Source: *\(.*\)$$,\1,p') 6 | VERSION := $(shell dpkg-parsechangelog | sed -ne 's,^Version: *\(.*\)$$,\1,p') 7 | VERSION_UPSTREAM := $(shell echo "$(VERSION)" | sed -e 's,-[^-]*$$,,') 8 | VERSION_BINNMU := $(shell echo "$(VERSION)" | sed -ne 's,.*+b\(.*\)$$,\1,p') 9 | 10 | include debian/rules.defs 11 | 12 | ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) 13 | DEBIAN_KERNEL_JOBS := $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) 14 | endif 15 | ifdef DEBIAN_KERNEL_JOBS 16 | MAKEFLAGS += -j$(DEBIAN_KERNEL_JOBS) 17 | endif 18 | 19 | .NOTPARALLEL: 20 | 21 | source: debian/control 22 | dh_testdir 23 | $(MAKE) -f debian/rules.gen source 24 | 25 | setup: debian/control 26 | dh_testdir 27 | $(MAKE) -f debian/rules.gen setup_$(DEB_HOST_ARCH) 28 | 29 | build: build-arch build-indep 30 | 31 | build-arch: debian/control 32 | dh_testdir 33 | $(MAKE) -f debian/rules.gen build-arch_$(DEB_HOST_ARCH) 34 | 35 | build-indep: debian/control 36 | dh_testdir 37 | $(MAKE) -f debian/rules.gen build-indep 38 | 39 | binary: binary-indep binary-arch 40 | 41 | binary-arch: 42 | dh_testdir 43 | $(MAKE) -f debian/rules.gen binary-arch_$(DEB_HOST_ARCH) 44 | 45 | binary-indep: 46 | dh_testdir 47 | $(MAKE) -f debian/rules.gen binary-indep 48 | 49 | get-orig-source: 50 | $(CURDIR)/debian/scripts/dfsg-prune $(VERSION) $(VERSION_UPSTREAM) $(VERSION_BINNMU) 51 | 52 | maintainerclean: 53 | rm -f debian/config.defines.dump debian/control debian/control.md5sum debian/linux-* debian/rules.gen debian/po/*.po 54 | rm -rf $(filter-out debian .svk .svn .git, $(wildcard * .[^.]*)) debian/linux-* 55 | 56 | clean: debian/control 57 | dh_testdir 58 | rm -rf $(BUILD_DIR) $(STAMPS_DIR) debian/lib/python/debian_linux/*.pyc debian/lib/python/debian_linux/__pycache__ $$(find debian -maxdepth 1 -type d -name 'linux-*') debian/*-modules-*-di* debian/kernel-image-*-di* debian/xen-linux-system-* 59 | dh_clean 60 | 61 | CONTROL_FILES = debian/changelog $(wildcard debian/templates/*.in) 62 | CONTROL_FILES += debian/config/defines $(wildcard debian/config/*/defines) $(wildcard debian/config/*/*/defines) 63 | CONTROL_FILES += $(wildcard debian/installer/*/kernel-versions) $(wildcard debian/installer/*/package-list) 64 | debian/control debian/rules.gen: debian/bin/gencontrol.py $(CONTROL_FILES) 65 | ifeq ($(wildcard debian/control.md5sum),) 66 | $(MAKE) -f debian/rules debian/control-real 67 | else ifeq ($(VERSION_BINNMU),) 68 | md5sum --check debian/control.md5sum --status || \ 69 | $(MAKE) -f debian/rules debian/control-real 70 | else 71 | grep -v debian/changelog debian/control.md5sum | md5sum --check - --status || \ 72 | $(MAKE) -f debian/rules debian/control-real 73 | endif 74 | 75 | debian/control-real: debian/bin/gencontrol.py $(CONTROL_FILES) 76 | $< 77 | md5sum $^ > debian/control.md5sum 78 | @echo 79 | @echo This target is made to fail intentionally, to make sure 80 | @echo that it is NEVER run during the automated build. Please 81 | @echo ignore the following error, the debian/control file has 82 | @echo been generated SUCCESSFULLY. 83 | @echo 84 | exit 1 85 | 86 | .PHONY: clean build setup binary-indep binary-arch binary 87 | -------------------------------------------------------------------------------- /scripts/archlinux/docker_bootstrap-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | declare arch=${1:-} 9 | declare distro=${2:-} 10 | declare release=${3:-} 11 | 12 | declare -i fail=0 13 | 14 | if [[ -z "$arch" ]]; then 15 | echo "[ERROR] No architecture set!" 16 | fail=1 17 | fi 18 | 19 | if [[ -z "$distro" ]]; then 20 | echo "[ERROR] No distribution set!" 21 | fail=1 22 | fi 23 | 24 | if [[ -z "$release" ]]; then 25 | echo "[ERROR] No release set!" 26 | fail=1 27 | fi 28 | 29 | if [[ $fail -eq 1 ]]; then 30 | echo "[ERROR] Encountered a fatal error, cannot continue!" 31 | exit 1 32 | fi 33 | 34 | declare default_key="$( 35 | cat ~/.gnupg/gpg.conf ~/.gnupg/options 2>/dev/null | \ 36 | grep -E '^\s*default-key' | grep -Po '\S+\s*$' 37 | )" 38 | 39 | if [[ -z "$default_key" ]]; then 40 | echo "[ERROR] No default key found in ~/.gnupg/gpg.conf or ~/.gnupg.options! Cannot proceed with building bootstrap images." 41 | exit 1 42 | fi 43 | 44 | declare public="$(gpg --armor --export -a "$default_key")" 45 | declare secret="$(gpg --armor --export-secret-keys -a "$default_key")" 46 | 47 | if ! echo "$public" | head -n1 | grep -q 'BEGIN PGP PUBLIC KEY BLOCK'; then 48 | echo "[ERROR] Exported public key is empty! Cannot proceed with building bootstrap images." 49 | exit 1 50 | fi 51 | 52 | if ! echo "$secret" | head -n1 | grep -q 'BEGIN PGP PRIVATE KEY BLOCK'; then 53 | echo "[ERROR] Exported secret key is empty! Cannot proceed with building bootstrap images." 54 | exit 1 55 | fi 56 | 57 | declare release_string="liquorix_$arch/$distro/$release" 58 | if [[ "$(docker image ls)" == *"$release_string"* ]]; then 59 | echo "[INFO ] $release_string: Docker image already built, performing update." 60 | declare container_id=$( 61 | docker run --net='host' -d $release_string bash -c \ 62 | 'sudo pacman -Syu --noconfirm && \ 63 | sudo rm -rf /var/cache/pacman && \ 64 | sudo rm -rf /var/lib/pacman/sync' 65 | ) 66 | 67 | echo "[INFO ] $release_string: Trailing container - $container_id" 68 | while true; do 69 | if [[ -n "$(docker container ls -q -f id=$container_id)" ]]; then 70 | sleep 1 71 | else 72 | break 73 | fi 74 | done 75 | 76 | echo "[INFO ] $release_string: Committing updated container to repository" 77 | docker commit -m "Update system packages" "$container_id" "$release_string" > /dev/null 78 | 79 | echo "[INFO ] $release_string: Removing container - $container_id" 80 | docker container rm "$container_id" > /dev/null 81 | else 82 | echo "[INFO ] $release_string: Docker image not found, building with Dockerfile." 83 | docker build --network="host" --no-cache \ 84 | -f "$dir_scripts/Dockerfile" \ 85 | -t "$release_string" \ 86 | --pull=true \ 87 | --build-arg ARCH="$arch" \ 88 | --build-arg DISTRO="$distro" \ 89 | --build-arg RELEASE="$release" \ 90 | --build-arg DEFAULT="$default_key" \ 91 | --build-arg PUBLIC="$public" \ 92 | --build-arg SECRET="$secret" \ 93 | $dir_base/ || true 94 | 95 | # We don't want the docker build --network="host" bootstrap script from stopping release 96 | # scripts from completing. 97 | fi 98 | -------------------------------------------------------------------------------- /linux-liquorix/debian/lib/python/debian_linux/firmware.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | class FirmwareFile(object): 5 | def __init__(self, binary, desc=None, source=None, version=None): 6 | self.binary = binary 7 | self.desc = desc 8 | self.source = source 9 | self.version = version 10 | 11 | 12 | class FirmwareSection(object): 13 | def __init__(self, driver, files, licence): 14 | self.driver = driver 15 | self.files = files 16 | self.licence = licence 17 | 18 | 19 | class FirmwareWhence(list): 20 | def __init__(self, file): 21 | self.read(file) 22 | 23 | def read(self, file): 24 | in_header = True 25 | driver = None 26 | files = {} 27 | licence = None 28 | binary = [] 29 | desc = None 30 | source = [] 31 | version = None 32 | 33 | for line in file: 34 | if line.startswith("----------"): 35 | if in_header: 36 | in_header = False 37 | else: 38 | # Finish old section 39 | if driver: 40 | self.append(FirmwareSection(driver, files, licence)) 41 | driver = None 42 | files = {} 43 | licence = None 44 | continue 45 | 46 | if in_header: 47 | continue 48 | 49 | if line == "\n": 50 | # End of field; end of file fields 51 | for b in binary: 52 | # XXX The WHENCE file isn't yet consistent in its 53 | # association of binaries and their sources and 54 | # metadata. This associates all sources and 55 | # metadata in a group with each binary. 56 | files[b] = FirmwareFile(b, desc, source, version) 57 | binary = [] 58 | desc = None 59 | source = [] 60 | version = None 61 | continue 62 | 63 | match = re.match( 64 | r"(Driver|File|Info|Licen[cs]e|Source|Version" 65 | r"|Original licen[cs]e info(?:rmation)?):\s*(.*)\n", 66 | line, 67 | ) 68 | if match: 69 | keyword, value = match.group(1, 2) 70 | if keyword == "Driver": 71 | driver = value.split(" ")[0].lower() 72 | elif keyword == "File": 73 | match = re.match(r"(\S+)(?:\s+--\s+(.*))?", value) 74 | binary.append(match.group(1)) 75 | desc = match.group(2) 76 | elif keyword in ["Info", "Version"]: 77 | version = value 78 | elif keyword == "Source": 79 | source.append(value) 80 | else: 81 | licence = value 82 | elif licence is not None: 83 | licence = ( 84 | licence 85 | + "\n" 86 | + re.sub(r"^(?:[/ ]\*| \*/)?\s*(.*?)\s*$", r"\1", line) 87 | ) 88 | 89 | # Finish last section if non-empty 90 | for b in binary: 91 | files[b] = FirmwareFile(b, desc, source, version) 92 | if driver: 93 | self.append(FirmwareSection(driver, files, licence)) 94 | -------------------------------------------------------------------------------- /linux-liquorix/debian/lib/python/debian_linux/utils.py: -------------------------------------------------------------------------------- 1 | import codecs 2 | import os 3 | import re 4 | import textwrap 5 | 6 | 7 | class Templates(object): 8 | def __init__(self, dirs=["debian/templates"]): 9 | self.dirs = dirs 10 | 11 | self._cache = {} 12 | 13 | def __getitem__(self, key): 14 | ret = self.get(key) 15 | if ret is not None: 16 | return ret 17 | raise KeyError(key) 18 | 19 | def _read(self, name): 20 | prefix, id = name.split(".", 1) 21 | 22 | for suffix in [".in", ""]: 23 | for dir in self.dirs: 24 | filename = "%s/%s%s" % (dir, name, suffix) 25 | if os.path.exists(filename): 26 | with codecs.open(filename, "r", "utf-8") as f: 27 | mode = os.stat(f.fileno()).st_mode 28 | if prefix == "control": 29 | return (read_control(f), mode) 30 | if prefix == "tests-control": 31 | return (read_tests_control(f), mode) 32 | return (f.read(), mode) 33 | 34 | def _get(self, key): 35 | try: 36 | return self._cache[key] 37 | except KeyError: 38 | self._cache[key] = value = self._read(key) 39 | return value 40 | 41 | def get(self, key, default=None): 42 | value = self._get(key) 43 | if value is None: 44 | return default 45 | return value[0] 46 | 47 | def get_mode(self, key): 48 | value = self._get(key) 49 | if value is None: 50 | return None 51 | return value[1] 52 | 53 | 54 | def read_control(f): 55 | from .debian import Package 56 | 57 | return _read_rfc822(f, Package) 58 | 59 | 60 | def read_tests_control(f): 61 | from .debian import TestsControl 62 | 63 | return _read_rfc822(f, TestsControl) 64 | 65 | 66 | def _read_rfc822(f, cls): 67 | entries = [] 68 | eof = False 69 | 70 | while not eof: 71 | e = cls() 72 | last = None 73 | lines = [] 74 | while True: 75 | line = f.readline() 76 | if not line: 77 | eof = True 78 | break 79 | # Strip comments rather than trying to preserve them 80 | if line[0] == "#": 81 | continue 82 | line = line.strip("\n") 83 | if not line: 84 | break 85 | if line[0] in " \t": 86 | if not last: 87 | raise ValueError("Continuation line seen before first header") 88 | lines.append(line.lstrip()) 89 | continue 90 | if last: 91 | e[last] = "\n".join(lines) 92 | i = line.find(":") 93 | if i < 0: 94 | raise ValueError("Not a header, not a continuation: ``%s''" % line) 95 | last = line[:i] 96 | lines = [line[i + 1 :].lstrip()] 97 | if last: 98 | e[last] = "\n".join(lines) 99 | if e: 100 | entries.append(e) 101 | 102 | return entries 103 | 104 | 105 | class TextWrapper(textwrap.TextWrapper): 106 | wordsep_re = re.compile( 107 | r"(\s+|" # any whitespace 108 | r"(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))" 109 | ) # em-dash 110 | -------------------------------------------------------------------------------- /scripts/debian/docker_bootstrap-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # shellcheck source=env.sh 6 | source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh" 7 | 8 | declare arch=${1:-} 9 | declare distro=${2:-} 10 | declare release=${3:-} 11 | 12 | declare -i fail=0 13 | 14 | if [[ -z "$arch" ]]; then 15 | echo "[ERROR] No architecture set!" 16 | fail=1 17 | fi 18 | 19 | if [[ -z "$distro" ]]; then 20 | echo "[ERROR] No distribution set!" 21 | fail=1 22 | fi 23 | 24 | if [[ -z "$release" ]]; then 25 | echo "[ERROR] No release set!" 26 | fail=1 27 | fi 28 | 29 | if [[ $fail -eq 1 ]]; then 30 | echo "[ERROR] Encountered a fatal error, cannot continue!" 31 | exit 1 32 | fi 33 | 34 | declare default_key="$( 35 | cat ~/.gnupg/gpg.conf ~/.gnupg/options 2>/dev/null | \ 36 | grep -E '^\s*default-key' | grep -Po '\S+\s*$' 37 | )" 38 | 39 | if [[ -z "$default_key" ]]; then 40 | echo "[ERROR] No default key found in ~/.gnupg/gpg.conf or ~/.gnupg.options! Cannot proceed with building bootstrap images." 41 | exit 1 42 | fi 43 | 44 | declare public="$(gpg --armor --export -a "$default_key")" 45 | declare secret="$(gpg --armor --export-secret-keys -a "$default_key")" 46 | 47 | if ! echo "$public" | head -n1 | grep -q 'BEGIN PGP PUBLIC KEY BLOCK'; then 48 | echo "[ERROR] Exported public key is empty! Cannot proceed with building bootstrap images." 49 | exit 1 50 | fi 51 | 52 | if ! echo "$secret" | head -n1 | grep -q 'BEGIN PGP PRIVATE KEY BLOCK'; then 53 | echo "[ERROR] Exported secret key is empty! Cannot proceed with building bootstrap images." 54 | exit 1 55 | fi 56 | 57 | declare release_string="liquorix_$arch/$distro/$release" 58 | if [[ "$(docker image ls)" == *"$release_string"* ]]; then 59 | echo "[INFO ] $release_string: Docker image already built, performing update." 60 | declare container_id=$( 61 | docker run --net='host' -d $release_string bash -c \ 62 | 'apt-get update && \ 63 | apt-get dist-upgrade && \ 64 | apt-get clean && \ 65 | rm -rf /var/lib/apt/lists' 66 | ) 67 | 68 | echo "[INFO ] $release_string: Trailing container - $container_id" 69 | while true; do 70 | if [[ -n "$(docker container ls -q -f id=$container_id)" ]]; then 71 | sleep 1 72 | else 73 | break 74 | fi 75 | done 76 | 77 | echo "[INFO ] $release_string: Committing updated container to repository" 78 | docker commit -m "Update system packages" "$container_id" "$release_string" > /dev/null 79 | 80 | echo "[INFO ] $release_string: Removing container - $container_id" 81 | docker container rm "$container_id" > /dev/null 82 | else 83 | echo "[INFO ] $release_string: Docker image not found, building with Dockerfile." 84 | docker buildx build \ 85 | --network="host" \ 86 | --no-cache \ 87 | --progress=quiet \ 88 | -f "$dir_scripts/Dockerfile" \ 89 | -t "$release_string" \ 90 | --pull=true \ 91 | --build-arg ARCH="$arch" \ 92 | --build-arg DISTRO="$distro" \ 93 | --build-arg RELEASE="$release" \ 94 | --build-arg DEFAULT="$default_key" \ 95 | --build-arg PUBLIC="$public" \ 96 | --build-arg SECRET="$secret" \ 97 | $dir_base/ || true 98 | 99 | # We don't want the docker build --network="host" bootstrap script from stopping release 100 | # scripts from completing. 101 | fi 102 | -------------------------------------------------------------------------------- /linux-liquorix/debian/scripts/dfsg-prune: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | #http_proxy=http://proxyserver.lan:3128 5 | #ftp_proxy=http://proxyserver.lan:3128 6 | #export http_proxy ftp_proxy 7 | 8 | VERSION_DEBIAN="${1}" 9 | VERSION="${2}" 10 | VERSION_DEBIAN_BINNMU="${3}" 11 | 12 | K_TEMP="${VERSION%%~*}" 13 | K_TEMP="${K_TEMP%%-*}" 14 | 15 | K_VERSION="$(echo ${K_TEMP} | cut -d\. -f1)" 16 | K_PATCHLEVEL="$(echo ${K_TEMP} | cut -d\. -f2)" 17 | K_SUBLEVEL="$(echo ${K_TEMP} | cut -d\. -f3)" 18 | 19 | case "${VERSION}" in 20 | 2\.*) 21 | MAJOR_VER="${K_VERSION}.${K_PATCHLEVEL}.${K_SUBLEVEL}" 22 | K_PATCHLEVEL_SYM="${K_PATCHLEVEL}" 23 | ;; 24 | *) 25 | MAJOR_VER="${K_VERSION}.${K_PATCHLEVEL}" 26 | K_PATCHLEVEL_SYM="x" 27 | ;; 28 | esac 29 | 30 | RC_VER="${VERSION#*\~}" 31 | [ "x${VERSION%\~*}" = "x${RC_VER}" ] && RC_VER="" 32 | 33 | TMP_DIR="$(mktemp -d -p /tmp linux-liquorix.XXXXXX)" 34 | pushd "${TMP_DIR}" 35 | if [ -z "$RC_VER" ]; then 36 | # stable kernel 37 | UP_TARBALL="linux-${MAJOR_VER}.tar.bz2" 38 | wget -Nc "http://www.kernel.org/pub/linux/kernel/v${K_VERSION}.${K_PATCHLEVEL_SYM}/${UP_TARBALL}" 39 | 40 | if [ -n "${K_SUBLEVEL}" ]; then 41 | ORIG_TARBALL="linux-liquorix_${K_VERSION}.${K_PATCHLEVEL}.${K_SUBLEVEL}.orig.tar.bz2" 42 | else 43 | ORIG_TARBALL="linux-liquorix_${K_VERSION}.${K_PATCHLEVEL}.orig.tar.bz2" 44 | fi 45 | else 46 | # rc kernel 47 | UP_TARBALL="linux-${MAJOR_VER}-${RC_VER}.tar.bz2" 48 | #wget -Nc "http://www.kernel.org/pub/linux/kernel/v${K_VERSION}.${K_PATCHLEVEL_SYM}/testing/${UP_TARBALL}" 49 | cp /home/debbuilder/testkernel/private/${UP_TARBALL} ./ 50 | if [ -n "${K_SUBLEVEL}" ]; then 51 | ORIG_TARBALL="linux-liquorix_${K_VERSION}.${K_PATCHLEVEL}.${K_SUBLEVEL}~${RC_VER}.orig.tar.bz2" 52 | else 53 | ORIG_TARBALL="linux-liquorix_${K_VERSION}.${K_PATCHLEVEL}~${RC_VER}.orig.tar.bz2" 54 | fi 55 | fi 56 | popd >/dev/null 2>&1 57 | 58 | mkdir "${TMP_DIR}/linux-${VERSION}" 59 | pushd "${TMP_DIR}/linux-${VERSION}" >/dev/null 2>&1 60 | tar --strip 1 -xjf "${TMP_DIR}/${UP_TARBALL}" 61 | rm "${TMP_DIR}/${UP_TARBALL}" 62 | 63 | # remove shipped firmware images 64 | rm -rf firmware \ 65 | drivers/video/nvidia \ 66 | drivers/video/riva \ 67 | sound/pci/cs46xx/imgs 68 | 69 | # remove individual blobby files throughout the tree 70 | rm Documentation/netlabel/draft-ietf-cipso-ipsecurity-01.txt \ 71 | arch/powerpc/sysdev/micropatch.c \ 72 | drivers/media/usb/dvb-usb/af9005-script.h \ 73 | drivers/media/i2c/vs6624.c \ 74 | drivers/net/appletalk/cops.c \ 75 | drivers/net/appletalk/cops.h \ 76 | drivers/net/appletalk/cops_ffdrv.h \ 77 | drivers/net/appletalk/cops_ltdrv.h \ 78 | drivers/staging/ft1000/ft1000-pcmcia/boot.h \ 79 | drivers/staging/ft1000/ft1000-*/*.img \ 80 | drivers/staging/keucr/init.h \ 81 | drivers/staging/wlags49_h2/ap_h2.c \ 82 | drivers/staging/wlags49_h2/ap_h25.c \ 83 | drivers/staging/wlags49_h2/sta_h2.c \ 84 | drivers/staging/wlags49_h2/sta_h25.c \ 85 | sound/pci/cs46xx/cs46xx_image.h 86 | 87 | #unifdef drivers/staging/rtl8192e/r8192E_hwimg.c -UREMOVE_DFSG 88 | [ "x$(md5sum -b drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c | awk '{print $1}')" = "x7a968f2691c625f33ee004d6ba90bd61" ] || false 89 | sed -i -e '23,2792d' \ 90 | drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c 91 | 92 | echo "mark pruned modules as BROKEN" 93 | patch -p1 < ${0%$(basename $0)}/../patches/dfsg/orig/disable-pruned-modules.patch 94 | popd >/dev/null 2>&1 95 | 96 | pushd "${TMP_DIR}" >/dev/null 2>&1 97 | echo "" 98 | echo "create pruned ${ORIG_TARBALL}" 99 | tar \ 100 | --exclude \*\\.orig \ 101 | --posix \ 102 | --numeric-owner \ 103 | --owner=0 \ 104 | --group=0 \ 105 | -cjf "${TMP_DIR}/${ORIG_TARBALL}" \ 106 | "linux-${VERSION}" 107 | 108 | rm -rf ${TMP_DIR}/linux-${VERSION} 109 | popd >/dev/null 2>&1 110 | 111 | echo "COMPLETED: ${TMP_DIR}/${ORIG_TARBALL}" 112 | -------------------------------------------------------------------------------- /linux-liquorix/debian/po/templates.pot: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: PACKAGE VERSION\n" 10 | "Report-Msgid-Bugs-To: linux-2.6@packages.debian.org\n" 11 | "POT-Creation-Date: 2011-07-04 04:24+0100\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: \n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=CHARSET\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | 20 | #. Type: boolean 21 | #. Description 22 | #: ../templates/temp.image.plain/templates:2001 23 | msgid "Abort installation after depmod error?" 24 | msgstr "" 25 | 26 | #. Type: boolean 27 | #. Description 28 | #: ../templates/temp.image.plain/templates:2001 29 | msgid "" 30 | "The 'depmod' command exited with the exit code ${exit_value} " 31 | "(${SIGNAL}${CORE})." 32 | msgstr "" 33 | 34 | #. Type: boolean 35 | #. Description 36 | #: ../templates/temp.image.plain/templates:2001 37 | msgid "" 38 | "Since this image uses initrd, the ${modules_base}/=V/modules.dep file will " 39 | "not be deleted, even though it may be invalid." 40 | msgstr "" 41 | 42 | #. Type: boolean 43 | #. Description 44 | #: ../templates/temp.image.plain/templates:2001 45 | msgid "" 46 | "You should abort the installation and fix the errors in depmod, or " 47 | "regenerate the initrd image with a known good modules.dep file. If you don't " 48 | "abort the installation, there is a danger that the system will fail to boot." 49 | msgstr "" 50 | 51 | #. Type: boolean 52 | #. Description 53 | #: ../templates/temp.image.plain/templates:3001 54 | msgid "Abort kernel removal?" 55 | msgstr "" 56 | 57 | #. Type: boolean 58 | #. Description 59 | #: ../templates/temp.image.plain/templates:3001 60 | msgid "" 61 | "You are running a kernel (version ${running}) and attempting to remove the " 62 | "same version." 63 | msgstr "" 64 | 65 | #. Type: boolean 66 | #. Description 67 | #: ../templates/temp.image.plain/templates:3001 68 | msgid "" 69 | "This can make the system unbootable as it will remove /boot/vmlinuz-" 70 | "${running} and all modules under the directory /lib/modules/${running}. This " 71 | "can only be fixed with a copy of the kernel image and the corresponding " 72 | "modules." 73 | msgstr "" 74 | 75 | #. Type: boolean 76 | #. Description 77 | #: ../templates/temp.image.plain/templates:3001 78 | msgid "" 79 | "It is highly recommended to abort the kernel removal unless you are prepared " 80 | "to fix the system after removal." 81 | msgstr "" 82 | 83 | #. Type: note 84 | #. Description 85 | #: ../templates/temp.image.plain/templates:4001 86 | msgid "Required firmware files may be missing" 87 | msgstr "" 88 | 89 | #. Type: note 90 | #. Description 91 | #: ../templates/temp.image.plain/templates:4001 92 | msgid "" 93 | "This system is currently running Linux ${runningversion} and you are " 94 | "installing Linux ${version}. In the new version some of the drivers used on " 95 | "this system may require additional firmware files:" 96 | msgstr "" 97 | 98 | #. Type: note 99 | #. Description 100 | #: ../templates/temp.image.plain/templates:4001 101 | msgid "" 102 | "Most firmware files are not included in the system because they do not " 103 | "conform to the Debian Free Software Guidelines. You may need to reconfigure " 104 | "the package manager to include the contrib and non-free sections of the " 105 | "package archive before you can install these firmware files." 106 | msgstr "" 107 | 108 | #. Type: error 109 | #. Description 110 | #: ../templates/temp.image.plain/templates:5001 111 | msgid "Ramdisk configuration must be updated" 112 | msgstr "" 113 | 114 | #. Type: error 115 | #. Description 116 | #: ../templates/temp.image.plain/templates:5001 117 | msgid "" 118 | "Kernel packages will no longer run a specific ramdisk creator. The ramdisk " 119 | "creator package must install a script in /etc/kernel/postinst.d, and you " 120 | "should remove the line beginning 'ramdisk =' from /etc/kernel-img.conf." 121 | msgstr "" 122 | -------------------------------------------------------------------------------- /scripts/debian/env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dir_script="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 4 | package_name='linux-liquorix' 5 | 6 | dir_base="${dir_script%/*/*}" 7 | dir_package="$dir_base/$package_name" 8 | dir_build="$dir_base/build" 9 | dir_scripts="$dir_base/scripts/debian" 10 | dir_artifacts="$dir_base/artifacts" 11 | 12 | version_package="$( head -n1 "$dir_package"/debian/changelog | grep -Po '\d+\.\d+-\d+' )" 13 | version_kernel="$( echo $version_package | grep -Po '\d+\.\d+' )" 14 | version_major="$( echo $version_kernel | sed -r 's/\..*//' )" 15 | version_build="1" 16 | 17 | package_source="${package_name}_${version_kernel}.orig.tar.xz" 18 | 19 | # Distribution and release to build source packages with. Normally defaulted 20 | # to Debian Sid since it normally tracks the latest upstream. 21 | source_arch='amd64' 22 | source_distro='debian' 23 | source_release='bookworm' 24 | 25 | # oldstable => bookworm, stable => trixie, testing => forky, unstable => sid 26 | releases_debian=('bookworm' 'trixie' 'forky' 'sid') 27 | releases_ubuntu=('jammy' 'noble' 'plucky' 'questing') 28 | mirror_debian='http://deb.debian.org/debian' 29 | mirror_ubuntu='http://archive.ubuntu.com/ubuntu' 30 | 31 | # Now that we're sure this system is compatible with the bootstrap script, lets 32 | # set all the variables needed to proceed. 33 | build_user="$(whoami)" 34 | build_base=$(grep -E "^${build_user}:" /etc/passwd | cut -f6 -d:) 35 | build_deps=( 36 | 'debhelper' 37 | 'devscripts' 38 | 'fakeroot' 39 | 'gcc' 40 | 'gzip' 41 | 'pigz' 42 | 'xz-utils' 43 | 'schedtool' 44 | ) 45 | 46 | schedtool='schedtool -D -n19 -e' 47 | 48 | # Common routine to get correct release version for Debian / Ubuntu 49 | function get_release_version { 50 | local distro="${1:-}" 51 | local release="${2:-}" 52 | local build="${3:-${version_build}}" 53 | 54 | declare version='' 55 | if [[ "$distro" == "ubuntu" ]]; then 56 | version="${version_package}ubuntu${build}~${release}" 57 | else 58 | version="${version_package}.${build}~${release}" 59 | fi 60 | 61 | echo "$version" 62 | } 63 | 64 | function prepare_env { 65 | echo "[INFO ] Preparing build directory: $dir_build" 66 | mkdir -p "$dir_build" 67 | if [[ -d "$dir_build/$package_name" ]]; then 68 | echo "[INFO ] Removing $dir_build/$package_name" 69 | rm -rf "$dir_build/$package_name" 70 | fi 71 | 72 | echo "[INFO ] Creating folder $package_name in $dir_build/" 73 | mkdir -pv "$dir_build/$package_name" 74 | 75 | echo "[INFO ] Copying $package_name/debian to $dir_build/$package_name/" 76 | cp -raf "$dir_package/debian" "$dir_build/$package_name/" 77 | 78 | # Fakeroot has a 15% chance of failing for a semop error in docker 79 | local maintainerclean='fakeroot debian/rules maintainerclean' 80 | if [[ "$(id -u)" == 0 ]]; then 81 | maintainerclean='debian/rules maintainerclean' 82 | fi 83 | cd "$dir_build/$package_name" 84 | 85 | echo "[INFO ] Running '$maintainerclean'" 86 | $maintainerclean 87 | 88 | if [[ ! -L "$dir_build/$package_source" ]]; then 89 | echo "[INFO ] Missing symlink: $dir_build/$package_source, creating" 90 | ln -sf "$dir_base/$package_source" "$dir_build/$package_source" 91 | fi 92 | 93 | echo "[INFO ] Unpacking kernel source into package folder." 94 | tar -xpf "$dir_base/$package_source" --strip-components=1 -C "$dir_build/$package_name" 95 | } 96 | 97 | function build_source_package { 98 | local release_name="$1" 99 | local release_version="$2" 100 | 101 | cd "$dir_build/$package_name" 102 | 103 | echo "[INFO ] Updating changelog to: $release_version" 104 | sed -r -i "1s/[^;]+(;.*)/$package_name ($release_version) $release_name\1/" debian/changelog 105 | 106 | echo "[INFO ] Cleaning package" 107 | 108 | local clean='fakeroot debian/rules clean' 109 | 110 | # Fakeroot has a 15% chance of failing for a semop error in docker 111 | if [[ "$(id -u)" == 0 ]]; then 112 | clean='debian/rules clean' 113 | fi 114 | 115 | $clean || $clean 116 | 117 | mk-build-deps -ir -t 'apt-get -y' 118 | 119 | EDITOR="cat" \ 120 | DPKG_SOURCE_COMMIT_MESSAGE="Automated changes through CI" \ 121 | DPKG_SOURCE_COMMIT_OPTIONS="--include-removal" \ 122 | dpkg-source --commit . ci.patch 123 | 124 | echo "[INFO ] Making source package" 125 | $schedtool dpkg-buildpackage --build=source 126 | } 127 | -------------------------------------------------------------------------------- /scripts/install-liquorix.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | log() { 6 | local level=$1 7 | local message=$2 8 | 9 | echo "" 10 | case "$level" in 11 | INFO) printf "\033[32m[INFO ] %s\033[0m\n" "$message" ;; # green 12 | WARN) printf "\033[33m[WARN ] %s\033[0m\n" "$message" ;; # yellow 13 | ERROR) printf "\033[31m[ERROR] %s\033[0m\n" "$message" ;; # red 14 | *) printf "[UNKNOWN] %s\n" "$message" ;; 15 | esac 16 | echo "" 17 | } 18 | 19 | if [ "$(id -u)" -ne 0 ]; then 20 | log ERROR "You must run this script as root!" 21 | exit 1 22 | fi 23 | 24 | if [ "$(uname -m)" != x86_64 ]; then 25 | log ERROR "Architecture not supported" 26 | exit 1 27 | fi 28 | 29 | export DEBIAN_FRONTEND="noninteractive" # `curl | sudo bash` suppresses stdin 30 | export NEEDRESTART_SUSPEND="*" # suspend needrestart or it will restart services automatically 31 | 32 | # Smash all possible distributions into one line 33 | dists="$( 34 | grep -P '^ID.*=' /etc/os-release | cut -f2 -d= | tr '\n' ' ' | 35 | tr '[:upper:]' '[:lower:]' | tr -dc '[:lower:] [:space:]' 36 | )" 37 | 38 | # Append upstream distributions through package manager landmarks 39 | command -v apt-get &> /dev/null && dists="$dists debian" 40 | command -v pacman &> /dev/null && dists="$dists arch" 41 | 42 | # Deduplicate and trim list of discovered distributions 43 | dists=$(echo "$dists" | tr '[:space:]' '\n' | sort | uniq | xargs) 44 | 45 | log INFO "Possible distributions: $dists" 46 | 47 | case "$dists" in 48 | *arch*) 49 | gpg_key='9AE4078033F8024D' 50 | sudo pacman-key --keyserver hkps://keyserver.ubuntu.com --recv-keys $gpg_key 51 | sudo pacman-key --lsign-key $gpg_key 52 | log INFO "Liquorix keyring added to pacman-key" 53 | 54 | repo_file='/etc/pacman.conf' 55 | if ! grep -q 'liquorix.net/archlinux' /etc/pacman.conf; then 56 | echo -e '\n[liquorix]\nServer = https://liquorix.net/archlinux/$repo/$arch' |\ 57 | sudo tee -a $repo_file 58 | log INFO "Liquorix repository added successfully to $repo_file" 59 | else 60 | log INFO "Liquorix repo already configured in $repo_file, skipped add step" 61 | fi 62 | 63 | if ! pacman -Q | grep -q linux-lqx; then 64 | sudo pacman -Sy --noconfirm linux-lqx linux-lqx-headers 65 | log INFO "Liquorix kernel installed successfully" 66 | else 67 | log INFO "Liquorix kernel already installed" 68 | fi 69 | 70 | grub_cfg='/boot/grub/grub.cfg' 71 | if [ -f "$grub_cfg" ]; then 72 | if sudo grub-mkconfig -o "$grub_cfg"; then 73 | log INFO "GRUB updated successfully" 74 | else 75 | log ERROR "GRUB update failed" 76 | fi 77 | fi 78 | ;; 79 | *ubuntu*) 80 | apt-get update && apt-get install -y --no-install-recommends \ 81 | gpg gpg-agent software-properties-common 82 | 83 | add-apt-repository -y ppa:damentz/liquorix &&\ 84 | apt-get update -y 85 | 86 | log INFO "Liquorix PPA repository added successfully" 87 | 88 | apt-get install -y linux-image-liquorix-amd64 linux-headers-liquorix-amd64 89 | 90 | log INFO "Liquorix kernel installed successfully" 91 | ;; 92 | *debian*) 93 | apt-get update && apt-get install -y --no-install-recommends \ 94 | curl gpg ca-certificates 95 | 96 | mkdir -p /etc/apt/{sources.list.d,keyrings} 97 | chmod 0755 /etc/apt/{sources.list.d,keyrings} 98 | 99 | keyring_url='https://liquorix.net/liquorix-keyring.gpg' 100 | keyring_path='/etc/apt/keyrings/liquorix-keyring.gpg' 101 | curl "$keyring_url" | gpg --batch --yes --output "$keyring_path" --dearmor 102 | chmod 0644 "$keyring_path" 103 | 104 | log INFO "Liquorix keyring added to $keyring_path" 105 | 106 | apt-get install apt-transport-https lsb-release -y 107 | 108 | repo_file="/etc/apt/sources.list.d/liquorix.list" 109 | repo_code="$( 110 | apt-cache policy | grep o=Debian | grep -Po 'n=\w+' | cut -f2 -d= |\ 111 | sort | uniq -c | sort | tail -n1 | awk '{print $2}' 112 | )" 113 | repo_line="[arch=amd64 signed-by=$keyring_path] https://liquorix.net/debian $repo_code main" 114 | echo "deb $repo_line" > $repo_file 115 | echo "deb-src $repo_line" >> $repo_file 116 | 117 | apt-get update -y 118 | 119 | log INFO "Liquorix repository added successfully to $repo_file" 120 | 121 | apt-get install -y linux-image-liquorix-amd64 linux-headers-liquorix-amd64 122 | 123 | log INFO "Liquorix kernel installed successfully" 124 | ;; 125 | *) 126 | log ERROR "This distribution is not supported at this time" 127 | exit 1 128 | ;; 129 | esac 130 | -------------------------------------------------------------------------------- /linux-liquorix/debian/patches/debian/version.patch: -------------------------------------------------------------------------------- 1 | From: Ben Hutchings 2 | Subject: Include package version along with kernel release in stack traces 3 | Date: Tue, 24 Jul 2012 03:13:10 +0100 4 | Forwarded: not-needed 5 | 6 | For distribution binary packages we assume 7 | $DISTRIBUTION_OFFICIAL_BUILD, $DISTRIBUTOR and $DISTRIBUTION_VERSION 8 | are set. 9 | --- 10 | Makefile | 16 +++++++++++++++- 11 | arch/powerpc/kernel/process.c | 6 ++++-- 12 | arch/x86/um/sysrq_64.c | 6 ++++-- 13 | kernel/hung_task.c | 6 ++++-- 14 | lib/dump_stack.c | 7 +++++-- 15 | 5 files changed, 32 insertions(+), 9 deletions(-) 16 | 17 | Index: linux-liquorix/Makefile 18 | =================================================================== 19 | --- linux-liquorix.orig/Makefile 20 | +++ linux-liquorix/Makefile 21 | @@ -1273,7 +1273,7 @@ PHONY += prepare archprepare 22 | archprepare: outputmakefile archheaders archscripts scripts include/config/kernel.release \ 23 | asm-generic $(version_h) include/generated/utsrelease.h \ 24 | include/generated/compile.h include/generated/autoconf.h \ 25 | - include/generated/rustc_cfg remove-stale-files 26 | + include/generated/rustc_cfg include/generated/package.h remove-stale-files 27 | 28 | prepare0: archprepare 29 | $(Q)$(MAKE) $(build)=scripts/mod 30 | @@ -1331,6 +1331,16 @@ define filechk_version.h 31 | echo \#define LINUX_VERSION_SUBLEVEL $(SUBLEVEL) 32 | endef 33 | 34 | +ifneq ($(DISTRIBUTION_OFFICIAL_BUILD),) 35 | +define filechk_package.h 36 | + echo \#define LINUX_PACKAGE_ID \" $(DISTRIBUTOR) $(DISTRIBUTION_VERSION)\" 37 | +endef 38 | +else 39 | +define filechk_package.h 40 | + echo \#define LINUX_PACKAGE_ID \"\" 41 | +endef 42 | +endif 43 | + 44 | $(version_h): private PATCHLEVEL := $(or $(PATCHLEVEL), 0) 45 | $(version_h): private SUBLEVEL := $(or $(SUBLEVEL), 0) 46 | $(version_h): FORCE 47 | @@ -1345,6 +1355,9 @@ filechk_compile.h = $(srctree)/scripts/m 48 | include/generated/compile.h: FORCE 49 | $(call filechk,compile.h) 50 | 51 | +include/generated/package.h: $(srctree)/Makefile FORCE 52 | + $(call filechk,package.h) 53 | + 54 | PHONY += headerdep 55 | headerdep: 56 | $(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \ 57 | Index: linux-liquorix/arch/powerpc/kernel/process.c 58 | =================================================================== 59 | --- linux-liquorix.orig/arch/powerpc/kernel/process.c 60 | +++ linux-liquorix/arch/powerpc/kernel/process.c 61 | @@ -38,6 +38,7 @@ 62 | #include 63 | #include 64 | #include 65 | +#include 66 | 67 | #include 68 | #include 69 | @@ -1560,8 +1561,9 @@ static void __show_regs(struct pt_regs * 70 | 71 | printk("NIP: "REG" LR: "REG" CTR: "REG"\n", 72 | regs->nip, regs->link, regs->ctr); 73 | - printk("REGS: %px TRAP: %04lx %s (%s)\n", 74 | - regs, regs->trap, print_tainted(), init_utsname()->release); 75 | + printk("REGS: %px TRAP: %04lx %s (%s%s)\n", 76 | + regs, regs->trap, print_tainted(), init_utsname()->release, 77 | + LINUX_PACKAGE_ID); 78 | printk("MSR: "REG" ", regs->msr); 79 | print_msr_bits(regs->msr); 80 | pr_cont(" CR: %08lx XER: %08lx\n", regs->ccr, regs->xer); 81 | Index: linux-liquorix/arch/x86/um/sysrq_64.c 82 | =================================================================== 83 | --- linux-liquorix.orig/arch/x86/um/sysrq_64.c 84 | +++ linux-liquorix/arch/x86/um/sysrq_64.c 85 | @@ -10,6 +10,7 @@ 86 | #include 87 | #include 88 | #include 89 | +#include 90 | #include 91 | #include 92 | 93 | @@ -17,8 +18,9 @@ void show_regs(struct pt_regs *regs) 94 | { 95 | printk("\n"); 96 | print_modules(); 97 | - printk(KERN_INFO "Pid: %d, comm: %.20s %s %s\n", task_pid_nr(current), 98 | - current->comm, print_tainted(), init_utsname()->release); 99 | + printk(KERN_INFO "Pid: %d, comm: %.20s %s %s%s\n", task_pid_nr(current), 100 | + current->comm, print_tainted(), init_utsname()->release, 101 | + LINUX_PACKAGE_ID); 102 | printk(KERN_INFO "RIP: %04lx:%pS\n", PT_REGS_CS(regs) & 0xffff, 103 | (void *)PT_REGS_IP(regs)); 104 | printk(KERN_INFO "RSP: %016lx EFLAGS: %08lx\n", PT_REGS_SP(regs), 105 | Index: linux-liquorix/kernel/hung_task.c 106 | =================================================================== 107 | --- linux-liquorix.orig/kernel/hung_task.c 108 | +++ linux-liquorix/kernel/hung_task.c 109 | @@ -25,6 +25,7 @@ 110 | #include 111 | #include 112 | 113 | +#include 114 | #include 115 | 116 | /* 117 | @@ -234,10 +235,11 @@ static void check_hung_task(struct task_ 118 | sysctl_hung_task_warnings--; 119 | pr_err("INFO: task %s:%d blocked for more than %ld seconds.\n", 120 | t->comm, t->pid, (jiffies - t->last_switch_time) / HZ); 121 | - pr_err(" %s %s %.*s\n", 122 | + pr_err(" %s %s %.*s%s\n", 123 | print_tainted(), init_utsname()->release, 124 | (int)strcspn(init_utsname()->version, " "), 125 | - init_utsname()->version); 126 | + init_utsname()->version, 127 | + LINUX_PACKAGE_ID); 128 | if (t->flags & PF_POSTCOREDUMP) 129 | pr_err(" Blocked by coredump.\n"); 130 | pr_err("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\"" 131 | Index: linux-liquorix/lib/dump_stack.c 132 | =================================================================== 133 | --- linux-liquorix.orig/lib/dump_stack.c 134 | +++ linux-liquorix/lib/dump_stack.c 135 | @@ -14,6 +14,7 @@ 136 | #include 137 | #include 138 | #include 139 | +#include 140 | 141 | static char dump_stack_arch_desc_str[128]; 142 | 143 | @@ -54,7 +55,7 @@ void __init dump_stack_set_arch_desc(con 144 | */ 145 | void dump_stack_print_info(const char *log_lvl) 146 | { 147 | - printk("%sCPU: %d UID: %u PID: %d Comm: %.20s %s%s %s %.*s %s " BUILD_ID_FMT "\n", 148 | + printk("%sCPU: %d UID: %u PID: %d Comm: %.20s %s%s %s %.*s %s %s " BUILD_ID_FMT "\n", 149 | log_lvl, raw_smp_processor_id(), 150 | __kuid_val(current_real_cred()->euid), 151 | current->pid, current->comm, 152 | @@ -62,7 +63,9 @@ void dump_stack_print_info(const char *l 153 | print_tainted(), 154 | init_utsname()->release, 155 | (int)strcspn(init_utsname()->version, " "), 156 | - init_utsname()->version, preempt_model_str(), BUILD_ID_VAL); 157 | + init_utsname()->version, preempt_model_str(), 158 | + LINUX_PACKAGE_ID, 159 | + BUILD_ID_VAL); 160 | 161 | if (get_taint()) 162 | printk("%s%s\n", log_lvl, print_tainted_verbose()); 163 | -------------------------------------------------------------------------------- /linux-liquorix/debian/lib/python/debian_linux/config.py: -------------------------------------------------------------------------------- 1 | import collections 2 | import os 3 | import os.path 4 | import pickle 5 | import re 6 | import sys 7 | 8 | from configparser import RawConfigParser 9 | 10 | __all__ = [ 11 | "ConfigCoreDump", 12 | "ConfigCoreHierarchy", 13 | "ConfigParser", 14 | ] 15 | 16 | 17 | class SchemaItemBoolean(object): 18 | def __call__(self, i): 19 | i = i.strip().lower() 20 | if i in ("true", "1"): 21 | return True 22 | if i in ("false", "0"): 23 | return False 24 | raise ValueError 25 | 26 | 27 | class SchemaItemInteger(object): 28 | def __call__(self, i): 29 | return int(i.strip(), 0) 30 | 31 | 32 | class SchemaItemList(object): 33 | def __init__(self, type=r"\s+"): 34 | self.type = type 35 | 36 | def __call__(self, i): 37 | i = i.strip() 38 | if not i: 39 | return [] 40 | return [j.strip() for j in re.split(self.type, i)] 41 | 42 | 43 | # Using OrderedDict instead of dict makes the pickled config reproducible 44 | class ConfigCore(collections.OrderedDict): 45 | def get_merge(self, section, arch, featureset, flavour, key, default=None): 46 | temp = [] 47 | 48 | if arch and featureset and flavour: 49 | temp.append(self.get((section, arch, featureset, flavour), {}).get(key)) 50 | temp.append(self.get((section, arch, None, flavour), {}).get(key)) 51 | if arch and featureset: 52 | temp.append(self.get((section, arch, featureset), {}).get(key)) 53 | if arch: 54 | temp.append(self.get((section, arch), {}).get(key)) 55 | if featureset: 56 | temp.append(self.get((section, None, featureset), {}).get(key)) 57 | temp.append(self.get((section,), {}).get(key)) 58 | 59 | ret = [] 60 | 61 | for i in temp: 62 | if i is None: 63 | continue 64 | elif isinstance(i, (list, tuple)): 65 | ret.extend(i) 66 | elif ret: 67 | # TODO 68 | return ret 69 | else: 70 | return i 71 | 72 | return ret or default 73 | 74 | def merge(self, section, arch=None, featureset=None, flavour=None): 75 | ret = {} 76 | ret.update(self.get((section,), {})) 77 | if featureset: 78 | ret.update(self.get((section, None, featureset), {})) 79 | if arch: 80 | ret.update(self.get((section, arch), {})) 81 | if arch and featureset: 82 | ret.update(self.get((section, arch, featureset), {})) 83 | if arch and featureset and flavour: 84 | ret.update(self.get((section, arch, None, flavour), {})) 85 | ret.update(self.get((section, arch, featureset, flavour), {})) 86 | return ret 87 | 88 | def dump(self, fp): 89 | pickle.dump(self, fp, 0) 90 | 91 | 92 | class ConfigCoreDump(object): 93 | def __new__(self, fp): 94 | return pickle.load(fp) 95 | 96 | 97 | class ConfigCoreHierarchy(object): 98 | schema_base = { 99 | "base": { 100 | "arches": SchemaItemList(), 101 | "enabled": SchemaItemBoolean(), 102 | "featuresets": SchemaItemList(), 103 | "flavours": SchemaItemList(), 104 | }, 105 | } 106 | 107 | def __new__(cls, schema, dirs=[]): 108 | schema_complete = cls.schema_base.copy() 109 | for key, value in schema.items(): 110 | schema_complete.setdefault(key, {}).update(value) 111 | return cls.Reader(dirs, schema_complete)() 112 | 113 | class Reader(object): 114 | config_name = "defines" 115 | 116 | def __init__(self, dirs, schema): 117 | self.dirs, self.schema = dirs, schema 118 | 119 | def __call__(self): 120 | ret = ConfigCore() 121 | self.read(ret) 122 | return ret 123 | 124 | def get_files(self, *dirs): 125 | dirs = list(dirs) 126 | dirs.append(self.config_name) 127 | return (os.path.join(i, *dirs) for i in self.dirs if i) 128 | 129 | def read_arch(self, ret, arch): 130 | config = ConfigParser(self.schema) 131 | config.read(self.get_files(arch)) 132 | 133 | featuresets = config["base",].get("featuresets", []) 134 | flavours = config["base",].get("flavours", []) 135 | 136 | for section in iter(config): 137 | if section[0] in featuresets: 138 | real = (section[-1], arch, section[0]) 139 | elif len(section) > 1: 140 | real = (section[-1], arch, None) + section[:-1] 141 | else: 142 | real = (section[-1], arch) + section[:-1] 143 | s = ret.get(real, {}) 144 | s.update(config[section]) 145 | ret[tuple(real)] = s 146 | 147 | for featureset in featuresets: 148 | self.read_arch_featureset(ret, arch, featureset) 149 | 150 | if flavours: 151 | base = ret["base", arch] 152 | featuresets.insert(0, "none") 153 | base["featuresets"] = featuresets 154 | del base["flavours"] 155 | ret["base", arch] = base 156 | ret["base", arch, "none"] = { 157 | "flavours": flavours, 158 | "implicit-flavour": True, 159 | } 160 | 161 | def read_arch_featureset(self, ret, arch, featureset): 162 | config = ConfigParser(self.schema) 163 | config.read(self.get_files(arch, featureset)) 164 | 165 | for section in iter(config): 166 | real = (section[-1], arch, featureset) + section[:-1] 167 | s = ret.get(real, {}) 168 | s.update(config[section]) 169 | ret[tuple(real)] = s 170 | 171 | def read(self, ret): 172 | config = ConfigParser(self.schema) 173 | config.read(self.get_files()) 174 | 175 | arches = config["base",]["arches"] 176 | featuresets = config["base",].get("featuresets", []) 177 | 178 | for section in iter(config): 179 | if section[0].startswith("featureset-"): 180 | real = (section[-1], None, section[0][11:]) 181 | else: 182 | real = (section[-1],) + section[1:] 183 | ret[real] = config[section] 184 | 185 | for arch in arches: 186 | self.read_arch(ret, arch) 187 | for featureset in featuresets: 188 | self.read_featureset(ret, featureset) 189 | 190 | def read_featureset(self, ret, featureset): 191 | config = ConfigParser(self.schema) 192 | config.read(self.get_files("featureset-%s" % featureset)) 193 | 194 | for section in iter(config): 195 | real = (section[-1], None, featureset) 196 | s = ret.get(real, {}) 197 | s.update(config[section]) 198 | ret[real] = s 199 | 200 | 201 | class ConfigParser(object): 202 | __slots__ = "_config", "schemas" 203 | 204 | def __init__(self, schemas): 205 | self.schemas = schemas 206 | 207 | self._config = RawConfigParser() 208 | 209 | def __getitem__(self, key): 210 | return self._convert()[key] 211 | 212 | def __iter__(self): 213 | return iter(self._convert()) 214 | 215 | def __str__(self): 216 | return "<%s(%s)>" % (self.__class__.__name__, self._convert()) 217 | 218 | def _convert(self): 219 | ret = {} 220 | for section in self._config.sections(): 221 | data = {} 222 | for key, value in self._config.items(section): 223 | data[key] = value 224 | section_list = section.split("_") 225 | section_base = section_list[-1] 226 | if section_base in self.schemas: 227 | section_ret = tuple(section_list) 228 | data = self._convert_one(self.schemas[section_base], data) 229 | else: 230 | section_ret = (section,) 231 | ret[section_ret] = data 232 | return ret 233 | 234 | def _convert_one(self, schema, data): 235 | ret = {} 236 | for key, value in data.items(): 237 | if key in schema: 238 | value = schema[key](value) 239 | ret[key] = value 240 | return ret 241 | 242 | def keys(self): 243 | return self._convert().keys() 244 | 245 | def read(self, data): 246 | return self._config.read(data) 247 | 248 | 249 | if __name__ == "__main__": 250 | sys.path.append("debian/lib/python") 251 | config = ConfigCoreDump(open("debian/config.defines.dump", "rb")) 252 | for section, items in sorted( 253 | config.items(), key=(lambda a: tuple(i or "" for i in a[0])) 254 | ): 255 | print("[%s]" % (section,)) 256 | for item, value in sorted(items.items()): 257 | print("%s: %s" % (item, value)) 258 | print() 259 | -------------------------------------------------------------------------------- /linux-liquorix/debian/rules.real: -------------------------------------------------------------------------------- 1 | # 2 | # This Makefile executes the unpack/build/binary targets for a single 3 | # subarch, which is passed in the subarch variable. Empty subarch 4 | # variable means that we are building for an arch without the subarch. 5 | # Additionally, variables version, abiname and ltver are 6 | # expected to be available (need to be exported from the parent process). 7 | # 8 | SHELL := bash -e 9 | MAINTAINER := $(shell sed -ne 's,^Maintainer: .[^<]*<\([^>]*\)>,\1,p' debian/control) 10 | DISTRIBUTION := $(shell dpkg-parsechangelog -SDistribution) 11 | SOURCE_DATE := $(shell dpkg-parsechangelog -SDate) 12 | SOURCE_DATE_UTC_ISO := $(shell date -u -d '$(SOURCE_DATE)' +%Y-%m-%d) 13 | DEB_BUILD_OPTIONS := noddebs 14 | 15 | DISTRIBUTOR := $(shell lsb_release -is 2>/dev/null) 16 | ifeq ($(DISTRIBUTOR),) 17 | DISTRIBUTOR := Debian 18 | endif 19 | 20 | ifdef OVERRIDE_HOST_TYPE 21 | CROSS_COMPILE := $(OVERRIDE_HOST_TYPE)- 22 | else ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) 23 | CROSS_COMPILE := $(DEB_HOST_GNU_TYPE)- 24 | else 25 | CROSS_COMPILE := 26 | endif 27 | 28 | export PYTHONPATH = $(CURDIR)/debian/lib/python 29 | export DH_OPTIONS 30 | export DEB_HOST_ARCH DEB_HOST_GNU_TYPE DEB_BUILD_ARCH 31 | export LC_ALL = C.UTF-8 32 | 33 | include debian/rules.defs 34 | 35 | stamp = [ -d $(dir $@) ] || mkdir $(dir $@); touch $@ 36 | 37 | setup_env := env -u ABINAME -u ARCH -u FEATURESET -u FLAVOUR -u VERSION -u LOCALVERSION 38 | setup_env += DISTRIBUTION_OFFICIAL_BUILD=1 DISTRIBUTOR="$(DISTRIBUTOR)" DISTRIBUTION_VERSION="$(SOURCEVERSION)" KBUILD_BUILD_TIMESTAMP="$(DISTRIBUTOR) $(SOURCEVERSION) ($(SOURCE_DATE_UTC_ISO))" KBUILD_BUILD_USER="$(word 1,$(subst @, ,$(MAINTAINER)))" KBUILD_BUILD_HOST="$(word 2,$(subst @, ,$(MAINTAINER)))" 39 | 40 | MAKE_CLEAN = $(setup_env) $(MAKE) 41 | MAKE_SELF := $(MAKE) -f debian/rules.real $(MAKEOVERRIDES) 42 | MAKEOVERRIDES = 43 | 44 | TOOLS = tools/objtool \ 45 | tools/perf \ 46 | tools/power/cpupower \ 47 | tools/power/x86/turbostat \ 48 | tools/power/x86/x86_energy_perf_policy 49 | 50 | # 51 | # Targets 52 | # 53 | binary-arch-flavour: install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 54 | ifeq ($(DEBUG),True) 55 | binary-arch-flavour: install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 56 | endif 57 | binary-arch-flavour: install-image-meta_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 58 | binary-arch-flavour: install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 59 | binary-arch-flavour: install-headers-meta_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 60 | 61 | binary-indep: 62 | 63 | build-arch-flavour: $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 64 | build-indep: 65 | 66 | setup-arch-flavour: $(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 67 | 68 | source-featureset: $(STAMPS_DIR)/source_$(FEATURESET) 69 | 70 | $(BUILD_DIR)/config.$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(KCONFIG) 71 | mkdir -p '$(dir $@)' 72 | debian/bin/kconfig.py '$@' $(KCONFIG) $(KCONFIG_OPTIONS) 73 | 74 | define copy_source 75 | mkdir -p '$(1)' 76 | cp -al $(filter-out debian .pc .svk .svn .git, $(wildcard * .[^.]*)) '$(1)' 77 | endef 78 | 79 | $(STAMPS_DIR)/source: 80 | @$(stamp) 81 | 82 | $(STAMPS_DIR)/source_%: SOURCE_DIR=$(BUILD_DIR)/source 83 | $(STAMPS_DIR)/source_%: DIR=$(BUILD_DIR)/source_$* 84 | $(STAMPS_DIR)/source_%: $(STAMPS_DIR)/source 85 | mkdir -p '$(BUILD_DIR)' 86 | rm -rf '$(DIR)' 87 | $(call copy_source,$(DIR)) 88 | @$(stamp) 89 | .PRECIOUS: $(STAMPS_DIR)/source_% 90 | 91 | $(STAMPS_DIR)/source_none: DIR=$(BUILD_DIR)/source_none 92 | $(STAMPS_DIR)/source_none: $(STAMPS_DIR)/source 93 | mkdir -p '$(BUILD_DIR)' 94 | rm -f '$(DIR)' 95 | ln -s '$(CURDIR)' '$(DIR)' 96 | @$(stamp) 97 | 98 | $(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR): CONFIG=$(BUILD_DIR)/config.$(ARCH)_$(FEATURESET)_$(FLAVOUR) 99 | $(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR): SOURCE_DIR=$(BUILD_DIR)/source_$(FEATURESET) 100 | $(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DIR=$(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 101 | $(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(STAMPS_DIR)/source_$(FEATURESET) $(BUILD_DIR)/config.$(ARCH)_$(FEATURESET)_$(FLAVOUR) 102 | rm -rf '$(DIR)' 103 | mkdir '$(DIR)' 104 | 105 | @for tool in ${TOOLS}; do \ 106 | mkdir $(DIR)/$${tool} -pv; \ 107 | done 108 | 109 | # cpupower requires custom lib folder when built statically 110 | mkdir $(DIR)/tools/power/lib 111 | 112 | cp '$(CONFIG)' '$(DIR)/.config' 113 | echo 'override ARCH = $(KERNEL_ARCH)' >> '$(DIR)/.kernelvariables' 114 | echo 'override KERNELRELEASE = $(ABINAME)$(LOCALVERSION_IMAGE)' >> '$(DIR)/.kernelvariables' 115 | echo 'CCACHE = ccache' >> '$(DIR)/.kernelvariables' 116 | echo 'CC = $$(if $$(DEBIAN_KERNEL_USE_CCACHE),$$(CCACHE)) $$(CROSS_COMPILE)$(COMPILER)' >> '$(DIR)/.kernelvariables' 117 | # TODO: Should we set CROSS_COMPILE always? 118 | ifdef OVERRIDE_HOST_TYPE 119 | echo 'override CROSS_COMPILE = $(OVERRIDE_HOST_TYPE)-' >> '$(DIR)/.kernelvariables' 120 | else 121 | echo 'ifneq ($$(DEB_BUILD_ARCH),$$(DEB_HOST_ARCH))' >> '$(DIR)/.kernelvariables' 122 | echo 'override CROSS_COMPILE = $$(DEB_HOST_GNU_TYPE)-' >> '$(DIR)/.kernelvariables' 123 | echo 'endif' >> '$(DIR)/.kernelvariables' 124 | endif 125 | ifdef CFLAGS_KERNEL 126 | echo 'CFLAGS_KERNEL += $(CFLAGS_KERNEL)' >> '$(DIR)/.kernelvariables' 127 | echo 'CFLAGS_MODULE += $(CFLAGS_KERNEL)' >> '$(DIR)/.kernelvariables' 128 | endif 129 | +$(MAKE_CLEAN) -C '$(SOURCE_DIR)' O='$(CURDIR)/$(DIR)' listnewconfig 130 | +$(MAKE_CLEAN) -C '$(SOURCE_DIR)' O='$(CURDIR)/$(DIR)' olddefconfig 131 | @$(stamp) 132 | 133 | $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DIR=$(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 134 | $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 135 | 136 | $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR): 137 | +$(MAKE_CLEAN) -C '$(DIR)/source/tools/perf' O='$(CURDIR)/$(DIR)/tools/perf' WERROR=0 138 | +$(MAKE_CLEAN) -C '$(DIR)/source/tools/power/cpupower' O='$(CURDIR)/$(DIR)/tools/power/cpupower' STATIC='true' 139 | +$(MAKE_CLEAN) -C '$(DIR)/source/tools/power/x86/turbostat' O='$(CURDIR)/$(DIR)/tools/power/x86/turbostat' 140 | +$(MAKE_CLEAN) -C '$(DIR)/source/tools/power/x86/x86_energy_perf_policy' O='$(CURDIR)/$(DIR)/tools/power/x86/x86_energy_perf_policy' 141 | +$(MAKE_CLEAN) -C '$(DIR)' $(BUILD_TARGET) 142 | 143 | mkdir -p $(DIR)/tools/bpf/bpftool 144 | +$(MAKE_CLEAN) -C '$(DIR)/source/tools/bpf/bpftool' O=$(DIR)/tools/bpf/bpftool CROSS_COMPILE= FEATURE_TESTS= FEATURE_DISPLAY= 145 | 146 | if grep -q CONFIG_DEBUG_INFO_BTF=y $(DIR)/.config; then \ 147 | $(DIR)/tools/bpf/bpftool/bpftool btf dump file $(DIR)/vmlinux format c > $(DIR)/vmlinux.h; \ 148 | else \ 149 | echo '#error "Kernel build without CONFIG_DEBUG_INFO_BTF, no type info available"' > $(DIR)/vmlinux.h; \ 150 | fi 151 | 152 | @$(stamp) 153 | 154 | install-base: 155 | dh_installdocs 156 | dh_installchangelogs 157 | dh_strip 158 | dh_compress 159 | dh_fixperms 160 | dh_strip 161 | dh_shlibdeps 162 | dh_installdeb 163 | dh_gencontrol -- $(GENCONTROL_ARGS) 164 | dh_md5sums 165 | dh_builddeb -- -Zxz $(BUILDDEB_ARGS) 166 | 167 | install-dummy: 168 | dh_testdir 169 | dh_testroot 170 | dh_prep 171 | +$(MAKE_SELF) install-base 172 | 173 | install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): REAL_VERSION = $(ABINAME)$(LOCALVERSION) 174 | install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_NAME = linux-headers-$(REAL_VERSION) 175 | install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DH_OPTIONS = -p$(PACKAGE_NAME) 176 | install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): BASE_DIR = /usr/src/$(PACKAGE_NAME) 177 | install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): IMAGE_BUILD_DIR = $(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 178 | install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): SOURCE_DIR = $(BUILD_DIR)/source_$(FEATURESET) 179 | install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): REF_DIR = $(BUILD_DIR)/source_$(FEATURESET) 180 | install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_DIR = debian/$(PACKAGE_NAME) 181 | install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DIR = $(PACKAGE_DIR)/$(BASE_DIR) 182 | install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 183 | dh_testdir 184 | dh_testroot 185 | dh_prep 186 | 187 | mkdir -p $(DIR)/arch/$(KERNEL_ARCH)/kernel 188 | mkdir -p $(DIR)/include 189 | cp -a $(IMAGE_BUILD_DIR)/.config $(DIR) 190 | cp -a $(IMAGE_BUILD_DIR)/.kernel* $(DIR) 191 | cp -a $(IMAGE_BUILD_DIR)/Module.symvers $(DIR) 192 | cp -a $(IMAGE_BUILD_DIR)/vmlinux.h $(DIR) 193 | 194 | set -o pipefail; \ 195 | cd $(SOURCE_DIR); \ 196 | ( \ 197 | find . \ 198 | -path './.git' -prune \ 199 | -o -path './.pc' -prune \ 200 | -o -path '*.gitignore' -prune \ 201 | -o -path '*.svn' -prune \ 202 | -o -path '.*.cmd' -prune \ 203 | -o -path './Documentation/*' -prune \ 204 | -o -path './arch/*' -prune \ 205 | -o -path './debian/*' -prune \ 206 | -o -path './include/asm*' -prune \ 207 | -o -path './scripts/*' -print \ 208 | -o -path './include/*' -print \ 209 | -o \( \ 210 | -name 'Makefile*' \ 211 | -o -name 'Kconfig*' \ 212 | -o -name 'Rules.make' \ 213 | \) -print; \ 214 | find include/asm-generic -print; \ 215 | for i in $(KERNEL_ARCH); do \ 216 | find arch/$$i \ 217 | \( \ 218 | -name 'Makefile*' \ 219 | -o -name 'Kconfig*' \ 220 | -o -name 'Rules.make' \ 221 | -o -name 'module.lds' \ 222 | -o -name 'Kbuild.platforms' \ 223 | -o -name 'Platform' \ 224 | \) -print; \ 225 | done; \ 226 | ) | cpio -pd --preserve-modification-time '$(CURDIR)/$(DIR)' 227 | 228 | set -o pipefail; \ 229 | cd $(IMAGE_BUILD_DIR); \ 230 | ( \ 231 | find . \ 232 | -path './.git' -prune \ 233 | -o -path './.pc' -prune \ 234 | -o -path '*.gitignore' -prune \ 235 | -o -path '*.svn' -prune \ 236 | -o -path '.*.cmd' -prune \ 237 | -o -path './scripts/*' -print \ 238 | -o -path './include/*' -print \ 239 | -o \( \ 240 | -name 'Makefile*' \ 241 | -o -name 'Kconfig*' \ 242 | -o -name 'Rules.make' \ 243 | \) -print; \ 244 | ) | cpio -pd --preserve-modification-time '$(CURDIR)/$(DIR)' 245 | 246 | find $(DIR)/scripts -type f -name \*\\.o -delete || : 247 | cp -a $(SOURCE_DIR)/arch/$(KERNEL_ARCH)/include $(DIR)/arch/$(KERNEL_ARCH)/ 248 | cp -a $(SOURCE_DIR)/Makefile $(DIR)/ 249 | cp -a $(IMAGE_BUILD_DIR)/arch/$(KERNEL_ARCH)/kernel/asm-offsets.s $(DIR)/arch/$(KERNEL_ARCH)/kernel/ 250 | mkdir -p $(DIR)/arch/$(KERNEL_ARCH)/include/generated/asm/ 251 | cp -a $(IMAGE_BUILD_DIR)/arch/$(KERNEL_ARCH)/include/generated/asm/*.h $(DIR)/arch/$(KERNEL_ARCH)/include/generated/asm/ 252 | mkdir -p $(DIR)/arch/$(KERNEL_ARCH)/include/generated/uapi/asm/ 253 | cp -a $(IMAGE_BUILD_DIR)/arch/$(KERNEL_ARCH)/include/generated/uapi/asm/*.h $(DIR)/arch/$(KERNEL_ARCH)/include/generated/uapi/asm/ 254 | cp -a $(SOURCE_DIR)/arch/Kconfig $(DIR)/arch/ 255 | 256 | @for tool in ${TOOLS}; do \ 257 | mkdir -pv $(DIR)/build/$${tool}; \ 258 | cp -arv $(IMAGE_BUILD_DIR)/$${tool}/* $(DIR)/$${tool}/; \ 259 | find $(DIR)/$${tool}/ -type f -name '*.o' | xargs rm -fv; \ 260 | find $(DIR)/$${tool}/ -type f -name '.*' | xargs rm -fv; \ 261 | done 262 | 263 | mkdir -p $(PACKAGE_DIR)/lib/modules/$(REAL_VERSION) 264 | ln -s /usr/src/$(PACKAGE_NAME) $(PACKAGE_DIR)/lib/modules/$(REAL_VERSION)/build 265 | 266 | +$(MAKE_SELF) install-base 267 | 268 | install-image-meta_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_NAME = linux-image-$(FLAVOUR) 269 | install-image-meta_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DH_OPTIONS = -p$(PACKAGE_NAME) 270 | install-image-meta_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_DIR = debian/$(PACKAGE_NAME) 271 | install-image-meta_$(ARCH)_$(FEATURESET)_$(FLAVOUR): 272 | dh_testdir 273 | dh_testroot 274 | dh_prep 275 | +$(MAKE_SELF) install-base 276 | 277 | install-headers-meta_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_NAME = linux-headers-$(FLAVOUR) 278 | install-headers-meta_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DH_OPTIONS = -p$(PACKAGE_NAME) 279 | install-headers-meta_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_DIR = debian/$(PACKAGE_NAME) 280 | install-headers-meta_$(ARCH)_$(FEATURESET)_$(FLAVOUR): 281 | dh_testdir 282 | dh_testroot 283 | dh_prep 284 | +$(MAKE_SELF) install-base 285 | 286 | install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR): REAL_VERSION = $(ABINAME)$(LOCALVERSION) 287 | install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_NAME = linux-image-$(REAL_VERSION) 288 | install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_DIR = debian/$(PACKAGE_NAME) 289 | install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR): INSTALL_DIR = $(PACKAGE_DIR)/boot 290 | install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DIR = $(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 291 | install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DH_OPTIONS = -p$(PACKAGE_NAME) 292 | install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 293 | 294 | install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR): 295 | dh_testdir 296 | dh_testroot 297 | dh_prep 298 | dh_installdirs 'boot' 299 | install -m644 '$(DIR)/$(IMAGE_FILE)' $(INSTALL_DIR)/$(IMAGE_INSTALL_STEM)-$(REAL_VERSION) 300 | +$(MAKE_SELF) \ 301 | install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_dt \ 302 | DIR='$(DIR)' PACKAGE_DIR='$(PACKAGE_DIR)' REAL_VERSION='$(REAL_VERSION)' 303 | +$(MAKE_CLEAN) -C $(DIR) modules_install DEPMOD='$(CURDIR)/debian/bin/no-depmod' INSTALL_MOD_PATH='$(CURDIR)'/$(PACKAGE_DIR) INSTALL_MOD_STRIP=1 304 | ifeq ($(DEBUG),True) 305 | set -o pipefail; \ 306 | find $(PACKAGE_DIR) -name '*.ko' | sed 's|$(PACKAGE_DIR)/lib/modules/$(REAL_VERSION)/kernel/||' | while read module ; do \ 307 | $(CROSS_COMPILE)objcopy --add-gnu-debuglink=$(DIR)/$$module $(PACKAGE_DIR)/lib/modules/$(REAL_VERSION)/kernel/$$module || exit; \ 308 | done 309 | endif 310 | cp $(DIR)/.config $(PACKAGE_DIR)/boot/config-$(REAL_VERSION) 311 | cp $(DIR)/System.map $(PACKAGE_DIR)/boot/System.map-$(REAL_VERSION) 312 | rm -f $(PACKAGE_DIR)/lib/modules/$(REAL_VERSION)/build 313 | rm -f $(PACKAGE_DIR)/lib/modules/$(REAL_VERSION)/source 314 | rm $(PACKAGE_DIR)/lib/firmware -rf 315 | dh_installdebconf 316 | +$(MAKE_SELF) \ 317 | install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_bug \ 318 | PACKAGE_DIR='$(PACKAGE_DIR)' PACKAGE_NAME='$(PACKAGE_NAME)' REAL_VERSION='$(REAL_VERSION)' 319 | +$(MAKE_SELF) install-base GENCONTROL_ARGS='-Vkernel:Recommends='"$$( \ 320 | if grep -q '^CONFIG_SMP=y' $(DIR)/.config; then \ 321 | printf irqbalance,; \ 322 | fi)" 323 | 324 | install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_dt: DT_INSTALL_DIR = $(PACKAGE_DIR)/usr/lib/linux-image-$(REAL_VERSION) 325 | install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_dt: 326 | ifneq ($(filter arm64 armel armhf,$(ARCH)),) 327 | +$(MAKE_CLEAN) -C $(DIR) dtbs 328 | +$(MAKE_CLEAN) -C $(DIR) dtbs_install INSTALL_DTBS_PATH=$(CURDIR)/$(DT_INSTALL_DIR) 329 | endif 330 | 331 | install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_bug: 332 | dh_installdirs usr/share/bug/$(PACKAGE_NAME) 333 | dh_install debian/templates/image.bug/* usr/share/bug/$(PACKAGE_NAME) 334 | chmod 755 $(PACKAGE_DIR)/usr/share/bug/$(PACKAGE_NAME)/script 335 | printf "RELEASE='$(REAL_VERSION)'\nDISTRIBUTOR='$(DISTRIBUTOR)'\nSOURCEVERSION='$(SOURCEVERSION)'\nPACKAGE_NAME='$(PACKAGE_NAME)'\nPACKAGE_VERSION='$(SOURCEVERSION)'" > $(PACKAGE_DIR)/usr/share/bug/$(PACKAGE_NAME)/info 336 | 337 | install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): REAL_VERSION = $(ABINAME)$(LOCALVERSION) 338 | install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_NAME = linux-image-$(REAL_VERSION)-dbgsym 339 | install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): PACKAGE_DIR = debian/$(PACKAGE_NAME) 340 | install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DEBUG_DIR = $(PACKAGE_DIR)/usr/lib/debug 341 | install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DIR = $(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 342 | install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): DH_OPTIONS = -p$(PACKAGE_NAME) 343 | install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR) 344 | dh_testdir 345 | dh_testroot 346 | dh_prep 347 | dh_installdirs usr/lib/debug usr/lib/debug/boot usr/share/lintian/overrides/ 348 | dh_lintian 349 | install -m644 $(DIR)/vmlinux $(DEBUG_DIR)/boot/vmlinux-$(REAL_VERSION) 350 | +$(MAKE_CLEAN) -C $(DIR) modules_install DEPMOD='$(CURDIR)/debian/bin/no-depmod' INSTALL_MOD_PATH='$(CURDIR)'/$(DEBUG_DIR) 351 | find $(DEBUG_DIR)/lib/modules/$(REAL_VERSION)/ -mindepth 1 -maxdepth 1 \! -name kernel -exec rm {} \+ 352 | rm $(DEBUG_DIR)/lib/firmware -rf 353 | # Add symlinks to vmlinux from the locations expected by kdump-tools, 354 | # systemtap and others 355 | ln -s boot/vmlinux-$(REAL_VERSION) $(DEBUG_DIR)/ 356 | mkdir -p $(DEBUG_DIR)/lib/modules/$(REAL_VERSION) 357 | ln -s ../../../boot/vmlinux-$(REAL_VERSION) $(DEBUG_DIR)/lib/modules/$(REAL_VERSION)/vmlinux 358 | +$(MAKE_SELF) install-base GENCONTROL_ARGS='-DAuto-Built-Package=debug-symbols' 359 | 360 | # vim: filetype=make 361 | -------------------------------------------------------------------------------- /linux-liquorix/debian/lib/python/debian_linux/gencontrol.py: -------------------------------------------------------------------------------- 1 | import codecs 2 | import os 3 | import re 4 | from collections import OrderedDict 5 | 6 | from .debian import ( 7 | Changelog, 8 | PackageArchitecture, 9 | PackageDescription, 10 | PackageRelation, 11 | Version, 12 | ) 13 | 14 | 15 | class PackagesList(OrderedDict): 16 | def append(self, package): 17 | self[package["Package"]] = package 18 | 19 | def extend(self, packages): 20 | for package in packages: 21 | self[package["Package"]] = package 22 | 23 | 24 | class Makefile(object): 25 | def __init__(self): 26 | self.rules = {} 27 | self.add(".NOTPARALLEL") 28 | 29 | def add(self, name, deps=None, cmds=None): 30 | if name in self.rules: 31 | self.rules[name].add(deps, cmds) 32 | else: 33 | self.rules[name] = self.Rule(name, deps, cmds) 34 | if deps is not None: 35 | for i in deps: 36 | if i not in self.rules: 37 | self.rules[i] = self.Rule(i) 38 | 39 | def write(self, out): 40 | for i in sorted(self.rules.keys()): 41 | self.rules[i].write(out) 42 | 43 | class Rule(object): 44 | def __init__(self, name, deps=None, cmds=None): 45 | self.name = name 46 | self.deps, self.cmds = set(), [] 47 | self.add(deps, cmds) 48 | 49 | def add(self, deps=None, cmds=None): 50 | if deps is not None: 51 | self.deps.update(deps) 52 | if cmds is not None: 53 | self.cmds.append(cmds) 54 | 55 | def write(self, out): 56 | deps_string = "" 57 | if self.deps: 58 | deps = list(self.deps) 59 | deps.sort() 60 | deps_string = " " + " ".join(deps) 61 | 62 | if self.cmds: 63 | if deps_string: 64 | out.write("%s::%s\n" % (self.name, deps_string)) 65 | for c in self.cmds: 66 | out.write("%s::\n" % self.name) 67 | for i in c: 68 | out.write("\t%s\n" % i) 69 | else: 70 | out.write("%s:%s\n" % (self.name, deps_string)) 71 | 72 | 73 | class MakeFlags(dict): 74 | def __str__(self): 75 | return " ".join("%s='%s'" % i for i in sorted(self.items())) 76 | 77 | def copy(self): 78 | return self.__class__(super(MakeFlags, self).copy()) 79 | 80 | 81 | def iter_featuresets(config): 82 | for featureset in config["base",]["featuresets"]: 83 | if config.merge("base", None, featureset).get("enabled", True): 84 | yield featureset 85 | 86 | 87 | def iter_arches(config): 88 | return iter(config["base",]["arches"]) 89 | 90 | 91 | def iter_arch_featuresets(config, arch): 92 | for featureset in config["base", arch].get("featuresets", []): 93 | if config.merge("base", arch, featureset).get("enabled", True): 94 | yield featureset 95 | 96 | 97 | def iter_flavours(config, arch, featureset): 98 | return iter(config["base", arch, featureset]["flavours"]) 99 | 100 | 101 | class Gencontrol(object): 102 | makefile_targets = ("binary-arch", "build-arch", "setup") 103 | makefile_targets_indep = ("binary-indep", "build-indep", "setup") 104 | 105 | def __init__(self, config, templates, version=Version): 106 | self.config, self.templates = config, templates 107 | self.changelog = Changelog(version=version) 108 | self.vars = {} 109 | 110 | def __call__(self): 111 | packages = PackagesList() 112 | makefile = Makefile() 113 | 114 | self.do_source(packages) 115 | self.do_main(packages, makefile) 116 | self.do_extra(packages, makefile) 117 | 118 | self.merge_build_depends(packages) 119 | self.write(packages, makefile) 120 | 121 | def do_source(self, packages): 122 | source = self.templates["control.source"][0] 123 | if not source.get("Source"): 124 | source["Source"] = self.changelog[0].source 125 | packages["source"] = self.process_package(source, self.vars) 126 | 127 | def do_main(self, packages, makefile): 128 | vars = self.vars.copy() 129 | 130 | makeflags = MakeFlags() 131 | extra = {} 132 | 133 | self.do_main_setup(vars, makeflags, extra) 134 | self.do_main_makefile(makefile, makeflags, extra) 135 | self.do_main_packages(packages, vars, makeflags, extra) 136 | self.do_main_recurse(packages, makefile, vars, makeflags, extra) 137 | 138 | def do_main_setup(self, vars, makeflags, extra): 139 | pass 140 | 141 | def do_main_makefile(self, makefile, makeflags, extra): 142 | makefile.add( 143 | "build-indep", 144 | cmds=["$(MAKE) -f debian/rules.real build-indep %s" % makeflags], 145 | ) 146 | makefile.add( 147 | "binary-indep", 148 | cmds=["$(MAKE) -f debian/rules.real binary-indep %s" % makeflags], 149 | ) 150 | 151 | def do_main_packages(self, packages, vars, makeflags, extra): 152 | pass 153 | 154 | def do_main_recurse(self, packages, makefile, vars, makeflags, extra): 155 | for featureset in iter_featuresets(self.config): 156 | self.do_indep_featureset( 157 | packages, makefile, featureset, vars.copy(), makeflags.copy(), extra 158 | ) 159 | for arch in iter_arches(self.config): 160 | self.do_arch(packages, makefile, arch, vars.copy(), makeflags.copy(), extra) 161 | 162 | def do_extra(self, packages, makefile): 163 | templates_extra = self.templates.get("control.extra", None) 164 | if templates_extra is None: 165 | return 166 | 167 | packages_extra = self.process_packages(templates_extra, self.vars) 168 | packages.extend(packages_extra) 169 | extra_arches = {} 170 | for package in packages_extra: 171 | arches = package["Architecture"] 172 | for arch in arches: 173 | i = extra_arches.get(arch, []) 174 | i.append(package) 175 | extra_arches[arch] = i 176 | for arch in sorted(extra_arches.keys()): 177 | cmds = [] 178 | for i in extra_arches[arch]: 179 | cmds.append( 180 | "$(MAKE) -f debian/rules.real install-dummy " 181 | "ARCH='%s' DH_OPTIONS='-p%s'" % (arch, i["Package"]) 182 | ) 183 | makefile.add("binary-arch_%s" % arch, ["binary-arch_%s_extra" % arch]) 184 | makefile.add("binary-arch_%s_extra" % arch, cmds=cmds) 185 | 186 | def do_indep_featureset( 187 | self, packages, makefile, featureset, vars, makeflags, extra 188 | ): 189 | vars["localversion"] = "" 190 | if featureset != "none": 191 | vars["localversion"] = "-" + featureset 192 | 193 | self.do_indep_featureset_setup(vars, makeflags, featureset, extra) 194 | self.do_indep_featureset_makefile(makefile, featureset, makeflags, extra) 195 | self.do_indep_featureset_packages( 196 | packages, makefile, featureset, vars, makeflags, extra 197 | ) 198 | 199 | def do_indep_featureset_setup(self, vars, makeflags, featureset, extra): 200 | pass 201 | 202 | def do_indep_featureset_makefile(self, makefile, featureset, makeflags, extra): 203 | makeflags["FEATURESET"] = featureset 204 | 205 | for i in self.makefile_targets_indep: 206 | target1 = i 207 | target2 = "_".join((target1, featureset)) 208 | target3 = "_".join((target2, "real")) 209 | makefile.add(target1, [target2]) 210 | makefile.add(target2, [target3]) 211 | 212 | def do_indep_featureset_packages( 213 | self, packages, makefile, featureset, vars, makeflags, extra 214 | ): 215 | pass 216 | 217 | def do_arch(self, packages, makefile, arch, vars, makeflags, extra): 218 | vars["arch"] = arch 219 | 220 | self.do_arch_setup(vars, makeflags, arch, extra) 221 | self.do_arch_makefile(makefile, arch, makeflags, extra) 222 | self.do_arch_packages(packages, makefile, arch, vars, makeflags, extra) 223 | self.do_arch_recurse(packages, makefile, arch, vars, makeflags, extra) 224 | 225 | def do_arch_setup(self, vars, makeflags, arch, extra): 226 | pass 227 | 228 | def do_arch_makefile(self, makefile, arch, makeflags, extra): 229 | makeflags["ARCH"] = arch 230 | 231 | for i in self.makefile_targets: 232 | target1 = i 233 | target2 = "_".join((target1, arch)) 234 | target3 = "_".join((target2, "real")) 235 | makefile.add(target1, [target2]) 236 | makefile.add(target2, [target3]) 237 | 238 | def do_arch_packages(self, packages, makefile, arch, vars, makeflags, extra): 239 | pass 240 | 241 | def do_arch_recurse(self, packages, makefile, arch, vars, makeflags, extra): 242 | for featureset in iter_arch_featuresets(self.config, arch): 243 | self.do_featureset( 244 | packages, 245 | makefile, 246 | arch, 247 | featureset, 248 | vars.copy(), 249 | makeflags.copy(), 250 | extra, 251 | ) 252 | 253 | def do_featureset( 254 | self, packages, makefile, arch, featureset, vars, makeflags, extra 255 | ): 256 | vars["localversion"] = "" 257 | if featureset != "none": 258 | vars["localversion"] = "-" + featureset 259 | 260 | self.do_featureset_setup(vars, makeflags, arch, featureset, extra) 261 | self.do_featureset_makefile(makefile, arch, featureset, makeflags, extra) 262 | self.do_featureset_packages( 263 | packages, makefile, arch, featureset, vars, makeflags, extra 264 | ) 265 | self.do_featureset_recurse( 266 | packages, makefile, arch, featureset, vars, makeflags, extra 267 | ) 268 | 269 | def do_featureset_setup(self, vars, makeflags, arch, featureset, extra): 270 | pass 271 | 272 | def do_featureset_makefile(self, makefile, arch, featureset, makeflags, extra): 273 | makeflags["FEATURESET"] = featureset 274 | 275 | for i in self.makefile_targets: 276 | target1 = "_".join((i, arch)) 277 | target2 = "_".join((target1, featureset)) 278 | target3 = "_".join((target2, "real")) 279 | makefile.add(target1, [target2]) 280 | makefile.add(target2, [target3]) 281 | 282 | def do_featureset_packages( 283 | self, packages, makefile, arch, featureset, vars, makeflags, extra 284 | ): 285 | pass 286 | 287 | def do_featureset_recurse( 288 | self, packages, makefile, arch, featureset, vars, makeflags, extra 289 | ): 290 | for flavour in iter_flavours(self.config, arch, featureset): 291 | self.do_flavour( 292 | packages, 293 | makefile, 294 | arch, 295 | featureset, 296 | flavour, 297 | vars.copy(), 298 | makeflags.copy(), 299 | extra, 300 | ) 301 | 302 | def do_flavour( 303 | self, packages, makefile, arch, featureset, flavour, vars, makeflags, extra 304 | ): 305 | vars["localversion"] += "-" + flavour 306 | 307 | self.do_flavour_setup(vars, makeflags, arch, featureset, flavour, extra) 308 | self.do_flavour_makefile(makefile, arch, featureset, flavour, makeflags, extra) 309 | self.do_flavour_packages( 310 | packages, makefile, arch, featureset, flavour, vars, makeflags, extra 311 | ) 312 | 313 | def do_flavour_setup(self, vars, makeflags, arch, featureset, flavour, extra): 314 | for i in ( 315 | ("kernel-arch", "KERNEL_ARCH"), 316 | ("localversion", "LOCALVERSION"), 317 | ): 318 | if i[0] in vars: 319 | makeflags[i[1]] = vars[i[0]] 320 | 321 | def do_flavour_makefile( 322 | self, makefile, arch, featureset, flavour, makeflags, extra 323 | ): 324 | makeflags["FLAVOUR"] = flavour 325 | 326 | for i in self.makefile_targets: 327 | target1 = "_".join((i, arch, featureset)) 328 | target2 = "_".join((target1, flavour)) 329 | target3 = "_".join((target2, "real")) 330 | makefile.add(target1, [target2]) 331 | makefile.add(target2, [target3]) 332 | 333 | def do_flavour_packages( 334 | self, packages, makefile, arch, featureset, flavour, vars, makeflags, extra 335 | ): 336 | pass 337 | 338 | def process_relation(self, dep, vars): 339 | import copy 340 | 341 | dep = copy.deepcopy(dep) 342 | for groups in dep: 343 | for item in groups: 344 | item.name = self.substitute(item.name, vars) 345 | if item.version: 346 | item.version = self.substitute(item.version, vars) 347 | return dep 348 | 349 | def process_description(self, in_desc, vars): 350 | desc = in_desc.__class__() 351 | desc.short = self.substitute(in_desc.short, vars) 352 | for i in in_desc.long: 353 | desc.append(self.substitute(i, vars)) 354 | return desc 355 | 356 | def process_package(self, in_entry, vars={}): 357 | entry = in_entry.__class__() 358 | for key, value in in_entry.items(): 359 | if isinstance(value, PackageRelation): 360 | value = self.process_relation(value, vars) 361 | elif isinstance(value, PackageDescription): 362 | value = self.process_description(value, vars) 363 | else: 364 | value = self.substitute(value, vars) 365 | entry[key] = value 366 | return entry 367 | 368 | def process_packages(self, entries, vars): 369 | return [self.process_package(i, vars) for i in entries] 370 | 371 | def substitute(self, s, vars): 372 | if isinstance(s, (list, tuple)): 373 | return [self.substitute(i, vars) for i in s] 374 | 375 | def subst(match): 376 | return vars[match.group(1)] 377 | 378 | return re.sub(r"@([-_a-z0-9]+)@", subst, str(s)) 379 | 380 | # Substitute kernel version etc. into maintainer scripts, 381 | # bug presubj message and lintian overrides 382 | def substitute_debhelper_config( 383 | self, prefix, vars, package_name, output_dir="debian" 384 | ): 385 | for id in [ 386 | "bug-presubj", 387 | "lintian-overrides", 388 | "maintscript", 389 | "postinst", 390 | "postrm", 391 | "preinst", 392 | "prerm", 393 | ]: 394 | name = "%s.%s" % (prefix, id) 395 | try: 396 | template = self.templates[name] 397 | except KeyError: 398 | continue 399 | else: 400 | target = "%s/%s.%s" % (output_dir, package_name, id) 401 | with open(target, "w") as f: 402 | f.write(self.substitute(template, vars)) 403 | os.chmod(f.fileno(), self.templates.get_mode(name) & 0o777) 404 | 405 | def merge_build_depends(self, packages): 406 | # Merge Build-Depends pseudo-fields from binary packages into the 407 | # source package 408 | source = packages["source"] 409 | arch_all = PackageArchitecture("all") 410 | for name, package in packages.items(): 411 | if name == "source": 412 | continue 413 | dep = package.get("Build-Depends") 414 | if not dep: 415 | continue 416 | del package["Build-Depends"] 417 | for group in dep: 418 | for item in group: 419 | if package["Architecture"] != arch_all and not item.arches: 420 | item.arches = sorted(package["Architecture"]) 421 | if package.get("Build-Profiles") and not item.restrictions: 422 | profiles = package["Build-Profiles"] 423 | assert profiles[0] == "<" and profiles[-1] == ">" 424 | item.restrictions = re.split(r"\s+", profiles[1:-1]) 425 | if package["Architecture"] == arch_all: 426 | dep_type = "Build-Depends-Indep" 427 | else: 428 | dep_type = "Build-Depends-Arch" 429 | if dep_type not in source: 430 | source[dep_type] = PackageRelation() 431 | source[dep_type].extend(dep) 432 | 433 | def write(self, packages, makefile): 434 | self.write_control(packages.values()) 435 | self.write_makefile(makefile) 436 | 437 | def write_control(self, list, name="debian/control"): 438 | self.write_rfc822(codecs.open(name, "w", "utf-8"), list) 439 | 440 | def write_makefile(self, makefile, name="debian/rules.gen"): 441 | f = open(name, "w") 442 | makefile.write(f) 443 | f.close() 444 | 445 | def write_rfc822(self, f, list): 446 | for entry in list: 447 | for key, value in entry.items(): 448 | f.write("%s: %s\n" % (key, value)) 449 | f.write("\n") 450 | 451 | 452 | def merge_packages(packages, new, arch): 453 | for new_package in new: 454 | name = new_package["Package"] 455 | if name in packages: 456 | package = packages.get(name) 457 | package["Architecture"].add(arch) 458 | 459 | for field in ("Depends", "Provides", "Suggests", "Recommends", "Conflicts"): 460 | if field in new_package: 461 | if field in package: 462 | v = package[field] 463 | v.extend(new_package[field]) 464 | else: 465 | package[field] = new_package[field] 466 | 467 | else: 468 | new_package["Architecture"] = arch 469 | packages.append(new_package) 470 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /linux-liquorix/debian/bin/gencontrol.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import codecs 4 | import os 5 | from debian_linux import config 6 | from debian_linux.debian import ( 7 | VersionLinux, 8 | PackageRelation, 9 | PackageRelationGroup, 10 | PackageRelationEntry, 11 | PackageDescription, 12 | ) 13 | from debian_linux.gencontrol import Gencontrol as Base, merge_packages 14 | from debian_linux.utils import Templates 15 | 16 | 17 | class Gencontrol(Base): 18 | config_schema = { 19 | "abi": { 20 | "ignore-changes": config.SchemaItemList(), 21 | }, 22 | "build": { 23 | "debug-info": config.SchemaItemBoolean(), 24 | }, 25 | "description": { 26 | "parts": config.SchemaItemList(), 27 | }, 28 | "image": { 29 | "bootloaders": config.SchemaItemList(), 30 | "configs": config.SchemaItemList(), 31 | "initramfs-generators": config.SchemaItemList(), 32 | "check-size": config.SchemaItemInteger(), 33 | "check-size-with-dtb": config.SchemaItemBoolean(), 34 | }, 35 | "relations": {}, 36 | } 37 | 38 | def __init__( 39 | self, config_dirs=["debian/config"], template_dirs=["debian/templates"] 40 | ): 41 | super(Gencontrol, self).__init__( 42 | config.ConfigCoreHierarchy(self.config_schema, config_dirs), 43 | Templates(template_dirs), 44 | VersionLinux, 45 | ) 46 | self.process_changelog() 47 | self.config_dirs = config_dirs 48 | 49 | def _setup_makeflags(self, names, makeflags, data): 50 | for src, dst, optional in names: 51 | if src in data or not optional: 52 | makeflags[dst] = data[src] 53 | 54 | def _substitute_file(self, template, vars, target, append=False): 55 | with codecs.open(target, "a" if append else "w", "utf-8") as f: 56 | f.write(self.substitute(self.templates[template], vars)) 57 | 58 | def do_main_setup(self, vars, makeflags, extra): 59 | super(Gencontrol, self).do_main_setup(vars, makeflags, extra) 60 | makeflags.update( 61 | { 62 | "VERSION": self.version.linux_version, 63 | "UPSTREAMVERSION": self.version.linux_upstream, 64 | "ABINAME": self.version.linux_upstream + self.abiname_part, 65 | "SOURCEVERSION": self.version.complete, 66 | } 67 | ) 68 | 69 | """ 70 | # Prepare to generate debian/tests/control 71 | self.tests_control = None 72 | """ 73 | 74 | def do_main_makefile(self, makefile, makeflags, extra): 75 | fs_enabled = [ 76 | featureset 77 | for featureset in self.config["base",]["featuresets"] 78 | if self.config.merge("base", None, featureset).get("enabled", True) 79 | ] 80 | for featureset in fs_enabled: 81 | makeflags_featureset = makeflags.copy() 82 | makeflags_featureset["FEATURESET"] = featureset 83 | cmds_source = [ 84 | "$(MAKE) -f debian/rules.real source-featureset %s" 85 | % makeflags_featureset 86 | ] 87 | makefile.add("source_%s_real" % featureset, cmds=cmds_source) 88 | makefile.add("source_%s" % featureset, ["source_%s_real" % featureset]) 89 | makefile.add("source", ["source_%s" % featureset]) 90 | 91 | triplet_enabled = [] 92 | for arch in iter(self.config["base",]["arches"]): 93 | for featureset in self.config["base", arch].get("featuresets", ()): 94 | if self.config.merge("base", None, featureset).get("enabled", True): 95 | for flavour in self.config["base", arch, featureset]["flavours"]: 96 | triplet_enabled.append("%s_%s_%s" % (arch, featureset, flavour)) 97 | 98 | makeflags = makeflags.copy() 99 | makeflags["ALL_FEATURESETS"] = " ".join(fs_enabled) 100 | makeflags["ALL_TRIPLETS"] = " ".join(triplet_enabled) 101 | super(Gencontrol, self).do_main_makefile(makefile, makeflags, extra) 102 | 103 | # linux-source-$UPSTREAMVERSION will contain all kconfig files 104 | makefile.add("binary-indep", deps=["setup"]) 105 | 106 | def do_main_packages(self, packages, vars, makeflags, extra): 107 | packages.extend( 108 | self.process_packages(self.templates["control.main"], self.vars) 109 | ) 110 | 111 | arch_makeflags = (("kernel-arch", "KERNEL_ARCH", False),) 112 | 113 | def do_arch_setup(self, vars, makeflags, arch, extra): 114 | config_base = self.config.merge("base", arch) 115 | 116 | self._setup_makeflags(self.arch_makeflags, makeflags, config_base) 117 | 118 | def do_arch_packages(self, packages, makefile, arch, vars, makeflags, extra): 119 | # Some userland architectures require kernels from another 120 | # (Debian) architecture, e.g. x32/amd64. 121 | 122 | if self.version.linux_modifier is None: 123 | try: 124 | abiname_part = ".%s" % self.config["abi", arch]["abiname"] 125 | except KeyError: 126 | abiname_part = self.abiname_part 127 | makeflags["ABINAME"] = vars["abiname"] = ( 128 | self.version.linux_upstream + abiname_part 129 | ) 130 | 131 | """ 132 | foreign_kernel = not self.config['base', arch].get('featuresets') 133 | 134 | if foreign_kernel: 135 | packages_headers_arch = [] 136 | makeflags['FOREIGN_KERNEL'] = True 137 | else: 138 | headers_arch = self.templates["control.headers.arch"] 139 | packages_headers_arch = self.process_packages(headers_arch, vars) 140 | 141 | libc_dev = self.templates["control.libc-dev"] 142 | packages_headers_arch[0:0] = self.process_packages(libc_dev, {}) 143 | 144 | packages_headers_arch[-1]['Depends'].extend(PackageRelation()) 145 | extra['headers_arch_depends'] = packages_headers_arch[-1]['Depends'] 146 | 147 | merge_packages(packages, packages_headers_arch, arch) 148 | 149 | cmds_binary_arch = ["$(MAKE) -f debian/rules.real binary-arch-arch %s" % makeflags] 150 | makefile.add('binary-arch_%s_real' % arch, cmds=cmds_binary_arch) 151 | 152 | # Shortcut to aid architecture bootstrapping 153 | makefile.add('binary-libc-dev_%s' % arch, 154 | ['source_none_real'], 155 | ["$(MAKE) -f debian/rules.real install-libc-dev_%s %s" % 156 | (arch, makeflags)]) 157 | 158 | if os.getenv('DEBIAN_KERNEL_DISABLE_INSTALLER'): 159 | if self.changelog[0].distribution == 'UNRELEASED': 160 | import warnings 161 | warnings.warn('Disable installer modules on request (DEBIAN_KERNEL_DISABLE_INSTALLER set)') 162 | else: 163 | raise RuntimeError('Unable to disable installer modules in release build (DEBIAN_KERNEL_DISABLE_INSTALLER set)') 164 | else: 165 | # Add udebs using kernel-wedge 166 | installer_def_dir = 'debian/installer' 167 | installer_arch_dir = os.path.join(installer_def_dir, arch) 168 | if os.path.isdir(installer_arch_dir): 169 | kw_env = os.environ.copy() 170 | kw_env['KW_DEFCONFIG_DIR'] = installer_def_dir 171 | kw_env['KW_CONFIG_DIR'] = installer_arch_dir 172 | kw_proc = subprocess.Popen( 173 | ['kernel-wedge', 'gen-control', vars['abiname']], 174 | stdout=subprocess.PIPE, 175 | env=kw_env) 176 | if not isinstance(kw_proc.stdout, io.IOBase): 177 | udeb_packages = read_control(io.open(kw_proc.stdout.fileno(), encoding='utf-8', closefd=False)) 178 | else: 179 | udeb_packages = read_control(io.TextIOWrapper(kw_proc.stdout, 'utf-8')) 180 | kw_proc.wait() 181 | if kw_proc.returncode != 0: 182 | raise RuntimeError('kernel-wedge exited with code %d' % 183 | kw_proc.returncode) 184 | 185 | merge_packages(packages, udeb_packages, arch) 186 | 187 | # These packages must be built after the per-flavour/ 188 | # per-featureset packages. Also, this won't work 189 | # correctly with an empty package list. 190 | if udeb_packages: 191 | makefile.add( 192 | 'binary-arch_%s' % arch, 193 | cmds=["$(MAKE) -f debian/rules.real install-udeb_%s %s " 194 | "PACKAGE_NAMES='%s'" % 195 | (arch, makeflags, 196 | ' '.join(p['Package'] for p in udeb_packages))]) 197 | """ 198 | 199 | def do_featureset_setup(self, vars, makeflags, arch, featureset, extra): 200 | makeflags["LOCALVERSION_HEADERS"] = vars["localversion_headers"] = vars[ 201 | "localversion" 202 | ] 203 | 204 | def do_featureset_packages( 205 | self, packages, makefile, arch, featureset, vars, makeflags, extra 206 | ): 207 | """ 208 | headers_featureset = self.templates["control.headers.featureset"] 209 | package_headers = self.process_package(headers_featureset[0], vars) 210 | 211 | merge_packages(packages, (package_headers,), arch) 212 | 213 | cmds_binary_arch = ["$(MAKE) -f debian/rules.real binary-arch-featureset %s" % makeflags] 214 | makefile.add('binary-arch_%s_%s_real' % (arch, featureset), cmds=cmds_binary_arch) 215 | """ 216 | 217 | flavour_makeflags_base = ( 218 | ("compiler", "COMPILER", False), 219 | ("kernel-arch", "KERNEL_ARCH", False), 220 | ("cflags", "CFLAGS_KERNEL", True), 221 | ("override-host-type", "OVERRIDE_HOST_TYPE", True), 222 | ) 223 | 224 | flavour_makeflags_build = (("image-file", "IMAGE_FILE", True),) 225 | 226 | flavour_makeflags_image = (("install-stem", "IMAGE_INSTALL_STEM", True),) 227 | 228 | flavour_makeflags_other = ( 229 | ("localversion", "LOCALVERSION", False), 230 | ("localversion-image", "LOCALVERSION_IMAGE", True), 231 | ) 232 | 233 | def do_flavour_setup(self, vars, makeflags, arch, featureset, flavour, extra): 234 | config_base = self.config.merge("base", arch, featureset, flavour) 235 | config_build = self.config.merge("build", arch, featureset, flavour) 236 | config_description = self.config.merge("description", arch, featureset, flavour) 237 | config_image = self.config.merge("image", arch, featureset, flavour) 238 | 239 | vars["class"] = config_description["hardware"] 240 | vars["longclass"] = config_description.get("hardware-long") or vars["class"] 241 | 242 | vars["localversion-image"] = vars["localversion"] 243 | override_localversion = config_image.get("override-localversion", None) 244 | if override_localversion is not None: 245 | vars["localversion-image"] = ( 246 | vars["localversion_headers"] + "-" + override_localversion 247 | ) 248 | vars["image-stem"] = config_image.get("install-stem") 249 | 250 | self._setup_makeflags(self.flavour_makeflags_base, makeflags, config_base) 251 | self._setup_makeflags(self.flavour_makeflags_build, makeflags, config_build) 252 | self._setup_makeflags(self.flavour_makeflags_image, makeflags, config_image) 253 | self._setup_makeflags(self.flavour_makeflags_other, makeflags, vars) 254 | 255 | def do_flavour_packages( 256 | self, packages, makefile, arch, featureset, flavour, vars, makeflags, extra 257 | ): 258 | headers = self.templates["control.headers"] 259 | 260 | config_entry_base = self.config.merge("base", arch, featureset, flavour) 261 | config_entry_build = self.config.merge("build", arch, featureset, flavour) 262 | config_entry_description = self.config.merge( 263 | "description", arch, featureset, flavour 264 | ) 265 | config_entry_image = self.config.merge("image", arch, featureset, flavour) 266 | config_entry_relations = self.config.merge( 267 | "relations", arch, featureset, flavour 268 | ) 269 | 270 | compiler = config_entry_base.get("compiler", "gcc") 271 | 272 | relations_compiler_headers = PackageRelation( 273 | config_entry_relations.get("headers%" + compiler) 274 | or config_entry_relations.get(compiler) 275 | ) 276 | 277 | relations_compiler_build_dep = PackageRelation(config_entry_relations[compiler]) 278 | for group in relations_compiler_build_dep: 279 | for item in group: 280 | item.arches = [arch] 281 | packages["source"]["Build-Depends"].extend(relations_compiler_build_dep) 282 | 283 | image_fields = {"Description": PackageDescription()} 284 | for field in ( 285 | "Depends", 286 | "Provides", 287 | "Suggests", 288 | "Recommends", 289 | "Conflicts", 290 | "Breaks", 291 | ): 292 | image_fields[field] = PackageRelation( 293 | config_entry_image.get(field.lower(), None), override_arches=(arch,) 294 | ) 295 | 296 | generators = config_entry_image["initramfs-generators"] 297 | prg = PackageRelationGroup() 298 | for i in generators: 299 | i = config_entry_relations.get(i, i) 300 | prg.append(i) 301 | a = PackageRelationEntry(i) 302 | if a.operator is not None: 303 | a.operator = -a.operator 304 | image_fields["Breaks"].append(PackageRelationGroup([a])) 305 | for item in prg: 306 | item.arches = [arch] 307 | image_fields["Depends"].append(prg) 308 | 309 | bootloaders = config_entry_image.get("bootloaders") 310 | if bootloaders: 311 | prg = PackageRelationGroup() 312 | for i in bootloaders: 313 | i = config_entry_relations.get(i, i) 314 | prg.append(i) 315 | a = PackageRelationEntry(i) 316 | if a.operator is not None: 317 | a.operator = -a.operator 318 | image_fields["Breaks"].append(PackageRelationGroup([a])) 319 | for item in prg: 320 | item.arches = [arch] 321 | image_fields["Suggests"].append(prg) 322 | 323 | desc_parts = self.config.get_merge( 324 | "description", arch, featureset, flavour, "parts" 325 | ) 326 | if desc_parts: 327 | # XXX: Workaround, we need to support multiple entries of the same name 328 | parts = list(set(desc_parts)) 329 | parts.sort() 330 | desc = image_fields["Description"] 331 | for part in parts: 332 | desc.append(config_entry_description["part-long-" + part]) 333 | desc.append_short( 334 | config_entry_description.get("part-short-" + part, "") 335 | ) 336 | 337 | packages_dummy = [] 338 | packages_own = [] 339 | 340 | image = self.templates["control.image"] 341 | 342 | vars.setdefault("desc", None) 343 | 344 | image_main = self.process_real_image(image[0], image_fields, vars) 345 | packages_own.append(image_main) 346 | packages_own.extend(self.process_packages(image[1:], vars)) 347 | 348 | package_headers = self.process_package(headers[0], vars) 349 | package_headers["Depends"].extend(relations_compiler_headers) 350 | packages_own.append(package_headers) 351 | """ 352 | extra['headers_arch_depends'].append('%s (= ${binary:Version})' % packages_own[-1]['Package']) 353 | """ 354 | 355 | build_debug = config_entry_build.get("debug-info") 356 | 357 | if os.getenv("DEBIAN_KERNEL_DISABLE_DEBUG"): 358 | if self.changelog[0].distribution == "UNRELEASED": 359 | import warnings 360 | 361 | warnings.warn( 362 | "Disable debug infos on request (DEBIAN_KERNEL_DISABLE_DEBUG set)" 363 | ) 364 | build_debug = False 365 | else: 366 | raise RuntimeError( 367 | "Unable to disable debug infos in release build (DEBIAN_KERNEL_DISABLE_DEBUG set)" 368 | ) 369 | 370 | if build_debug: 371 | makeflags["DEBUG"] = True 372 | packages_own.extend( 373 | self.process_packages(self.templates["control.image-dbg"], vars) 374 | ) 375 | 376 | merge_packages(packages, packages_own + packages_dummy, arch) 377 | 378 | """ 379 | tests_control = self.process_package( 380 | self.templates['tests-control.main'][0], vars) 381 | tests_control['Depends'].append( 382 | PackageRelationGroup(image_main['Package'], 383 | override_arches=(arch,))) 384 | if self.tests_control: 385 | self.tests_control['Depends'].extend(tests_control['Depends']) 386 | else: 387 | self.tests_control = tests_control 388 | """ 389 | 390 | def get_config(*entry_name): 391 | entry_real = ("image",) + entry_name 392 | entry = self.config.get(entry_real, None) 393 | if entry is None: 394 | return None 395 | return entry.get("configs", None) 396 | 397 | def check_config_default(fail, f): 398 | for d in self.config_dirs[::-1]: 399 | f1 = d + "/" + f 400 | if os.path.exists(f1): 401 | return [f1] 402 | if fail: 403 | raise RuntimeError("%s unavailable" % f) 404 | return [] 405 | 406 | def check_config_files(files): 407 | ret = [] 408 | for f in files: 409 | for d in self.config_dirs[::-1]: 410 | f1 = d + "/" + f 411 | if os.path.exists(f1): 412 | ret.append(f1) 413 | break 414 | else: 415 | raise RuntimeError("%s unavailable" % f) 416 | return ret 417 | 418 | def check_config(default, fail, *entry_name): 419 | configs = get_config(*entry_name) 420 | if configs is None: 421 | return check_config_default(fail, default) 422 | return check_config_files(configs) 423 | 424 | kconfig = check_config("config", True) 425 | kconfig.extend( 426 | check_config( 427 | "kernelarch-%s/config" % config_entry_base["kernel-arch"], False 428 | ) 429 | ) 430 | kconfig.extend(check_config("%s/config" % arch, True, arch)) 431 | kconfig.extend( 432 | check_config("%s/config.%s" % (arch, flavour), False, arch, None, flavour) 433 | ) 434 | kconfig.extend( 435 | check_config("featureset-%s/config" % featureset, False, None, featureset) 436 | ) 437 | kconfig.extend( 438 | check_config("%s/%s/config" % (arch, featureset), False, arch, featureset) 439 | ) 440 | kconfig.extend( 441 | check_config( 442 | "%s/%s/config.%s" % (arch, featureset, flavour), 443 | False, 444 | arch, 445 | featureset, 446 | flavour, 447 | ) 448 | ) 449 | makeflags["KCONFIG"] = " ".join(kconfig) 450 | if build_debug: 451 | makeflags["KCONFIG_OPTIONS"] = "-o DEBUG_INFO=y" 452 | 453 | cmds_binary_arch = [ 454 | "$(MAKE) -f debian/rules.real binary-arch-flavour %s" % makeflags 455 | ] 456 | if packages_dummy: 457 | cmds_binary_arch.append( 458 | "$(MAKE) -f debian/rules.real install-dummy DH_OPTIONS='%s' %s" 459 | % (" ".join("-p%s" % i["Package"] for i in packages_dummy), makeflags) 460 | ) 461 | cmds_build = ["$(MAKE) -f debian/rules.real build-arch-flavour %s" % makeflags] 462 | cmds_setup = ["$(MAKE) -f debian/rules.real setup-arch-flavour %s" % makeflags] 463 | makefile.add( 464 | "binary-arch_%s_%s_%s_real" % (arch, featureset, flavour), 465 | cmds=cmds_binary_arch, 466 | ) 467 | makefile.add( 468 | "build-arch_%s_%s_%s_real" % (arch, featureset, flavour), cmds=cmds_build 469 | ) 470 | makefile.add( 471 | "setup_%s_%s_%s_real" % (arch, featureset, flavour), cmds=cmds_setup 472 | ) 473 | 474 | # Substitute kernel version etc. into maintainer scripts, 475 | # translations and lintian overrides 476 | self._substitute_file( 477 | "headers.postinst", 478 | vars, 479 | "debian/linux-headers-%s%s.postinst" 480 | % (vars["abiname"], vars["localversion"]), 481 | ) 482 | for name in ["postinst", "postrm", "preinst", "prerm"]: 483 | self._substitute_file( 484 | "image.%s" % name, 485 | vars, 486 | "debian/linux-image-%s%s.%s" 487 | % (vars["abiname"], vars["localversion"], name), 488 | ) 489 | if build_debug: 490 | self._substitute_file( 491 | "image-dbg.lintian-override", 492 | vars, 493 | "debian/linux-image-%s%s-dbgsym.lintian-overrides" 494 | % (vars["abiname"], vars["localversion"]), 495 | ) 496 | 497 | def process_changelog(self): 498 | act_upstream = self.changelog[0].version.upstream 499 | versions = [] 500 | for i in self.changelog: 501 | if i.version.upstream != act_upstream: 502 | break 503 | versions.append(i.version) 504 | self.versions = versions 505 | version = self.version = self.changelog[0].version 506 | if self.version.linux_modifier is not None: 507 | self.abiname_part = "" 508 | else: 509 | self.abiname_part = ".%s" % self.config["abi",]["abiname"] 510 | self.vars = { 511 | "upstreamversion": self.version.linux_upstream, 512 | "version": self.version.linux_version, 513 | "source_upstream": self.version.upstream, 514 | "source_package": self.changelog[0].source, 515 | "abiname": self.version.linux_upstream + self.abiname_part, 516 | } 517 | self.config["version",] = { 518 | "source": self.version.complete, 519 | "upstream": self.version.linux_upstream, 520 | "abiname_base": self.version.linux_version, 521 | "abiname": (self.version.linux_upstream + self.abiname_part), 522 | } 523 | 524 | distribution = self.changelog[0].distribution 525 | if distribution in ("unstable",): 526 | if ( 527 | version.linux_revision_experimental 528 | or version.linux_revision_backports 529 | or version.linux_revision_other 530 | ): 531 | raise RuntimeError( 532 | "Can't upload to %s with a version of %s" % (distribution, version) 533 | ) 534 | if distribution in ("experimental",): 535 | if not version.linux_revision_experimental: 536 | raise RuntimeError( 537 | "Can't upload to %s with a version of %s" % (distribution, version) 538 | ) 539 | if distribution.endswith("-security") or distribution.endswith("-lts"): 540 | if not version.linux_revision_security or version.linux_revision_backports: 541 | raise RuntimeError( 542 | "Can't upload to %s with a version of %s" % (distribution, version) 543 | ) 544 | if distribution.endswith("-backports"): 545 | if not version.linux_revision_backports: 546 | raise RuntimeError( 547 | "Can't upload to %s with a version of %s" % (distribution, version) 548 | ) 549 | 550 | def process_real_image(self, entry, fields, vars): 551 | entry = self.process_package(entry, vars) 552 | for key, value in fields.items(): 553 | if key in entry: 554 | real = entry[key] 555 | real.extend(value) 556 | elif value: 557 | entry[key] = value 558 | return entry 559 | 560 | def write(self, packages, makefile): 561 | self.write_config() 562 | super(Gencontrol, self).write(packages, makefile) 563 | """ 564 | self.write_tests_control() 565 | """ 566 | 567 | def write_config(self): 568 | f = open("debian/config.defines.dump", "wb") 569 | self.config.dump(f) 570 | f.close() 571 | 572 | def write_tests_control(self): 573 | self.write_rfc822( 574 | codecs.open("debian/tests/control", "w", "utf-8"), [self.tests_control] 575 | ) 576 | 577 | 578 | if __name__ == "__main__": 579 | Gencontrol()() 580 | --------------------------------------------------------------------------------