|
|
@ -2,52 +2,32 @@ |
|
|
|
主机系统推荐使用 Ubuntu >= 20.04 的版本。 |
|
|
|
|
|
|
|
\section{工具链获取} |
|
|
|
从公司共享目录获取 RK3588 的编译工具: |
|
|
|
|
|
|
|
从公司共享目录获取 RK3588 的编译工具:\\ |
|
|
|
\texttt { |
|
|
|
\small |
|
|
|
\textbackslash{}\textbackslash{}192.168.1.202\textbackslash{}常用工具\textbackslash{}2.开发工具\textbackslash{}RK3588\textbackslash{}gcc-arm-9.2-2019.12-x86\_64-aarch64-none-linux-gnu.tar.xz。 |
|
|
|
} |
|
|
|
|
|
|
|
} \\ |
|
|
|
下载后用放在 linux 系统下,用命令解压: |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\small]{bash} |
|
|
|
tar xpvf gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz |
|
|
|
\end{minted} |
|
|
|
\shellcmd{bash}{tar xpvf gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz} |
|
|
|
|
|
|
|
\section{U-Boot 代码下载} |
|
|
|
U-Boot 源代码在这里: |
|
|
|
|
|
|
|
U-Boot 源代码在这里:\\ |
|
|
|
\texttt { |
|
|
|
\small |
|
|
|
http://192.168.1.202:8888/rk3588/uboot.git |
|
|
|
} |
|
|
|
|
|
|
|
} \\ |
|
|
|
用 git 命令下载: |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\small]{bash} |
|
|
|
git clone http://192.168.1.202:8888/rk3588/uboot.git |
|
|
|
\end{minted} |
|
|
|
\shellcmd{bash}{git clone http://192.168.1.202:8888/rk3588/uboot.git} |
|
|
|
|
|
|
|
\section{Kernel 代码下载} |
|
|
|
kernel 源代码在这里: |
|
|
|
|
|
|
|
kernel 源代码在这里:\\ |
|
|
|
\texttt { |
|
|
|
\small |
|
|
|
http://192.168.1.202:8888/rk3588/kernel.git |
|
|
|
} |
|
|
|
|
|
|
|
} \\ |
|
|
|
用 git 命令下载: |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\small]{bash} |
|
|
|
git clone http://192.168.1.202:8888/rk3588/kernel.git |
|
|
|
\end{minted} |
|
|
|
|
|
|
|
\shellcmd{bash}{git clone http://192.168.1.202:8888/rk3588/kernel.git} |
|
|
|
准备好文件以后,目录结构如下图所示: |
|
|
|
|
|
|
|
% \begin{figure}[H] |
|
|
|
% \centering |
|
|
|
% \includegraphics[width=0.8\textwidth]{down} |
|
|
|
% \end{figure} |
|
|
|
%\caption{代码目录结构} |
|
|
|
|
|
|
|
\begin{figure}[H] |
|
|
|
\centering |
|
|
|
\begin{tikzpicture} |
|
|
@ -73,10 +53,8 @@ rk3588 |
|
|
|
\section{U-Boot} |
|
|
|
|
|
|
|
\subsection{U-Boot 编译} |
|
|
|
用下面的命令编译 U-Boot : |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\small]{bash} |
|
|
|
./make.sh sytc |
|
|
|
\end{minted} |
|
|
|
\noindent 用下面的命令编译 U-Boot : |
|
|
|
\shellcmd{bash}{./make.sh sytc} |
|
|
|
编译生成的文件是 uboot.img。 |
|
|
|
|
|
|
|
\subsection{U-Boot 版本号} |
|
|
@ -86,7 +64,7 @@ U-Boot 在启动的时候会打印我们内部的版本号,例如: |
|
|
|
\begin{tikzpicture} |
|
|
|
\node [anchor=south west, inner sep=0] (image) at (0,0) { |
|
|
|
\begin{tcolorbox}[colframe=gray!20, coltitle=blue!80] |
|
|
|
\footnotesize |
|
|
|
\scriptsize |
|
|
|
\begin{Verbatim} |
|
|
|
ON=0x00, OFF=0x00 |
|
|
|
vdd_gpu_s0 750000 uV |
|
|
@ -140,11 +118,8 @@ U-Boot 的版本号在 \verb+include/configs/sytc_rk3588.h+ 里修改: |
|
|
|
\section{Kernel} |
|
|
|
|
|
|
|
\subsection{kernel 编译} |
|
|
|
kernel 编译: |
|
|
|
|
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\small]{bash} |
|
|
|
./make.sh |
|
|
|
\end{minted} |
|
|
|
\noindent kernel 编译: |
|
|
|
\shellcmd{bash}{./make.sh} |
|
|
|
编译生成的文件是当前目录下的 boot.img。 |
|
|
|
|
|
|
|
\subsection{kernel 版本号} |
|
|
@ -153,8 +128,8 @@ kernel 编译: |
|
|
|
\centering |
|
|
|
\begin{tikzpicture} |
|
|
|
\node [anchor=south west, inner sep=0] (image) at (0,0) { |
|
|
|
\begin{tcolorbox}[title={init/main.c:start\_kernel()},colframe=gray!20, coltitle=blue!80] |
|
|
|
\footnotesize |
|
|
|
\begin{tcolorbox}[title={\small init/main.c:start\_kernel()},colframe=gray!20, coltitle=blue!80] |
|
|
|
\scriptsize |
|
|
|
\begin{Verbatim} |
|
|
|
pr_notice("%s", linux_banner); |
|
|
|
pr_notice("SYTC Linux version: %d.%d (%s)", |
|
|
@ -172,7 +147,7 @@ setup_arch(&command_line); |
|
|
|
%\draw [lightgray, step=1] (image.south west) grid (image.north east); |
|
|
|
%\foreach \x in {0, 1, ..., 10} {\node [below] at (\x, 0) {\x};} |
|
|
|
%\foreach \y in {0, 1, ..., 10} {\node [left] at (0, \y) {\y};} |
|
|
|
\draw [red,thick, rounded corners] (0.2, 3.3) rectangle (9.1, 6.05); |
|
|
|
\draw [red,thick, rounded corners] (0.2, 3.3) rectangle (9.1, 5.70); |
|
|
|
\end{scope} |
|
|
|
\end{tikzpicture} |
|
|
|
\caption{Kernel 版本号} |
|
|
@ -184,7 +159,7 @@ setup_arch(&command_line); |
|
|
|
\begin{tikzpicture} |
|
|
|
\node [anchor=south west, inner sep=0] (image) at (0,0) { |
|
|
|
\begin{tcolorbox}[colframe=gray!20, coltitle=blue!80] |
|
|
|
\footnotesize |
|
|
|
\scriptsize |
|
|
|
\begin{Verbatim} |
|
|
|
[ 0.947325] Booting Linux on physical CPU 0x0000000000 [0x412fd050] |
|
|
|
[ 0.947345] Linux version 5.10.110 (user@DESKTOP-8539AN4) |
|
|
@ -214,8 +189,8 @@ setup_arch(&command_line); |
|
|
|
\centering |
|
|
|
\begin{tikzpicture} |
|
|
|
\node [anchor=south west, inner sep=0] (image) at (0,0) { |
|
|
|
\begin{tcolorbox}[title={arch/arm64/configs/rk3588\_sytc\_defconfig:},colframe=gray!20, coltitle=blue!80] |
|
|
|
\footnotesize |
|
|
|
\begin{tcolorbox}[title={\small arch/arm64/configs/rk3588\_sytc\_defconfig:},colframe=gray!20, coltitle=blue!80] |
|
|
|
\scriptsize |
|
|
|
\begin{Verbatim} |
|
|
|
CONFIG_SYTC_MAJOR_VERSION=1 |
|
|
|
CONFIG_SYTC_MINOR_VERSION=0 |
|
|
@ -252,17 +227,17 @@ setup_arch(&command_line); |
|
|
|
开机时在调试串口上按住 {\kx「}CTRL-C{\kx」},串口打印将停止在 U-Boot 的命令行上。 |
|
|
|
|
|
|
|
\subsection{升级 uboot} |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\small]{bash} |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|
|
|
tftpflash 20000000 uboot.img uboot |
|
|
|
\end{minted} |
|
|
|
|
|
|
|
\subsection{升级 boot} |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\small]{bash} |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|
|
|
tftpflash 20000000 boot.img boot |
|
|
|
\end{minted} |
|
|
|
|
|
|
|
\subsection{升级 rootfs} |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\small]{bash} |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|
|
|
tftpflash 20000000 rootfs.img rootfs |
|
|
|
\end{minted} |
|
|
|
|
|
|
@ -289,40 +264,38 @@ rootfs.img 是一个 ext4 文件系统格式的文件,可以通过 mount 的 |
|
|
|
可以按下面的步骤进行修改: |
|
|
|
\begin{enumerate}[(1),nosep] |
|
|
|
\item 将 rootfs.img 挂载到系统下,例如: |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\small]{bash} |
|
|
|
sudo mount -o loop rootfs.img /media |
|
|
|
\end{minted} |
|
|
|
\shellcmd{bash}{sudo mount -o loop rootfs.img /media} |
|
|
|
\item 将 rootfs 的内容复制出来: |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\small]{bash} |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|
|
|
sudo mkdir rootfs |
|
|
|
sudo cp -a /media/* rootfs/ |
|
|
|
sudo umount /media |
|
|
|
\end{minted} |
|
|
|
\item chroot 到 rootfs 的文件系统: |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\small]{pwsh} |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{pwsh} |
|
|
|
sudo mount -o bind /proc rootfs/proc |
|
|
|
sudo mount -o bind /dev rootfs/dev |
|
|
|
sudo mount -o bind /sys rootfs/sys |
|
|
|
sudo chroot rootfs /bin/bash |
|
|
|
\end{minted} |
|
|
|
\item 安装新的软件包,例如: |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\small]{bash} |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|
|
|
apt-get update |
|
|
|
apt-get install tcpdump |
|
|
|
\end{minted} |
|
|
|
\item 安装所需软件以后,清理临时文件并退出 chroot 环境: |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\small]{bash} |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|
|
|
apt-get clean |
|
|
|
exit |
|
|
|
\end{minted} |
|
|
|
\item 卸载 bind 的文件系统: |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\small]{bash} |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|
|
|
sudo umount rootfs/proc |
|
|
|
sudo umount rootfs/dev |
|
|
|
sudo umount rootfs/sys |
|
|
|
\end{minted} |
|
|
|
\item 重新打包文件系统: |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\small]{bash} |
|
|
|
\begin{minted}[bgcolor=lightgray!30,fontsize=\scriptsize]{bash} |
|
|
|
IMAGE_SIZE_MB=$(( $(sudo du -sh -m rootfs | cut -f1) + 300 )) |
|
|
|
dd if=/dev/zero of=rootfs.img bs=1M count=0 seek=${IMAGE_SIZE_MB} |
|
|
|
sudo mkfs.ext4 -d rootfs rootfs.img |
|
|
|