]> git.plutz.net Git - blast/commitdiff
changes from master
authorPaul Hänsch <paul@plutz.net>
Sun, 20 Dec 2020 14:29:36 +0000 (15:29 +0100)
committerPaul Hänsch <paul@plutz.net>
Sun, 20 Dec 2020 14:29:36 +0000 (15:29 +0100)
.gitignore
Makefile
modules/approx.mk
modules/default.mk
modules/display_wsLCD4.mk [new file with mode: 0644]
modules/smb_nis.mk
modules/waveshare35a-overlay.dtb [new file with mode: 0644]
modules/xfce.mk
modules/xfce/etc/gtk-3.0/settings.ini
modules/xfce/etc/xdg/autostart/onboard.desktop [new file with mode: 0644]
modules/xfce/etc/xdg/xfce4/panel/whiskermenu-10.rc

index 31af722e88d9379453ddeb3678c44e1fbb51c611..b79c58ad14361cfc7e0e4732873b2b0adf3fac5f 100644 (file)
@@ -1,14 +1,13 @@
-sys_root_stretch/
-sys_root_buster/
-rpi_root_stretch/
-rpi_root_buster/
+sys_root_stretch_*/
+sys_root_buster_*/
 cfg_root/
 img_mount/
 iso_root/
-part_boot.img
-part_root.img
-rpi_boot.img
-rpi_root.img
 config.mk
+*.img
+*.iso
+*.squash
+*.squashfs
 .*.swp
 .*.swo
+*~
index 8da2961171dc795d65fbe15b80f4517561a26eba..84c9221595f947f9196b53951fb96eed5193944a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,8 @@ PACKAGES := ${PACKAGES} apt busybox-static debian-archive-keyring init systemd
 BOOT_MB := 62
 ROOT_MB := 959
 
+fstype := ext4
+
 config.mk:
        cp "config.example" "$@"
 
@@ -43,8 +45,6 @@ deb   http://cdn.debian.net/debian ${release} main
 endef
 endif
 
-fstype := ext4
-
 ifdef disk
   VOLUME := ${disk}
   PBOOT := ${disk}1
@@ -68,7 +68,7 @@ else ifdef image
   VOLUME := ${image}
   PBOOT := part_boot.img
   PROOT := part_root.img
-  SYSROOT := sys_root_${release}/
+  SYSROOT := sys_root_${release}_${ARCH}/
   CFGROOT := img_mount/
   
   _target: _mbr _umount _config _install
@@ -86,9 +86,23 @@ else ifdef image
   _umount: _img_mount _config _bootloader_pc
   _mbr: _partcopy _bootloader_pc
 
+else ifdef subvol
+  SYSROOT := sys_root_${release}_${ARCH}/
+  CFGROOT := cfg_root/
+
+  _target: _install _config ${subvol}
+  
+  _bootstrap:
+  _install: _bootstrap
+  _copy: _install
+  _config: _copy
+
+  ${subvol}: _config
+       btrfs sub snap "${CFGROOT}" "$@"
+
 else ifdef squash
   SQUASH := ${squash}
-  SYSROOT := sys_root_${release}/
+  SYSROOT := sys_root_${release}_${ARCH}/
   CFGROOT := cfg_root/
 
   PACKAGES += squashfs-tools nbd-client
@@ -104,7 +118,7 @@ else ifdef squash
 else ifdef iso
   ISO := ${iso}
   ISOROOT := iso_root/
-  SYSROOT := sys_root_${release}/
+  SYSROOT := sys_root_${release}_${ARCH}/
   CFGROOT := cfg_root/
   BOOT_MB := 2
   PBOOT := ${ISOROOT}/efi.img
@@ -118,21 +132,18 @@ else ifdef iso
   _copy: _install
   _config: _copy _squash_modules
   _isosquash: _config
-#  ${PBOOT}: ${ISOROOT}
-#  _format_boot: ${PBOOT}
-#  _efi_mount: ${PBOOT} _format_boot
-#  _efi_umount: _config
   _bootloader_iso: _config
   _iso_image: _bootloader_iso _isosquash # _efi_umount
 
 else ifdef raspi
+  ARCH := armhf
+
   VOLUME := ${raspi}
   PBOOT := rpi_boot.img
   PROOT := rpi_root.img
-  SYSROOT := rpi_root_${release}/
+  SYSROOT := sys_root_${release}_${ARCH}/
   CFGROOT := img_mount/
   
-  ARCH := armhf
   KEYRING := keys/raspbian-archive-keyring.gpg
   BOOTSTRAP := http://raspbian.raspberrypi.org/raspbian
 
@@ -141,8 +152,7 @@ else ifdef raspi
   deb  http://archive.raspberrypi.org/debian ${release} main
   endef
 
-  PACKAGES += firmware-brcm80211 libraspberrypi-bin libraspberrypi0 pi-bluetooth raspberrypi-bootloader raspberrypi-kernel initramfs-tools nilfs-tools
-  fstype := nilfs2
+  PACKAGES += firmware-brcm80211 libraspberrypi-bin libraspberrypi0 pi-bluetooth raspberrypi-bootloader raspberrypi-kernel initramfs-tools
 
   _target: _umount _config
   
@@ -157,7 +167,7 @@ else ifdef raspi
   _copy: _install _img_mount
   _config: _copy _img_mount
   _bootloader_raspi: _img_mount
-  _umount: _img_mount _config _bootloader_raspi
+  _umount: _copy _config _bootloader_raspi
 
 else
   _target:
@@ -170,7 +180,8 @@ ifdef modules
   include $(addsuffix .mk, $(addprefix modules/, $(subst ${comma_},${space_},${modules})))
 endif
 
-ifeq "${ARCH}" "amd64"
+ifeq "$(findstring linux-image, ${PACKAGES})" "linux-image"
+else ifeq "${ARCH}" "amd64"
   PACKAGES += linux-image-amd64
 else ifeq "${ARCH}" "i386"
   PACKAGES += linux-image-686
@@ -178,15 +189,11 @@ endif
 
 export SOURCES SYSROOT CFGROOT VOLUME PBOOT PROOT SQUASH ARCH KEYRING BOOTSTRAP ISOROOT ISO
 
-sys_root_${release}/:
+sys_root_${release}_${ARCH}/:
        btrfs subvol create "$@" || mkdir "$@"
        chmod 755 "$@"
 
-rpi_root_${release}/:
-       btrfs subvol create "$@" || mkdir "$@"
-       chmod 755 "$@"
-
-cfg_root/: sys_root_${release}/ _install
+cfg_root/: sys_root_${release}_${ARCH}/ _install
        -btrfs sub del "$@" || rm -r "$@"
        btrfs sub snap "$<" "$@" || mkdir "$@"
        chmod 755 "$@"
