Oct 16, 2023
TechnologyCreate lxc instance
Configuration file for pve 100:
# cat /etc/pve/lxc/100.conf
arch: amd64
cores: 4
features: nesting=1
hostname: ubuntu2204
memory: 8192
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=DA:8A:5D:E2:3D:1F,ip=dhcp,type=veth
ostype: ubuntu
rootfs: local-lvm:vm-100-disk-0,size=40G
swap: 512
unprivileged: 1
lxc.cgroup2.devices.allow: c 226:0 rwm
lxc.cgroup2.devices.allow: c 226:128 rwm
lxc.cgroup2.devices.allow: c 29:0 rwm
lxc.mount.entry: /dev/fb0 dev/fb0 none bind,optional,create=file
lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir
lxc.mount.entry: /dev/dri/renderD128 dev/renderD128 none bind,optional,create=file
lxc.cgroup2.devices.allow: c 4:7 rwm
lxc.mount.entry: /dev/tty7 dev/tty7 none bind,optional,create=file
lxc.cgroup2.devices.allow: c 13:* rwm
lxc.mount.entry: /dev/input dev/input none bind,optional,create=dir
lxc.cgroup2.devices.allow: c 116:* rwm
lxc.mount.entry: /dev/snd dev/snd none bind,optional,create=dir
lxc.idmap: u 0 100000 65536
lxc.idmap: g 0 100000 5
lxc.idmap: g 5 5 1
lxc.idmap: g 6 100006 23
lxc.idmap: g 29 29 1
lxc.idmap: g 30 100030 14
lxc.idmap: g 44 44 1
lxc.idmap: g 45 100045 60
lxc.idmap: g 105 101 1
lxc.idmap: g 106 100106 2
lxc.idmap: g 108 103 1
lxc.idmap: g 109 100109 65427
Start the machine and ssh into it.
Configuration in lxc
apt update -y && apt upgrade -y
apt install -y curl sudo gnupg
apt install -y va-driver-all ocl-icd-libopencl1
apt-get install -y lightdm
echo "/usr/sbin/lightdm" > /etc/X11/default-display-manager
apt-get install -y kodi
apt install -y kodi-peripheral-joystick
cat <<EOF >/usr/share/xsessions/kodi-alsa.desktop
[Desktop Entry]
Name=Kodi-alsa
Comment=This session will start Kodi media center with alsa support
Exec=env AE_SINK=ALSA kodi-standalone
TryExec=env AE_SINK=ALSA kodi-standalone
Type=Application
EOF
useradd -d /home/kodi -m kodi &>/dev/null
gpasswd -a kodi audio &>/dev/null
gpasswd -a kodi video &>/dev/null
gpasswd -a kodi render &>/dev/null
groupadd -r autologin &>/dev/null
gpasswd -a kodi autologin &>/dev/null
gpasswd -a kodi input &>/dev/null
cat <<EOF >/usr/share/xsessions/kodi-alsa.desktop
[Desktop Entry]
Name=Kodi-alsa
Comment=This session will start Kodi media center with alsa support
Exec=env AE_SINK=ALSA kodi-standalone
TryExec=env AE_SINK=ALSA kodi-standalone
Type=Application
EOF
cat <<EOF >/etc/lightdm/lightdm.conf.d/autologin-kodi.conf
[Seat:*]
autologin-user=kodi
autologin-session=kodi-alsa
EOF
apt-get install -y xserver-xorg-input-evdev
mkdir -p /etc/X11/xorg.conf.d
cat >/usr/local/bin/preX-populate-input.sh << __EOF__
#!/usr/bin/env bash
### Creates config file for X with all currently present input devices
# after connecting new device restart X (systemctl restart lightdm)
######################################################################
cat >/etc/X11/xorg.conf.d/10-lxc-input.conf << _EOF_
Section "ServerFlags"
Option "AutoAddDevices" "False"
EndSection
_EOF_
cd /dev/input
for input in event*
do
cat >> /etc/X11/xorg.conf.d/10-lxc-input.conf <<_EOF_
Section "InputDevice"
Identifier "\$input"
Option "Device" "/dev/input/\$input"
Option "AutoServerLayout" "true"
Driver "evdev"
EndSection
_EOF_
done
__EOF__
chmod +x /usr/local/bin/preX-populate-input.sh
mkdir -p /etc/systemd/system/lightdm.service.d
cat > /etc/systemd/system/lightdm.service.d/override.conf << __EOF__
[Service]
ExecStartPre=/bin/sh -c '/usr/local/bin/preX-populate-input.sh'
SupplementaryGroups=video render input audio tty
__EOF__
ln -fs /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service
systemctl daemon-reload
systemctl start lightdm
ln -fs /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service
Change to xfce4:
apt install -y xfce4
root@ubuntu2204:~# cat /etc/lightdm/lightdm.conf.d/autologin-kodi.conf
[Seat:*]
autologin-user=kodi
autologin-session=xfce4-alsa
#autologin-session=kodi-alsa
root@ubuntu2204:~# cat /usr/share/xsessions/xfce4-alsa.desktop
[Desktop Entry]
Name=xfce4-alsa
Comment=This session will start xfce4 with alsa support
Exec=env AE_SINK=ALSA startxfce4
TryExec=env AE_SINK=ALSA startxfce4
Type=Application
Change to dde:
add-apt-repository ppa:ubuntudde-dev/stable
apt install ubuntudde-dde
Oct 11, 2023
Technologyshift + F10
, call the command window:
reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassTPMCheck" /t REG_DWORD /d "1" /f
reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassSecureBootCheck" /t REG_DWORD /d "1" /f
reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassRAMCheck" /t REG_DWORD /d "1" /f
reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassStorageCheck" /t REG_DWORD /d "1" /f
reg add "HKLM\SYSTEM\Setup\LabConfig" /v "BypassCPUCheck" /t REG_DWORD /d "1" /f
reg add "HKLM\SYSTEM\Setup\MoSetup" /v "AllowUpgradesWithUnsupportedTPMOrCPU" /t REG_DWORD /d "1" /f
Then continue.
Connection issue:
shift + f10
input : oobe\bypassnro
Upload to s3:
root@dell2 ~]# aws --endpoint http://192.168.1.162:9000 s3 cp win11.qcow2 s3://tyy
upload: ./win11.qcow2 to s3://tyy/win11.qcow2
[root@dell2 ~]# aws --endpoint http://192.168.1.162:9000 s3 ls s3://tyy/win11.qcow2
2023-10-11 09:40:09 12190482432 win11.qcow2
verification
failed, because it’s bios
mode:
Oct 9, 2023
TechnologyHardware/OS/Software
nuc11 running Ubuntu 22.04:
dash@dash-NUC11PAHi5:~$ lscpu | grep 1135
型号名称: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
dash@dash-NUC11PAHi5:~$ uname -a
Linux dash-NUC11PAHi5 6.2.0-31-generic #31~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Aug 16 13:45:26 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
dash@dash-NUC11PAHi5:~$ cat /etc/issue
Ubuntu 22.04.3 LTS \n \l
Build Steps
Install prerequisite packages:
sudo apt update -y
sudo apt install -y build-essential git meson protobuf-c-compiler autoconf automake libtool curl make g++ unzip protobuf-compiler cmake uuid-dev pkg-config libyaml-cpp-dev libspice-client-glib-2.0-dev libpixman-1-dev libzstd-dev libasound2-dev libsdl2-dev libepoxy-dev
Clone/build/install virglrender:
unzip virglrenderer-main.zip
cd virglrenderer-main/
meson -Dprefix=/usr build
cd build/
sudo ninja install
Clone/build/install mvisor:
unzip mvisor-master.zip
cd mvisor-master/
vim meson_options.txt
option('vgpu',
type: 'boolean',
value: true,
description: 'Enable VGPU device'
meson setup build
meson compile -C build
./build/mvisor --version
MVisor: 2.5.2
sudo cp build/mvisor /usr/bin/
VM Operations
Folder content:
$ pwd
/home/dash/mvisorwin
$ ls
virtio-win-0.1.240.iso win10.qcow2 zh-cn_windows_10_consumer_editions_version_22h2_updated_sep_2023_x64_dvd_4cde879b.iso
Create the yaml via:
$ cat default.yaml
name: Default configuration
base: i440fx.yaml
machine:
memory: 8G
vcpu: 4
# Set vcpu thread priority value [-20, 19]
# A higher value means a lower priority
priority: 1
# Turn on BIOS output and performance measurement
debug: No
# Turn on hypervisor to lower CPU usage (Hyper-V is used for Windows)
hypervisor: Yes
objects:
- name: cmos
# gmtime for linux, localtime for windows
rtc: localtime
- class: qxl
- class: spice-agent
- class: qemu-guest-agent
- class: usb-tablet
- class: virtio-network
backend: uip
mac: 00:50:00:11:22:33
map: tcp:0.0.0.0:8022-:22
- class: ata-cdrom
image: /home/dash/mvisorwin/zh-cn_windows_10_consumer_editions_version_22h2_updated_sep_2023_x64_dvd_4cde879b.iso
- class: ata-cdrom
image: /home/dash/mvisorwin/virtio-win-0.1.240.iso
- class: virtio-block
image: /home/dash/mvisorwin/win10.qcow2
snapshot: No
# - class: floppy
# image: /data/images/floppy.img
# - class: virtio-block
# image: /data/empty.qcow2
# snapshot: No
# - class: virtio-fs
# path: /tmp/fuse
# disk_name: mvisor-fs
# disk_size: 2G
# inode_count: 200
# - class: vfio-pci
# sysfs: /sys/bus/mdev/devices/c2e088ba-954f-11ec-8584-525400666f2b
# debug: Yes
- class: virtio-vgpu
memory: 1G
staging: Yes
blob: No
node: /dev/dri/renderD128
Start the machine via:
mvisor -c default.yaml
After installation:
Install virtio drivers:
Install qxl driver:
Qxl ready:
virtio-vgpu:
Enable the test sign driver:
Reboot to make the driver take effect, install driver:
Result:
The Mvisor VGPU:
but the gpu won’t work
Aug 31, 2023
Technologylspci for getting the wireless card mode:
# lspci | grep -i wireless
01:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8188EE Wireless Network Adapter (rev 01)
Install the script:
yay -S linux-wifi-hotspot
Create the wifi via:
systemctl enable --now create_ap
create_ap wlp1s0 enp4s0 xxx xxxxxxx --hidden
Aug 25, 2023
Technology编译镜像准备
使用rockylinux:9
的容器镜像创建一个容器实例:
sudo docker run -it rockylinux:9 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
dnf install -y 'dnf-command(config-manager)'
dnf config-manager --set-enabled crb
yum install -y vim rpm-build python3-devel elfutils-devel openssl-devel perl-generators pesign yum-utils bc bison bpftool dwarves flex gcc gcc-c++ git-core hmaccalc kmod m4 make net-tools perl-devel gcc-plugin-devel 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 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
# download the following packages offlinely
yum install -y WALinuxAgent-cvm-2.7.0.6-9.el9_2.1.rocky.0.noarch.rpm systemd-boot-unsigned-252-14.el9_2.1.x86_64.rpm
useradd -m mock
新建一个终端,在该终端上将运行中且已做上述修改的容器实例提交为容器镜像以便下次使用:
[root@dellnew ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f7eb549f3d44 rockylinux:9 "bash" 7 minutes ago Up 7 minutes wonderful_sinoussi
[root@dellnew ~]# docker commit wonderful_sinoussi buidrockykernel:latest
[root@dellnew ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
buidrockykernel latest 207a4b57059e 5 seconds ago 1.94GB
2. 使用容器编译内核
使用上节创建的编译镜像编译内核:
[root@text ~]# docker run --name=testrocky -v /root/buildout:/buildout -it buidrockykernel:latest /bin/bash
[root@fa4d8f532c21 /]# cp /buildout/kernel-5.15.113-200.el9.src.rpm /home/mock/
[root@fa4d8f532c21 /]# su - mock
[mock@fa4d8f532c21 ~]$ rpm -Uvh kernel-5.15.113-200.el9.src.rpm
[mock@fa4d8f532c21 ~]$ cd rpmbuild/SPECS/
[mock@fa4d8f532c21 SPECS]$ time rpmbuild -ba kernel.spec 2>&1 | tee build.log
编译出的内核rpm包位于/home/mock/rpmbuild下,可以通过find /home/mock/rpmbuild | grep rpm$
命令找到。