„Home“ ändern

Stefan Tabbert 2021-03-24 14:15:48 +01:00
parent 47e4d196ba
commit b97445e9fb

150
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/apt/sources.list
deb http://ftp.uk.debian.org/debian $distro main contrib non-free
deb-src http://ftp.uk.debian.org/debian $distro main contrib non-free
deb http://ftp.uk.debian.org/debian $distro-updates main contrib non-free
deb-src http://ftp.uk.debian.org/debian $distro-updates main contrib non-free
deb http://security.debian.org/debian-security $distro/updates main contrib non-free
deb-src http://security.debian.org/debian-security $distro/updates main contrib non-free
EOT
```
```
cat </etc/apt/apt.conf.d/71-no-recommends
APT::Install-Recommends "0";
APT::Install-Suggests "0";
EOT
```
```
apt-get update
apt-get install locales dialog openssh-server ntpdate sudo wireless-tools wpasupplicant mc dbus slim -y
dpkg-reconfigure locales
dpkg-reconfigure tzdata
```
```
passwd root
useradd -m -G users,sudo,ssh -s /bin/bash bpi
passwd bpi
```
```
cat </etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
EOT
```
```
echo bpi > /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
```