e0bc4785e9
Flashes the diskOS custom UI onto the FiiO Snowsky Disc over Ingenic mask-ROM USB, building the image from your own stock firmware. Runs from source via install.sh.
3.5 KiB
3.5 KiB
Vendored native tools - portability requirements
The installer bundles native binaries under vendor/<os>-<arch>/ and calls them
via subprocess. For a distributable build these MUST be portable across the user's
machines - not just copies of the build host's dynamically-linked binaries.
| tool | why bundled | portability requirement |
|---|---|---|
usbboot |
Ingenic mask-ROM USB loader (the flasher) | Build static against libusb compiled --disable-udev (drops libudev + libcap; libusb falls back to sysfs enumeration). usbboot has no direct udev symbols - they were only transitive via libusb - so this yields a binary needing only libc. Prefer full-static (musl) or, at minimum, $ORIGIN/lib rpath + a bundled libusb-1.0.so in vendor/<tag>/lib/. Do not ship arbitrary host glibc .sos or rely on LD_LIBRARY_PATH as the primary strategy. |
mksquashfs, unsquashfs |
build/extract the rootfs image | Ship static squashfs-tools (with lzo support - the stock image uses -comp lzo). |
my_write5_dram.bin |
the DRAM NAND writer run on-device | Architecture-neutral blob (runs on the device, not the host). Copy as-is. |
disc_spl_lpddr3.bin |
X2000 SPL | Same - device blob, copy as-is. |
Status
vendor/linux-x86_64/holds fully staticusbboot,mksquashfs, andunsquashfs, produced bybuild/build-usbboot-static.shandbuild/build-squashfs-static.sh(each verifies the binary isstatically linked; the squashfs build additionally runs an LZO round-trip self-test). They are static against glibc (built withgcc -static), so no runtime.sois needed; note the static glibc/liblzo2/libusb licensing in../NOTICE.mdand the corresponding source in../corresponding-source/.my_write5_dram.binanddisc_spl_lpddr3.binare device blobs, copied as-is.vendor/macos-*/is produced on a Mac byvendor/setup-macos.sh(compilesusbbootfromsrc/usbboot/usbboot.cagainst Homebrew libusb, gathers lzo-capable squashfs-tools, copies the device blobs, and runsdylibbundlerso every tool is self-contained undervendor/macos-<arch>/lib/- no Homebrew at runtime).usbboot.cis a single libusb-only file (no udev / no Linux-isms), so it builds on macOS as-is. Thenbuild/build-macos.shpackages the app.
macOS: Intel + Apple Silicon coverage
usbboot.c and pyusb are portable; only the build is per-arch. Options:
- Native per-arch (most robust): run
build/build-macos.shon an Intel Mac and on an Apple Silicon Mac → two binaries. Recommended. - Single file via Rosetta: build x86_64 only (on an Intel Mac, or with an
x86_64 Homebrew under
arch -x86_64). The x86_64 app runs natively on Intel and under Rosetta 2 on M-series (macOS offers to install Rosetta on first run). One file covers both, at a small speed cost - fine for a flasher. - Universal2 (advanced): build both arches,
lipothe vendor tools into fat binaries, and settarget_arch='universal2'in the spec with a universal2 Python. One native file for both, most work.
Building portable usbboot (sketch)
- Get the Ingenic
usbbootsource (the X2000 burn tool). - Build libusb static:
./configure --disable-udev --enable-static --disable-shared→libusb-1.0.a. - Link
usbbootagainst the static libusb; confirm withlddthat libudev/libcap are gone and only libc (or nothing, if fully static) remains. - Verify it still enters mask-ROM and flashes on a real unit before shipping.