§2023-11-11

  1. /etc/apt/sources.list, as deb-src is not commented out
# deb http://deb.debian.org/debian/ bullseye main

deb http://deb.debian.org/debian/ bullseye main
deb-src http://deb.debian.org/debian/ bullseye main

deb http://security.debian.org/debian-security bullseye-security main
deb-src http://security.debian.org/debian-security bullseye-security main

# bullseye-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
deb http://deb.debian.org/debian/ bullseye-updates main
deb-src http://deb.debian.org/debian/ bullseye-updates main
  1. install build requirements

check /etc/resolv.cong, ping -c 3 google.com

$ sudo apt-get build-dep linux linux-image-$(uname -r)
  1. Download form https://www.kernel.org/
$ wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.6.1.tar.xz
$ cd ..
$ tar xvf src/linux-6.6.1.tar.xz
$ cd linux-6.6.1
$ cp /boot/config-6.1.0-odroid-arm64 .config
$ sudo apt inatsll libncurses-dev
$ make oldconfig    <-- has bunch of selection, took all default
$ make menuconfig   <-- to check
$ time make -j6

real  072m28.159s
user  391m39.086s
sys    24m27.42s
  1. make modules_install
$ ls /lib/modules
6.1.0-odroid-arm64
alexlai@n2Bookworm:~/build/linux-6.6.1$ sudo make modules_install
...
INSTALL /lib/modules/6.6.1/kernel/net/vmw_vsock/vmw_vsock_virtio_transport_common.ko
INSTALL /lib/modules/6.6.1/kernel/net/vmw_vsock/vsock_loopback.ko
INSTALL /lib/modules/6.6.1/kernel/net/nsh/nsh.ko
INSTALL /lib/modules/6.6.1/kernel/net/hsr/hsr.ko
DEPMOD  /lib/modules/6.6.1
  1. make install
alexlai@n2Bookworm:~/build/linux-6.6.1$ ls -l /boot/
total 23928
-rw-r--r-- 1 root root     4552 Nov 11 13:33 boot.scr
-rw-r--r-- 1 root root     4494 Nov 11 11:38 boot.scr.bak
-rw-r--r-- 1 root root     4480 Nov 11 13:33 boot.script
-rw-r--r-- 1 root root     4494 Nov 11 13:28 boot.scr.ori
-rw-r--r-- 1 root root   231625 Jun 30 10:08 config-6.1.0-odroid-arm64
-rw-r--r-- 1 root root      237 Nov 11 11:36 config.ini
lrwxrwxrwx 1 root root       57 Nov 11 11:58 dtb -> dtbs/6.1.0-odroid-arm64/amlogic/meson64_odroidn2_plus.dtb
lrwxrwxrwx 1 root root       57 Nov 11 11:58 dtb-6.1.0-odroid-arm64 -> dtbs/6.1.0-odroid-arm64/amlogic/meson64_odroidn2_plus.dtb
drwxr-xr-x 3 root root     4096 Nov 11 11:38 dtbs
drwxr-xr-x 2 root root     4096 Nov 11 11:58 grub
lrwxrwxrwx 1 root root       29 Nov 11 11:37 initrd.img -> initrd.img-6.1.0-odroid-arm64
-rw-r--r-- 1 root root 10137038 Nov 11 11:58 initrd.img-6.1.0-odroid-arm64
lrwxrwxrwx 1 root root       29 Nov 11 11:37 initrd.img.old -> initrd.img-6.1.0-odroid-arm64
drwx------ 2 root root    16384 Nov 11 11:17 lost+found
lrwxrwxrwx 1 root root       40 Nov 11 11:58 overlays -> dtbs/6.1.0-odroid-arm64/amlogic/overlays
-rw-r--r-- 1 root root  3858715 Jun 30 10:08 System.map-6.1.0-odroid-arm64
lrwxrwxrwx 1 root root       26 Nov 11 11:37 vmlinuz -> vmlinuz-6.1.0-odroid-arm64
-rw-r--r-- 1 root root 10206439 Jun 30 10:08 vmlinuz-6.1.0-odroid-arm64
lrwxrwxrwx 1 root root       26 Nov 11 11:37 vmlinuz.old -> vmlinuz-6.1.0-odroid-arm64
alexlai@n2Bookworm:~/build/linux-6.6.1$ sudo make install
  INSTALL /boot
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 6.6.1 /boot/vmlinuz-6.6.1
update-initramfs: Generating /boot/initrd.img-6.6.1
Using DTB: amlogic/meson64_odroidn2_plus.dtb
Couldn't find DTB meson64_odroidn2_plus.dtb in /usr/lib/linux-image-6.6.1 or /etc/flash-kernel/dtbs
Couldn't find DTB files in /usr/lib/linux-image-6.6.1/amlogic
run-parts: /etc/initramfs/post-update.d//flash-kernel exited with return code 1
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
make[1]: *** [arch/arm64/Makefile:170: install] Error 1
make: *** [Makefile:234: __sub-make] Error 2
alexlai@n2Bookworm:~/build/linux-6.6.1$ ls -l /boot/
total 63480
-rw-r--r-- 1 root root     4552 Nov 11 13:33 boot.scr
-rw-r--r-- 1 root root     4494 Nov 11 11:38 boot.scr.bak
-rw-r--r-- 1 root root     4480 Nov 11 13:33 boot.script
-rw-r--r-- 1 root root     4494 Nov 11 13:28 boot.scr.ori
-rw-r--r-- 1 root root   231625 Jun 30 10:08 config-6.1.0-odroid-arm64
-rw-r--r-- 1 root root   238455 Nov 11 15:40 config-6.6.1
-rw-r--r-- 1 root root      237 Nov 11 11:36 config.ini
lrwxrwxrwx 1 root root       57 Nov 11 11:58 dtb -> dtbs/6.1.0-odroid-arm64/amlogic/meson64_odroidn2_plus.dtb
lrwxrwxrwx 1 root root       57 Nov 11 11:58 dtb-6.1.0-odroid-arm64 -> dtbs/6.1.0-odroid-arm64/amlogic/meson64_odroidn2_plus.dtb
drwxr-xr-x 3 root root     4096 Nov 11 11:38 dtbs
drwxr-xr-x 2 root root     4096 Nov 11 11:58 grub
lrwxrwxrwx 1 root root       29 Nov 11 11:37 initrd.img -> initrd.img-6.1.0-odroid-arm64
-rw-r--r-- 1 root root 10137038 Nov 11 11:58 initrd.img-6.1.0-odroid-arm64
-rw-r--r-- 1 root root 10258491 Nov 11 15:40 initrd.img-6.6.1
lrwxrwxrwx 1 root root       29 Nov 11 11:37 initrd.img.old -> initrd.img-6.1.0-odroid-arm64
drwx------ 2 root root    16384 Nov 11 11:17 lost+found
lrwxrwxrwx 1 root root       40 Nov 11 11:58 overlays -> dtbs/6.1.0-odroid-arm64/amlogic/overlays
-rw-r--r-- 1 root root  3858715 Jun 30 10:08 System.map-6.1.0-odroid-arm64
-rw-r--r-- 1 root root  3977735 Nov 11 15:40 System.map-6.6.1
lrwxrwxrwx 1 root root       13 Nov 11 15:40 vmlinuz -> vmlinuz-6.6.1
-rw-r--r-- 1 root root 10206439 Jun 30 10:08 vmlinuz-6.1.0-odroid-arm64
-rw-r--r-- 1 root root 26013704 Nov 11 15:40 vmlinuz-6.6.1
lrwxrwxrwx 1 root root       26 Nov 11 11:37 vmlinuz.old -> vmlinuz-6.1.0-odroid-arm64
  1. create boot.scr
# setenv fk_kvers "6.1.0-odroid-arm64"
setenv fk_kvers "6.6.1"
alexlai@n2Bookworm:/boot$ sudo mkimage -A arm -T script -C none -n "Debian boot script" -d boot.script boot.scr
Image Name:   Debian boot script
Created:      Sat Nov 11 15:45:48 2023
Image Type:   ARM Linux Script (uncompressed)
Data Size:    4514 Bytes = 4.41 KiB = 0.00 MiB
Load Address: 00000000
Entry Point:  00000000
Contents:
   Image 0: 4506 Bytes = 4.40 KiB = 0.00 MiB

failed to boot linux-6.6.1 !!!!

'Vb,�)eO1,�4��Debian boot script�
#
# flash-kernel: bootscr.odroid-g12
#

# Bootscript using the new unified bootcmd handling
#
# Expects to be called with the following environment variables set:
#
#  devtype              e.g. mmc/scsi etc
#  devnum               The device number of the given type
#  bootpart             The partition containing the boot files
#  distro_bootpart      The partition containing the boot files
#                       (introduced in u-boot mainline 2016.01)
#  prefix               Prefix within the boot partiion to the boot files
#  kernel_addr_r        Address to load the kernel to
#  fdt_addr_r           Address to load the FDT to
#  ramdisk_addr_r       Address to load the initrd to.
#
# The uboot must support the booti and generic filesystem load commands.

