ยง2023-11-12

  1. get kernel source, from directory alexlai@n2JamGen:~/build/src/kernel-6.2.0
$ apt-cache search linux-source
$ apt source linux-source-6.2.0
$ ls -l
total 223476
drwxrwxr-x 30 alexlai alexlai      4096 Nov 12 13:35 linux-hwe-6.2-6.2.0
-rw-r--r--  1 alexlai alexlai  10255392 Oct 16 20:24 linux-hwe-6.2_6.2.0-36.37~22.04.1.diff.gz
-rw-r--r--  1 alexlai alexlai      8838 Oct 16 20:24 linux-hwe-6.2_6.2.0-36.37~22.04.1.dsc
-rw-r--r--  1 alexlai alexlai 218562620 Jun  9 00:24 linux-hwe-6.2_6.2.0.orig.tar.gz
  1. make oldconfig,
$ cd linux-hwe-6.2-6.2.0/
$ cp /boot/config-5.15.126 .config   --> bunch of new configs, take all defaut
$ make oldconfig
$ make menuconfig  --> plateform enable is Amlogic and Rockchip
  1. time make -j6
real  60m32.874s
user 320m4.845s
sys   35m45.674s
  1. sudo make modules_install
$ sudo make modules_install
...
INSTALL /lib/modules/6.2.16/kernel/net/vmw_vsock/vmw_vsock_virtio_transport_common.ko
INSTALL /lib/modules/6.2.16/kernel/net/vmw_vsock/vsock_loopback.ko
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
  1. make install
$ sudo ln -sf /usr/lib/linux-image-5.15.0-odroid-arm64/ /usr/lib/linux-image-6.2.16
$ ls -l /boot
total 72668
-rw-r--r-- 1 root root     4548 Nov 12 13:24 boot.scr
-rw-r--r-- 1 root root     4490 Nov 12 08:37 boot.scr.bak
-rw-r--r-- 1 root root     4476 Nov 12 11:19 boot.script
-rw-r--r-- 1 root root     4548 Nov 12 11:19 boot.scr.mod
-rw-r--r-- 1 root root     4490 Nov 12 13:11 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   221407 Nov 12 13:20 config-5.15.126
-rw-r--r-- 1 root root      237 Nov 12 08:30 config.ini
lrwxrwxrwx 1 root root       47 Nov 12 13:20 dtb -> dtbs/5.15.126/amlogic/meson64_odroidn2_plus.dtb
lrwxrwxrwx 1 root root       58 Nov 12 08:37 dtb-5.15.0-odroid-arm64 -> dtbs/5.15.0-odroid-arm64/amlogic/meson64_odroidn2_plus.dtb
lrwxrwxrwx 1 root root       47 Nov 12 13:20 dtb-5.15.126 -> dtbs/5.15.126/amlogic/meson64_odroidn2_plus.dtb
drwxr-xr-x 4 root root     4096 Nov 12 13:17 dtbs
lrwxrwxrwx 1 root root       19 Nov 12 13:20 initrd.img -> initrd.img-5.15.126
-rw-r--r-- 1 root root 11759126 Nov 12 08:37 initrd.img-5.15.0-odroid-arm64
-rw-r--r-- 1 root root 11781392 Nov 12 13:20 initrd.img-5.15.126
lrwxrwxrwx 1 root root       30 Nov 12 13:20 initrd.img.old -> initrd.img-5.15.0-odroid-arm64
drwx------ 2 root root    16384 Nov 12 08:24 lost+found
lrwxrwxrwx 1 root root       30 Nov 12 13:20 overlays -> dtbs/5.15.126/amlogic/overlays
-rw-r--r-- 1 root root  5487786 Jun 23 17:13 System.map-5.15.0-odroid-arm64
-rw-r--r-- 1 root root  5498600 Nov 12 13:20 System.map-5.15.126
lrwxrwxrwx 1 root root       16 Nov 12 13:20 vmlinuz -> vmlinuz-5.15.126
-rw-r--r-- 1 root root 11508233 Jun 23 17:13 vmlinuz-5.15.0-odroid-arm64

$ sudo make install
  INSTALL /boot
run-parts: executing /etc/kernel/postinst.d/dkms 6.2.16 /boot/vmlinuz-6.2.16
 * dkms: running auto installation service for kernel 6.2.16                                                                                         [ OK ] 
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 6.2.16 /boot/vmlinuz-6.2.16
update-initramfs: Generating /boot/initrd.img-6.2.16
Using DTB: amlogic/meson64_odroidn2_plus.dtb
Couldn't find DTB meson64_odroidn2_plus.dtb in /usr/lib/linux-image-6.2.16 or /etc/flash-kernel/dtbs
Installing amlogic into /boot/dtbs/6.2.16/amlogic/
Couldn't find DTB meson64_odroidn2_plus.dtb in /usr/lib/linux-image-6.2.16 or /etc/flash-kernel/dtbs
Installing amlogic into /boot/dtbs/6.2.16/amlogic/
Kernel /boot/vmlinuz-6.2.16 does not match any of the expected flavors (arm64), therefore not writing it to flash.
run-parts: executing /etc/kernel/postinst.d/xx-update-initrd-links 6.2.16 /boot/vmlinuz-6.2.16
I: /boot/initrd.img.old is now a symlink to initrd.img-5.15.126
I: /boot/initrd.img is now a symlink to initrd.img-6.2.16
run-parts: executing /etc/kernel/postinst.d/zz-flash-kernel 6.2.16 /boot/vmlinuz-6.2.16
Using DTB: amlogic/meson64_odroidn2_plus.dtb
Couldn't find DTB meson64_odroidn2_plus.dtb in /usr/lib/linux-image-6.2.16 or /etc/flash-kernel/dtbs
Installing amlogic into /boot/dtbs/6.2.16/amlogic/
Couldn't find DTB meson64_odroidn2_plus.dtb in /usr/lib/linux-image-6.2.16 or /etc/flash-kernel/dtbs
Installing amlogic into /boot/dtbs/6.2.16/amlogic/
Kernel /boot/vmlinuz-6.2.16 does not match any of the expected flavors (arm64), therefore not writing it to flash. 27854856 Nov 12 13:20 vmlinuz-5.15.126
lrwxrwxrwx 1 root root       27 Nov 12 13:20 vmlinuz.old -> vmlinuz-5.15.0-odroid-arm64

