Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Koch <[email protected]>
  • Loading branch information
hugelgupf committed Feb 20, 2024
1 parent 8c0c6c2 commit 78b09e7
Showing 1 changed file with 37 additions and 25 deletions.
62 changes: 37 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Build gobusybox binaries of these two commands and add to initramfs:
mkuimage ./u-root/cmds/core/{init,gosh}
```
<details>
<summary>Result</summary>
<summary>Result</summary>

<pre>
$ cpio -ivt < /tmp/initramfs.linux_amd64.cpio
Expand All @@ -57,59 +57,71 @@ lrwxrwxrwx 0 root root 2 Jan 1 1970 bbin/init -> bb
</pre>
</details>

Add symlinks for shell and init:

```shell
mkuimage -initcmd=init -defaultsh=gosh ./u-root/cmds/core/{init,gosh}
```
# Add symlinks for shell and init.
$ mkuimage -initcmd=init -defaultsh=gosh ./u-root/cmds/core/{init,gosh}
<details>
<summary>Result</summary>

<pre>
$ cpio -ivt < /tmp/initramfs.linux_amd64.cpio
...
lrwxrwxrwx 0 root root 12 Jan 1 1970 bin/defaultsh -> ../bbin/gosh
lrwxrwxrwx 0 root root 12 Jan 1 1970 bin/sh -> ../bbin/gosh
...
lrwxrwxrwx 0 root root 9 Jan 1 1970 init -> bbin/init
...
</pre>
</details>

Build everything from core without ls and losetup:

```shell
mkuimage ./u-root/cmds/core/* -./u-root/cmds/core/{ls,losetup}
```

# Build everything from core without ls and losetup.
$ mkuimage ./u-root/cmds/core/* -./u-root/cmds/core/{ls,losetup}
Build an initramfs with init, gosh and cpud in a gobusybox binary.

# Build an initramfs with init, gosh and cpud in a gobusybox binary.
#
# Note that these are 2 different modules, and cpud has a dependency on u-root.
# Since no go.mod is found in the current directory, one will be synthesized as
# the warning advertises.
$ mkuimage ./u-root/cmds/core/{init,gosh} ./cpu/cmds/cpud
Note that these are 2 different modules, and cpud has a dependency on u-root.
Since no go.mod is found in the current directory, one will be synthesized as
the warning advertises.

```
mkuimage ./u-root/cmds/core/{init,gosh} ./cpu/cmds/cpud
...
01:24:15 INFO GBB_STRICT is not set.
01:24:15 INFO [WARNING] github.com/u-root/cpu/cmds/cpud depends on github.com/u-root/u-root @ version v0.11.1-0.20230913033713-004977728a9d
01:24:15 INFO Using github.com/u-root/u-root @ directory /usr/local/google/home/chrisko/u-root to build it.
...
```

<details>
<summary>Result</summary>
<pre>
$ cpio -ivt < /tmp/initramfs.linux_amd64.cpio
...
-rwxr-x--- 0 root root 6365184 Jan 1 1970 bbin/bb
lrwxrwxrwx 0 root root 2 Jan 1 1970 bbin/cpud -> bb
lrwxrwxrwx 0 root root 2 Jan 1 1970 bbin/gosh -> bb
lrwxrwxrwx 0 root root 2 Jan 1 1970 bbin/init -> bb
...
# GBB_PATH instructs mkuimage where to resolve commands, separated by colon.
$ GBB_PATH=$(pwd)/u-root:$(pwd)/cpu mkuimage cmds/core/{init,gosh} cmds/cpud
# Equivalent to mkuimage ./u-root/cmds/core/{init,gosh} ./cpu/cmds/cpud
```
</pre>
</details>

`GBB_PATH` is a place that mkuimage will look for commands. Each colon-separated
`GBB_PATH` element is concatenated with patterns from the command-line and
checked for existence. For example:

```shell
GBB_PATH=$HOME/u-root:$HOME/u-bmc mkuimage \
cmds/core/init \
cmds/core/gosh \
cmd/socreset

# matches:
# $HOME/u-root/cmds/core/init
# $HOME/u-root/cmds/core/gosh
# $HOME/u-bmc/cmd/socreset
GBB_PATH=$(pwd)/u-root:$(pwd)/cpu mkuimage \
cmds/core/{init,gosh} \
cmds/cpud

# Matches
# ./u-root/cmds/core/{init,gosh}
# ./cpu/cmds/cpud
```

## Extra Files
Expand Down

0 comments on commit 78b09e7

Please sign in to comment.