编译

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

uname -r
4.19.0-5-amd64
1
2
3
4
apt install build-essential libncurses-dev bison flex libssl-dev libelf-dev curl wget git vim bc
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.19.67.tar.xz
unxz -v linux-4.19.67.tar.xz
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.19.67.tar.sign
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
gpg --verify linux-4.19.67.tar.sign

gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
gpg: assuming signed data in 'linux-4.19.67.tar'
gpg: Signature made Fri 16 Aug 2019 04:13:42 AM EDT
gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
gpg: Can't check signature: No public key

gpg --recv-keys 647F28654894E3BD457199BE38DBBDC86092693E

gpg: key 38DBBDC86092693E: 174 signatures not checked due to missing keys
gpg: key 38DBBDC86092693E: public key "Greg Kroah-Hartman <gregkh@linuxfoundation.org>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1

gpg --verify linux-4.19.67.tar.sign
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
61
62
tar xvf linux-4.19.67.tar

cd linux-4.19.67
cp -v /boot/config-$(uname -r) .config
# vi .config

sh -c 'yes "" | make oldconfig'


diff .config .config.old
3c3
< # Linux/x86 4.19.67 Kernel Configuration
---
> # Linux/x86 4.19.37 Kernel Configuration
7c7
< # Compiler: gcc (Debian 8.3.0-6) 8.3.0
---
> # Compiler: gcc-8 (Debian 8.3.0-6) 8.3.0
12d11
< CONFIG_CC_HAS_ASM_GOTO=y
673a673
> CONFIG_X86_X32_DISABLED=y
2996c2996
< # CONFIG_AX88796B_PHY is not set
---
> # CONFIG_ASIX_PHY is not set
5314d5313
< CONFIG_NOUVEAU_LEGACY_CTX_SUPPORT=y
5422,5423d5420
< # CONFIG_FB_NVIDIA is not set
< # CONFIG_FB_RIVA is not set
6052c6049
< CONFIG_USB_COMMON=y
---
> CONFIG_USB_COMMON=m
6952c6949
< # CONFIG_ASHMEM is not set
---
> CONFIG_ASHMEM=m
6974a6972
> # CONFIG_XIL_AXIS_FIFO is not set
7581c7579,7581
< # CONFIG_ANDROID_BINDER_IPC is not set
---
> CONFIG_ANDROID_BINDER_IPC=m
> CONFIG_ANDROID_BINDER_DEVICES="binder"
> # CONFIG_ANDROID_BINDER_IPC_SELFTEST is not set
7736d7735
< # CONFIG_NTFS_FS is not set
7978a7978
> CONFIG_SECURITY_PERF_EVENTS_RESTRICT=y
7993a7994,7996
> CONFIG_LOCK_DOWN_KERNEL=y
> CONFIG_ALLOW_LOCKDOWN_LIFT_BY_SYSRQ=y
> CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT=y
8251c8254
< CONFIG_SYSTEM_TRUSTED_KEYS=""
---
> # CONFIG_SYSTEM_TRUSTED_KEYS="debian/certs/debian-uefi-certs.pem"
8255a8259,8260
> CONFIG_EFI_SIGNATURE_LIST_PARSER=y
> CONFIG_LOAD_UEFI_KEYS=y
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
make
make modules_install
make install

# update-initramfs -c -k 4.19.67
# update-grub
# update-grub2



sh ./arch/x86/boot/install.sh 4.19.67 arch/x86/boot/bzImage \
	System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.19.67 /boot/vmlinuz-4.19.67
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.19.67 /boot/vmlinuz-4.19.67
update-initramfs: Generating /boot/initrd.img-4.19.67
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.19.67 /boot/vmlinuz-4.19.67
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.19.67
Found initrd image: /boot/initrd.img-4.19.67
Found linux image: /boot/vmlinuz-4.19.0-5-amd64
Found initrd image: /boot/initrd.img-4.19.0-5-amd64
done
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
make[1]: *** No rule to make target 'debian/certs/debian-uefi-certs.pem', needed by 'certs/x509_certificate_list'.  Stop.
make: *** [Makefile:1046: certs] Error 2

# 完成或者安装过程出错,可以清理上次编译的现场
# make mrproper         
# make clean
# make distclean

# make bzImage
# make modules

删除

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
cd /lib/modules/4.19.67
find . -name '*.ko' | wc -l

# end Kernel panic not syncing system is deadlocked on memory
# 内存不够
rm -rf /boot/*4.19.67
rm -rf /boot/config-4.19.67  
rm -rf /boot/initrd.img-4.19.67	
rm -rf /boot/System.map-4.19.67  
rm -rf /boot/vmlinuz-4.19.67
rm -rf /lib//modules​/4.19.67
update-grub

验证

1
2
uname -a
Linux debian 4.19.67 #1 SMP Mon Aug 19 23:49:58 EDT 2019 x86_64 GNU/Linux

参考