usr-linux: deploy the user space where the running root is, drop the leaked e1c injection - #337
Merged
Merged
Conversation
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".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the meta-usr usr-linux bbappend headed "EDGE-M1 Factory Capsule": it injected the apps into
rootfs.cpiounconditionally (edge-m1's e1c capsule policy, now in edge-m1's own meta-e1c). WithIB_RAMFS_SOURCE = "initrd"the apps reached p2 only if nothing had regenerated the cpio since the last build, anddeploy.sh usr-linuxnever reached the card.usr-linux:do_deploynow puts the user space where the running root is, in ONE place chosen byIB_RAMFS_SOURCE:IB_RAMFS_SOURCE"rootfs"(bsp.bbclass default,root=/dev/ram)rootfs.cpio(extract, sudo rsync, re-pack) → embedded in the ITBbsp-linux:do_prepare_initrd(build); depends onrootfs-linux:do_build, afterusr-linux:do_build, never touches the boot media"initrd", pivot to p2)rootfs-linux:do_deploy(sudo rsync,check=True, verdin skipped)bsp-linux:do_deploy(deploy only, noafter do_build)Before: the apps were never on the running root with the default
"rootfs"(infrabase copied them — silently failing, unprivilegedcp— onto a p2 nobody mounts), anddeploy.sh bsp-linuxdid not deploy them at all.deploy.sh usr-linuxnow does the right thing in both modes.Aligned on smartobjectoriented/infrabase#47. Validated with
bitbake -g bsp-linux(build + deploy graphs),IB_RAMFS_SOURCEforced to "rootfs" and "initrd". Not run on real media.