Skip to content

Commit 8299fa6

Browse files
committed
update readme
1 parent c31f26a commit 8299fa6

File tree

1 file changed

+33
-7
lines changed

1 file changed

+33
-7
lines changed

readme.md

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,39 @@ The `validate` option is set by default and attempts to verify that the generate
6868

6969
It can be forced at runtime with `--validate` and disabled with `--no-validate`.
7070

71+
## Output
72+
73+
Unless the `ugrd.base.cpio` module is included, an initramfs environment will be generated at `build_dir` which defaults to `/tmp/initramfs/`.
74+
75+
### Embedding the initramfs image into the kernel
76+
77+
The `build_dir`can be embedded into the Linux kernel using `CONFIG_INITRAMFS_SOURCE="/tmp/initramfs"`.
78+
79+
A CPIO file can be embedded into the Linux kernel passing the path: `CONFIG_INITRAMFS_SOURCE="/usr/src/initramfs/ugrd.cpio"`
80+
81+
### Making the kernel automatically search for the initamfs image
82+
83+
To make the kernel try to load a specific initrd file at boot, without embedding it:
84+
85+
```
86+
CONFIG_CMDLINE_BOOL=y
87+
CONFIG_CMDLINE="initrd=ugrd.cpio"
88+
```
89+
90+
> This will use `ugrd.cpio` under the ESP.
91+
92+
### efibootmgr configuration
93+
94+
If the kernel is built with the `CONFIG_EFI_STUB` option, the path of the initramfs can be passed to it with the `initrd=` command line option.
95+
96+
This can be set with:
97+
98+
`efibootmgr -c -d /dev/sda -L "Gentoo UGRD" -l 'vmlinuz-gentoo.efi' -u 'initrd=ugrd.cpio'`
99+
100+
> This example assumes that the ESP is the first partition on `/dev/sda`, the kernel is named `vmlinuz-gentoo.efi` under the root of the ESP, and `ugrd.cpio` is also on the ESP root.
101+
102+
> On some systems, the EFI may remove entries that don't follow a particular format.
103+
71104
## Runtime usage
72105

73106
`ugrd` runs the `init` script generated in the build dir. In cases where `agetty` is needed, all but basic initialization and the final switch_root are performed in `init_main.sh`.
@@ -78,13 +111,6 @@ UGRD should prompt for relevant input or warn if devices are missing at runtime.
78111

79112
In the event of a failure, modules will either fail through, or re-exec the init script.
80113

81-
## Output
82-
83-
Unless the `ugrd.base.cpio` module is included, an initramfs environment will be generated at `build_dir` which defaults to `/tmp/initramfs/`.
84-
85-
This directory can be embedded into the Linux kernel using `CONFIG_INITRAMFS_SOURCE="/tmp/initramfs"`.
86-
`CONFIG_INITRAMFS_SOURCE` can also be pointed at a CPIO archive, but is easiest to use with a directory.
87-
88114
If a CPIO file is generated, it can be passed to the bootloader. Embedding the initramfs into the kernel is preferred, as the entire kernel image can be signed.
89115

90116
## Configuration

0 commit comments

Comments
 (0)