BuildKernelOnRockyLinux92

Try Steps

Replace the repository for speedup:

sed -e 's|^mirrorlist=|#mirrorlist=|g'     -e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.ustc.edu.cn/rocky|g'     -i.bak     /etc/yum.repos.d/rocky-extras.repo     /etc/yum.repos.d/rocky.repo
yum makecache

Install docker:

dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
# replace all of the `download.docker.com` into `https://mirrors.ustc.edu.cn/docker-ce`
yum makecache
yum install -y docker-ce
systemctl enable docker
systemctl start docker

Pull rockylinux9 and prepare building environment via:

docker pull rockylinux:9
docker run -it -v /root/source:/source rockylinux:9 /bin/bash
sed -e 's|^mirrorlist=|#mirrorlist=|g'     -e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.ustc.edu.cn/rocky|g'     -i.bak     /etc/yum.repos.d/rocky-extras.repo     /etc/yum.repos.d/rocky.repo
yum makecache
yum install -y rpm-build rpmdevtools  dnf-plugins-core ncurses-devel make gcc bc bison flex elfutils-libelf-devel openssl-devel grub2 rpm-build rsync gcc vim yum-utils
rpm -ivh kernel-5.15.113_lts2021_iotg-1.src.rpm
useradd -m dash
su dash
$ cd 
$ rpmdev-setuptree
$ ls ~
rpmbuild

RockyLinux Way

Create docker instance:

docker run -it -v /root/source:/source rockylinux:9 /bin/bash

In docker, prepare for building kernel:

sed -e 's|^mirrorlist=|#mirrorlist=|g'     -e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.ustc.edu.cn/rocky|g'     -i.bak     /etc/yum.repos.d/rocky-extras.repo     /etc/yum.repos.d/rocky.repo
yum makecache
yum install -y rpm-build rpmdevtools  dnf-plugins-core ncurses-devel make gcc bc bison flex elfutils-libelf-devel openssl-devel grub2 rpm-build rsync gcc vim yum-utils perl
yum --enablerepo=crb install -y systemd-udev  asciidoc audit-libs-devel binutils-devel clang dwarves fuse-devel gcc-c++ gcc-plugin-devel git-core glibc-static java-devel kabi-dw kernel-rpm-macros libbabeltrace-devel libbpf-devel libcap-devel libcap-ng-devel libmnl-devel libnl3-devel libtraceevent-devel libtracefs-devel lld llvm lvm2 net-tools newt-devel numactl-devel pciutils-devel perl-devel python3-docutils system-sb-certs tpm2-tools xmlto elfutils-devel nss-tools perl-generators pesign python3-devel xz-devel
# yum --enablerepo=crb install -y  kmod  patch  bash    tar  git-core  which bzip2  xz  findutils  gzip  m4  perl-interpreter  perl-Carp  perl-devel  perl-generators  make  diffutils  gawk gcc  binutils  redhat-rpm-config  hmaccalc  bison  flex  gcc-c++ net-tools  hostname  bc  elfutils-devel dwarves python3-devel gcc-plugin-devel bpftool rsync xmlto  asciidoc  python3-sphinx  python3-sphinx_rtd_theme  zlib-devel binutils-devel newt-devel  bison flex xz-devel audit-libs-devel java-devel libbabeltrace-devel libtraceevent-devel numactl-devel   gettext ncurses-devel libcap-devel libcap-ng-devel pciutils-devel python3-docutils zlib-devel binutils-devel clang llvm numactl-devel libcap-devel libcap-ng-devel rsync libmnl-devel rpm-build  elfutils kabi-dw openssl openssl-devel nss-tools pesign    xmlto asciidoc clang llvm lld


yum install /source/WALinuxAgent-cvm-2.7.0.6-9.el9_2.1.rocky.0.noarch.rpm /source/systemd-boot-unsigned-252-14.el9_2.1.x86_64.rpm
useradd -m mock
su - mock

Download the kernel src rpm:

$ yumdownloader --source kernel
$ ls -l -h
total 139M
-rw-r--r--. 1 mock mock 139M Aug 10 06:30 kernel-5.14.0-284.25.1.el9_2.src.rpm
$ rpm -Uvh kernel-5.14.0-284.25.1.el9_2.src.rpm 
[mock@c51507a516d4 ~]$ cd ./rpmbuild/SPECS/
[mock@c51507a516d4 SPECS]$ ls
kernel.spec
[mock@c51507a516d4 SPECS]$ time rpmbuild -ba kernel.spec 

intel way

using the kernel-5.15.113-1.src.rpm package we got following issue:

Processing files: kernel-headers-5.15.113-1.x86_64
Provides: kernel-headers = 5.15.113 kernel-headers = 5.15.113-1 kernel-headers(x86-64) = 5.15.113-1
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Obsoletes: kernel-headers
Processing files: kernel-devel-5.15.113-1.x86_64
warning: absolute symlink: /lib/modules/5.15.113/build -> /usr/src/kernels/5.15.113
warning: absolute symlink: /lib/modules/5.15.113/source -> /usr/src/kernels/5.15.113
Provides: kernel-devel = 5.15.113-1 kernel-devel(x86-64) = 5.15.113-1
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Processing files: kernel-debugsource-5.15.113-1.x86_64
error: Could not open %files file /home/mock/rpmbuild/BUILD/kernel-5.15.113/debugsourcefiles.list: No such file or directory


RPM build errors:
    line 20: It's not recommended to have unversioned Obsoletes: Obsoletes: kernel-headers
    absolute symlink: /lib/modules/5.15.113/build -> /usr/src/kernels/5.15.113
    absolute symlink: /lib/modules/5.15.113/source -> /usr/src/kernels/5.15.113
    Could not open %files file /home/mock/rpmbuild/BUILD/kernel-5.15.113/debugsourcefiles.list: No such file or directory

fedora 5.15 lts

Refers to https://copr.fedorainfracloud.org/coprs/kwizart/kernel-longterm-5.15/.

yum install -y bpftool
dnf copr enable kwizart/kernel-longterm-5.15
yumdownloader --source kernel-longterm
su - mock
rpm -Uvh kernel-longterm-5.15.124-200.el9.src.rpm
cd /home/mock/rpmbuild
time rpmbuild -ba kernel.spec 

build result:

$ find . | grep rpm$
./RPMS/x86_64/kernel-longterm-modules-internal-5.15.124-200.el9.x86_64.rpm
./RPMS/x86_64/kernel-longterm-debug-devel-matched-5.15.124-200.el9.x86_64.rpm
./RPMS/x86_64/kernel-longterm-debug-5.15.124-200.el9.x86_64.rpm
./RPMS/x86_64/kernel-longterm-5.15.124-200.el9.x86_64.rpm
./RPMS/x86_64/kernel-longterm-devel-matched-5.15.124-200.el9.x86_64.rpm
./RPMS/x86_64/kernel-longterm-debug-modules-extra-5.15.124-200.el9.x86_64.rpm
./RPMS/x86_64/kernel-longterm-modules-extra-5.15.124-200.el9.x86_64.rpm
./RPMS/x86_64/kernel-longterm-debug-modules-internal-5.15.124-200.el9.x86_64.rpm
./RPMS/x86_64/kernel-longterm-debug-debuginfo-5.15.124-200.el9.x86_64.rpm
./RPMS/x86_64/kernel-longterm-debug-devel-5.15.124-200.el9.x86_64.rpm
./RPMS/x86_64/kernel-longterm-debuginfo-5.15.124-200.el9.x86_64.rpm
./RPMS/x86_64/kernel-longterm-devel-5.15.124-200.el9.x86_64.rpm
./RPMS/x86_64/kernel-longterm-debug-modules-5.15.124-200.el9.x86_64.rpm
./RPMS/x86_64/kernel-longterm-debuginfo-common-x86_64-5.15.124-200.el9.x86_64.rpm
./RPMS/x86_64/kernel-longterm-modules-5.15.124-200.el9.x86_64.rpm
./RPMS/x86_64/kernel-longterm-debug-core-5.15.124-200.el9.x86_64.rpm
./RPMS/x86_64/kernel-longterm-core-5.15.124-200.el9.x86_64.rpm
./SRPMS/kernel-longterm-5.15.124-200.el9.src.rpm

Aug17

Enable perftools building, I think it failed because of the libebpf is too new comparing to 5.15.113 kernel. so changes to kerner’s tools/lib/bpf version’s libebpf-devel package for building.

WorkingTipsOniventoy

Create the server:

cd Downloads
mkdir iventory
cd iventory
tar xzvf ../iventoy-1.0.17-linux-free.tar.gz
cd iventoy-1.0.17
sudo ./iventoy.sh start

Select the DHCP server mode for external:

/images/2023_08_09_09_42_48_888x625.jpg

Create the linked iso:

➜  ~ ls /home/dash/Downloads/iventory/iventoy-1.0.17/iso 
➜  ~ ln -s /media/121/iso/Rocky-9.2-x86_64-dvd.iso /home/dash/Downloads/iventory/iventoy-1.0.17/iso/Rocky-9.2-x86_64-dvd.iso
➜  ~ ln -s /media/121/iso/ubuntu-22.04.2-desktop-amd64.iso /home/dash/Downloads/iventory/iventoy-1.0.17/iso/ubuntu-22.04.2-desktop-amd64.iso
➜  ~ ls -l -h /home/dash/Downloads/iventory/iventoy-1.0.17/iso 
total 0
lrwxrwxrwx 1 dash root 39 Aug  9 09:40 Rocky-9.2-x86_64-dvd.iso -> /media/121/iso/Rocky-9.2-x86_64-dvd.iso
lrwxrwxrwx 1 dash root 47 Aug  9 09:40 ubuntu-22.04.2-desktop-amd64.iso -> /media/121/iso/ubuntu-22.04.2-desktop-amd64.iso

Start the server:

/images/2023_08_09_09_43_26_1079x379.jpg

Using external dhcp server may need other configuration.

# vim /etc/dhcpd.conf
......
 subnet 192.168.1.0	netmask 255.255.255.0 {
    range 192.168.1.160 192.168.1.199;
    option routers 192.168.1.33;
    option subnet-mask 255.255.255.0;
       filename "iventoy_loader_16000";
       next-server 192.168.1.12;
    option broadcast-address 192.168.1.255;
    option domain-name-servers 223.5.5.5;
    option time-offset 0;
    default-lease-time	1209600;
    max-lease-time 1814400;
    }
......

OnMeshCommander

Steps:

# docker run -it ubuntu:latest /bin/bash
In docker instance:    
# cd /root
# mkdir meshcommander
# cd meshcommander
# npm install meshcommander 

Then commit this docker instance to docker image:

# docker commit awgowugowugouawo meshcommander:mine

Start the instance:

docker run -it -p 4080:3000 meshcommander:ctyun /bin/bash

Edit the node modules:

root@938cedc55cde:~/meshcommander# vim node_modules/meshcommander/webserver.js 
156         obj.app.listen(port, '0.0.0.0', function () { console.log("MeshCommander running on http://127.0.0.1:" + port + '.'); });
node node_modules/meshcommander/

Visit the https://ip:4080 you could reache the meshcommander webpage.

/images/2023_08_04_09_31_09_640x215.jpg

Configuration:

/images/2023_08_04_09_31_33_433x288.jpg

System Status:

./images/2023_08_04_09_32_08_363x424.jpg

Attach an iso for Linux installation:

meshcommander is too old. switch to

UsingCloneZillaForInstallCentOS7On5950x

Boot the vm with clonezilla iso:

/images/2023_07_24_14_03_07_486x413.jpg

Select sshfs for destination:

/images/2023_07_24_14_05_00_701x167.jpg

Select which disk:

DockerizeUOS

Install the server via :

/images/2023_07_19_08_15_49_457x277.jpg

关机后,在host机器上,:

apt install -y docker.io guestfish
qemu-img convert -f qcow2 -O raw  uos10G.qcow2 uos10G.img
guestfish -a uos10G.img --ro

Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.

Type: ‘help’ for help on commands
      ‘man’ to read the manual
      ‘quit’ to quit the shell

><fs> run
><fs> list-filesystems
/dev/sda1: ext4
/dev/sda2: ext4
><fs> mount /dev/sda2 /
><fs> mount /dev/sda1 /boot
><fs> tar-out / - | xz --best >> myuos.xz
><fs> exit
 cat myuos.xz | docker import - uoskkk
root@delli9:~# docker images
REPOSITORY   TAG       IMAGE ID       CREATED          SIZE
uoskkk     latest    2fb3905a142f   18 seconds ago   1.68GB

run into docker instance via:

root@delli9:~# docker run -it uosctyun:latest /bin/bash
[root@8d94931f1eb0 /]# cat /etc/issue
\S
Kernel \r on an \m
[root@8d94931f1eb0 /]# cat /etc/uos-release 
UOS Server Enterprise-C 20
[root@8d94931f1eb0 /]# yum makecache

使用方法, 绿色版安装docker:

[root@uos ~]# tar xzvf docker-24.0.2.tgz 
docker/
docker/docker-proxy
docker/containerd-shim-runc-v2
docker/ctr
docker/docker
docker/docker-init
docker/runc
docker/dockerd
docker/containerd
[root@uos ~]# mv docker/* /usr/bin
[root@uos ~]# dockerd&

在另一个终端上启动容器实例:

[root@uos ~]# cat myuos.xz | docker import - uosxj
sha256:e09cca9384977ce87a05d50a50134a8fa44607b19f4586222b835916dddb24a0
[root@uos ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED          SIZE
uosxj        latest    e09cca938497   40 seconds ago   1.68GB
[root@uos ~]# docker run --privileged -it uosxj /bin/bash
[root@0bb3783f7e1e /]# yum makecache
[root@0bb3783f7e1e /]# yum install -y qemu-kvm-ev
[root@0bb3783f7e1e /]# /usr/libexec/qemu-kvm  --version
QEMU emulator version 2.12.0 (qemu-kvm-ev-2.12.0-45.uelc20_2.01)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers