From 39f24dc0d995aeda97b0dd32a88186f45504770b Mon Sep 17 00:00:00 2001 From: "S.J.R. van Schaik" Date: Thu, 14 Sep 2017 15:25:43 +0200 Subject: [PATCH] user-doc: add notes about mkimage for initramfs --- user-doc/user-doc.tex | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/user-doc/user-doc.tex b/user-doc/user-doc.tex index 7d99dbb..6ad3c29 100644 --- a/user-doc/user-doc.tex +++ b/user-doc/user-doc.tex @@ -178,6 +178,18 @@ More specifically, it is recommended to build a kernel without any support for n For the initramfs, we will need static binaries of \emph{busybox}, \emph{kexec-tools}, \emph{cpio} and \emph{gzip}. +Run the following command to pack up the directory structure of the initramfs into a gzip compressed cpio archive: + +\begin{minted}[breaklines]{text} +find . -print0 | cpio --null -ov --format=newc | gzip -9 > ../initramfs.cpio.gz +\end{minted} + +Because u-boot expects the initramfs to be in the u-boot format, we also have to wrap it up in their format using \emph{mkimage}: + +\begin{minted}[breaklines]{text} +mkimage -n 'Ramdisk Image' -A arm -O linux -T ramdisk -C gzip -d initramfs.cpio.gz initramfs.uImage +\end{minted} + \section{Flashing ROTS} To write the ROTS image to the SPI NOR flash, we can either use an external programmer or boot the device in FEL mode and use the \emph{sunxi-fel} tool. @@ -349,12 +361,12 @@ Once the board has booted into FEL mode, we can detect the SPI NOR flash chip as Manufacturer: Winbond (EFh), model: 40h, size: 16777216 bytes. \end{minted} -Then we can write the \path{u-boot.bin}, \path{bzImage} and \path{initramfs.cpio.gz} images as follows: +Then we can write the \path{u-boot.bin}, \path{bzImage} and \path{initramfs.uImage} images as follows: \begin{minted}[breaklines]{text} ./sunxi-fel -p spiflash-write 0x000000 u-boot.bin ./sunxi-fel -p spiflash-write 0x0a0000 bzImage -./sunxi-fel -p spiflash-write 0x600000 initramfs.cpio.gz +./sunxi-fel -p spiflash-write 0x600000 initramfs.uImage \end{minted} \section{Booting ROTS}