@@ -230,6 +237,7 @@ ${SYSROOT}/etc/apt/apt.conf.d/10norecommends: ${SYSROOT}
 ${SYSROOT}/etc/apt/trusted.gpg.d/: ${SYSROOT} _bootstrap
        mkdir -p -m 755 "$@"
        cp keys/*.gpg "$@"
+       chmod 644 "$@"/*.gpg
 
 _install: ${SYSROOT} _aptkeys _norecommends
        printf '%s\n' "$${SOURCES}" |sort -u >"$${SYSROOT}/etc/apt/sources.list"
@@ -249,6 +257,7 @@ _install: ${SYSROOT} _aptkeys _norecommends
        chroot "$${SYSROOT}" rm /usr/sbin/udevadm
 
 _copy: ${SYSROOT} ${CFGROOT}
+       sync
        cp -au "$${SYSROOT}/." "$${CFGROOT}/"
 
 _config: ${CFGROOT}
@@ -299,15 +308,15 @@ _partition_gpt: ${VOLUME}
 
 _sparse: ${PBOOT} ${PROOT}
 
-ifdef raspi
-_format_root: ${PROOT}
-       -umount "$${CFGROOT}/boot" "$${CFGROOT}" "${PROOT}"
-       mkfs.nilfs2 -f -L FSROOT "$${PROOT}"
+ifeq "${fstype}" "ext4"
+  fsflag:=-F
 else
+  fsflag:=-f
+endif
+
 _format_root: ${PROOT}
        -umount "$${CFGROOT}/boot" "$${CFGROOT}" "${PROOT}"
-       mkfs.ext4 -F -L FSROOT "$${PROOT}"
-endif
+       mkfs.${fstype} ${fsflag} -L FSROOT "$${PROOT}"
 
 _format_boot: ${PBOOT}
        -umount "$${CFGROOT}/boot" "${PBOOT}"
@@ -372,10 +381,12 @@ _bootloader_pc: ${CFGROOT} _grub_efi32 _grub_efi64 _syslinux_bios #_syslinux_efi
 _bootloader_iso: ${CFGROOT} ${ISOROOT}
        mkdir -p "$${ISOROOT}/boot/grub/"
        cp -L "$${CFGROOT}/vmlinuz" "$${CFGROOT}/initrd.img" "$${ISOROOT}"
+       printf '%s\n' "insmod all_video" "set gfxmode=auto" "load_video" "insmod gfxterm" \
+               >"$${ISOROOT}/boot/grub/grub.cfg"
        printf '%s\n' "set timeout=10" "default=buster" \
                "menuentry 'Debian Buster' --id 'buster' {" \
                "linux '/vmlinuz' boot=live" "initrd '/initrd.img'" "}" \
-               >"$${ISOROOT}/boot/grub/grub.cfg"
+               >>"$${ISOROOT}/boot/grub/grub.cfg"
        -[ -f "$${ISOROOT}/install/initrd.gz" -a -f "$${ISOROOT}/install/linux" ] && \
        printf '%s\n' "menuentry 'Install Debian' --id 'install' {" \
                "linux '/install/linux'" "initrd '/install/initrd.gz'" "}" \
@@ -387,6 +398,7 @@ _efi_mount: ${PBOOT}
        mount -t vfat -o loop "$${PBOOT}" "efi/"
 
 _efi_umount: _efi_mount
+       sync
        umount efi/ && rmdir efi/
 
 .PHONY: _syslinux_mbr _grub_mbr
@@ -430,10 +442,12 @@ _img_mount: ${CFGROOT}
        || mount -o loop,offset=2M,sizelimit=${BOOT_MB}M \
                 -t vfat "$${VOLUME}" "$${CFGROOT}/boot"
 
-_umount_boot: ${CFGROOT}
+_umount_boot: ${CFGROOT} _config
+       sync
        -umount "$${CFGROOT}/boot"
 
-_umount_root: _umount_boot
+_umount_root: _umount_boot _config
+       sync
        umount "$${CFGROOT}" && rmdir "$${CFGROOT}"
 
 _umount: _umount_boot _umount_root
@@ -448,8 +462,7 @@ clean:
        -rmdir hdd_mount
        if [ -d "cfg_root/" ]; then btrfs sub del "cfg_root/" || rm -r "cfg_root/"; fi
        if [ -d "iso_root/" ]; then btrfs sub del "iso_root/" || rm -r "iso_root/"; fi
-       if [ -d "sys_root_${release}/" ]; then btrfs sub del "sys_root_${release}/" || rm -r "sys_root_${release}/"; fi
-       if [ -d "rpi_root_${release}/" ]; then btrfs sub del "rpi_root_${release}/" || rm -r "rpi_root_${release}/"; fi
+       if [ -d "sys_root_${release}_${ARCH}/" ]; then btrfs sub del "sys_root_${release}_${ARCH}/" || rm -r "sys_root_${release}_${ARCH}/"; fi
        -rm part_boot.img
        -rm part_root.img
        -rm rpi_boot.img
index 05bda84badab938ea853b98b93fb71e69c260b17..f7541d7d231d3cde159a4882e0101d9a4d4240d8 100644 (file)
@@ -7,10 +7,14 @@ ifndef approxhost
   approxhost := localhost
 endif
 
+approxrepos := main
+approxrepos += $(findstring contrib, ${SOURCES})
+approxrepos += $(findstring non-free, ${SOURCES})
+
 ifdef approx
   BOOTSTRAP := ${approx}
   define SOURCES =
-  deb ${approx} ${release} main
+  deb ${approx} ${release} ${approxrepos}
   endef
 else ifdef raspi
   BOOTSTRAP := http://localhost/raspbian
@@ -23,7 +27,7 @@ else ifdef raspi
 else
   BOOTSTRAP := http://localhost/debian
   define SOURCES :=
-  deb http://${approxhost}/debian ${release} main
+  deb http://${approxhost}/debian ${release} ${approxrepos}
   endef
 endif
 
index 5885a38fd0522cd5d1eebb19f83ef6f5aded3ecc..ceb91ff07aee2c7f856a7a62c874991d7a25cffb 100644 (file)
@@ -15,12 +15,19 @@ ${DEBCONF}
 
 keyboard-configuration keyboard-configuration/model    select  Generic 105-key (Intl) PC
 keyboard-configuration keyboard-configuration/variant  select  English (US) - English (Macintosh)
+
+console-setup  console-setup/charmap47 select  UTF-8
+console-setup  console-setup/codeset47 select  # Latin1 and Latin5 - western Europe and Turkic languages
 endef
 
+ifndef rpivmem
+  rpivmem := 128
+endif
+
 define RPICONFIG :=
 ${RPICONFIG}
 
-dtoverlay=vc4-fkms-v3d,cma-256
+dtoverlay=vc4-fkms-v3d,cma-${rpivmem}
 endef
 
 .PHONY: _debconf_selections _raspberry_config _keyboard
@@ -42,8 +49,9 @@ _raspberry_config: ${CFGROOT}
        printf '%s\n' "$${RPICONFIG}" >>"$${CFGROOT}/boot/config.txt"
 
 _raspberry_initrd: ${CFGROOT}
-       printf 'nilfs2\n' >>"$${CFGROOT}/etc/initramfs-tools/modules"
-       k="$$(echo "$${CFGROOT}"/lib/modules/*-v7+)"; \
+       printf '${fstype}\n' >>"$${CFGROOT}/etc/initramfs-tools/modules"
+       k="$$(printf '%s\n' "$${CFGROOT}"/lib/modules/* |sed 's;^.*/;;; /-/d')"; \
+       [ "${kernel}" ] && k="${kernel}"; \
        chroot $${CFGROOT} update-initramfs -c -k "$${k##*/}"; \
        printf 'initramfs initrd.img-%s\n' "$${k##*/}" >>"$${CFGROOT}/boot/config.txt"
 
