build-kernel-deb: drop root requirement - #223
Conversation
a397777 to
032cac5
Compare
|
Xinzheng Long (@xinlon-z) it has been quite a while that build-dtb-image tool moved to qcom-dtb-metadata: https://github.com/qualcomm-linux/qcom-dtb-metadata/blob/main/build-dtb-image.sh. Please consider this tool in build-utils depricated. |
sure, thanks for providing this info, will update this PR. |
The script previously self-elevated via `exec sudo "$0" "$@"`, but every operation it performs is local: it stages files under `$DEB_DIR` in the current working directory and runs `dpkg-deb --build`. None of those need root. Pass `--root-owner-group` to `dpkg-deb --build` so all entries in the resulting `.deb` are recorded as `root:root` regardless of the build user's uid/gid. This is the standard mechanism for building Debian packages without fakeroot or a real root shell, and matches what the postinst/preinst scripts assume at install time on the target. Drop the `EUID` guard and the self-sudo block. The CLI is unchanged; existing callers that wrap the script in sudo continue to work -- sudo is now allowed but no longer required. Verified by building a synthetic `out/` tree (Image, .config, modules, .dtb, .dtbo) and running the script as a normal user; `dpkg-deb --contents` on the resulting package shows every entry owned by `root/root`, and the preinst/postinst/postrm maintainer scripts are intact and executable. Signed-off-by: Xinzheng Long <xinzheng.long@oss.qualcomm.com>
032cac5 to
9b573f9
Compare
updated |
In some environments, such as AI-driven workflows, sudo privileges may not be available, which makes it difficult to run the existing scripts. To make things a bit more flexible, I did some update in
kernel/scripts/build-kernel-deb.shso they can be executed without requiring root privileges, bringing their behavior just like Yocto.