From 02581ac3ce048b55c94b3c9be9f640d2e7ed7b41 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 1 Jan 2019 06:02:33 -0800 Subject: [PATCH] misc pinebook stuff --- Makefile | 213 +++++++++++++++++++++++++++++++++++++++ boot-script/Makefile | 4 + boot-script/jcarr.cmd | 73 ++++++++++++++ boot-script/jcarr.scr | Bin 0 -> 3058 bytes boot-script/sid.cmd | 76 ++++++++++++++ wifi/Makefile | 24 +++++ wifi/wpa-supplicant.conf | 4 + 7 files changed, 394 insertions(+) create mode 100644 Makefile create mode 100644 boot-script/Makefile create mode 100644 boot-script/jcarr.cmd create mode 100644 boot-script/jcarr.scr create mode 100644 boot-script/sid.cmd create mode 100755 wifi/Makefile create mode 100644 wifi/wpa-supplicant.conf diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..404c1d2 --- /dev/null +++ b/Makefile @@ -0,0 +1,213 @@ +BRNAME = $(shell hostname -s) + +all: + echo do stuff + +push: + git pull + git add --all + -git commit -a + git push + +update: + git pull + +fucking-delete-everything: + rm -rf [A-Za-z]* + git reset --hard + +# suggested 'best practices' as of 2017 (maybe?) +sshkeygen: + ssh-keygen -t ed25519 -a 100 + ssh-keygen -t rsa -b 4096 -o -a 100 + +nmap: + nmap -v -sP 192.168.0.0/24 + # nmap -sS 192.168.0.123 + # nmap -v 192.168.0.123 + +diff: + git diff + +systemd-resolve: + systemd-resolve --status + SYSTEMD_LOG_LEVEL=debug systemd-resolve git.wit.com + systemd-resolve --statistics + +resolv-ipv6: + mv /etc/resolv.conf /etc/resolv.conf.old + cp resolv-ipv6-only.conf /etc/resolv.conf + ls -al /etc/resolv.conf + cat /etc/resolv.conf + +resolv-1: + mv /etc/resolv.conf /etc/resolv.conf.old + cp resolv-1-1-1-1.conf /etc/resolv.conf + +resolv-8: + mv /etc/resolv.conf /etc/resolv.conf.old + cp resolv-8-8-8-8.conf /etc/resolv.conf + +showyourip: + dig myip.opendns.com @resolver1.opendns.com + dig +short myip.opendns.com @resolver1.opendns.com + +realuser: + @echo you are actually user: + stat -c'%U' `tty` + +sysbench: + sysbench --test=cpu --num-threads=8 --cpu-max-prime=100000 run # for 8 cpus + +fwupd: + apt install fwupdate fwupd + fwupdmgr get-devices + fwupdmgr refresh + fwupdmgr get-updates + +flashrom: + apt install flashrom + flashrom -p internal:amd_imc_force=yes # for amd + flashrom -p internal:boardenable=force # for coreboot + flashrom -p internal:ich_spi_mode=auto # for intel + flashrom -p internal:ich_spi_mode=swseq # for intel + flashrom -p internal:ich_spi_mode=hwseq # for intel + +i2c: + apt install i2c-tools + ls /dev/i2c-* -l + i2cdetect 0 + +dmidecode: + biosdecode + dmidecode + +efi: + apt install efitools efivar + efivar -L + +# FirmWare Test Suite +fwts: + # add-apt-repository ppa:firmware-testing-team/ppa-fwts-stable + # apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A1E2B0920C32E7C6 + # apt update + apt install fwts + cd; fwts + +xinput: + xinput list # shows you all the registered devices + xinput test 13 # dumps out values for an event + xev # the old school X tool + +# DSTREAM installer on x86 needs this +dstream: + dpkg --add-architecture i386 + apt update + apt install libwebkitgtk-3.0-0 + apt-file update + apt-file -x search '/libz.so.1$' + # lib32z1: /usr/lib32/libz.so.1 + # libzadc4: /usr/lib/x86_64-linux-gnu/genwqe/libz.so.1 + # zlib1g: /lib/x86_64-linux-gnu/libz.so.1 + apt install lib32z1 + # apt-get install libstdc++6:i386 # syntax for specifying i386 + +vrf: + ip vrf show + ip vrf pids mgmt + +# change to mgmt vrf +vrf-mgmt: + ip vrf exec mgmt /bin/bash + +# turn off all laptop suspend and sleep +# This does even disable the buttons in the GNOME logout interface +# leaving only 'restart' and 'poweroff' buttons +# This is how all GUI interfaces should work +systemctl_power_disable: + systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target + +systemctl_power_enable: + # turn back on all laptop suspend and sleep + systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target + +systemctl_power_show: + # show what systemctl is using for suspend, sleep, etc + systemctl show -p FragmentPath sleep.target + systemctl show -p FragmentPath suspend.target + systemctl show -p FragmentPath hibernate.target + systemctl show -p FragmentPath hybrid-sleep.target + +rename_wlan0: + /sbin/ip link set wlan0 down + /sbin/ip link set wlan0 name wifi0 + /sbin/ip link set wifi0 up + +ss_display: + # Display all TCP sockets. + ss -t -a + + # Display all TCP sockets with process SELinux security contexts. + ss -t -a -Z + + # Display all UDP sockets. + ss -u -a + + # Display all established ssh connections. + ss -o state established '( dport = :ssh or sport = :ssh )' + +# command line utility for networking on Cumulus Linux switches +net: + net show interface + net show bgp + +# llpd (Link Layer Discovery Protocol) show what is connected to you: +llpd: + lldpcli show neigh + +# pixelbook has port 1080 as the default socks port. So does golang it seems. +# you have to use this so that 'go get' works: +# git config --global http.proxy socks5://127.0.0.1:1080 # to set the socks proxy +# git config --global --unset http.proxy # to unset the socks proxy +# or this works too: +# http_proxy=socks5://127.0.0.1:1080 go get git.wit.com/wit/ipv6-gui + +golangbinsizes: + eval `go build -work -a 2>&1` + find $WORK -type f -name "*.a" | xargs -I{} du -hxs "{}" | sort -rh + +git.wit.options: + git config --global --add url."git@git.wit.com:".insteadOf "https://git.wit.com/" + git config --global --list + go get git.wit.com/jcarr/ipv6-gui + +git-fsck: + git fsck + git show + # this will destroy them forever. No going back: + git-prune + git gc + +android: + adb devices # shows all the devices on your USB bus + adb shell # opens a bash shell + +# https://wiki.archlinux.org/index.php/DSDT +# https://blog.fpmurphy.com/2014/12/decompiling-acpi-tables.html +# remember kvm has a --no-acpi option +acpi-decompile: + # root@librem15:/sys/firmware/acpi# find . |less + dmesg | grep DSDT + # root@librem15:/sys/firmware/acpi# dmesg | grep DSDT + # [ 0.000000] ACPI: DSDT 0x000000007AB6B280 00304C (v05 COREv4 COREBOOT 20110725 INTL 20161222) + cat /sys/firmware/acpi/tables/DSDT > dsdt.dat + # apt install iasl + iasl -d dsdt.dat # decompile + iasl -tc dsdt.dsl # recompile + less dsdt.dsl + +ip-del-all-ipv6: + ip -6 route del ::/0 + ip -6 route del fe80::/64 + ip -6 route del ::1 + ifconfig wifi0 del fe80::85f1:48b8:601c:6a3/64 diff --git a/boot-script/Makefile b/boot-script/Makefile new file mode 100644 index 0000000..a8c5377 --- /dev/null +++ b/boot-script/Makefile @@ -0,0 +1,4 @@ +# Recompile with: +all: + mkimage -C none -A arm -T script -d sid.cmd /boot/sid.scr + # mkimage -C none -A arm -T script -d /boot/jcarr.cmd /boot/jcarr.scr diff --git a/boot-script/jcarr.cmd b/boot-script/jcarr.cmd new file mode 100644 index 0000000..02ef7a9 --- /dev/null +++ b/boot-script/jcarr.cmd @@ -0,0 +1,73 @@ +# DO NOT EDIT THIS FILE +# +# Please edit /boot/armbianEnv.txt to set supported parameters +# + +# default values +setenv load_addr "0x44000000" +setenv rootdev "/dev/mmcblk0p1" +setenv verbosity "1" +setenv rootfstype "ext4" +setenv console "both" +setenv docker_optimizations "on" + +# Print boot source +itest.b *0x10028 == 0x00 && echo "U-boot loaded from SD" +itest.b *0x10028 == 0x02 && echo "U-boot loaded from eMMC or secondary SD" +itest.b *0x10028 == 0x03 && echo "U-boot loaded from SPI" + +echo "Boot script loaded from ${devtype}" + +if test -e ${devtype} ${devnum} ${prefix}armbianEnv.txt; then + load ${devtype} ${devnum} ${load_addr} ${prefix}armbianEnv.txt + env import -t ${load_addr} ${filesize} +fi + +if test "${console}" = "display" || test "${console}" = "both"; then setenv consoleargs "console=ttyS0,115200 console=tty1 single"; fi +if test "${console}" = "serial"; then setenv consoleargs "console=ttyS0,115200 single"; fi + +# get PARTUUID of first partition on SD/eMMC it was loaded from +# mmc 0 is always mapped to device u-boot (2016.09+) was loaded from +if test "${devtype}" = "mmc"; then part uuid mmc 0:1 partuuid; fi + +setenv bootargs "root=${rootdev} rootwait rootfstype=${rootfstype} ${consoleargs} panic=10 consoleblank=0 loglevel=${verbosity} ubootpart=${partuuid} usb-storage.quirks=${usbstoragequirks} ${extraargs} ${extraboardargs}" + +if test "${docker_optimizations}" = "on"; then setenv bootargs "${bootargs} cgroup_enable=memory swapaccount=1"; fi + +load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile} +fdt addr ${fdt_addr_r} +fdt resize 65536 +for overlay_file in ${overlays}; do + if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/allwinner/overlay/${overlay_prefix}-${overlay_file}.dtbo; then + echo "Applying kernel provided DT overlay ${overlay_prefix}-${overlay_file}.dtbo" + fdt apply ${load_addr} || setenv overlay_error "true" + fi +done +for overlay_file in ${user_overlays}; do + if load ${devtype} ${devnum} ${load_addr} ${prefix}overlay-user/${overlay_file}.dtbo; then + echo "Applying user provided DT overlay ${overlay_file}.dtbo" + fdt apply ${load_addr} || setenv overlay_error "true" + fi +done +if test "${overlay_error}" = "true"; then + echo "Error applying DT overlays, restoring original DT" + load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile} +else + if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/allwinner/overlay/${overlay_prefix}-fixup.scr; then + echo "Applying kernel provided DT fixup script (${overlay_prefix}-fixup.scr)" + source ${load_addr} + fi + if test -e ${devtype} ${devnum} ${prefix}fixup.scr; then + load ${devtype} ${devnum} ${load_addr} ${prefix}fixup.scr + echo "Applying user provided fixup script (fixup.scr)" + source ${load_addr} + fi +fi + +load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}uInitrd +load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}Image + +booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} + +# Recompile with: +# mkimage -C none -A arm -T script -d /boot/jcarr.cmd /boot/jcarr.scr diff --git a/boot-script/jcarr.scr b/boot-script/jcarr.scr new file mode 100644 index 0000000000000000000000000000000000000000..b4d8d5a114184df3441fdddf1a6b6b1ea0b7663d GIT binary patch literal 3058 zcmcIm&2HO95H<>=g_yoTZv$FLlQxnl$2QU!I=GRG3TPT5mU}87EXkF;6}ijqF7*>f zFVJh>qQ|~N(LSr9c1m{l|;n_x2wC zx>tNY`t!Fx9(?d&dE4;+@E3Zx55w2+?dvg|4M$@be?7W@uSVaTIs48&oJX7)4m=bV zdcIP&$8_uqCeP%eYgZPm0>dqsG)a`UJcNX47IVwB!2lQ`Mj>B-+r!^p90z_h_mY0~e8IJ^jIe8Pw?=ZB8oN$7xO`;~ ztJQ&$Mn!1#mA$I0p$g_)PgG(>EZ#CJa22>px|H;}7SaOM3r3|n;Eu4|*sc$sd8@wX z9XyA@0KApw!J|jOgDVB@WhYxtl_3mMtzx(sx_3DqG&=HEuU>-E2rVWbGQDmJ^{g?} z#rX(J%2WI@D=5$+u~`SoJlofZGa}7;OjV_s~cNYCoJ>Y>bz@jBv z8;DtwVBb-<*mDtZNORskKJfa-UGIy}pWF&kE3o1T;f$fn>L?#bQxWF-z368dk|Ber z6gDX&hnUnlXkQmf-vC`K8CI~Baq&3UG%=>uqYcKFA{g|mzW5Q7^MQxeV`COPLhou! zY#^nbDM>WbA7zGC<9Cczn$39k$5iOK!N+JUY`KYc#(AO{C0^b5ifI%kT56I(2K>`l z$yte`WtR$DFxuDU^#+2OR%tTflKBxI#5`80ezRl=3j&o&JLu=EbDD%U4Q)1EC%UGz z(E7dhH9jI0p@KpS*#ypPnI)5_=CX_7>1R3zX;mpp<*tA(H` zJRFy)Z&RK$1$LcQD+7iiqE9Vx945uAC^O_*BQ~zpDMvq?1fi1r4!lyF29tjeS`nc` z;c8gD9~p9Z4=&pv{{afMnXv;`u7wP;vWa;Q&oVG^IOUz(cFsHn