@@ -111,6 +119,12 @@ _hostname: ${CFGROOT}
        printf '%s\n' "$${hostname}" >"$${CFGROOT}/etc/hostname"
        sed -Ei "s;^127\.0\.0\.1.*$$;&  $${hostname};" "$${CFGROOT}/etc/hosts"
 
+.PHONY: _systemd_timeout
+_config: _systemd_timeout
+_systemd_timeout: ${CFGROOT}
+       mkdir -p "$${CFGROOT}/etc/systemd"
+       printf 'DefaultTimeout%sSec=%s\n' Start 10s Stop 10s >>"$${CFGROOT}/etc/systemd/system.conf"
+
 ifdef wifi
   _config: ${CFGROOT}/etc/network/interfaces.d/wifi
   ifdef wifipass
@@ -122,6 +136,6 @@ ifdef wifi
     export wifi
     ${CFGROOT}/etc/network/interfaces.d/wifi: ${CFGROOT}
        printf 'auto wlan0\nallow-hotplug wlan0\n\niface wlan0 inet dhcp\n' >$@
-       printf '  wireless-essid %s\n' "$$wifi" >>$@
+       printf '  wireless-essid "%s"\n' "$$wifi" >>$@
   endif
 endif
diff --git a/modules/display_wsLCD4.mk b/modules/display_wsLCD4.mk
new file mode 100644 (file)
index 0000000..7c32cf5
--- /dev/null
@@ -0,0 +1,77 @@
+PACKAGES += xserver-xorg-input-evdev xinput xinput-calibrator
+
+define RPICONFIG +=
+
+### Waveshare 4 Inch Display ###
+hdmi_force_hotplug=1
+dtparam=i2c_arm=on
+dtparam=spi=on
+enable_uart=1
+dtoverlay=waveshare35a
+# dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900
+hdmi_group=2
+hdmi_mode=1
+hdmi_mode=87
+hdmi_cvt 430 320 60 6 0 0 0
+hdmi_drive=2
+display_rotate=0
+endef
+
+export display_wsLCD4_cfg display_wsLCD4_rotation
+
+define display_wsLCD4_cfg :=
+Section "InputClass"
+       Identifier      "calibration"
+       MatchProduct    "ADS7846 Touchscreen"
+       Option  "Calibration"   "3950 172 3871 194"
+       Option  "SwapAxes"      "1"
+       Option  "EmulateThirdButton"    "1"
+       Option  "EmulateThirdButtonTimeout"     "1000"
+       Option  "EmulateThirdButtonMoveThreshold"       "300"
+
+       # Identifier "evdev touchscreen catchall"
+       # MatchIsTouchscreen "on"
+       # Option  "Calibration"   "200 3950 250 4000"
+       # MatchDevicePath "/dev/input/event*"
+       # Driver "evdev"
+EndSection
+endef
+
+define display_wsLCD4_rotation :=
+# Keep touch matrix rotated in accordance with screen rotation
+while sleep 3; do
+  oldrotate="$${rotate}"
+  rotate="$$(xrandr |grep primary)"
+  rotate="$${rotate#*+0+0 }"
+  rotate="$${rotate% (*}"
+
+  [ "$${oldrotate}" = "$${rotate}" ] || case $$rotate in
+    left)     xinput set-prop 'ADS7846 Touchscreen' 'Coordinate Transformation Matrix' 0 -1 1  1 0 0  0 0 1;;
+    right)    xinput set-prop 'ADS7846 Touchscreen' 'Coordinate Transformation Matrix' 0 1 0  -1 0 1  0 0 1;;
+    inverted) xinput set-prop 'ADS7846 Touchscreen' 'Coordinate Transformation Matrix' -1 0 1  0 -1 1  0 0 1;;
+    *)        xinput set-prop 'ADS7846 Touchscreen' 'Coordinate Transformation Matrix' 1 0 0  0 1 0  0 0 1;;
+  esac
+done &
+endef
+
+.PHONY: _display_wsLCD4
+_config: _display_wsLCD5 ${CFGROOT}/boot/waveshare35a.dtbo
+_display_wsLCD4: ${CFGROOT} _copy _mount
+       # Rough touch calibration
+       mkdir -p "$${CFGROOT}/usr/share/X11/xorg.conf.d/"
+       printf '%s\n' "$${display_wsLCD4_cfg}" >"$${CFGROOT}/usr/share/X11/xorg.conf.d/45-evdev.conf"
+       # Resolution / Rotation stuff
+       mkdir -p "$${CFGROOT}/etc/X11/Xsession.d/"
+       printf 'xrandr --size 480x320\n' >"$${CFGROOT}/etc/X11/Xsession.d/10display_resolution"
+       printf '%s\n' "$$display_wsLCD4_rotation" >"$${CFGROOT}/etc/X11/Xsession.d/20touch_rotation"
+       # Correct DPI scaling, although application support is mediocre
+       mkdir -p "$${CFGROOT}/etc/X11/Xresources/"
+       printf 'Xft.dpi: 144\n' >"$${CFGROOT}/etc/X11/Xresources/dpi_resolution"
+       # Workaround for applications that do not handle DPI scaling correctly
+       -sed -i 's;^Exec=;Exec=env GDK_DPI_SCALE=.5 ;' \
+         $${CFGROOT}/usr/share/applications/chromium*.desktop \
+         $${CFGROOT}/usr/share/applications/firefox*.desktop \
+         $${CFGROOT}/usr/share/applications/exo-web-browser.desktop
+
+${CFGROOT}/boot/waveshare35a.dtbo: modules/waveshare35a-overlay.dtb
+       cp "$<" "$@"
index d11d00b9a14a5416743ce3e9e34c52a1f656b13d..9eed7d380d84cfdf6efa81f8e5bb42c19f3fd16c 100644 (file)
@@ -57,6 +57,7 @@ _smb_nis: ${CFGROOT}
 ${CFGROOT}/opt/pam_script/pam_script_passwd: ${CFGROOT} .FORCE
        mkdir -p "$(dir $@)"
        printf '%s' "$${smb_nis_pamscript}" >"$@"
