package/uutils-coreutils: new package
PATCH v5 1/3 package/uutils-coreutils: new package
This package is an implementation of coreutils written entirely in Rust. Currently defined functions:
[, b2sum, b3sum, base32, base64, basename, basenc, cat, cksum, comm, cp, csplit, cut, date, dd, df, dir, dircolors, dirname, du, echo, env, expand, expr, factor, false, fmt, fold, hashsum, head, join, link, ln, ls, md5sum, mkdir, mktemp, more, mv, nl, numfmt, od, paste, pr, printenv, printf, ptx, pwd, readlink, realpath, rm, rmdir, seq, sha1sum, sha224sum, sha256sum, sha3-224sum, sha3-256sum, sha3-384sum, sha3-512sum, sha384sum, sha3sum, sha512sum, shake128sum, shake256sum, shred, shuf, sleep, sort, split, sum, tac, tail, tee, test, touch, tr, true, truncate, tsort, unexpand, uniq, unlink, vdir, wc, yes
This is a continuation of the work started in [1] and [2]. This version introduces several major changes:
- updated to the latest uutils-coreutils version (0.1.0)
- added a flag to enable or disable the multicall binary
- build fixes and improvements
Links:
[1] https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
[2] https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
--- package/Config.in | 1 + package/busybox/busybox.mk | 1 + package/coreutils/Config.in | 1 + package/uutils-coreutils/Config.in | 28 +++++ .../uutils-coreutils/uutils-coreutils.hash | 3 + package/uutils-coreutils/uutils-coreutils.mk | 112 ++++++++++++++++++ 6 files changed, 146 insertions(+) create mode 100644 package/uutils-coreutils/Config.in create mode 100644 package/uutils-coreutils/uutils-coreutils.hash create mode 100644 package/uutils-coreutils/uutils-coreutils.mk
package/Config.in +1 -0
@@ -2947,6 +2947,7 @@ menu "System tools" source "package/tpm2-totp/Config.in" source "package/unscd/Config.in" source "package/util-linux/Config.in" + source "package/uutils-coreutils/Config.in" source "package/watchdog/Config.in" source "package/watchdogd/Config.in" source "package/xdg-dbus-proxy/Config.in"
package/busybox/busybox.mk +1 -0
@@ -68,6 +68,7 @@ BUSYBOX_DEPENDENCIES = \ $(if $(BR2_PACKAGE_UNZIP),unzip) \ $(if $(BR2_PACKAGE_USBUTILS),usbutils) \ $(if $(BR2_PACKAGE_UTIL_LINUX),util-linux) \ + $(if $(BR2_PACKAGE_UUTILS_COREUTILS),uutils-coreutils) \ $(if $(BR2_PACKAGE_TINYINIT),tinyinit) \ $(if $(BR2_PACKAGE_VIM),vim) \ $(if $(BR2_PACKAGE_WATCHDOG),watchdog) \
package/coreutils/Config.in +1 -0
@@ -3,6 +3,7 @@ config BR2_PACKAGE_COREUTILS depends on BR2_USE_WCHAR depends on BR2_USE_MMU # fork() depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS + depends on !BR2_PACKAGE_UUTILS_COREUTILS help All of the basic file/text/shell utilities. These are the core utilities which are expected to exist on every system.
package/uutils-coreutils/Config.in new file +28 -0
@@ -0,0 +1,28 @@ +config BR2_PACKAGE_UUTILS_COREUTILS + bool "uutils-coreutils" + depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS + depends on BR2_PACKAGE_HOST_RUSTC + depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS + help + uutils is an attempt at writing universal (as in + cross-platform) CLI utilities in Rust. While all programs have + been implemented, some options might be missing or different + behavior might be experienced. + + https://github.com/uutils/coreutils + +if BR2_PACKAGE_UUTILS_COREUTILS + +config BR2_PACKAGE_UUTILS_COREUTILS_MULTICALL + bool "multicall" + default y + help + Build coreutils as a multi-call binary. + + Selecting 'y' will build and install a single + 'coreutils' binary that supports all commands. + + Selecting 'n' will build and install the utilities + as separate files. + +endif
package/uutils-coreutils/uutils-coreutils.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally generated +sha256 40a56def7387edbc242e57eacc058449c6567bce0f681fb5c1dac7e7dac32e6a uutils-coreutils-0.1.0-cargo4.tar.gz +sha256 29953405eaa3dcc41c37d1621d55b6a47eee93e05613e439e73295029740b10c LICENSE
package/uutils-coreutils/uutils-coreutils.mk new file +112 -0
112 lines not on this page · raw message
Signature · 6 lines
2.49.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v5 1/3 package/uutils-coreutils: new package
The changes were validated on QEMU, Raspberry Pi 3 B, and Orange Pi Zero 2W platforms, with both multicall and non-multicall configurations. In general, the binaries functioned correctly across all targets.
Non-multicall images resulted in larger file sizes. For example, the QEMU multicall image was approximately 14 MB, while its non-multicall counterpart reached 43 MB.
On one hand, the larger image sizes were expected — many standalone binaries naturally consume more space. On the other hand, the extent of the increase was (at least for me) a bit unexpected.
To build uutils/coreutils-specific changes and share test images [1], I created a GitLab repository [2]. Feel free to check the repository for more information and images.
Thank you
Links:
[1] - https://gitlab.com/alexs-sh/uutils-coreutils-tester/-/releases
[2] - https://gitlab.com/alexs-sh/uutils-coreutils-tester
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v5 1/3 package/uutils-coreutils: new package
Hi Alexander, all,
Thanks a lot for your work on this.
I’ve spent some time trying to understand and improve the
way we handle the build of individual utilities, mainly to avoid hardcoding a list of tools manually in the .mk file, which is error-prone and hard to maintain during version bumps.
I know this might be something you're already aware of, but I also want to re-explain it here in order to bring more people into the context, in case someone else wants to help or understand the discussion more easily. Building individual tools with Cargo requires
explicit -p uu_<util> arguments, which forces us to define a list of utilities beforehand. The GNUmakefile does this by hardcoding the PROGS list. However, this list isn't directly usable for Cargo builds in Buildroot.
The uutils project does provide a script show-utils.sh, but it hasn't been updated for a long time and misses some recently added utilities, so we can't use it.
After exploring several approaches, I found that the best way to get a utility list is to extract it directly from the '[features]' section of Cargo.toml, especially the 'feat_common_core' feature, which corresponds to the set of tools that are known to work across most architectures.
So instead of hardcoding the list, we can generate it dynamically using:
""" PROGS = $(shell cd $(@D) && sed -n '/feat_common_core =/,/]/p' Cargo.toml | grep -o '".*"' | tr -d '"') """
Or alternatively with awk:
""" PROGS = $(shell cd $(@D) && awk '/feat_common_core =/,/]/' Cargo.toml | grep -o '".*"' | tr -d '"') """
This keeps the logic in sync with upstream and avoids manual updates each time new utilities are added or removed from the common core set.
I haven’t sent a v6 using this yet because I’d like your thoughts first. Maybe someone else has a better idea!
Best regards,
El Mehdi
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v5 1/3 package/uutils-coreutils: new package
In reply to Alexander ShirokovHi El Mehdi, all
Thank you for the review, efforts, and valuable comments.
I like the improvement with reading feat_common_core from Cargo.toml. However, it seems that the modification needs to go deeper. This is exactly what I wanted to discuss with other developers. Here are my concerns:
1. During migration, it’s very desirable to replace utilites in small pieces - update 2-3 apps, prepare the image, run tests, analyze, then repeat. This kind of migration provides better control over the process. To do this, we need a mechanism to enable/disable a single app, not all apps. I’ve already encountered the need for such functionality in practice.
2. Not all utilities are needed, especially on production devices. For example, cp, mv, and cat are common, while dircolors, factor, and nl are rare (at least in my experience). So, having a mechanism to include only the needed apps seems very desirable. I haven’t faced this issue yet, but it looks likely.
3. Using feat_common_core could implicitly change the set of apps when modifying package versions, which would be unexpected. I haven’t encountered this myself, so it’s only a theoretical problem.
So, it seems that for a non-multicall build, it’s very likely necessary to have a mechanism to configure the list of utilites via Config.in.
Some thoughts about possible solutions:
Thought #1:
To address the problem, I can add more parameters to the Config.in file. But this approach has several drawbacks:
- increases the final Buildroot config by adding 50-70 parameters
- increases complexity of Config.in and makefiles
- increases commit sizes
Sure, playing with defaults is possible, but it doesn’t solve the core problem of granularity.
Thought #2:
For me, the ideal solution would be a BusyBox-like config. However, uutils doesn’t support this functionality. I can start discussing it with the uutils developers, but it would cause a significant delay - and I’m not sure it would succeed.
Thought #3:
Since we have mk files, we can configure the utilites lists in separate mk files acting as configs. Then, we can specify the exact file (over Config.in) and include it in uutils-coreutils.mk during the build. Overall, this should solve the core granularity problem and seems technically feasible. However, I’m not sure how well it aligns with Buildroot’s approaches.
Thought #4:
Just proceed step-by-step. Let’s enable it and merge, as it looks good enough to start. Later, we can improve the configuration mechanism delivering those changes in separate patches.
Thank you. Please feel free to share any thoughts and ideas. They’re much appreciated.
PS: Sorry for the long message.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Le 27/06/2025 à 14:55, Alexander Shirokov a écrit :
Quoted 7 lines
Hi El Mehdi, all
Thank you for the review, efforts, and valuable comments.
I like the improvement with reading
feat_common_corefrom Cargo.toml. However, it seems that the modification needs to go deeper. This is exactly what I wanted to discuss with other developers. Here are my concerns:
Hi,
Thanks again for the detailed reply and for opening this interesting discussion.
Quoted 5 lines
1. During migration, it’s very desirable to replace utilites in small pieces - update 2-3 apps, prepare the image, run tests, analyze, then repeat. This kind of migration provides better control over the process. To do this, we need a mechanism to enable/disable a single app, not all apps. I’ve already encountered the need for such functionality in practice.
agree
Quoted 5 lines
2. Not all utilities are needed, especially on production devices. For example,
cp,mv, andcatare common, whiledircolors,factor, andnlare rare (at least in my experience). So, having a mechanism to include only the needed apps seems very desirable. I haven’t faced this issue yet, but it looks likely.
Yes, not all tools are needed on production
devices. The project itself uses feature groups in Cargo.toml like feat_common_core, but it's not ideal for building only a minimal set of specific tools. So I do agree with the need for better granularity. Unfortunately, this is not handled well yet in upstream uutils-coreutils.
Quoted 3 lines
3. Using
feat_common_corecould implicitly change the set of apps when modifying package versions, which would be unexpected. I haven’t encountered this myself, so it’s only a theoretical problem.
In fact, this was the main motivation behind my proposal. The list of utilities you define in 'PROGS' looked very similar to 'feat_common_core', so I thought they were meant to match. If the project adds new tools to this list, it seems better to pull the change automatically than manually updating 'PROGS' every time.
Quoted 10 lines
So, it seems that for a non-multicall build, it’s very likely necessary to have a mechanism to configure the list of utilites via Config.in.
Some thoughts about possible solutions:
Thought #1:
To address the problem, I can add more parameters to the Config.in file. But this approach has several drawbacks:
Quoted 6 lines
- increases the final Buildroot config by adding 50-70 parameters
- increases complexity of Config.in and makefiles
- increases commit sizesSure, playing with defaults is possible, but it doesn’t solve the core problem of granularity.
I also considered using 'Config.in', but not to control each individual tool. I was thinking more about letting the user choose between supported feature sets defined by uutils, like 'feat_common_core', 'unix', etc. However, selecting tools one-by-one feels like something that should be managed upstream in the project, not in Buildroot.
Quoted 6 lines
Thought #2:
For me, the ideal solution would be a BusyBox-like config. However, uutils doesn’t support this functionality. I can start discussing it with the uutils developers, but it would cause a significant delay - and I’m not sure it would succeed.
I completely agree. A BusyBox-style config would be the perfect long-term solution. But as you mentioned, this is something to discuss with the uutils developers. It doesn’t exist yet.
Quoted 7 lines
Thought #3:
Since we have mk files, we can configure the utilites lists in separate mk files acting as configs. Then, we can specify the exact file (over Config.in) and include it in uutils-coreutils.mk during the build. Overall, this should solve the core granularity problem and seems technically feasible. However, I’m not sure how well it aligns with Buildroot’s approaches.
I personally don’t think adding external '.mk' files to define lists of tools is the right direction in Buildroot.
Quoted 5 lines
Thought #4:
Just proceed step-by-step. Let’s enable it and merge, as it looks good enough to start. Later, we can improve the configuration mechanism delivering those changes in separate patches.
That’s fair. My main concern was only about hardcoding the utility list in the '.mk' file. From a maintenance perspective, this can be time-consuming for contributors, especially when updating versions. But I tested your patch and it works fine, so no problem for me if maintainers prefer to go with this approach.
Quoted 2 lines
Thank you. Please feel free to share any thoughts and ideas. They’re much appreciated.
Finally, I just wanted to share a personal point: for a normal Buildroot user, enabling or disabling a tool should not be done by editing an 'mk' file. That’s why I assumed that your 'PROGS' list was not meant to be changed by users directly. So I thought about using a static upstream list like 'feat_common_core'. And if we want proper per-tool selection, then upstream uutils-coreutils must first support this kind of configurability — otherwise we can't implement it cleanly in Buildroot. Maybe it can be done also by a post image script, not clean, but I think that it is better than editing the 'mk' file.
Quoted 1 line
PS: Sorry for the long message.
Thanks again for the discussion and your effort on the package. Sorry for the late response
Best regards,
El Mehdi
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v5 1/3 package/uutils-coreutils: new package
In reply to Alexander ShirokovIt seems we can provide a brief summary at this point:
1. Reading the list of packages from feat_common_core is currently the best available approach. It results in minimal and simple code while still providing sufficient functionality. I tested it on my side, and it works very well. Therefore, I’d like to proceed with this approach and can provide v6 patches with the change.
2. I’ll contact the uutils-coreutils developers to understand their ideas regarding the configuration of the app list. At the same time, I’ll try several approaches on the Buildroot side — just to experiment, gain experience, and compare methods. I expect this will take some time. I’d like to deliver the configuration-related changes later, separately from the "new package" changes (if that matches Buildroot’s approach and vision).
What do you think?
Thank you
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Le 02/07/2025 à 12:52, Alexander Shirokov a écrit :
Quoted 7 lines
It seems we can provide a brief summary at this point:
1. Reading the list of packages from
feat_common_coreis currently the best available approach. It results in minimal and simple code while still providing sufficient functionality. I tested it on my side, and it works very well. Therefore, I’d like to proceed with this approach and can provide v6 patches with the change.
Looks good for me. Although, I'm still not entirely sure whether it's objectively better than v5, so maybe it would help to get a maintainer's (or someone else's) opinion on which version fells more appropriate in the long term. Since we agree that both versions are valid, having a third perspective might help us choose more confidently.
Quoted 6 lines
2. I’ll contact the uutils-coreutils developers to understand their ideas regarding the configuration of the app list. At the same time, I’ll try several approaches on the Buildroot side — just to experiment, gain experience, and compare methods. I expect this will take some time. I’d like to deliver the configuration-related changes later, separately from the "new package" changes (if that matches Buildroot’s approach and vision).
Thank you again in advance for moving this forward!
Quoted 4 lines
What do you think?
Thank you
Best regards,
El Mehdi
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v5 1/3 package/uutils-coreutils: new package
In reply to Alexander ShirokovQuoted 5 lines
Looks good for me. Although, I'm still not entirely sure whether it's objectively better than v5, so maybe it would help to get a maintainer's (or someone else's) opinion on which version fells more appropriate in the long term. Since we agree that both versions are valid, having a third perspective might help us choose more confidently.
That sounds reasonable. Let's wait for more opinions.
Quoted 1 line
Thank you again in advance for moving this forward!
Happy to help! BTW, I've started a discussion on the uutils-coreutils side. Let's see where it leads.
https://github.com/uutils/coreutils/discussions/8297
Thank you
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v5 2/3 package/uutils-coreutils: new tests
In reply to Alexander ShirokovAdd a small set of tests for uutils-coreutils to ensure that the binary is present and executable.
--- support/testing/tests/package/test_rust.py | 9 +++++++++ 1 file changed, 9 insertions(+)
support/testing/tests/package/test_rust.py +9 -0
@@ -28,11 +28,14 @@ class TestRustBin(TestRustBase): # BR2_TARGET_ROOTFS_TAR is not set BR2_PACKAGE_HOST_RUSTC=y BR2_PACKAGE_RIPGREP=y + BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y + BR2_PACKAGE_UUTILS_COREUTILS=y """ def test_run(self): self.login() self.assertRunOk("rg Buildroot /etc/issue") + self.assertRunOk("coreutils --help") class TestRust(TestRustBase):
@@ -50,11 +53,14 @@ class TestRust(TestRustBase): BR2_PACKAGE_HOST_RUSTC=y BR2_PACKAGE_HOST_RUST=y BR2_PACKAGE_RIPGREP=y + BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y + BR2_PACKAGE_UUTILS_COREUTILS=y """ def test_run(self): self.login() self.assertRunOk("rg Buildroot /etc/issue") + self.assertRunOk("coreutils --help") class TestRustVendoring(infra.basetest.BRConfigTest):
@@ -70,6 +76,8 @@ class TestRustVendoring(infra.basetest.BRConfigTest): BR2_PACKAGE_RIPGREP=y BR2_PACKAGE_PYTHON3=y BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y + BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y + BR2_PACKAGE_UUTILS_COREUTILS=y """ def setUp(self):
@@ -95,3 +103,4 @@ class TestRustVendoring(infra.basetest.BRConfigTest): def test_run(self): self.check_download("ripgrep") self.check_download("python-cryptography") + self.check_download("uutils-coreutils")
Signature · 6 lines
2.49.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v5 3/3 DEVELOPERS: add Alexander Shirokov for uutils-coreutils
In reply to Alexander Shirokov--- DEVELOPERS | 3 +++ 1 file changed, 3 insertions(+)
DEVELOPERS +3 -0
@@ -2992,6 +2992,9 @@ F: package/lrzip/ N: Sam Voss <[email protected]> F: package/ripgrep/ +N: Alexander Shirokov <[email protected]> +F: package/uutils-coreutils/ + N: Sébastien Szymanski <[email protected]> F: board/armadeus/ F: configs/armadeus*
Signature · 6 lines
2.49.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot