%!TEX program = latexmk
% arara: xelatex: { shell: yes, synctex: yes, options: ['--output-directory=output' ]}
% arara: xelatex: { shell: yes, synctex: yes, options: ['--output-directory=output' ]}
% arara: xelatex: { shell: yes, synctex: yes, options: ['--output-directory=output' ]}
% arara: remove: {
% arara: --> directory: output,
% arara: --> recursive: true,
% arara: --> patterns: [
% arara: -->     '*.idx', '*.ver', '*.aux',
% arara: -->     '*.log', '*.out', '*.hst',
% arara: -->     '*.toc', '*.lot', '*.glo',
% arara: -->     '*.glg', '*.gls', '*.ist',
% arara: -->     '*.lof', '*.ind'
% arara: --> ]}
% arara: halt if name = getBasename(getOriginalReference().getName()) + '.pdf';
% arara: --> dst = toFile('pdf/' + name);
% arara: --> from = toFile('output/' + name);
% arara: --> java.nio.file.Files.move(from.toPath(), dst.toPath(),
% arara: -->     java.nio.file.StandardCopyOption.REPLACE_EXISTING); true
%%%%%%%%------------------------------------------------------------------------
%%%% 导言区
%% 文档类型为article
\special{dvipdfmx:config z 9}
% PDF 压缩
% gswin64c -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=pdf/rk3588_guide.pdf  rk3588_guide.pdf
% 
% -dPDFSETTINGS 
% -dPDFSETTINGS=/screen质量较低，体积较小。
% -dPDFSETTINGS=/ebook更好的质量，但略大pdf。
% -dPDFSETTINGS=/prepress输出类似于Acrobat Distiller ``Prepress Optimized``设置
% -dPDFSETTINGS=/printer选择类似于Acrobat Distiller ``Print Optimized``设置的输出
% -dPDFSETTINGS=/default选择用于各种用途的输出，可能会牺牲较大的输出文件
\documentclass[a4paper,12pt,oneside]{book}
%1m = 39.4 inch
%大18开 （18.5cm * 23cm)
\usepackage{import}
\usepackage[framemethod=tikz]{mdframed}
\usepackage[left=3.75cm,right=3.25cm,top=3cm,bottom=2.5cm]{geometry}
\usepackage[cachedir=output/cache, outputdir=output]{minted}
%\usepackage{minted}
%% en_preamble包含基本的宏包配置
\import {style/}{en_preamble}
% \input{style/en_preamble}

%% 如果不写中文的话就不需要引用xecjk_preamble里面的配置
\import{style/}{xecjk_preamble}

\import{style/}{coding}
\usepackage{imakeidx}
\usepackage{tcolorbox}
\usepackage[shortlabels]{enumitem}
% xelatex
\usepackage{navigator}
% lualatex
%\usepackage{embedfile}
\usepackage{ulem}
\usepackage{pgfplots}
\usepackage{pifont}
\usepackage{adjustbox}
\usepackage{marginnote}
% lualatex
%\usepackage{emoji}
\usepackage{circuitikz}
\usepackage{comment}
\usepackage{tablefootnote}
\usepackage{makecell}
% \usepackage{xdufont}
\usepackage[owncaptions,tablegrid]{vhistory}
\usepackage{attachfile2}

\pgfplotsset{compat=newest}
% \usepackage[
%   placement=center,
%   angle=45,
%   scale=20,
%   color=black!40,
%   %hshift=60,
%   %vshift=-5
% ]{background}

% \backgroundsetup{contents={样章}}
% \backgroundsetup{contents={\includegraphics[width=0.2\textwidth]{figures/cock.jpg}}}

\usetikzlibrary{calc,arrows, arrows.meta}
\newcommand{\myclearpage}{\clearpage{\pagestyle{empty}\cleardoublepage}}
%\newcommand{\mydedicate}{\clearpage{\pagestyle{empty}\cleardedicatepage}}

\renewcommand{\thefootnote}{\fnsymbol{footnote}}

% otfinfo -i TwemojiMozilla.ttfamily
% Full name: Twemoji Mozilla
%\setemojifont{Twemoji Mozilla}
%%%% 导言区结束
%%%%%%%%------------------------------------------------------------------------
\graphicspath{{images/}{tex/}}
\setlength{\headheight}{14pt}
\renewcommand{\headrulewidth}{0.7pt}
\renewcommand{\footrulewidth}{0pt}

\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{3}

\setlength{\floatsep}{4pt plus 2pt minus 2pt}
\setlength{\textfloatsep}{4pt plus 2pt minus 2pt}
\setlength{\intextsep}{4pt plus 2pt minus 2pt}

\DeclareRobustCommand{\shellcmd}[2]{\\ \mintinline[bgcolor=lightgray!30,fontsize=\scriptsize]{#1}{#2} \\}
%\xeCJKsetup{CJKmath=true}
\hypersetup{colorlinks=true,linkcolor=blue!80, urlcolor=orange!80, %
            pdfstartview=FitH,%
            pdfpagemode=UseNone,%
            bookmarksopen=false,%
            urlcolor=,%
            pdffitwindow=true,%
            pdfauthor=surenyi82@163.com,%
            pdfsubject=RK3588 开发说明,%
            pdftitle=RK3588 开发指导,%
            pdfkeywords=RK3588 AARCH64 Linux U-Boot
}
% url style
\makeatletter
\def\url@leostyle{%
    \@ifundefined{selectfont}{\def\UrlFont{\sf}}{\def\UrlFont{\small\rmfamily}} %
}
\makeatother
\urlstyle{leo}

\newcommand{\zhsquote}[1]{「#1」}
% vhistory
\renewcommand{\vhhistoryname}{修订记录}
\renewcommand{\vhversionname}{版本变更}
\renewcommand{\vhdatename}{日期}
\renewcommand{\vhauthorname}{作者}
\renewcommand{\vhchangename}{修改内容}
\renewcommand{\vhAuthorColWidth}{0.25\hsize}
\renewcommand{\vhChangeColWidth}{1.75\hsize}
% reset chapter number from 1 in very part
\makeatletter
\@addtoreset{chapter}{part}
\makeatother
%\pagecolor[rgb]{0.9, 0.99, 0.9}
%\renewcommand{\today}{\CJKnumber\year 年 \CJKnumber\month 月 \CJKnumber\day 日}
\renewcommand{\today}{\number\year{} 年 \number\month{} 月 \number\day{} 日}
%\setmonofont{Consolas}

\newcommand{\apientry}[1] {%
\tikz[baseline] \node[fill=gray!20, text=blue!85, anchor=text, align=right, font=\ttfamily\small]{ #1};
}

\newcommand{\coloredref}[3][blue]{\href{#2}{\color{#1}{#3}}}%

\renewcommand\vhAuthorColWidth{0.5\hsize}
\renewcommand\vhChangeColWidth{1.5\hsize}
\makeindex

% \xdusetup {
%     style / cjk-font   = win,
%     style / latin-font = tacn,
% }
%%%% 正文部分
%%%%%%%%------------------------------------------------------------------------
\begin{document}

\frontmatter
\pagestyle{empty}

% region: title page
%%自定义封面
\def\titlename{Rockchip RK3588 软件开发指导}
\def\subtitle{RK3588 平台移植参考}
\def\authors{苏仁义 \\ \vspace{0.9em} \coloredref[black]{mailto:surenyi82@163.com}{me@email.cn} }
\def\orgnization{版本: \vhCurrentVersion}
\def\titlescale{0.40}
\def\titlepic{title}
\input{style/title.tex}
\begin{versionhistory}
\renewcommand\arraystretch{1.5}
\vhEntry{1.0}{2024/3/11}{苏仁义}{开始编写本文档}
\end{versionhistory}
% endregion

% region: table of contents
{
    \hypersetup{linkcolor=black}
    \tableofcontents
}
% endregion

\def\thelstlisting{\thechapter-\arabic{lstlisting}}
%% 中文习惯是设定首行缩进为2em。
%% 注意此设置一定要在document环境之中，这可能与\setlength作用范围相关
\setlength{\parindent}{2em}

\setlength{\headheight}{14.8pt}
% region ： main part
%%开始正文，页面计数从正文开始
\mainmatter{}
\setcounter{page}{1}
\pagestyle{fancy}
\begin{content}

\part {开发篇}
\import{tex/}{build}
\import{tex/}{resource}
\import{tex/}{upgrade}
\import{tex/}{issue}
\part {生产部署}
\import{tex/}{deploy}
\part{其他}
\import{tex/}{wsl2}
\import{tex/}{ubuntu}
\import{tex/}{openeuler}
\backmatter{}
%\input{tex/appendix}
%\myclearpage
\end{content}

\clearpage

\embeddedfile[Change .pdf to .tar.xz]{resizedisk}[resize-disk.pdf]{images/resize-disk.tar.xz}

%\bibliographystyle{alpha}
%\input{contents/biblio}
%\clearpage

{
\hypersetup{linkcolor=black}
%\listoftables
\listoffigures
%\printindex
}
% endregion

%\textattachfile[description={Change .pdf to .tar.xz}, mimetype=application/pdf]{resize-disk.tar.xz}{}
\finishpdffile

\end{document}
%%%% 正文部分结束

% Local Variables:
% mode: latex
% TeX-engine: xelatex
% TeX-master: t
% End: