Skip to content
Syno Package Land
Language: English

Package an existing native product

Use the native layout when the product already builds its own binaries, start script and DSM window; synopkgland runs your hooks, checks the result and writes one SPK per architecture, without generating a backend or UI. For generated code, see Build a native app.

Write dsm-package.yaml by hand; the native layout is not an init template.

schema: 2
backend: {kind: native}
package: ExampleNative
version: 1.2.3
build: 8
displayname: Example Native
description: Existing native product
maintainer: Example
os_min_ver: 7.0-40000
arches: [x86_64, armv8, armv7]
layout:
payload: target/native-layout/{arch}/payload
metadata: target/spk-metadata
binaries:
- {path: bin/app, linkage: static, arches: [x86_64, armv8]}
- {path: bin/app, linkage: dynamic, arches: [armv7]}
native:
prepare: {cwd: ., command: [python3, package/prepare.py]}
hook: {cwd: ., command: [python3, package/compile.py]}
toolkits:
x86_64:
- {url: 'https://example.com/toolkit.txz', sha256: '<64 lowercase hex digits>'}

Replace the toolkit URL and digest, or remove toolkits if unused.

Terminal window
synopkgland check
synopkgland build --arch x86_64,armv8,armv7
synopkgland inspect dist/ExampleNative-1.2.3-0008-x86_64.spk

Without --arch, build covers every entry in arches. deploy --host <nas> builds and installs only the NAS architecture (armv8 for an aarch64 NAS when declared); raise build before each deploy. See Ship.

Set schema: 2 and backend: {kind: native}. build accepts 1–2147483647 and arches may also use armv8; other identity fields follow the manifest reference.

FieldRule
Allowed keysschema, backend, package, version, build, displayname, description, maintainer, metadata, icon, os_min_ver, privilege, arches, layout, native
layoutpayload (files; {arch} allowed), metadata, binaries ({path, linkage, arches?}; one per architecture) and optional anchors (<key>_sha256)
nativehook (required), prepare (once, before hooks), toolkits (<arch>: [{url, sha256}])
reproducibleOptional {inputs?, clean?} for build --verify-reproducible; see reproducible builds.

Paths are relative, never absolute or containing .. or braces other than {arch}. A compose.yaml beside it is rejected.

A hook is {command: [argv...], cwd?: '.', env?: {...}}, runs without a shell inside the project, and must exit 0. env keys match ^[A-Z_][A-Z0-9_]*$, not SYNOPKGLAND_.

VariableMeaning
SYNOPKGLAND_PACKAGEPackage name
SYNOPKGLAND_VERSION, SYNOPKGLAND_BUILD, SYNOPKGLAND_SPK_VERSIONVersion, build number, and version plus the build padded to 4 digits
SYNOPKGLAND_PROJECT_DIRAbsolute project root
SYNOPKGLAND_ARCH, SYNOPKGLAND_TOOLKIT_DIR, SYNOPKGLAND_WORK_DIRCurrent architecture, extracted toolkit tree, and empty scratch folder removed after the build. Compile hook only.

build --jobs <n> runs the compile hook for up to n architectures at once. It needs {arch} in layout.payload (the CLI refuses --jobs above 1 otherwise) and no shared output folder; use SYNOPKGLAND_WORK_DIR for scratch. native.prepare runs once.

Toolkits download over HTTPS and are checked against sha256 each build. SYNOPKGLAND_CACHE_DIR sets the cache (default $XDG_CACHE_HOME/synopkgland or ~/.cache/synopkgland, ~/Library/Caches/synopkgland on macOS), which must not be a symlink or writable by other users. Archives are extracted with the tar on PATH (GNU tar or bsdtar); a later archive can write through a folder symlink an earlier one created.

check and build verify both folders.

AreaRule
Files and sizeNo symlinks, special files or setuid/setgid bits; each file at most 256 MiB, all files at most 1 GiB.
BinariesExecutable ELF for the architecture, with matching linkage.
metadata top levelOnly conf, scripts, WIZARD_UIFILES, PACKAGE_ICON.PNG and PACKAGE_ICON_256.PNG (not both with manifest icon)
scripts/*start-stop-status is required; no sudo, chown root or chmod +s.
Lifecycle scriptsExecutable: preinst, postinst, preuninst, postuninst, preupgrade, postupgrade, start-stop-status, prereplace, postreplace
confprivilege uses defaults.run-as: package (optional matching username/groupname); resource takes only an empty systemd-unit; systemd holds top-level *.service with one matching User= and optional Group=.
Service unitsNo line continuations. User, Group and Exec* only in [Service]; no AmbientCapabilities, SupplementaryGroups, PermissionsStartOnly, RootDirectory or RootImage; no +/! on Exec*.

The native layout has no root option; the package runs as its own account.

Bind the grant to the approved capabilities, package account and pinned task command, not to a build, manifest or file-tree digest. Declare each root payload in layout.anchors so a new SPK can change root code without a new approval:

layout:
anchors:
example_helper_sha256: bin/helper
example_bootstrap_sha256: bin/bootstrap
RuleValue
Key and path^[a-z][a-z0-9_]{0,48}_sha256$ (not synopkgland_, at most 16 keys) naming a regular payload file without {arch}
build and inspectbuild fails on a missing file or a key that collides with another INFO field; inspect refuses an SPK whose anchor is changed, duplicated, missing or undeclared

For every architecture, build writes the file’s SHA-256 into the root-owned INFO, for example example_helper_sha256="<64 lowercase hex>". The helper reads one valid line per key, copies the payload into its protected folder, checks the copy and only then runs it; a missing, duplicated or different value keeps the grant inactive until approval. Revoke the grant on upgrade only when the capabilities change, with reason: upgrade_reapproval in authorization.status.

arches valueELF checkNotes
x86_6464-bit, machine 62
aarch6464-bit, machine 183INFO arch lists the aarch64 platforms armada37xx rtd1296 rtd1619 rtd1619b, as native-go and binary packages do.
armv864-bit, machine 183Same binary format as aarch64; the SPK keeps the armv8 name.
armv732-bit, machine 40

dynamic linkage depends on the target DSM’s libraries; pin the matching toolkit in native.toolkits.

logs rejects a native layout; check, build, inspect, deploy and status work. inspect checks the archive without installing it and does not prove the product runs on a device.

Code or messageCauseFix
NATIVE_LAYOUT_INVALID: schema 2 requiredschema is not 2, or backend is missing.Set schema: 2 and backend: {kind: native}.
NATIVE_LAYOUT_INVALID: ELF architecture mismatchThe binary is not for the architecture being built.Build the right binary in the hook.
NATIVE_LAYOUT_INVALID: native hook failedA hook exited non-zero.Run the hook command by hand.

See Errors for every code.