snakeware

Python-based Linux distro for x86-64 and RPi
git clone git://squid-tech.com/snakeware.git
Log | Files | Refs | README

commit cd326553b73837e2bc24f23855cd840986e82b1b
parent 67fac74f0341bb6a8f28e1585bed89413264c895
Author: Josh Moore <jxm5210@g.rit.edu>
Date:   Thu, 11 Jun 2020 22:18:09 -0400

Merge pull request #114 from joshiemoore/rpi4-config

Rpi4 config
Diffstat:
Msnakeware/README.md | 1+
Msnakeware/build.sh | 30+++++++++++++++++++++---------
Msnakeware/configure.sh | 2+-
Asnakeware/external/configs/rpi4_defconfig | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msnakeware/external/post-build.sh | 8++++----
Asnakeware/external/rpi4-firmware.sh | 6++++++
Asnakeware/external/rpi4-firmware/cmdline.txt | 1+
Asnakeware/external/rpi4-firmware/config.txt | 27+++++++++++++++++++++++++++
Msnakewm/wm.py | 6+++++-
9 files changed, 141 insertions(+), 15 deletions(-)

diff --git a/snakeware/README.md b/snakeware/README.md @@ -6,6 +6,7 @@ minutes each subsequent time (unless you do a `make clean` in the buildroot dire Currently supported platforms: * x86-64 +* rpi4 ## Build Process diff --git a/snakeware/build.sh b/snakeware/build.sh @@ -12,8 +12,8 @@ BUILDROOT_VERSION=2020.05 SNAKEWARE=$PWD IMG=snakeware.img -if [ ! -d buildroot ]; then - git clone -b $BUILDROOT_VERSION https://github.com/buildroot/buildroot.git buildroot --depth 1 +if [ ! -d buildroot_$1 ]; then + git clone -b $BUILDROOT_VERSION https://github.com/buildroot/buildroot.git buildroot_$1 --depth 1 fi if [ ! -f "$SNAKEWARE/external/configs/$1_defconfig" ]; then @@ -22,16 +22,28 @@ if [ ! -f "$SNAKEWARE/external/configs/$1_defconfig" ]; then fi # run build -cd buildroot +cd buildroot_$1 make BR2_EXTERNAL="$SNAKEWARE/external" "$1_defconfig" make cd $SNAKEWARE -if [ ! -f buildroot/output/images/rootfs.iso9660 ]; then - echo "Failed to generate rootfs.tar, not creating bootable image." - exit +if [ $1 == x86-64 ]; then + # look for x86-64 ISO + if [ ! -f buildroot_$1/output/images/rootfs.iso9660 ]; then + echo "Failed to generate rootfs.iso." + exit + fi + + cp buildroot_$1/output/images/rootfs.iso9660 snakeware_x86-64.iso + echo "snakeware_x86-64.iso SUCCESS :)" +elif [ $1 == rpi4 ]; then + # look for rpi4 SD card image + if [ ! -f buildroot_$1/output/images/sdcard.img ]; then + echo "Failed to generate sdcard.img." + exit + fi + + cp buildroot_$1/output/images/sdcard.img snakeware_rpi4.img + echo "snakeware_rpi4.img SUCCESS :)" fi - -cp buildroot/output/images/rootfs.iso9660 snakeware.iso -echo "snakeware.iso SUCCESS :)" diff --git a/snakeware/configure.sh b/snakeware/configure.sh @@ -9,7 +9,7 @@ set -euo pipefail snakeware="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" external="$snakeware/external" -buildroot="$snakeware/buildroot" +buildroot="$snakeware/buildroot_$2" # https://buildroot.org/downloads/manual/manual.html#_configuration_of_other_components buildroot() { diff --git a/snakeware/external/configs/rpi4_defconfig b/snakeware/external/configs/rpi4_defconfig @@ -0,0 +1,75 @@ +BR2_arm=y +BR2_cortex_a72=y +BR2_ARM_FPU_NEON_VFPV4=y +BR2_TOOLCHAIN_BUILDROOT_GLIBC=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y +BR2_TOOLCHAIN_BUILDROOT_CXX=y +BR2_TARGET_GENERIC_HOSTNAME="snakeware" +BR2_TARGET_GENERIC_ISSUE="Welcome to Snakeware!" +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y +# BR2_TARGET_ENABLE_ROOT_LOGIN is not set +# BR2_TARGET_GENERIC_GETTY is not set +BR2_SYSTEM_DHCP="eth0" +BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_SNAKEWARE_PATH)/overlay" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi4/post-build.sh $(BR2_EXTERNAL_SNAKEWARE_PATH)/post-build.sh $(BR2_EXTERNAL_SNAKEWARE_PATH)/rpi4-firmware.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi4/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="--add-miniuart-bt-overlay" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_GIT=y +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/raspberrypi/linux.git" +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="rpi-4.19.y" +BR2_LINUX_KERNEL_DEFCONFIG="bcm2711" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2711-rpi-4-b" +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y +BR2_PACKAGE_ALSA_UTILS=y +BR2_PACKAGE_ALSA_UTILS_ALSACONF=y +BR2_PACKAGE_ALSA_UTILS_ACONNECT=y +BR2_PACKAGE_ALSA_UTILS_ALSALOOP=y +BR2_PACKAGE_ALSA_UTILS_ALSAUCM=y +BR2_PACKAGE_ALSA_UTILS_ALSATPLG=y +BR2_PACKAGE_ALSA_UTILS_AMIDI=y +BR2_PACKAGE_ALSA_UTILS_AMIXER=y +BR2_PACKAGE_ALSA_UTILS_APLAY=y +BR2_PACKAGE_ALSA_UTILS_APLAYMIDI=y +BR2_PACKAGE_ALSA_UTILS_ARECORDMIDI=y +BR2_PACKAGE_ALSA_UTILS_ASEQDUMP=y +BR2_PACKAGE_ALSA_UTILS_ASEQNET=y +BR2_PACKAGE_ALSA_UTILS_BAT=y +BR2_PACKAGE_ALSA_UTILS_IECSET=y +BR2_PACKAGE_ALSA_UTILS_SPEAKER_TEST=y +BR2_PACKAGE_ESPEAK=y +BR2_PACKAGE_ESPEAK_AUDIO_BACKEND_ALSA=y +BR2_PACKAGE_SDL_GFX=y +BR2_PACKAGE_SDL_NET=y +BR2_PACKAGE_SDL_SOUND=y +BR2_PACKAGE_SDL_SOUND_PLAYSOUND=y +BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4=y +BR2_PACKAGE_PYTHON3=y +BR2_PACKAGE_PYTHON3_PY_PYC=y +BR2_PACKAGE_PYTHON3_BZIP2=y +BR2_PACKAGE_PYTHON3_CODECSCJK=y +BR2_PACKAGE_PYTHON3_CURSES=y +BR2_PACKAGE_PYTHON3_DECIMAL=y +BR2_PACKAGE_PYTHON3_OSSAUDIODEV=y +BR2_PACKAGE_PYTHON3_READLINE=y +BR2_PACKAGE_PYTHON3_SQLITE=y +BR2_PACKAGE_PYTHON3_XZ=y +BR2_PACKAGE_PYTHON_PIP=y +BR2_PACKAGE_PYTHON_PYGAME_IMAGE=y +BR2_PACKAGE_PYTHON_PYGAME_EXAMPLES=y +BR2_PACKAGE_PYTHON_PYGAME_FONT=y +BR2_PACKAGE_PYTHON_PYGAME_MIXER=y +BR2_PACKAGE_PYTHON_PYGAME_MIXER_MUSIC=y +BR2_PACKAGE_LIBVORBIS=y +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_4=y +BR2_TARGET_ROOTFS_EXT2_SIZE="160M" +# BR2_TARGET_ROOTFS_TAR is not set +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MKPASSWD=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_PYTHON_PYGAME_GUI=y +BR2_PACKAGE_PYTHON_PYTTSX3=y diff --git a/snakeware/external/post-build.sh b/snakeware/external/post-build.sh @@ -7,9 +7,9 @@ PYLIBVER=python3.8 SNAKEWARE=$PWD/.. # copy snakewm -rm -rf $SNAKEWARE/buildroot/output/target/usr/lib/$PYLIBVER/snakewm -cp -r $SNAKEWARE/../snakewm $SNAKEWARE/buildroot/output/target/usr/lib/$PYLIBVER/ +rm -rf output/target/usr/lib/$PYLIBVER/snakewm +cp -r $SNAKEWARE/../snakewm output/target/usr/lib/$PYLIBVER/ # copy snake-games -rm -rf $SNAKEWARE/buildroot/output/target/usr/lib/$PYLIBVER/snake_games -cp -r $SNAKEWARE/../snake_games $SNAKEWARE/buildroot/output/target/usr/lib/$PYLIBVER/ +rm -rf output/target/usr/lib/$PYLIBVER/snake_games +cp -r $SNAKEWARE/../snake_games output/target/usr/lib/$PYLIBVER/ diff --git a/snakeware/external/rpi4-firmware.sh b/snakeware/external/rpi4-firmware.sh @@ -0,0 +1,6 @@ +# override rpi4 firmware configs with custom configs + +SNAKEWARE=$PWD/.. + +# copy firmware config +cp -r $SNAKEWARE/external/rpi4-firmware/* $SNAKEWARE/buildroot_rpi4/output/images/rpi-firmware/ diff --git a/snakeware/external/rpi4-firmware/cmdline.txt b/snakeware/external/rpi4-firmware/cmdline.txt @@ -0,0 +1 @@ +root=/dev/mmcblk0p2 rootwait console=tty1 console=ttyAMA0,115200 loglevel=3 quiet logo.nologo diff --git a/snakeware/external/rpi4-firmware/config.txt b/snakeware/external/rpi4-firmware/config.txt @@ -0,0 +1,27 @@ +# See http://buildroot.org/manual.html#rootfs-custom +# and http://elinux.org/RPiconfig for a description of config.txt syntax + +kernel=zImage + +# To use an external initramfs file +#initramfs rootfs.cpio.gz + +# Disable overscan assuming the display supports displaying the full resolution +# If the text shown on the screen disappears off the edge, comment this out +disable_overscan=1 + +# How much memory in MB to assign to the GPU on Pi models having +# 256, 512 or 1024 MB total memory +gpu_mem_256=100 +gpu_mem_512=100 +gpu_mem_1024=100 + +# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console +dtoverlay=miniuart-bt + + +# disable color splash +disable_splash=1 + +# enable audio +dtparam=audio=on diff --git a/snakewm/wm.py b/snakewm/wm.py @@ -128,7 +128,11 @@ class SnakeWM: app = "snakewm." + app _app = importlib.import_module(app) - _app.load(self.MANAGER, params) + + try: + _app.load(self.MANAGER, params) + except: + pygame.quit() def appmenu_load(self, app): """