-
-
Save FlorianHeigl/32fc39779295c385ffa32253f3e92e95 to your computer and use it in GitHub Desktop.
| startsituation, altes alpine setup, fehlendes modloop. | |
| aktuell bekommen und dann strip down wg. RAM | |
| u-boot tricks mitnehmen und fuer mips benutzen | |
| rpi kernel bootet nicht auf cubietruck | |
| problem war wohl u.a. dass ich mit kernelupdate das NAND nicht mehr hatte | |
| jahre spaeter beim versuch, das auf aktuelles alpine zu ziehen versehentlich noch die packages geloescht | |
| dann schritt fuer schritt reparatur | |
| (tarball auspacken, apk.static, 3.20 packages) | |
| hatte dann xen package mismatch - und dann hat der update mir die bootoptionen aus der extlinux.conf gemoppst | |
| xen config muss ich desswegen am ende neu machen | |
| cpu info | |
| https://linux-sunxi.org/A20 | |
| referenz zum loesen | |
| https://wiki.alpinelinux.org/wiki/DIY_Fully_working_Alpine_Linux_for_Allwinner_and_Other_ARM_SOCs | |
| nand geht noch nicht, sollte aber (mainline format braucht neuformatieren) | |
| https://linux-sunxi.org/MTD_Driver | |
| https://linux-sunxi.org/Mainline_NAND_Howto | |
| weitere alpine specifics | |
| - armhf-generic-uboot build existiert nicht mehr (sh hier https://dl-cdn.alpinelinux.org/alpine/v3.10/releases/armhf/) | |
| - https://wiki.alpinelinux.org/wiki/Upgrading_Alpine_Linux_to_a_new_release_branch | |
| - https://community.riocities.com/alpine_rpi_upgrade.html (nur rpi lbu mode, kein xen) | |
| mirageos xen arm builder (OS, baut cubietruck SD image) | |
| https://github.com/mirage/xen-arm-builder | |
| export TARGET=Cubietruck | |
| funktioniert nicht mehr ganz (insb. Xen) weil es pakete aus edge nehmen will, gibt wohl kein passendes edge fuer armhf oder so. | |
| # build deps | |
| apk add alpine-sdk bison ccache flex ncurses-dev perl rsync | |
| # build dir | |
| apk add lvm2 | |
| vgchange -ay | |
| modprobe ext4 | |
| mkdir /build | |
| mount /dev/cubie2/build /build | |
| swapon /dev/cubie2/swap | |
| https://linux-sunxi.org/Mainline_Kernel_Howto | |
| https://linux-sunxi.org/Linux_Kernel#Compilation | |
| https://linux-sunxi.org/Script.bin | |
| cd /build/linux | |
| # hat noch fehler, wird nicht aktiv | |
| export CCACHE_DIR=/build/ccache | |
| export CCACHE_NOCOMPRESS=true | |
| export CC="ccache gcc" | |
| export CXX="ccache g++" | |
| # hier erst make defconfig wie in anleitung machen | |
| # laedt sunxi/allwinner defaults | |
| export TERM=putty | |
| # arch=arm - unoptimierter kernel, raspi1 etc. | |
| # loesung waere -march, -mtune, s.u. ungetestet. | |
| # https://gist.github.com/fm4dd/c663217935dc17f0fc73c9c81b0aa845 | |
| # https://wits-hep.blogspot.com/2013/11/arm-cortex-a7-gcc-flags-allwinner-a20.html - s.u. | |
| # https://wits-hep.blogspot.com/2014/08/optimal-compiler-flags-for-arm.html - s.u. | |
| export CFLAGS="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -funsafe-math-optimizations -mfloat-abi=hard -O3 -ffastmath" | |
| export CFLAGS="-mcpu=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -funsafe-math-optimizations -mfloat-abi=hard -O3 -ffastmath" | |
| export CXXFLAGS="${CFLAGS}" | |
| make ARCH=arm menuconfig | |
| - squashfs [*] | |
| - cramfs [*] | |
| - overlayfs [*] | |
| - pstore [*] # https://stackoverflow.com/questions/28538091/using-persistent-storage-in-linux-kernel | |
| - tmpfs [*] | |
| CONFIG_BLK_DEV_DM=y | |
| CONFIG_BLK_DEV_LOOP=y | |
| CONFIG_DM_UEVENT=y | |
| CONFIG_MD=y | |
| (ich hab dann die ganze.config genommen von https://github.com/mirage/xen-arm-builder/blob/master/linux.sh | |
| weil schon 5 versuche oder so) | |
| mtd pruefen | |
| ? drivers/media/rc/keymaps/rc... | |
| war bei den IRDA treibern, oberster punkt, einfach ausmachen | |
| man muss noch einige optionen nacharbeiten, insb. auch fuer hw crypto | |
| # make -j4 war sys(%) bound auch mit ssd | |
| ARCH=arm make -j2 olddefconfig && | |
| ARCH=arm make -j2 zImage && | |
| ARCH=arm make -j2 dtbs && | |
| ARCH=arm INSTALL_HDR_PATH=/build/headers make headers_install && | |
| ARCH=arm INSTALL_MOD_PATH=/build/squashfs-root make modules modules_install | |
| mount -o remount,rw /media/mmcblk0p1 | |
| cd /build/linux | |
| cp arch/arm/boot/zImage /media/mmcblk0p1/boot/vmlinuz-sunxi | |
| cp arch/arm/boot/dts/allwinner/sun7i-a20-cubietruck.dtb /media/mmcblk0p1/boot/dtbs/ | |
| cd /build/squashfs-root | |
| mksquashfs lib/ modloop-sunxi -noappend -always-use-fragments | |
| cp modloop-sunxi /media/mmcblk0p1/boot/modloop-sunxi | |
| extlinux.conf sieht so aus: | |
| prompt funktioniert nicht glaub ich | |
| bei problemen auf vanilla (4.19) zurueck | |
| TIMEOUT 20 | |
| PROMPT 1 | |
| DEFAULT vanilla # das da immer anpassen zum testen | |
| LABEL vanilla | |
| MENU LABEL Linux vanilla | |
| KERNEL /boot/vmlinuz-vanilla | |
| INITRD /boot/initramfs-vanilla | |
| DEVICETREEDIR /boot/dtbs | |
| APPEND modules=loop,squashfs,sd-mod,usb-storage quiet modloop=/boot/modloop-vanilla | |
| LABEL sunxi | |
| MENU LABEL Linux sunxi | |
| KERNEL /boot/vmlinuz-sunxi | |
| DEVICETREEDIR /boot/dtbs | |
| APPEND modules=loop,squashfs,sd-mod,usb-storage quiet modloop=/boot/modloop-sunxi modloop_verify=no | |
| out of scope im moment: | |
| (hatte ich 2019 schon erledigt) | |
| u-boot, boot.scr, ... | |
| todo nach gitlab | |
| dockerfile aktualisieren | |
| grsec raus | |
| ftd memory erhoehen (128M root ist zu klein?) | |
| was ist $V | |
| tmem / zswap aktivieren + swap auf ssd bei boot | |
| andere SSD suchen? | |
| generic-uboot build cherrypick + CI | |
| image testboot per qemu wenn mgl oder sonst wie? | |
| reboot problem loesen | |
| https://forum.armbian.com/topic/31698-armbian-hangs-on-reboot/ | |
| oder workaround (CI freundlich) mit arduino ich glaub es gab was | |
| reset button hat loetstellen :-) | |
| nand boot | |
| https://stevensaunderson.com/CTNandBoot.htm | |
| https://linux-sunxi.org/Mainline_NAND_Howto | |
| openqa | |
| https://github.com/grisu48/openqa-serial/blob/main/README.md | |
| 3. cubietruck besorgen | |
| +SD karte | |
| +Arduino | |
| an gitlab tun | |
| build ID in image in MOTD tun | |
| serial oder ssh -> build id pruefen | |
| modloop erklaerungen und zum spicken | |
| https://superuser.com/questions/1290314/what-is-modloop-option-in-alpine | |
| https://gist.github.com/alexalouit/37c6726d60f1ed19dcf95540331d90ff | |
| Xen specific | |
| https://wiki.alpinelinux.org/wiki/Xen_Dom0 | |
| LBU specific | |
| https://wiki.alpinelinux.org/wiki/Diskless_Mode | |
| LBU apkvol edit | |
| https://wiki.alpinelinux.org/wiki/Manually_editing_a_existing_apkovl | |
| LBU upgrade commands | |
| https://wiki.alpinelinux.org/wiki/Upgrading_Alpine_Linux_to_a_new_release_branch |
PTP
for some reason the kernel sunxi kernels included PTP but
[ 62.036287] sun7i-dwmac 1c50000.ethernet eth0: PTP not supported by HW
crypto
cubie2:~# apk add libkcapi libkcapi-tools
cubie2:~# grep sun /proc/crypto
driver : ecb-des3-sun4i-ss
driver : cbc-des3-sun4i-ss
driver : ecb-des-sun4i-ss
driver : cbc-des-sun4i-ss
driver : ecb-aes-sun4i-ss
driver : cbc-aes-sun4i-ss
driver : sha1-sun4i-ss
driver : md5-sun4i-ss
cubie2:~# kcapi-rng -b 512 -n cbc-aes-sun4i-ss -v
libkcapi - Verbose: libkcapi 1.5.0 - initializing cipher operation with kernel
libkcapi - Error: AF_ALG: socket syscall failed (errno: -97)
vmtl noch was falsch gebaut, alles tests knallen soll brauchen:
CONFIG_CRYPTO_USER_API
CONFIG_CRYPTO_USER_API_HASH
CONFIG_CRYPTO_USER_API_SKCIPHER
perf bonus lt. tests online ca. 30% (20MB/s -> 30MB/s), RNG sollte latenz auch helfen und so.
init ist ok
ubie2:~# cat /proc/crypto
name : ecb(des3_ede)
driver : ecb-des3-sun4i-ss
module : kernel
priority : 300
refcnt : 1
selftest : passed
internal : no
type : skcipher
async : no
blocksize : 8
min keysize : 24
max keysize : 24
ivsize : 0
chunksize : 8
walksize : 8
statesize : 0
aber auf der website ist auch async: yes bei mir nicht
hat auch erklaerungen zu openssl + krng, sollte fuer Cavium offload und QAT helfen.
bingo, Treiber gebaut aber API nicht eingeschaltet
cubie2:/build/linux# ls -l .config
-rw-r--r-- 1 root root 157101 Oct 28 13:55 .config
cubie2:/build/linux# grep CONFIG_CRYPTO_USER_API .config
# CONFIG_CRYPTO_USER_API_HASH is not set
# CONFIG_CRYPTO_USER_API_SKCIPHER is not set
# CONFIG_CRYPTO_USER_API_RNG is not set
# CONFIG_CRYPTO_USER_API_AEAD is not set
wenn Sie jetzt nur 10 Stunden warten, koennte der naechste Build passen
(dom0_vcpus = 1 lol)
was ist crosscompile? was ist distcc? egal ist es!
amn: kernel builds wollen wirklich "KERNEL_CC" nicht "CC" insofern ist CCACHE wirklich da nicht angewesen.
weitere builds aber mit chroot oder cross damit nicht / platz verschwendet wird
dom0 mem ist auch schon reduziert, ich denke, das muss jetzt mal anders weiter gehen...
cpu0 led zeigt mist an (bei 99% idle dauerleuchten), weil nur 1 cpu vorhanden. brauche nen anderen led trigger...
tmem wurde gecancelled :-(
stripping:
- busybox (statt chrony), dropbear (start openssh)
- kann man avahi wegmachen?
- kann man dbus wegmachen?
- kann man hg statt git fuer etckeeper nehmen
- was brauchte gnutls
- unterstuetzt irgendwas seccomp
- braucht etwas zstd, lzo, xz, ...
aktuell:
Filesystem Size Used Available Use% Mounted on
tmpfs 400.0M 129.6M 270.4M 32% /
ziel 100MB, dann ist gut...
zswap ca. 200MB plus 1-2GB SSD swap sollten passen.
groesse von /var/log beachten, auslagern?
fi-na-fucking-ly
now just to decide how to not have dependencies use up half of the ram of the system.
Xen dom0'less was tested on ARM, just btw ;-)
Serial console WORKS when you just remove all serial console settings like dtuart from Xen and point Linux at hvc0, plain and simple.