Add more libraries for kernel building + lock kernel build command to 1 invocation running at any time.
This commit is contained in:
parent
40c32b1ad9
commit
d304b49d52
93
bash_aliases
93
bash_aliases
@ -13,7 +13,9 @@ alias screen-off="xset dpms force off"
|
|||||||
alias boot-sign-verify="sudo sign-boot && sudo verify-boot"
|
alias boot-sign-verify="sudo sign-boot && sudo verify-boot"
|
||||||
function kernel-build-dep() {
|
function kernel-build-dep() {
|
||||||
echo "[+] Kernel Build Dependancy Installation...";
|
echo "[+] Kernel Build Dependancy Installation...";
|
||||||
sudo apt install gawk git dh-make llvm libclang-dev libclang1 sbsigntool;
|
sudo apt install gawk git dh-make llvm libclang-dev sbsigntool linux-libc-dev libperl-dev libpython3-dev libunwind-dev liblzma-dev lzma-dev libzstd-dev libnuma-dev libelf-dev libcap-dev linux-libc-dev;
|
||||||
|
sudo apt install zlib1g-dev libclang1 zlib1g libbpf0 libzstd1 libnuma1 libelf1;
|
||||||
|
sudo apt install libpython3.10 libunwind8 liblzma5 libcap-ng0 libcap2;
|
||||||
sudo apt build-dep linux-image-unsigned-$(uname -r);
|
sudo apt build-dep linux-image-unsigned-$(uname -r);
|
||||||
}
|
}
|
||||||
function kernel-build() {
|
function kernel-build() {
|
||||||
@ -22,51 +24,60 @@ function kernel-build() {
|
|||||||
mkdir -p ~/kernel;
|
mkdir -p ~/kernel;
|
||||||
cd ~/kernel;
|
cd ~/kernel;
|
||||||
doNotContinueKernelBuild=0;
|
doNotContinueKernelBuild=0;
|
||||||
if [ -f last-build-failed ]; then
|
if [ -f kernel-build-occuring ]; then
|
||||||
echo "[*] Resuming last build; delete last-build-failed in the kernel directory before starting a kernel build to re-obtain sources.";
|
echo "[-] Kernel Build Occuring Already!";
|
||||||
rm -f last-build-failed;
|
doNotContinueKernelBuild=1;
|
||||||
for _dir in *"linux"*; do
|
|
||||||
[ -d "${_dir}" ] && linuxdir="${_dir}" && break;
|
|
||||||
done;
|
|
||||||
cd "$linuxdir";
|
|
||||||
else
|
else
|
||||||
for _dir in *"linux"*; do
|
touch kernel-build-occuring;
|
||||||
[ -d "${_dir}" ] && linuxdir="${_dir}" && break;
|
fi;
|
||||||
done;
|
if [ $doNotContinueKernelBuild -eq 0 ]; then
|
||||||
echo "[-] Removing Sources...";
|
if [ -f last-build-failed ]; then
|
||||||
rm -rf "$linuxdir";
|
echo "[*] Resuming last build; delete last-build-failed in the kernel directory before starting a kernel build to re-obtain sources.";
|
||||||
sudo rm -rf deb-contents;
|
rm -f last-build-failed;
|
||||||
rm -f *.gz;
|
|
||||||
rm -f *.dsc;
|
|
||||||
echo "[*] Archiving old packages...";
|
|
||||||
mkdir -p old-debs;
|
|
||||||
touch dummy.deb;
|
|
||||||
mv *.deb old-debs/;
|
|
||||||
echo "[+] Obtaining Sources...";
|
|
||||||
apt-get source linux-image-unsigned-$(uname -r);
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
for _dir in *"linux"*; do
|
for _dir in *"linux"*; do
|
||||||
[ -d "${_dir}" ] && linuxdir="${_dir}" && break;
|
[ -d "${_dir}" ] && linuxdir="${_dir}" && break;
|
||||||
done;
|
done;
|
||||||
cd "$linuxdir";
|
cd "$linuxdir";
|
||||||
echo "[*] Patching source and configuration...";
|
|
||||||
sed -i "s/.*CONFIG_MODULE_SIG_FORCE.*/CONFIG_MODULE_SIG_FORCE policy<{'amd64': 'y', 'arm64': 'y', 'armhf': 'y', 'ppc64el': 'y', 's390x': 'y'}>/" debian.master/config/annotations;
|
|
||||||
git apply --verbose ~/Downloads/patches/hibernate/0001-Hibernate-Patch.patch;
|
|
||||||
echo "[*] Cleaning kernel build...";
|
|
||||||
chmod a+x debian/rules;
|
|
||||||
chmod a+x debian/scripts/*;
|
|
||||||
chmod a+x debian/scripts/misc/*;
|
|
||||||
fakeroot debian/rules clean;
|
|
||||||
mkdir -p debian/build/build-generic/certs;
|
|
||||||
sudo cp /cert/mok/signing_key.pem ../ -f;
|
|
||||||
sudo chmod u=rw,g=rw,o=rw ../signing_key.pem;
|
|
||||||
sudo cp /var/lib/shim-signed/mok/MOK.der ../signing_key.x509 -f;
|
|
||||||
sudo chmod u=rw,g=rw,o=rw ../signing_key.x509;
|
|
||||||
(((until [ -f debian/build/build-generic/certs/signing_key.pem ]; do sleep 0.1; done) && while lsof debian/build/build-generic/certs/signing_key.pem; do sleep 0.1; done) && mv -f ../signing_key.pem debian/build/build-generic/certs/signing_key.pem) &
|
|
||||||
(((until [ -f debian/build/build-generic/certs/signing_key.x509 ]; do sleep 0.1; done) && while lsof debian/build/build-generic/certs/signing_key.x509; do sleep 0.1; done) && mv -f ../signing_key.x509 debian/build/build-generic/certs/signing_key.x509) &
|
|
||||||
else
|
else
|
||||||
echo "[-] Failed to obtain sources!";
|
for _dir in *"linux"*; do
|
||||||
doNotContinueKernelBuild=1;
|
[ -d "${_dir}" ] && linuxdir="${_dir}" && break;
|
||||||
|
done;
|
||||||
|
echo "[-] Removing Sources...";
|
||||||
|
rm -rf "$linuxdir";
|
||||||
|
sudo rm -rf deb-contents;
|
||||||
|
rm -f *.gz;
|
||||||
|
rm -f *.dsc;
|
||||||
|
echo "[*] Archiving old packages...";
|
||||||
|
mkdir -p old-debs;
|
||||||
|
touch dummy.deb;
|
||||||
|
mv *.deb old-debs/;
|
||||||
|
echo "[+] Obtaining Sources...";
|
||||||
|
apt-get source linux-image-unsigned-$(uname -r);
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
for _dir in *"linux"*; do
|
||||||
|
[ -d "${_dir}" ] && linuxdir="${_dir}" && break;
|
||||||
|
done;
|
||||||
|
cd "$linuxdir";
|
||||||
|
echo "[*] Patching source and configuration...";
|
||||||
|
sed -i "s/.*CONFIG_MODULE_SIG_FORCE.*/CONFIG_MODULE_SIG_FORCE policy<{'amd64': 'y', 'arm64': 'y', 'armhf': 'y', 'ppc64el': 'y', 's390x': 'y'}>/" debian.master/config/annotations;
|
||||||
|
git apply --verbose ~/Downloads/patches/hibernate/0001-Hibernate-Patch.patch;
|
||||||
|
echo "[*] Cleaning kernel build...";
|
||||||
|
chmod a+x debian/rules;
|
||||||
|
chmod a+x debian/scripts/*;
|
||||||
|
chmod a+x debian/scripts/misc/*;
|
||||||
|
fakeroot debian/rules clean;
|
||||||
|
mkdir -p debian/build/build-generic/certs;
|
||||||
|
sudo cp /cert/mok/signing_key.pem ../ -f;
|
||||||
|
sudo chmod u=rw,g=rw,o=rw ../signing_key.pem;
|
||||||
|
sudo cp /var/lib/shim-signed/mok/MOK.der ../signing_key.x509 -f;
|
||||||
|
sudo chmod u=rw,g=rw,o=rw ../signing_key.x509;
|
||||||
|
(((until [ -f debian/build/build-generic/certs/signing_key.pem ]; do sleep 0.1; done) && while lsof debian/build/build-generic/certs/signing_key.pem; do sleep 0.1; done) && mv -f ../signing_key.pem debian/build/build-generic/certs/signing_key.pem) &
|
||||||
|
(((until [ -f debian/build/build-generic/certs/signing_key.x509 ]; do sleep 0.1; done) && while lsof debian/build/build-generic/certs/signing_key.x509; do sleep 0.1; done) && mv -f ../signing_key.x509 debian/build/build-generic/certs/signing_key.x509) &
|
||||||
|
else
|
||||||
|
echo "[-] Failed to obtain sources!";
|
||||||
|
doNotContinueKernelBuild=1;
|
||||||
|
rm -f kernel-build-occuring;
|
||||||
|
fi;
|
||||||
fi;
|
fi;
|
||||||
fi;
|
fi;
|
||||||
if [ $doNotContinueKernelBuild -eq 0 ]; then
|
if [ $doNotContinueKernelBuild -eq 0 ]; then
|
||||||
@ -108,12 +119,14 @@ function kernel-build() {
|
|||||||
sudo cp linux-modules* /usr/local/mydebs/;
|
sudo cp linux-modules* /usr/local/mydebs/;
|
||||||
sudo cp linux-lib-rust* /usr/local/mydebs/;
|
sudo cp linux-lib-rust* /usr/local/mydebs/;
|
||||||
sudo update-mydebs;
|
sudo update-mydebs;
|
||||||
|
rm -f kernel-build-occuring;
|
||||||
cd "$cwd";
|
cd "$cwd";
|
||||||
echo "[+] Kernel Build Finished!";
|
echo "[+] Kernel Build Finished!";
|
||||||
else
|
else
|
||||||
echo "[*] Build Failed!";
|
echo "[*] Build Failed!";
|
||||||
cd ~/kernel;
|
cd ~/kernel;
|
||||||
touch last-build-failed;
|
touch last-build-failed;
|
||||||
|
rm -f kernel-build-occuring;
|
||||||
cd "$cwd";
|
cd "$cwd";
|
||||||
fi;
|
fi;
|
||||||
fi;
|
fi;
|
||||||
|
Loading…
Reference in New Issue
Block a user