From 78b09e78c9a181610dc7a768e358844ddd2cf4dc Mon Sep 17 00:00:00 2001 From: Chris Koch Date: Tue, 20 Feb 2024 01:57:37 +0000 Subject: [PATCH] stuff Signed-off-by: Chris Koch --- README.md | 62 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 4238c95..44e62a0 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Build gobusybox binaries of these two commands and add to initramfs: mkuimage ./u-root/cmds/core/{init,gosh} ```
- Result +Result
 $ cpio -ivt < /tmp/initramfs.linux_amd64.cpio
@@ -57,9 +57,15 @@ lrwxrwxrwx   0 root     root            2 Jan  1  1970 bbin/init -> bb
 
+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} +
+Result + +
 $ cpio -ivt < /tmp/initramfs.linux_amd64.cpio
 ...
 lrwxrwxrwx   0 root     root           12 Jan  1  1970 bin/defaultsh -> ../bbin/gosh
@@ -67,22 +73,33 @@ lrwxrwxrwx   0 root     root           12 Jan  1  1970 bin/sh -> ../bbin/gosh
 ...
 lrwxrwxrwx   0 root     root            9 Jan  1  1970 init -> bbin/init
 ...
+
+
+ +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. ... +``` +
+Result +
 $ cpio -ivt < /tmp/initramfs.linux_amd64.cpio
 ...
 -rwxr-x---   0 root     root      6365184 Jan  1  1970 bbin/bb
@@ -90,26 +107,21 @@ 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
-```
+
+
`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