Skip to content

build-kernel-deb: drop root requirement - #223

Open
Xinzheng Long (xinlon-z) wants to merge 1 commit into
qualcomm-linux:mainfrom
xinlon-z:no-sudo-requirement
Open

build-kernel-deb: drop root requirement#223
Xinzheng Long (xinlon-z) wants to merge 1 commit into
qualcomm-linux:mainfrom
xinlon-z:no-sudo-requirement

Conversation

@xinlon-z

@xinlon-z Xinzheng Long (xinlon-z) commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

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.sh so they can be executed without requiring root privileges, bringing their behavior just like Yocto.

@bjordiscollaku

Copy link
Copy Markdown
Contributor

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.

@xinlon-z

Copy link
Copy Markdown
Contributor Author

has been quite a while that build-dtb-image tool moved to qcom-dtb

Xinzheng Long (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>
@xinlon-z Xinzheng Long (xinlon-z) changed the title build-dtb-image/build-kernel-deb: drop root requirement build-kernel-deb: drop root requirement Aug 20, 2026
@xinlon-z

Copy link
Copy Markdown
Contributor Author

Xinzheng Long (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.

updated

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.

2 participants