setenv bootargs " ${bootargs} quiet"
setenv overlay_resize 8192

setenv bootlabel "2023-11-11 Debian GNU/Linux 12 (bookworm) To Gentoo"
# setenv fk_kvers "6.1.0-odroid-arm64"
setenv fk_kvers "6.6.1"

# Default serial console
# setenv console "ttyAML0,115200n8"

# Default TTY console
setenv bootargs "${bootargs} console=tty1"
setenv fdt_addr_r "0x20000000"
setenv bootargs "${bootargs} cma=800M"
setenv bootargs "${bootargs} clk_ignore_unused"
setenv bootargs "${bootargs} fsck.mode=force fsck.repair=yes"
setenv bootargs "${bootargs} net.ifnames=0"

load ${devtype} ${devno}:${partition} ${loadaddr} ${prefix}config.ini \
    &&  ini generic ${loadaddr}
if test -n "${overlay_profile}"; then
    ini overlay_${overlay_profile} ${loadaddr}
fi

if test -n "${console}"; then
  setenv bootargs "${bootargs} console=${console}"
fi

if test -n "${default_console}"; then
  setenv bootargs "${bootargs} console=${default_console}"
fi

if test -z "${fk_kvers}"; then
   setenv fk_kvers "6.1.0-odroid-arm64"
fi

# Hack to set kernel load address for Linux kernel v3.16.56 only
if test "${fk_kvers}" = "3.16.56-odroid-arm64"; then
   setenv kernel_addr_r "0x10800000"
fi

if test -z "${fdtfile}"; then
   setenv fdtfile "meson64_odroid${variant}.dtb"
fi

if test -z "${distro_bootpart}"; then
  setenv partition ${bootpart}
else
  setenv partition ${distro_bootpart}
fi


if test -n "${fbcon}"; then
    setenv bootargs "${bootargs} fbcon=${fbcon}"
fi

setenv dtbo_addr_r 0x21000000
setenv zimage_addr_r ${ramdisk_addr_r}

load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${prefix}dtbs/${fk_kvers}/amlogic/${fdtfile}
if test -n "${overlays}"; then
    fdt addr ${fdt_addr_r}
    fdt resize ${overlay_resize}

    setenv overlay ${variant}
    if test "${variant}" = "n2l"; then setenv overlay "n2"; fi
    if test "${variant}" = "n2_plus"; then setenv overlay "n2"; fi
    if test "${variant}" = "hc4"; then setenv overlay "c4"; fi

    for file in ${overlays}; do
        load ${devtype} ${devnum}:${partition} ${dtbo_addr_r} ${prefix}dtbs/${fk_kvers}/amlogic/overlays/odroid${overlay}/${file}.dtbo \
            && fdt apply ${dtbo_addr_r}
    done
fi

load ${devtype} ${devnum}:${partition} ${zimage_addr_r} ${prefix}vmlinuz-${fk_kvers} \
&& unzip ${zimage_addr_r} ${kernel_addr_r} \
&& load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${prefix}initrd.img-${fk_kvers} \
&& echo "Booting Debian ${fk_kvers} from ${devtype} ${devnum}:${partition}..." \
&& booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}

load ${devtype} ${devnum}:${partition} ${kernel_addr_r} ${prefix}vmlinuz-${fk_kvers} \
&& load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${prefix}initrd.img-${fk_kvers} \
&& echo "Booting Debian ${fk_kvers} from ${devtype} ${devnum}:${partition}..." \
&& booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}

load ${devtype} ${devnum}:${partition} ${zimage_addr_r} ${prefix}vmlinuz-${fk_kvers} \
&& unzip ${zimage_addr_r} ${kernel_addr_r} \
&& load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${prefix}dtb-${fk_kvers} \
&& load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${prefix}initrd.img-${fk_kvers} \
&& echo "Booting Debian ${fk_kvers} from ${devtype} ${devnum}:${partition}..." \
&& booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}

load ${devtype} ${devnum}:${partition} ${zimage_addr_r} ${prefix}vmlinuz \
&& unzip ${zimage_addr_r} ${kernel_addr_r} \
&& load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${prefix}dtb \
&& load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${prefix}initrd.img \
&& echo "Booting Debian from ${devtype} ${devnum}:${partition}..." \
&& booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}