User Tools

Site Tools



en:bpi-r2:debian

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:bpi-r2:debian [2019/08/09 20:02] – [debootstrap] franken:bpi-r2:debian [2023/06/08 17:06] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Debian ======
  
 +===== debootstrap =====
 +
 +https://blog.night-shade.org.uk/2013/12/building-a-pure-debian-armhf-rootfs/
 +
 +[[ubuntu]]
 +
 +:!: in jessie/Ubuntu 14.x (64bit) there are problems in second-stage: [[https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=857338|link]], here debootstrap must be updated (first stage must be called again): [[https://packages.debian.org/jessie-backports/all/debootstrap/download|download]]
 +
 +<code bash>
 +sudo apt-get install qemu-user-static debootstrap binfmt-support
 +distro=buster
 +arch=armhf
 +#for bpi-r64 use arch=arm64
 +targetdir=$(pwd)/debian_${distro}_${arch}
 +mkdir $targetdir
 +sudo debootstrap --arch=$arch --foreign $distro $targetdir
 +sudo cp /usr/bin/qemu-arm-static $targetdir/usr/bin/
 +#for r64 use
 +# sudo cp /usr/bin/qemu-aarch64-static $targetdir/usr/bin/
 +sudo cp /etc/resolv.conf $targetdir/etc
 +sudo distro=$distro chroot $targetdir
 +export LANG=C
 +/debootstrap/debootstrap --second-stage
 +</code>
 +
 +like it's done in source hostname,apt (local Server),...must be configured
 +
 +  * hostname (/etc/hostname)
 +<code>
 +bpi-r2
 +</code>
 +  * /etc/apt/sources.list
 +<code>
 +deb http://ftp.us.debian.org/debian buster main contrib non-free
 +deb-src http://ftp.us.debian.org/debian buster main contrib non-free
 +deb http://ftp.us.debian.org/debian buster-updates main contrib non-free
 +deb-src http://ftp.us.debian.org/debian buster-updates main contrib non-free
 +deb http://security.debian.org/debian-security buster/updates main contrib non-free
 +deb-src http://security.debian.org/debian-security buster/updates main contrib non-free
 +</code>
 +  * fstab (boot,root)
 +<code>
 +# <file system> <dir> <type> <options> <dump> <pass>
 +/dev/mmcblk0p1 /boot vfat errors=remount-ro 0 1
 +/dev/mmcblk0p2 / ext4 defaults 0 0
 +</code>
 +  * Dns-server in /etc/resolv.conf
 +<code>
 +nameserver 192.168.0.5
 +</code>
 +  * Network-Configuration
 +<code>
 +auto eth0
 +iface eth0 inet manual
 +  pre-up ip link set $IFACE up
 +  post-down ip link set $IFACE down
 +
 +auto lan0
 +iface lan0 inet static
 +  hwaddress ether 08:00:00:00:00:00 # if you want to set MAC manually
 +  address 192.168.0.10
 +  netmask 255.255.255.0
 +  gateway 192.168.0.5
 +  pre-up ip link set $IFACE up
 +  post-down ip link set $IFACE down
 +...
 +</code>
 +
 +in existing Jessie-Image clear root-partition (except lib/modules/<kernelversion>) and put contents of Bootstrap-folder (debian_stretch) to it
 +
 +
 +Uploaded work so far on my [[https://drive.google.com/drive/folders/15Y5Y3NAOwg_IMmN3k6hdb7pAQj9oTVTl?usp=sharing|gdrive]]
 +
 +Image (sd+emmc in separate img's): 
 +[[https://drive.google.com/drive/folders/1oP7jy1KrrIOifvImo2nQ59wx3_9hHkgk?usp=sharing|gdrive]]
 +
 +(deb_stretch_…)
 +
 +on EMMC-Image SSH-Login is not possible as root because of missing option in ssh-server
 +
 +add the following line to /etc/ssh/sshd_config and reboot/restart sshd:
 +
 +  PermitRootLogin yes
 +
 +===== change working Image =====
 +
 +  * clear logs (echo -n "">logfile),
 +  * delete backup-files, 
 +  * clear cache (e.g. APT), 
 +  * remove unused Kernel-Modules (/lib/modules/)
 +  * delete own Users
 +  * reset PW for root
 +
 +fill free space in the Image with null-file (for better packing):
 +
 +<code bash>
 +loopdev=$(losetup -f) #get first free loopdevice
 +losetup ${loopdev} /path/to/file
 +partprobe ${loopdev}
 +mount ${loopdev}p2 /mnt
 +
 +#if you want to install/update things
 +cp /usr/bin/qemu-arm-static /mnt/usr/bin/
 +chroot /mnt
 +
 +#overwrite free space
 +dd if=/dev/zero of=/mnt/null.dat
 +rm /mnt/null.dat
 +
 +losetup -d ${loopdev}
 +</code>
 +
 +https://softwarebakery.com/shrinking-images-on-linux
 +
 +
 +alternative https://wiki.debian.org/DebianInstaller/Arm/OtherPlatforms
 +
 +===== my Image for BPI-R2 =====
 +
 +==== network ====
 +
 +you have ports wan, lan0-lan4 with kernel 4.14+
 +
 +current config can be displayed using ip a or by editing /etc/network/interfaces
 +
 +  wan:dhcp # maybe needs additional "auto wan" to go up on boot
 +  lan0: 192.168.0.10/24
 +  lan1+lan2 are in a bridge with address 192.168.40.1/24 #currently also auto lanx+manual missing
 +  lan3 unconfigured
 +  
 +
 +to add default-gateway / DNS server do this
 +
 +  ip route add default via <your router ip>
 +  nano /etc/resolv.conf #change ip of your gateway for DNS
 +
 +==== keyboard ====
 +
 +for configuring keyboard you have to install console-setup then you will be prompted for keyboard-layout
 +
 +  apt-get install console-setup