§2023-10-31
How to get linux kernel source
?
nano /etc/apt/sources.list
# deb-src http://us.ports.ubuntu.com/ubuntu-ports/ jammy main restricted
deb http://us.ports.ubuntu.com/ubuntu-ports/ jammy main restricted
deb http://us.ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted
deb http://us.ports.ubuntu.com/ubuntu-ports/ jammy universe
deb http://us.ports.ubuntu.com/ubuntu-ports/ jammy-updates universe
deb http://us.ports.ubuntu.com/ubuntu-ports/ jammy multiverse
deb http://us.ports.ubuntu.com/ubuntu-ports/ jammy-updates multiverse
deb http://us.ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse
deb http://ports.ubuntu.com/ubuntu-ports jammy-security main restricted
deb http://ports.ubuntu.com/ubuntu-ports jammy-security universe
deb http://ports.ubuntu.com/ubuntu-ports jammy-security multiverse
2) ` sudo apt update `
- `apt-cache search linux-source `
root@hc4JamGen:/home/alexlai# apt-cache search linux-source linux-source - Linux kernel source with Ubuntu patches linux-source-5.15.0 - Linux kernel source for version 5.15.0 with Ubuntu patches linux-source-5.19.0 - Linux kernel source for version 5.19.0 with Ubuntu patches linux-source-6.2.0 - Linux kernel source for version 6.2.0 with Ubuntu patches
3) ` alexlai@hc4JamGen:~/build/src$ apt source linux-source-6.2.0 `
alexlai@hc4JamGen:~/build/src$ apt source linux-source-6.2.0 Reading package lists... Done Picking 'linux-hwe-6.2' as source package instead of 'linux-source-6.2.0' NOTICE: 'linux-hwe-6.2' packaging is maintained in the 'Git' version control system at: git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy ... alexlai@hc4JamGen:~/build/src$ ls linux-hwe-6.2-6.2.0 linux-hwe-6.2_6.2.0-36.37~22.04.1.diff.gz linux-hwe-6.2_6.2.0-36.37~22.04.1.dsc linux-hwe-6.2_6.2.0.orig.tar.gz
4) copy config
alexlai@hc4JamGen:~/build/src$ cd linux-hwe-6.2-6.2.0/
alexlai@hc4JamGen:~/build/src/linux-hwe-6.2-6.2.0$ cp /boot/config-5.15.0-odroid-arm64 .config alexlai@hc4JamGen:~/build/src/linux-hwe-6.2-6.2.0$ make oldconfig alexlai@hc4JamGen:~/build/src/linux-hwe-6.2-6.2.0$ sudo apt install libncurses-dev alexlai@hc4JamGen:~/build/src/linux-hwe-6.2-6.2.0$ make menuconfig
4) ` time make -j6`
real 61m17.24s user 323m0.727s syd 35m12.484s
5) make modules_install
alexlai@hc4JamGen:~/build/src/linux-hwe-6.2-6.2.0$ ls /lib/modules 5.15.0-odroid-arm64 alexlai@hc4JamGen:~/build/src/linux-hwe-6.2-6.2.0$ sudo make modules_install .. INSTALL /lib/modules/6.2.16/kernel/net/nsh/nsh.ko INSTALL /lib/modules/6.2.16/kernel/net/hsr/hsr.ko DEPMOD /lib/modules/6.2.16 alexlai@hc4JamGen:~/build/src/linux-hwe-6.2-6.2.0$ ls -l /lib/modules total 8 drwxr-xr-x 3 root root 4096 Nov 11 17:42 5.15.0-odroid-arm64 drwxr-xr-x 3 root root 4096 Nov 11 19:46 6.2.16
5) make install
alexlai@hc4JamGen:~/build/src/linux-hwe-6.2-6.2.0$ ls -l /boot/ total 28356 -rw-r--r-- 1 root root 4511 Nov 11 18:08 boot.scr -rw-r--r-- 1 root root 4490 Nov 11 18:01 boot.scr.bak -rw-r--r-- 1 root root 4439 Nov 11 18:08 boot.script -rw-r--r-- 1 root root 4490 Nov 11 18:07 boot.scr.ori -rw-r--r-- 1 root root 220943 Jun 23 17:13 config-5.15.0-odroid-arm64 -rw-r--r-- 1 root root 237 Nov 11 17:41 config.ini lrwxrwxrwx 1 root root 58 Nov 11 18:02 dtb -> dtbs/5.15.0-odroid-arm64/amlogic/meson64_odroidn2_plus.dtb lrwxrwxrwx 1 root root 58 Nov 11 18:02 dtb-5.15.0-odroid-arm64 -> dtbs/5.15.0-odroid-arm64/amlogic/meson64_odroidn2_plus.dtb drwxr-xr-x 3 root root 4096 Nov 11 17:42 dtbs lrwxrwxrwx 1 root root 30 Nov 11 17:41 initrd.img -> initrd.img-5.15.0-odroid-arm64 -rw-r--r-- 1 root root 11759477 Nov 11 18:02 initrd.img-5.15.0-odroid-arm64 lrwxrwxrwx 1 root root 30 Nov 11 17:41 initrd.img.old -> initrd.img-5.15.0-odroid-arm64 drwx------ 2 root root 16384 Nov 11 17:22 lost+found lrwxrwxrwx 1 root root 41 Nov 11 18:02 overlays -> dtbs/5.15.0-odroid-arm64/amlogic/overlays -rw-r--r-- 1 root root 5487786 Jun 23 17:13 System.map-5.15.0-odroid-arm64 lrwxrwxrwx 1 root root 27 Nov 11 17:41 vmlinuz -> vmlinuz-5.15.0-odroid-arm64 -rw-r--r-- 1 root root 11508233 Jun 23 17:13 vmlinuz-5.15.0-odroid-arm64 lrwxrwxrwx 1 root root 27 Nov 11 17:41 vmlinuz.old -> vmlinuz-5.15.0-odroid-arm64 alexlai@hc4JamGen:~/build/src/linux-hwe-6.2-6.2.0$ sudo make install INSTALL /boot run-parts: executing /etc/kernel/postinst.d/dkms 6.2.16 /boot/vmlinuz-6.2.16
make: *** [arch/arm64/Makefile:180: install] Error 1
6) nano /boot/boot.scripts
f test -z "${fk_kvers}"; then
setenv fk_kvers "6.2.16" fi
alexlai@hc4JamGen:/boot$ sudo mkimage -A arm -T script -C none -n "Ubuntu boot script" -d boot.script boot.scr Image Name: Ubuntu boot script Created: Sat Nov 11 19:51:43 2023 Image Type: ARM Linux Script (uncompressed) Data Size: 4477 Bytes = 4.37 KiB = 0.00 MiB Load Address: 00000000 Entry Point: 00000000 Contents: Image 0: 4469 Bytes = 4.36 KiB = 0.00 MiB
---
- [ubuntu Kernel](https://kernel.ubuntu.com/)
-
1) using git
```bash
$ git clone https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy
$ cd jammy
alexlai@n2JamGen:~/build/src/jammy$ ls
arch certs CREDITS debian Documentation fs init Kbuild kernel LICENSES Makefile net samples security sound ubuntu update-dkms-versions usr
block COPYING crypto debian.master drivers include ipc Kconfig lib MAINTAINERS mm README scripts snapcraft.yaml tools Ubuntu.md update-version-dkms virt
$ chmod a+x debian/rules
$ chmod a+x debian/scripts/*
$ chmod a+x debian/scripts/misc/*
$ LANG=C fakeroot debian/rules clean
...
---> failed
dh_testdir
/bin/bash: line 1: dh_testdir: command not found
make: *** [debian/rules:127: clean] Error 127
Return to Top