descriptions, explanations and links (which took far too much time to be found out) that are useful to get arch linux running on a banana pi r2
kernel | ||
u-boot | ||
chroot-setup.sh | ||
mkbootimg.sh | ||
README.md | ||
setup.sh |
Everything this document is about is how to setup the sd card that finally is inserted to the banana. So lets start:
The sd card contains the following:
- Pre-Loader
- u-boot
- vfat: boot (
/dev/mmcblk1p1
) - ext4: root (
/dev/mmcblk1p2
) - ...
Pre-Loader:
...!!!
u-boot:
clone u-boot repository and compile:
cp -f u-boot/mt7623n_bpir2_defconfig ${u-boot-dir}/configs
cd ${u-boot-dir}
make CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- ARCH=arm mt7623n_bpir2_defconfig
make CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- ARCH=arm
dd if=u-boot.bin of=/dev/${sdcard} bs=1k seek=320
maybe you have to patch ${u-boot-dir}/scripts/dtc/dtc-lexer.l
; simply replace by u-boot/dtc-lexer.l
.
boot-partition:
Contains:
/boot.img
/zImage
/dts/mt7623n-bananapi-bpi-r2.dtb
and further images (eg different kernel versions etc...)
how to create these files:
(because they are not available anywhere, at least not for the most recent kernel. The most recent version provided by some debain derivates is 4.4 or 4.14... too old for my taste!)
git clone https://github.com/mbgg/linux-mediatek.git
cd linux-mediatek
git checkout <commit_I_recommend>
cp <this_repo>/kernel/linux-mediatek-<commit_hash>.config .config
cp <this_repo>/kernel/mt7623n-bananapi-bpi-r2.dts arch/arm/boot/dts
make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- oldconfig
make -j4 ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- zImage dtbs
mkdir boot.setup
mount /dev/mmcblk0p1 boot.setup
cp arch/arm/boot/zImage boot.setup
cp arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dtb boot.setup/dts
sync
umount boot.setup
rmdir boot.setup
/boot.img
is created by mkimage from u-boot/boot.cmd
:
mkimage -A arm -T script -C none -n "Load Kernel" -d u-boot/boot.cmd boot.img
root-partition:
If you did no mistake so far (...) this should be the easiest part: There are two possibilities:
- Use the provided image [name], dd it to your root partition, boot into this root and update and customaize the system
- dd the image to a temporary partition, boot into it, and setup the root partition using pacstrap (you dont need the linux or linux-firmware package, you already cared about these parts in the previous section)
... !!!