User talk:H3ndrik/Mainline Debian HowTo

This page describes bootstrapping debian with it's default (mainline) linux kernel to create a useful SD-card with a clean install.

Since most parts of sunxi-related drivers got accepted into mainline linux kernel, we can now install debian with little changes. The MMC (SD Card) driver is available in Linux 3.16 and we need some u-boot patches so we have to do a little extra work.

= Getting a cross toolchain =

For this part, you need to refer to our toolchain page.

= Building u-boot = Please refer to U-Boot

= Building script.bin =

First, get the following repositories: git clone git://github.com/linux-sunxi/sunxi-tools.git git clone git://github.com/linux-sunxi/sunxi-boards.git

Descend into sunxi-tools and run the command 'make fex2bin'.

Then, get into the sunxi-board tree and find the fex file for your board. You also need to find out the MAC Address of Ethernet adapter, as you will need to fix the MAC in the [dynamic] section of the fex file, to match the one for your device: [dynamic] MAC = "000000000000" to, for example: [dynamic] MAC = "0123456789AB"

Note: If the [dynamic] section does not exist in your .fex file, you can just add it with your MAC address.

For more information see EMAC.

Now you can create the script.bin file: ../../../sunxi-tools/fex2bin .fex script.bin You will need this later on when finishing u-boot installation.

= Building the kernel = Please refer to our Kernel compilation guide. = Setting up the boot partition =

install bootloader and partition card
Please execute commands in Bootable_SD_card, Bootable_SD_card, Bootable_SD_card

Mount your boot or root partition again: mount /dev/${card}1 /mnt

boot.cmd
Now create boot.cmd in /mnt or /mnt/boot with the following content:

kernel arguments
For traditional layout with separate boot partition the kerenl will use the second partition (mmcblk0p2) for root: setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10 ${extra} With single partition use the first: setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p1 rootwait panic=10 ${extra} You may want to add more arguments to set up display, etc

load kernel
These commands load the script.bin and kernel from the first partition. fatload mmc 0 0x43000000 script.bin || ext2load mmc 0 0x43000000 boot/script.bin fatload mmc 0 0x48000000 uImage || ext2load mmc 0 0x48000000 uImage boot/uImage bootm 0x48000000

boot.scr
Now you can generate boot.scr: mkimage -C none -A arm -T script -d /mnt/boot.cmd /mnt/boot.scr

cleanup
Unmount the partition again. umount /mnt

= Setting up the rootfs = Please refer to Bootable_SD_card

As a last step you need to copy the kernel modules into the newly created rootfs. Change into the top level directory of the newly created rootfs and run: mount ${cardroot} /mnt mkdir -p /mnt/lib/modules rm -rf /mnt/lib/modules/ cp -r /output/lib /mnt/ umount /mnt (Replace  with the directory you have built your kernel in as described above.)

= Boot! =

Now you should be able to unmount your SDCard filesystems, and you should be able to boot your brand new installation.