From b97445e9fb1d946fde0dbae99d52f27b7e36b7d1 Mon Sep 17 00:00:00 2001 From: Stefan Tabbert Date: Wed, 24 Mar 2021 14:15:48 +0100 Subject: [PATCH] =?UTF-8?q?=E2=80=9EHome=E2=80=9C=20=C3=A4ndern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Home.md | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 149 insertions(+), 1 deletion(-) diff --git a/Home.md b/Home.md index b4a0caf..6e9f9eb 100644 --- a/Home.md +++ b/Home.md @@ -1,2 +1,150 @@ # Anleitung zum erstellen eines Debian Images für BananaPi (Pro/LeMaker) -[Vorbereitung](https://git.isatho.me/a1d3s/BananaPi/wiki/Vorbereitung-des-Buildsystems) +`wsl --install -d ubuntu` + +``` +apt install ntp +apt install build-essential bison flex swig python3-dev u-boot-tools git dialog gcc-arm-linux-gnueabihf bc binutils-arm-linux-gnueabihf cpp-arm-linux-gnueabihf wget fakeroot debootstrap libncurses-dev libssl-dev qemu-user-static qemu-arm-static +``` + + +``` +mkdir /mnt/c/build +cd /mnt/c/build/ +``` + +``` +git clone --depth 1 -b v5.10 https://github.com/torvalds/linux.git +git clone --depth 1 -b v2021.01 https://source.denx.de/u-boot/u-boot.git +``` + +``` +dd if=/dev/zero of=image.img bs=1M count=3900 +losetup /dev/loop0 image.img +fdisk /dev/loop0 +partx -av /dev/loop0 +printf 'o\nn\np\n1\n+200M\n\nw' | fdisk /dev/loop0p1 +printf 'o\nn\np\n2\n\n\nw' | fdisk /dev/loop0p2 +mkfs.vfat /dev/loop0p1 +mkfs.ext4 /dev/loop0p2 +``` + + +``` +mkdir /mnt/c/build/rootfs +mount /dev/loop0p2 /mnt/c/build/rootfs +mount /dev/loop0p1 /mnt/c/build/rootfs/boot +``` + +``` +targetdir=/mnt/c/build/rootfs +distro=buster +sudo mount -o bind /proc $targetdir/proc +sudo mount -o bind /dev $targetdir/dev +sudo mount -o bind /sys $targetdir/sys +debootstrap --arch=armhf --foreign $distro $targetdir +cp /usr/bin/qemu-arm-static $targetdir/usr/bin/ +cp /etc/resolv.conf $targetdir/etc +``` +``` +chroot $targetdir +distro=buster +export LANG=C +/debootstrap/debootstrap --second-stage +``` +``` +cat /etc/hostname +echo T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 >> /etc/inittab +``` +``` +nano /etc/rc.local +-> vor exit 0 einfügen +test -f /etc/ssh/ssh_host_dsa_key || dpkg-reconfigure openssh-server + +exit +``` +``` +cd linux/ +make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sunxi_defconfig +make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig +make -j8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LOADADDR=0x40008000 uImage dtbs +make -j8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=$targetdir/lib/modules modules && modules_install + +cp arch/arm/boot/uImage $targetdir/boot +mkdir $targetdir/boot/dtbs +cp arch/arm/boot/dts/sun7i-a20-bananapi-pro.dtb $targetdir/boot/dtbs +``` +``` +cd .. +nano boot.cmd +part uuid ${devtype} ${devnum}:${bootpart} uuid +setenv bootargs console=${console} root=PARTUUID=${uuid} rw rootwait + +if fatload ${devtype} ${devnum}:${bootpart} 0x48000000 uImage; then + if fatload ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /dtbs/${fdtfile}; then + setenv bootm_boot_mode sec; + bootm 0x48000000; + fi; +fi +mkimage -C none -A arm -T script -d boot.cmd boot.scr +cp boot.scr $targetdir/boot +``` +``` +cd u-boot +make CROSS_COMPILE=arm-linux-gnueabihf- Bananapipro_defconfig +make CROSS_COMPILE=arm-linux-gnueabihf- +``` +``` +dd if=/dev/zero of=/dev/loop0 bs=1k count=1023 seek=1 +dd if=u-boot-sunxi-with-spl.bin of=/dev/loop0 bs=1024 seek=8 +``` +``` +rm $targetdir/etc/ssh/ssh_host* +rm $targetdir/etc/resolv.conf +rm $targetdir/usr/bin/qemu-arm-static +``` +``` +umount $targetdir/proc +umount $targetdir/dev +umount $targetdir/sys +umount $targetdir/boot +umount $targetdir +``` +``` +losetup -d /dev/loop0 +```