Newer
Older
#!/bin/sh
#
# Copyright (C) 2008-2022 Ruben Rodriguez <ruben@trisquel.info>
# Copyright (C) 2021 Luis Guzman <ark@switnet.org>
# Copyright (C) 2021 Pablo Correa Gómez <ablocorrea@hotmail.com>
# Copyright (C) 2019 David Trudgian <dave@trudgian.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
. ./config
for PATCH in $DATA/*.patch ; do
echo $PATCH
patch --no-backup-if-mismatch -p1 < $PATCH
done
PRESERVEDIRS='
drivers/bluetooth
drivers/gpu/drm/amd/amdgpu
drivers/gpu/drm/r128
drivers/gpu/drm/radeon
drivers/net/wireless/intel/ipw2x00
drivers/net/wireless/intel/iwlegacy
drivers/net/wireless/intel/iwlwifi
drivers/net/wireless/realtek/rtl8xxxu
drivers/net/wireless/realtek/rtlwifi
drivers/net/wireless/realtek/rtlwifi/rtl8188ee
drivers/net/wireless/realtek/rtlwifi/rtl8192ce
drivers/net/wireless/realtek/rtlwifi/rtl8192cu
drivers/net/wireless/realtek/rtlwifi/rtl8192de
drivers/net/wireless/realtek/rtlwifi/rtl8192ee
drivers/net/wireless/realtek/rtlwifi/rtl8192se
drivers/net/wireless/realtek/rtlwifi/rtl8723ae
drivers/net/wireless/realtek/rtlwifi/rtl8723be
drivers/net/wireless/realtek/rtlwifi/rtl8821ae
'
TMPDIR=$(mktemp -d preserve-XXXX)
PRESERVE=$(grep '^+++' $DATA/silent-accept-firmware.patch | /bin/sed 's/+++ //; s/\t.*//;' | cut -d/ -f2- | sort -u )
for FILE in $PRESERVE; do
cp $FILE $TMPDIR --parents -a
done
for DIR in $PRESERVEDIRS; do
cp $DIR $TMPDIR --parents -a
done
# Enable blobless activation - https://libreplanet.org/wiki/Group:Hardware/research/gpu/radeon
rm $TMPDIR/drivers/gpu/drm/radeon/ni.c
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
sh $DATA/deblob-5.13
echo "Reverting deblobbing for files patched by silent-accept-firmware"
cp $TMPDIR/* . -av
rm -rf $TMPDIR
# Wipe dkms-versions
# lists zfs / nvidia versions
echo > debian/dkms-versions
# Remove ZFS
rm zfs spl debian/scripts/misc/update-zfs.sh -rf
/bin/sed 's/spl-dkms, zfs-dkms//' -i debian/control debian.master/control.d/vars.generic debian.master/control.d/vars.*
/bin/sed '/^define build_zfs/,/^endef/d; /^define install_zfs/,/^endef/d; /zfs/d' -i debian/rules.d/2-binary-arch.mk
/bin/sed '/ifeq ($(do_zfs),false)/,/endif/d' -i debian/rules
/bin/sed '/zfs/d' -i debian.master/rules.d/* debian.master/d-i/modules/fs-core-modules debian.master/control.d/generic.inclusion-list debian.master/abi/*/*.modules debian/rules debian.master/control.d/vars.*
# Remove nvidia
rm -rf debian/scripts/debian/scripts/dkms-build--nvidia-N
sed -i '/dkms-build--nvidia-N/d' debian.master/reconstruct
/bin/sed '/do_dkms_nvidia = true/d' -i debian/rules
/bin/sed '/do_dkms_nvidia/,/endif/d' -i debian/rules.d/2-binary-arch.mk
# Remove VBox
/bin/sed '/do_dkms_vbox/d' -i debian.*/rules.d/* debian.hwe-*/scripts/helpers/local-mangle
# Remove wireguard
#sed '/do_dkms_wireguard/d' -i debian/rules.d/2-binary-arch.mk
/bin/sed '/do_dkms_wireguard/d' -i debian.master/rules.d/*
# Compile with less modules and avoid abi check
echo 'skipmodule = true' >> debian.master/rules.d/0-common-vars.mk
echo 'skipabi = true' >> debian.master/rules.d/0-common-vars.mk
echo 'skipmodule = true' >> debian/rules.d/0-common-vars.mk
echo 'skipabi = true' >> debian/rules.d/0-common-vars.mk
# Skip the retpoline check as there is no last release to chaeck against
echo 'skipretpoline = true' >> debian.master/rules.d/0-common-vars.mk
echo 'skipretpoline = true' >> debian/rules.d/0-common-vars.mk
# Do not label packages as unsigned
sed '/bin_pkg_name_unsigned/s/linux-image-unsigned/linux-image/' -i debian/rules.d/0-common-vars.mk
sed 's/.unsigned//' -i debian/scripts/control-create
line=$(grep -n ')-Ubuntu' debian/rules.d/0-common-vars.mk|cut -d: -f1)
sed $(expr $line - 1 ),$(expr $line + 1 )d debian/rules.d/0-common-vars.mk -i
sed 's/family=ubuntu/family=trisquel/' -i debian/rules.d/0-common-vars.mk
sed 's/ubuntu/trisquel/1' -i debian.*/etc/kernelconfig
rename s/ubuntu/trisquel/ debian.*/config/config.common.ubuntu
find debian* -type f -name *control* -exec sed 's/ with Ubuntu patches//; s/Linux/Linux-libre/g' -i {} \;
# Descriptions should not change based on the build arch
sed 's/on DESC//; s/PKGVER on/PKGVER/; /^ DESC.$/d;' debian*/control.d/flavour-control.stub -i
sed '/^firmware/d' debian.master/abi/fwinfo debian.hwe-*/abi/fwinfo -i
echo > ./debian.master/d-i/firmware/nic-modules
echo > ./debian.master/d-i/firmware/scsi-modules
# Disable using udev as a fallback for firmware loading
replace "CONFIG_FW_LOADER_USER_HELPER=y" "CONFIG_FW_LOADER_USER_HELPER=n" debian.master/config
cp debian.master/config debian.hwe -a
changelog "Removed non-free bits"
cp debian/changelog debian.master/changelog
cp debian/changelog debian.hwe/changelog
cp debian/changelog debian.hwe-5.13/changelog
compile