$ ls -l /boot
total 116472
-rw-r--r-- 1 root root     4548 Nov 12 13:24 boot.scr
-rw-r--r-- 1 root root     4490 Nov 12 08:37 boot.scr.bak
-rw-r--r-- 1 root root     4476 Nov 12 11:19 boot.script
-rw-r--r-- 1 root root     4548 Nov 12 11:19 boot.scr.mod
-rw-r--r-- 1 root root     4490 Nov 12 13:11 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   221407 Nov 12 13:20 config-5.15.126
-rw-r--r-- 1 root root   234272 Nov 12 15:59 config-6.2.16
-rw-r--r-- 1 root root      237 Nov 12 08:30 config.ini
lrwxrwxrwx 1 root root       45 Nov 12 15:59 dtb -> dtbs/6.2.16/amlogic/meson64_odroidn2_plus.dtb
lrwxrwxrwx 1 root root       58 Nov 12 08:37 dtb-5.15.0-odroid-arm64 -> dtbs/5.15.0-odroid-arm64/amlogic/meson64_odroidn2_plus.dtb
lrwxrwxrwx 1 root root       47 Nov 12 13:20 dtb-5.15.126 -> dtbs/5.15.126/amlogic/meson64_odroidn2_plus.dtb
lrwxrwxrwx 1 root root       45 Nov 12 15:59 dtb-6.2.16 -> dtbs/6.2.16/amlogic/meson64_odroidn2_plus.dtb
drwxr-xr-x 5 root root     4096 Nov 12 15:59 dtbs
lrwxrwxrwx 1 root root       17 Nov 12 15:59 initrd.img -> initrd.img-6.2.16
-rw-r--r-- 1 root root 11759126 Nov 12 08:37 initrd.img-5.15.0-odroid-arm64
-rw-r--r-- 1 root root 11781392 Nov 12 13:20 initrd.img-5.15.126
-rw-r--r-- 1 root root 11695346 Nov 12 15:59 initrd.img-6.2.16
lrwxrwxrwx 1 root root       19 Nov 12 15:59 initrd.img.old -> initrd.img-5.15.126
drwx------ 2 root root    16384 Nov 12 08:24 lost+found
lrwxrwxrwx 1 root root       28 Nov 12 15:59 overlays -> dtbs/6.2.16/amlogic/overlays
-rw-r--r-- 1 root root  5487786 Jun 23 17:13 System.map-5.15.0-odroid-arm64
-rw-r--r-- 1 root root  5498600 Nov 12 13:20 System.map-5.15.126
-rw-r--r-- 1 root root  4398175 Nov 12 15:59 System.map-6.2.16
lrwxrwxrwx 1 root root       14 Nov 12 15:59 vmlinuz -> vmlinuz-6.2.16
-rw-r--r-- 1 root root 11508233 Jun 23 17:13 vmlinuz-5.15.0-odroid-arm64
-rw-r--r-- 1 root root 27854856 Nov 12 13:20 vmlinuz-5.15.126
-rw-r--r-- 1 root root 28518408 Nov 12 15:59 vmlinuz-6.2.16
lrwxrwxrwx 1 root root       16 Nov 12 13:20 vmlinuz.old -> vmlinuz-5.15.126
if test -z "${fk_kvers}"; then
   # setenv fk_kvers "5.15.0-odroid-arm64"
   setenv fk_kvers "6.2.16"
fi
$ sudo mkimage -A arm -T script -C none -n "Ubuntu boot script" -d boot.script boot.scr
Image Name:   Ubuntu boot script
Created:      Sun Nov 12 16:02:37 2023
Image Type:   ARM Linux Script (uncompressed)
Data Size:    4482 Bytes = 4.38 KiB = 0.00 MiB
Load Address: 00000000
Entry Point:  00000000
Contents:
   Image 0: 4474 Bytes = 4.37 KiB = 0.00 MiB

for i in {1..6}; do
    systemctl restart autovt@tty${i}.service
done
ln -s /usr/lib/systemd/system/autovt@.service /etc/systemd/system/getty.target.wants/autovt@tty2.service
ln -s /usr/lib/systemd/system/autovt@.service /etc/systemd/system/getty.target.wants/autovt@tty3.service
# Repeat the above line for each tty you want to enable autovt on