Bootstrap a minimal debian rootfs for sunxi boards https://github.com/bleuchtang/sunxi-debian

Émile Morel dbdc149b77 readme - rename to lime il y a 10 ans
olinux e42a3f56ac create_sunxi - une lime.fex instead of lime2 il y a 10 ans
.gitignore 7a67dbb068 gitignore - add *.swp il y a 10 ans
Dockerfile be44a16703 Dockerfile - remove useless lines il y a 10 ans
README.md dbdc149b77 readme - rename to lime il y a 10 ans

README.md

olinux-a20-lime

Bootstrap a minimal debian for olinuxino-a20-lime

Thanks to lukas2511 for quick bootstrap.

Build docker image

sudo docker pull debian:stable
git clone https://github.com/bleuchtang/olinuxino-a20-lime
cd olinuxino-a20-lime && sudo docker build -t debian:olinux .

Build minimal arm debootstrap

We cannot perform a debootstrap in dockerfile because dockerfile doesn't accept privileged mode. For more details see docker issue

sudo docker run --privileged -i -t -v $(pwd)/olinux/:/olinux/ debian:olinux sh ./olinux/create_arm_debootstrap.sh

Build sunxi kernel and boot files

You shoud have both debootstrap and sunxi directories in olinux/

sudo docker run --privileged -i -t -v $(pwd)/olinux/:/olinux/ debian:olinux sh ./olinux/create_sunxi_boot_files.sh

Install on a SD card

Setup SD card device

Find your device card (with dmesg for instance) and put it in a variable.

mmc=/dev/sdc

Partitioning

Make 2 partitions; one for boot files (kernel, file with custom boot args...), and another for root fs.

parted -s ${mmc} mklabel msdos
parted -a optimal ${mmc} mkpart primary fat32 1 16MiB
parted -a optimal ${mmc} mkpart primary fat32 16MiB 100%
mkfs.fat -F 32 ${mmc}1
mkfs.ext4 ${mmc}2

Installation

Boot partition

Make SD card bootable, add kernel your previously builded and file with motherboard paramaters.

mkdir -p /media/usb
dd if=olinux/sunxi/u-boot-sunxi/u-boot-sunxi-with-spl.bin of=${mmc} bs=1024 seek=8
mount ${mmc}1 /media/usb/
cp olinux/sunxi/linux-sunxi/arch/arm/boot/uImage /media/usb/
cp olinux/sunxi/script.bin /media/usb/

If you want to do a server without graphical session, you can disable allocated ram for the graphical card. To do that copy uEnv.txt file; This file add custom kernel parameters to save 32MB of ram. If you want to use the graphical card; don't copy uEnv.txt file.

cp olinux/uEnv.txt /media/usb/
umount /media/usb

Root partition

Copy the rootfs you previously builded with debootstrap, and add firmware and modules build with sunxi kernel.

mount ${mmc}2 /media/usb/
cp -r olinux/debootstrap/* /media/usb/
sync
chmod 1777 /media/usb/tmp/
rm -rf /media/usb/lib/firmware/
cp -rf olinux/sunxi/linux-sunxi/out/lib/firmware/ /media/usb/lib/
sync
rm -rf /media/usb/lib/modules/
cp -rf olinux/sunxi/linux-sunxi/out/lib/modules/ /media/usb/lib/
sync
umount /media/usb

You can now connect to your box via ssh. Default root password is olinux. After your first connection on your box you should run depmod to build moddep file.

ssh root@mybox
depmod -a

That's it ! Now you probably doesn't want do more system administration for your home server so get an eye on yunohost ;)

TODO

  • change Install on a SD card to a script ?

Some links:

You probably want to Build your own docker image

  • Because it's quick and easy; tutorial here
  • Because you shoudn't trust regitry images; demonstration here

External links