本文是在默认操作系统Ubuntu 20.04.3(内核版本5.4.0-81-generic)下进行编译内核源码编译。
在编译开始前,请正确配置服务器的网络环境、软件源、同步服务器系统时间,以便下载相关的编译依赖包。
解压Kbox-AOSP11.zip压缩包后,在“Kbox-AOSP11/deploy_scripts/ubuntu_android11_deploy”目录下有一键式内核安装脚本:kbox11_install_kernel.sh,该脚本包含了编译内核的全部操作步骤,可通过执行该脚本快速地编译和安装内核。
脚本的具体使用方法请参见脚本开头处的注释说明内容。
1 | vim /etc/default/grub
|
GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
1 | vim /etc/selinux/config
|
SELINUX=disabled
1 | vim /etc/sysctl.conf
|
fs.inotify.max_user_instances=8192
1 2 | update-grub2 reboot |
1 | apt install -y build-essential dpkg dpkg-dev libncurses5-dev openssl libssl-dev libpciaccess0 pkg-config bison flex libelf-dev libdrm-amdgpu1 xserver-xorg-video-amdgpu lxc |
如果安装过程中有获取包失败的情况,请根据提示中的网址,手动获取安装包进行安装,安装成功后,继续安装尚未安装的依赖包。
请参见软件环境中的下载链接,下载Docker静态安装包,以docker-19.03.15.tgz为例。
1 2 | cd ~ tar xvpf docker-19.03.15.tgz |
1 | cp -p docker/* /usr/bin |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | cat >/usr/lib/systemd/system/docker.service <<EOF [Unit] Description=Docker Application Container Engine Documentation=http://docs.docker.com After=network.target docker.socket [Service] Type=notify EnvironmentFile=-/run/flannel/docker WorkingDirectory=/usr/local/bin ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock --selinux-enabled=false --log-opt max-size=1g ExecReload=/bin/kill -s HUP $MAINPID # Having non-zero Limit*s causes performance problems due to accounting overhead # in the kernel. We recommend using cgroups to do container-local accounting. LimitNOFILE=infinity LimitNPROC=infinity LimitCORE=infinity # Uncomment TasksMax if your systemd version supports it. # Only systemd 226 and above support this version. #TasksMax=infinity TimeoutStartSec=0 # set delegate yes so that systemd does not reset the cgroups of docker containers Delegate=yes # kill only the docker process, not all processes in the cgroup KillMode=process Restart=on-failure [Install] WantedBy=multi-user.target EOF |
拷贝上述代码时请注意粘贴在终端的样式,参考样式如下图:
1 2 3 | systemctl daemon-reload systemctl restart docker systemctl enable docker |
每次重启服务器后,如果Docker未自启动成功,需要执行上述三条命令。
请参见软件环境中的下载链接,下载linux-firmware-20210919.tar.gz文件。
1 2 | cd ~ tar -xvpf linux-firmware-20210919.tar.gz |
1 | cp -ar linux-firmware-20210919/*gpu /usr/lib/firmware/ |