9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] GitHub.com/u-root/u-root now works again on plan 9
@ 2025-01-02  1:04 Ron Minnich
  2025-01-02  1:19 ` Matt Wilbur
  0 siblings, 1 reply; 4+ messages in thread
From: Ron Minnich @ 2025-01-02  1:04 UTC (permalink / raw)
  To: 9fans

u-root is a set of about 180 unix commands (and some plan9-only
commands) written in Go.

It uses a tool called the gobusybox, which does a source-source
transformation of a set of Go prgorams, turning each command into a
package, then compiles them all into a single command.

A tool called mkuimage packages that single binary and, on Plan 9,
creates a set of #! files, into a cpiofs in newc-format.

Since a recent change on 9front, you can mount newc files with cpiofs.

So to get, e.g., find, you can do this:

#!/bin/rc
u-root '-defaultsh=' '-initcmd=' '-shellbang=true'
fs/cpiofs /tmp/initram*cpio
bind -a /n/tapefs /
bind -a /bbin /bin

and in /bbin you can see about 60 commands. I try to port one more
very few months. I welcome contributors.

A few of the things I find useful: grep -r works; I still use find
from time to time; timeout and backoff are two useful commands
(backoff tries a command and, if it fails, backs off and tries again;
timeout runs a command and, if it does not complete, kills it); and
there's a known-good sshd and scp command.

To get u-root,
1. install go 1.22
2. git/clone https://github.com/u-root/u-root
3. you can use the script above.

Let me know if you hit a problem, or you feel like contributing.

The entire rewrite-all-commands and create the initramfs is about 20s
for 180 commands on linux/*bsd/darwin; about 36s for 60 commands on
Plan 9 on my T420. The combined binary is 7 MiB, or about 120K per
command on Plan 9. For 160 commands, it's about the same size. For one
command, it's about 2M.

See slide 11 on
https://docs.google.com/presentation/d/1sFI4xSveKgi2iCJ95gc8VzrmdJwxiwNbMS6KcKX62Tg/edit?usp=sharing
 to get some idea of size and the limits at each end.

Also, note, there's nothing special about the u-root commands; they
are all standalone Go programs. Which means, you can include anything
you want into the cpio. The u-root  busybox needs no special
programming for its commands, unlike every C and Rust and Go busybox
I've used before.

Also, note, you can use the gobusybox command, and the mkuimage
command, and never use u-root at all. They are separate.

U-root is used in every firmware image in every datacenter platform at
Google. It's pretty hardened.

U-root is another project which the late Andrey Mirtchovski
contributed to in its early days.

Ron
p.s. "Why didn't you write it in Rust?" -- I take that question
seriously, and did some measurements. Rust does not do as well for
this purpose as Go. A good thing; we have native Go on Plan 9, and I
doubt we'll see native Rust on Plan 9 any time soon, if ever.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tb9714d4771613034-M288294a67a083b2635cc97a7
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] GitHub.com/u-root/u-root now works again on plan 9
  2025-01-02  1:04 [9fans] GitHub.com/u-root/u-root now works again on plan 9 Ron Minnich
@ 2025-01-02  1:19 ` Matt Wilbur
  2025-01-02  2:06   ` Ron Minnich
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Wilbur @ 2025-01-02  1:19 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 545 bytes --]

On Wed, Jan 1, 2025 at 8:04 PM Ron Minnich <rminnich@p9f.org> wrote:

> u-root is a set of about 180 unix commands (and some plan9-only
> commands) written in Go.
>

Playing with u-root on some embedded projects at work has been on my to-do
list for some time, as well as 'https://github.com/u-root/cpu'...

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tb9714d4771613034-Me13630dfd82abe69bd8bdf37
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1418 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] GitHub.com/u-root/u-root now works again on plan 9
  2025-01-02  1:19 ` Matt Wilbur
@ 2025-01-02  2:06   ` Ron Minnich
  2025-01-02  2:36     ` Stanley Lieber
  0 siblings, 1 reply; 4+ messages in thread
From: Ron Minnich @ 2025-01-02  2:06 UTC (permalink / raw)
  To: 9fans

The cpu command works really well. I've used it for years, and not
having to worry about lots of usb sticks is ... heavenly.

more on the cpu command here:
https://docs.google.com/presentation/d/1hlBi_sGJy-QCHa_2edBt0xu5lhTNmSxIjjKZV18E6Us/edit?usp=sharing

My next thing is to get u-root cpu working on Plan 9. 9front rcpu is
great, but I need to be able to go from darwin to plan9, and plan 9 to
linux, and bsd to Plan 9, and all that stuff.

And u-root cpu supports nfs3, which is pretty much unavoidable
nowadays in embedded or osx. Apple stopped any support for 9p it
seems.

On Wed, Jan 1, 2025 at 5:35 PM Matt Wilbur <wilburm@gmail.com> wrote:
>
>
>
> On Wed, Jan 1, 2025 at 8:04 PM Ron Minnich <rminnich@p9f.org> wrote:
>>
>> u-root is a set of about 180 unix commands (and some plan9-only
>> commands) written in Go.
>
>
> Playing with u-root on some embedded projects at work has been on my to-do list for some time, as well as 'https://github.com/u-root/cpu'...
>
>
> 9fans / 9fans / see discussions + participants + delivery options Permalink

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tb9714d4771613034-M40c80ee2bc2f11cf9eff2cb8
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] GitHub.com/u-root/u-root now works again on plan 9
  2025-01-02  2:06   ` Ron Minnich
@ 2025-01-02  2:36     ` Stanley Lieber
  0 siblings, 0 replies; 4+ messages in thread
From: Stanley Lieber @ 2025-01-02  2:36 UTC (permalink / raw)
  To: 9fans

9front drawterm has a -G flag to run without graphics.

sl


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tb9714d4771613034-M81ff43bd53905f3b5c3cf79a
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-02  3:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-02  1:04 [9fans] GitHub.com/u-root/u-root now works again on plan 9 Ron Minnich
2025-01-02  1:19 ` Matt Wilbur
2025-01-02  2:06   ` Ron Minnich
2025-01-02  2:36     ` Stanley Lieber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).