+       chmod a+x "$@"
 
 ${CFGROOT}/etc/security/pam_mount.conf.xml: ${CFGROOT} .FORCE
        mkdir -p "$(dir $@)"
diff --git a/modules/waveshare35a-overlay.dtb b/modules/waveshare35a-overlay.dtb
new file mode 100644 (file)
index 0000000..9f082e4
Binary files /dev/null and b/modules/waveshare35a-overlay.dtb differ
index 4a66575631740a1c55fc543b79e163f83fe379c1..20672816363ad1d69508e152dc2fc2b6bc76ab71 100644 (file)
@@ -1,4 +1,5 @@
-PACKAGES += xfce4 xauth x11-xserver-utils x2x xvkbd blueman xfce4-terminal xfce4-clipman-plugin xfce4-whiskermenu-plugin thunar gvfs gvfs-backends gvfs-fuse xscreensaver policykit-1
+PACKAGES += blueman gvfs gvfs-backends gvfs-fuse policykit-1 thunar x11-xserver-utils x2x xauth xfce4 xfce4-clipman-plugin xfce4-terminal xfce4-whiskermenu-plugin xscreensaver xvkbd
+
 
 .PHONY: _xfce
 _config: _xfce
index 8c395bc7e3155a9294fdd29f6bf5ca34d2cb92dc..13d86549a1bfc1d0c12bc3a65e0145cabf35f5e3 100644 (file)
@@ -1,2 +1,2 @@
-[settings]
+[Settings]
 gtk-print-preview-command = okular %f
diff --git a/modules/xfce/etc/xdg/autostart/onboard.desktop b/modules/xfce/etc/xdg/autostart/onboard.desktop
new file mode 100644 (file)
index 0000000..26ad013
--- /dev/null
@@ -0,0 +1,3 @@
+[Desktop Entry]
+Name=Virtual Keyboard
+Exec=onboard -l Small -t ModelM
index 864b7713edcdf87a282c1dac9fe268035fe82f12..8b780e314112ac9cc736ada2a14e9ab2f26e89f1 100644 (file)
@@ -1 +1 @@
-favorites=libreoffice-startcenter.desktop,firefox-esr.desktop,clementine.desktop,marble.desktop,audacity.desktop,org.kde.kdenlive.desktop,blender.desktop,inkscape.desktop,org.kde.krita.desktop,xfce4-terminal.desktop
+favorites=libreoffice-startcenter.desktop,firefox-esr.desktop,clementine.desktop,org.kde.marble.desktop,org.kde.marble.desktop,audacity.desktop,org.kde.kdenlive.desktop,blender.desktop,inkscape.desktop,org.kde.krita.desktop,xfce4-terminal.desktop