snakeware

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

commit c119876831619411531a1322a278b19ec570a80b
parent fdf7ba3e1adeba33c9fdd1539a8a3c80066eb834
Author: Josh Moore <jxm5210@g.rit.edu>
Date:   Thu, 18 Jun 2020 18:43:18 -0400

Merge pull request #130 from joshiemoore/persistence

Persistence
Diffstat:
MREADME.md | 16++++++++++++++++
Msnakeware/external/configs/rpi4_defconfig | 2+-
Msnakeware/external/configs/x86-64_defconfig | 2+-
Msnakeware/external/overlay/etc/init.d/S50startpy | 11+++++++++++
4 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md @@ -27,6 +27,22 @@ in QEMU are below. The rpi4 image can be flashed to an SD card and run on your Raspberry Pi 4, with no further setup required. +### Flash Drive / SD Card + +To run snakeware on real hardware, simply write the image file to the flash drive or SD card using `dd`, then boot it. +No further setup is required if you just need a live, non-persistent environment. + +To create a persistent snakeware drive: + +1. Note the virtual device corresponding to the drive you wrote the snakeware image to. For this example, we will +assume `/dev/sdc`. +2. Use `cfdisk` to add another partition to the drive, after the snakeware partition(s). This partition can be any size, but you'll likely want to fill the rest of the drive. Take note of the number of the new partition. This will be your "snakeuser" partition, where all of your scripts and data will be stored. +3. Once you have written the partition to the drive, format the partition to ext4. For example, `mkfs.ext4 /dev/sdc2`. +4. Finally, give the paritition the SNAKEUSER label, ex: `e2label /dev/sdc2 SNAKEUSER`. + +Once you've completed these steps, the snakeuser partition will be automatically mounted as `/snakeuser` and chdir'd +into on boot. Files and data stored on this partition will persist between boots. + ### QEMU To run snakeware on QEMU: diff --git a/snakeware/external/configs/rpi4_defconfig b/snakeware/external/configs/rpi4_defconfig @@ -6,7 +6,7 @@ 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_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y # BR2_TARGET_ENABLE_ROOT_LOGIN is not set # BR2_TARGET_GENERIC_GETTY is not set BR2_SYSTEM_DHCP="eth0" diff --git a/snakeware/external/configs/x86-64_defconfig b/snakeware/external/configs/x86-64_defconfig @@ -9,7 +9,7 @@ BR2_GCC_VERSION_9_X=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_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y BR2_ROOTFS_MERGED_USR=y # BR2_TARGET_ENABLE_ROOT_LOGIN is not set # BR2_TARGET_GENERIC_GETTY is not set diff --git a/snakeware/external/overlay/etc/init.d/S50startpy b/snakeware/external/overlay/etc/init.d/S50startpy @@ -6,6 +6,17 @@ amixer sset Speaker unmute amixer sset Master 100% +# create snakeuser directory in root dir +mkdir /snakeuser + +# attempt to mount SNAKEUSER partition to /snakeuser +# this will fail if no SNAKEUSER partition exists, which is fine, +# we will just be in the "live" environment with no persistence +mount -t ext4 /dev/disk/by-label/SNAKEUSER /snakeuser + +# cd to the user partition +cd /snakeuser + # PYTHON THREE FOREVER BABY! while [ 1 ] do