=============================================================================== HOW TO BUILD PsionLX YOURSELF =============================================================================== Two separate things can be done here: A. BUILDING THE THREE CF IMAGES from Psion's soho image. Seconds per image. No root privileges. Run the scripts from this folder as it is. B. COMPILING APPLICATIONS for the netBook Pro. Slow. The machine is ARM OABI, which no modern toolchain produces, so a whole ARM system is booted under emulation and the compiler runs inside it. Only needed to add or rebuild a program. Developed on macOS on Apple Silicon; Linux works too. =============================================================================== A. BUILDING THE CF IMAGES =============================================================================== ------------------------------------------------------------------------------- WHAT YOU NEED ------------------------------------------------------------------------------- * A copy from the archive made whole: in the release's top folder, run python3 restore-after-download.py The archive keeps no symbolic links, empty folders, permissions or hidden files, and the build needs them. * python3 * e2fsprogs: mke2fs, debugfs and e2fsck. macOS has none -- brew install e2fsprogs Linux has them already. The scripts look in Homebrew's places, then /sbin and /usr/sbin; set E2FS=/path/to/sbin to point them elsewhere. * About 7 GB of free space, and this folder on a writable disk (copy it out of the archive first if it is mounted read-only). For the emulator test only: qemu-system-arm and Python's Pillow. You do NOT need root. macOS can neither mount ext2 nor give files foreign owners, so the filesystem is populated with "mke2fs -d" and every device node, owner and mode is then written straight into it with debugfs. ------------------------------------------------------------------------------- BUILD THEM ------------------------------------------------------------------------------- From this folder: python3 scripts/mksoho.py python3 scripts/merge-soho.py PSION_CARD_DIR=card-soho scripts/mkimage.sh PSION_CARD_DIR=card-soho-safe scripts/mkimage.sh scripts/mkimage.sh Each image is written into its tree's folder as psionlx-cf-1gb.img: card-soho/psionlx-cf-1gb.img = ...-soho-original-ARCHIVAL.img card-soho-safe/psionlx-cf-1gb.img = ...-soho-safe.img card/psionlx-cf-1gb.img = psionlx-cf-1gb.img What each step does: mksoho.py Finds Psion's tarball in ../3-PSION-SOURCES/soho-image/, checks its SHA-256, and proves soho-analysis/soho-tarball-listing.txt describes it exactly -- every entry's type, mode, owner and size. It unpacks the tarball into card-soho/root, writes mknods.debugfs (the 59 device nodes) and metadata.debugfs (Psion's mode and owner for all 6,161 other entries) from the listing, and checks the tree against the listing. It then copies the tree to card-soho-safe/, makes the three safety changes, and checks nothing else differs. Boot partitions come from bootimg/. merge-soho.py Builds card/ -- the full image -- from card-soho, adding the extras (from card-reconstruction/, by their package lists), the custom files, Find new software (written in 2026, from built-binaries/psion-apps), the safety changes and the fixes, and registers each addition with the image's package manager. It refuses anything that would overwrite one of Psion's files, and its opening comment lists everything it adds and everything it deliberately leaves out. mkfeed.py Builds PsionLX-Software, beside this release: the archive folder "Find new software" installs from. Each addition is an ipkg package there, made from the same definitions merge-soho.py uses. mkimage.sh Builds the ext2 root filesystem from /root, applies the device nodes, the ownership and then Psion's exact metadata, assembles MBR + boot partition + root, and checks the result: /home/lx owned by 1000, the device nodes present, apm.orig, mount and tinylogin setuid, and the desktop's files in place. TO CHANGE THE FULL IMAGE, CHANGE merge-soho.py, not card/root: card/ is rebuilt from scratch every time. ------------------------------------------------------------------------------- THE BOOT PARTITIONS ------------------------------------------------------------------------------- bootimg/boot-original.fat Psion's own kernel (archival image) bootimg/boot-safe.fat the hardened kernel (safe and full) To rebuild the hardened kernel from fuchs's original: python3 scripts/mkbootsafe.py --install python3 scripts/fatpatch.py bootimg/boot-safe.fat NBKPROOS.IMG bootimg/nBkProOs.img.safe then rebuild the trees and images. mkbootsafe.py compares what it builds with the shipped nBkProOs.img.safe by content -- the kernel bytes, and every file, mode and owner in the ramdisk -- because ext2 stamps the time of each change, so the bytes never match. bootimg/README.txt explains the hardening. ------------------------------------------------------------------------------- WHAT IT PRODUCES ------------------------------------------------------------------------------- Type Start LBA Sectors Size MBR -- 0 1 512 B Partition 1 0x06 FAT16, bootable 2048 143,360 70 MB Partition 2 0x83 Linux ext2 145,408 1,856,480 906.5 MB Exactly 1,024,966,656 bytes: the full capacity of a 1 GB card. CHS fields are computed with H=16, S=32, the geometry the bootloader expects; this machine's firmware is old enough to read them. ext2 is created with "-b 1024 -O ^resize_inode,^dir_index". The 2.6.9 kernel predates both features and refuses the filesystem otherwise. ------------------------------------------------------------------------------- OWNERSHIP -- READ THIS BEFORE CHANGING ANYTHING ------------------------------------------------------------------------------- The whole desktop runs as user lx, uid 1000, so /home/lx must be owned by 1000:1000. If it is root's, lx cannot create ~/.matchbox (the dock) or ~/.gpe (settings, the Today screen's state, the dock presets), and you get no dock, the wrong theme and a bare desktop at once -- three symptoms that look like three bugs and are one. Psion's tarball says 1000:1000, and metadata.debugfs carries that into the image. mkimage.sh checks it in the BUILT image; check it yourself too: debugfs -R 'stat /home/lx' card/rootfs.ext2 # User: 1000 Group: 1000 Keep /home/lx empty. A leftover ~/.matchbox/mbdock.session or settings database overrides /etc for ever after. The same trap in another form: unpack Psion's tarball on macOS, or without root, and every setuid bit is lost. apm.orig without its setuid bit is why the power button could not suspend the machine on the community card this project started from. Take modes from the tarball's listing, as mksoho.py does, never from an extracted tree. ------------------------------------------------------------------------------- THE BOOT PARTITION, AND THE THING THAT DESTROYS MACHINES ------------------------------------------------------------------------------- BooSt loads the kernel from a file named exactly nBkProOs.img. It ALSO runs a file called nBkPro.img from the card automatically, if there is one, and which script that is decides whether your machine survives. SAFE -- what these images carry, 279 bytes, one line: load nBkProOS.img run FATAL -- the LX prototype's script, which contains: nand -ignore erase 18 ee8 nand partition e8 It erases the internal NAND; on a standard 32 MB machine the resulting partition is too small for Windows CE to reinstall. That happened to a real machine during this project. Read the script out of anything you build before booting it -- the commands are plain text after a 256-byte header: tail -c +257 /Volumes/PSIONBOOT/NBKPRO.IMG scripts/release-safety-check.py does this mechanically for a whole folder: every BooSt script must be on its whitelist, and every boot partition must be one of the two approved ones or pass a content check (no NAND command anywhere in its sectors, no NBLXLoad.sh, the one-line autoboot script only). The release is built with it. And read the CARD, not the image file: fixing an image does not fix a card already written from an older one. ------------------------------------------------------------------------------- TESTING IN THE EMULATOR ------------------------------------------------------------------------------- GUITEST_CARD=card scripts/guitest.sh 1500 GUITEST_CARD=card GUITEST_XCLICK='472 306 778 467 787 135' scripts/guitest.sh 1500 Boots a copy of a tree's root filesystem under qemu-system-arm with Debian's versatile kernel (qemu/) and writes qemu/psionlx-.png. The first boot spends about ten minutes configuring Psion's packages before X starts. The XCLICK form taps the emulator's mixer error away, closes the battery popup and presses PROGRAMS; "787 240" would press TASKS. Two things are lent to the test copy, never to an image: an Xfbdev X server from card-reconstruction/ (Psion's Xepson needs the netBook Pro's Epson display controller) and qemu/xclick, a small XTEST client, because the X server takes its pointer from a touchscreen library and the emulator has no touchscreen. Expect a mixer error and a low-battery popup in the emulator only. To test Find new software, run PsionNet on this computer serving the PsionLX-Software folder (from PsionNet's source: python3 proxy/run.py --host 127.0.0.1 --port 8080 --allow 127.0.0.1/32 --spotify-demo --software-src ../../PsionLX-Software), then: GUITEST_NET=1 GUITEST_RUN='mkdir -p $HOME/.psionnet && echo 10.0.2.2:8080 > $HOME/.psionnet/server' \ GUITEST_XCLICK='472 306 778 467 787 240 315 125' GUITEST_SETTLE=45 \ scripts/guitest.sh 1500 which gives the emulated machine a network (this computer is 10.0.2.2), presses TASKS and opens Find new software. GUITEST_RUN_ROOT runs a command as root -- on a safe-image tree, the one-line installer from PsionLX-Software/README.txt. GUITEST_RUN='command' runs a command in the session first, and GUITEST_FETCH='/guest/path ...' copies files out afterwards. =============================================================================== B. COMPILING APPLICATIONS =============================================================================== The three images do not need this: they are Psion's own binaries, plus extras compiled by the first edition and taken from card-reconstruction/. It is here for adding or rebuilding programs. It is how the emulator's tap helper (jobs/job-xclick.sh) was built, and the two programs written for PsionLX in 2026: Find new software (jobs/job-software.sh), which IS in the full image, and the Spotify app (jobs/job-spotify.sh), which it installs. It runs from this folder too: scripts/qbuild.sh uses arm-oabi-chroot/ as its template and qemu/ for the emulator, and leaves each job's output in build/out/. It needs qemu-system-arm and the same e2fsprogs. A copy from the archive needs restore-after-download.py first, as for A: the build environment is full of symbolic links and programs. ------------------------------------------------------------------------------- WHY THIS IS AWKWARD ------------------------------------------------------------------------------- The netBook Pro is ARM OABI -- ELF e_flags 0x2, the old ABI. Modern toolchains produce EABI and nothing on a current system produces OABI at all. Debian's "arm" architecture (as opposed to "armel") was OABI, which is why Debian sarge and etch packages still run on this machine unmodified. There is a second constraint that decides everything else: the card carries libstdc++.so.6.0.3, which is GCC 3.4's C++ runtime. Anything C++ must therefore be built with GCC 3.4. Debian's own builds of, say, AbiWord want __gnu_cxx::__pool symbols from libstdc++ 4.1 and simply will not run here. So: an entire Debian etch ARM OABI system is booted as a real ARM machine under QEMU, and the compiler runs natively inside it. Slow, but correct, and it removes every cross-compilation problem at once. ------------------------------------------------------------------------------- HOW IT WORKS ------------------------------------------------------------------------------- scripts/qbuild.sh [timeout-seconds] Each run: 1. packs a FRESH chroot from arm-oabi-chroot/ into a disk image 2. boots it under qemu-system-arm -M versatilepb with the kernel and initramfs in qemu/ 3. runs your job script with its output on the serial console, captured to .log 4. recovers /build/out from the image afterwards THE CRITICAL CONSEQUENCE, AND IT HAS CAUGHT ME MORE THAN ONCE: The chroot is repacked from the template EVERY RUN, and ONLY /build/out is recovered. A "make install" in one job does not exist in the next. If a job needs a library it also builds, it must build, install and use it WITHOUT LEAVING THAT BOOT. Splitting that across two jobs produces results that look plausible and are empty -- an aspell dictionary build did exactly this three times, reporting twelve dictionaries built when every one of them was an empty 304-byte file. Anything you want to persist between jobs must be put into arm-oabi-chroot/ itself, which is the template. ------------------------------------------------------------------------------- WRITING A JOB ------------------------------------------------------------------------------- Look at jobs/ -- there are working examples for AbiWord, Gnumeric, Balsa, Firefox, Samba, aspell, Solitaire and the GPE components, each with the log it produced. They are heavily commented, mostly with the reasons behind choices that look arbitrary. The pattern: set -x rm -rf /build/out; mkdir -p /build/out/bin export CC=gcc-3.4 export CXX=g++-3.4 cd /build/ ./configure --prefix=/usr > /build/out/conf.log 2>&1 make > /build/out/make.log 2>&1 cp /build/out/bin/ echo BUILD_SCRIPT_DONE Rules learned the hard way: * THE JOB MUST NOT REDIRECT ITS OWN STDOUT. The harness watches the console for the completion marker; redirect it and the run waits for the full timeout instead of finishing. * Use Psion's own configure flags, from the matching .oe recipe in 3-PSION-SOURCES/oe-netbook/. They are not arbitrary. Passing a flag the version does not have is silently ignored by autoconf -- Psion's own abiword_2.0.11.oe passes --with-aspell, which does not exist in 2.0.11, and the result is a word processor with no spellchecker. * VERIFY THE OUTPUT IN THE JOB ITSELF, behaviourally. Check the binary's DT_NEEDED with readelf, check e_flags is 0x2, and where it makes sense actually run the thing. A build that exits 0 and produces something useless is the normal failure mode here, not the exotic one. * busybox 1.00's find has neither -maxdepth nor -perm. A find-based check silently returns nothing and a successful build looks like a failed one. Check explicit paths instead. * gcc 3.4 rejects a redundant semicolon after a member declaration at class scope. Several 2004-era trees have them. ------------------------------------------------------------------------------- WHAT IS IN THIS FOLDER ------------------------------------------------------------------------------- FOR THE IMAGES scripts/ the build scripts (scripts/README.txt lists them) card/ the full image's tree, as built: root/ and the device and metadata lists (rebuilt by merge-soho.py) card-reconstruction/ the first edition's tree: the source of the extras, and of the Xfbdev the emulator borrows bootimg/ the boot partitions, the hardened kernel, and both start-up ramdisks soho-analysis/ the analysis of Psion's image, including the tarball listing every image's metadata comes from qemu/ the emulator's kernel and initramfs, and the tap helper card-soho/ and card-soho-safe/ are not shipped: mksoho.py makes them from Psion's tarball in a few seconds. FOR COMPILING (the first edition's toolchain) arm-oabi-chroot/ the Debian etch ARM OABI build environment, 828 MB debian-packages/ the Debian ARM OABI package cache (and the emulator kernel's modules, in kx/) gpe-src/ GPE sources, including the first edition's reconstruction of the launcher psionnet-spotify/ the Spotify app's source, icon and launcher jobs/ every build job used, with its console log built-binaries/ what those jobs produced jffs2-extracted/ the community GPE root filesystem, unpacked initramfs/ the build machine's initramfs, unpacked mbpanel/ the matchbox panel source overlay-route/ the original, superseded install method last-build-output/ /build/out from the AbiWord spellchecker build =============================================================================== CHECKING THAT A REBUILD MATCHES WHAT WAS SHIPPED =============================================================================== Your images will NOT have the same SHA-256 as the published ones, and nothing is wrong: mke2fs writes the creation, write and check times into the superblock, so two builds of an identical tree, minutes apart, differ. Compare the trees instead: python3 scripts/treehash.py card/root which hashes every file's path, size and MD5 and every symlink's target. The trees the published images were built from: card/root d91f6021471fccb35450f26f0ad979d9a7c68901470bc137ead43dc8756b3e82 card-soho/root bc0bc99f78d14f423fc0821226a9d8d262bfcb05cee12d7ae98943c753c54d91 card-soho-safe/root 93f80b1cad21eae67d0b552c36774bfa48cda7b569685677f59b388d80e25371 card-reconstruction/root b7447d6b7b1f5fab8b401b30589869c3bdbdd6bc552633f49a3240ac66852084 (as released, without two SSH keys: see card-reconstruction/README.txt) Modes and owners are not in that hash -- a host tree cannot hold them. They come from metadata.debugfs, which mksoho.py checks against Psion's listing. To compare inside two built filesystems: debugfs -R "stat /usr/bin/apm.orig" card/rootfs.ext2 dumpe2fs -h yours.ext2 > a; dumpe2fs -h theirs.ext2 > b; diff a b The last should show only the superblock times and the directory hash seed.