Skip to content

usr-linux: deploy the user space where the running root is, drop the leaked e1c injection - #337

Merged
daniel-rossier merged 2 commits into
mainfrom
fix/usr-deploy-onto-p2
Sep 25, 2026
Merged

daniel-rossier merged 2 commits into
mainfrom
fix/usr-deploy-onto-p2

Conversation

@daniel-rossier

@daniel-rossier daniel-rossier commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Removes the meta-usr usr-linux bbappend headed "EDGE-M1 Factory Capsule": it injected the apps into rootfs.cpio unconditionally (edge-m1's e1c capsule policy, now in edge-m1's own meta-e1c). With IB_RAMFS_SOURCE = "initrd" the apps reached p2 only if nothing had regenerated the cpio since the last build, and deploy.sh usr-linux never reached the card.

usr-linux:do_deploy now puts the user space where the running root is, in ONE place chosen by IB_RAMFS_SOURCE:

IB_RAMFS_SOURCE apps go to pulled by
"rootfs" (bsp.bbclass default, root=/dev/ram) INTO rootfs.cpio (extract, sudo rsync, re-pack) → embedded in the ITB bsp-linux:do_prepare_initrd (build); depends on rootfs-linux:do_build, after usr-linux:do_build, never touches the boot media
anything else ("initrd", pivot to p2) onto p2, on top of rootfs-linux:do_deploy (sudo rsync, check=True, verdin skipped) bsp-linux:do_deploy (deploy only, no after do_build)

Before: the apps were never on the running root with the default "rootfs" (infrabase copied them — silently failing, unprivileged cp — onto a p2 nobody mounts), and deploy.sh bsp-linux did not deploy them at all. deploy.sh usr-linux now does the right thing in both modes.

Aligned on smartobjectoriented/infrabase#47. Validated with bitbake -g bsp-linux (build + deploy graphs), IB_RAMFS_SOURCE forced to "rootfs" and "initrd". Not run on real media.

meta-usr carried a usr-linux bbappend, headed "EDGE-M1 Factory
Capsule", that replaced usr-linux:do_deploy with an injection of the
apps INTO rootfs.cpio. That is the e1c capsule policy of edge-m1 (the
capsule runs from RAM, rootfs.cpio is its initrd); edge-m1 has since
moved it to its own meta-e1c layer. Here it had no reason to be: SO3
trees boot the static initrd.cpio (IB_RAMFS_SOURCE = "initrd") and pivot
to p2, so the injected cpio fed nothing but p2, and only when nothing
had regenerated rootfs.cpio in between (build.sh rootfs-linux silently
dropped the apps from the next deploy). `deploy.sh usr-linux` wrote the
cpio only and never reached the card.

Back to the generic model, aligned on infrabase:

- bbappend removed; usr-linux:do_deploy copies linux/usr/build/deploy
  onto p2 after rootfs-linux:do_deploy, with sudo rsync and check=True
  (p2 is root-owned), verdin skipped like rootfs-linux:do_deploy.
- bsp-linux:do_deploy depends on usr-linux:do_deploy, so a full deploy
  always carries the user space, whatever rootfs.cpio contains.
- No `after do_build` on usr-linux:do_deploy: a deploy copies what the
  build produced and fails clearly when it is missing, instead of
  rebuilding usr and linux.
- do_prepare_initrd depends on rootfs-linux:do_build, as in infrabase,
  instead of the injection.
…rwise

Copying the user space onto p2 is right only when p2 is the running
root. With IB_RAMFS_SOURCE = "rootfs" (the bsp.bbclass default) the
kernel runs from the rootfs.cpio embedded in the ITB (root=/dev/ram), so
apps copied onto p2 were never seen by the running system, and the
initrd carried none.

usr-linux:do_deploy now puts the apps in ONE place, chosen by
IB_RAMFS_SOURCE:

- "rootfs": baked INTO rootfs.cpio (extract, sudo rsync, re-pack).
  bsp-linux:do_prepare_initrd pulls it into the build, before gzipping
  the cpio into the ITB; it then depends on rootfs-linux:do_build (never
  on the boot media) and runs after usr-linux:do_build.
- anything else ("initrd", pivoting to p2): copied onto p2 after
  rootfs-linux:do_deploy; bsp-linux:do_deploy pulls it, deploy-only, no
  `after do_build`.

`deploy.sh usr-linux` therefore does the right thing in both modes.
Validated with `bitbake -g bsp-linux` (build and deploy graphs) with
IB_RAMFS_SOURCE forced to "rootfs" and to "initrd".
@daniel-rossier daniel-rossier changed the title usr-linux: deploy the user space onto p2, drop the leaked e1c injection usr-linux: deploy the user space where the running root is, drop the leaked e1c injection Sep 25, 2026
@daniel-rossier
daniel-rossier merged commit 7225a70 into main Sep 25, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant