]> git.ipfire.org Git - thirdparty/dracut.git/blame - README.cross
Revert "wait for IPv6 RA if using none/static IPv6 assignment"
[thirdparty/dracut.git] / README.cross
CommitLineData
4efcd19a
BZ
1Dracut supports running against a sysroot directory that is different
2from the actual root (/) directory of the running system. It is most
3useful for creating/bootstrapping a new system that may or may not be
4using the same CPU architecture as the host system, i.e. building a
5whole Linux system with a cross-compiler framework like Yocto.
6
7The user-visible frontend change is the introduction of a new option
8called "-r" or "--sysroot". It expects a directory that contains the
9complete Linux system that has all the files (kernel drivers, firmware,
10executables, libraries and others) necessary to construct the initramfs.
11
12E.g: dracut --sysroot /path/to/sysroot initramfs.img kernelversion
13
14To support this, a new global variable was introduced inside dracut.
15This variable is called "dracutsysrootdir" and all the files installed
16into the initramfs image is searched relative to the sysroot directory.
17This variable can also be set externally to dracut without using option
18-r/--sysroot.
19
20There are other details that are necessary to tweak to be able to
21run on cross-compiled (a.k.a. foreign) binaries.
22
23dracut uses these crucial utilities during its operation:
24
25ldd
26===
27It lists dynamic library dependencies for executables or libraries
28
29ldconfig
30========
31It creates /etc/ld.so.cache, i.e. the cached information about libraries
32known to the system.
33
34These utilities the way they exist on the host system only work on
35the host system.
36
37To support cross-compiled binaries, a different ldd variant is needed that
38works on those binaries. One such ldd script is found at
39https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f
40
41ldconfig in GLIBC as is does support a sysroot with its -r option.
42
43Extra environment variables needed to run dracut on the sysroot are
44documented in the dracut(8) man page.
45
46For the Plymouth boot splash to be added to the initramfs image,
47this gitlab PR is needed for Plymouth:
48https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/72
49
50Extensions to be used with Yocto
51================================
52
53examples/yocto/classes/dracut.bbclass:
54 Bitbake class for running dracut during the "do_rootfs" stage of
55 creating a distribution image and from the postinstall script of
56 a package. A kernel recipe needs this line to activate it:
57
58 inherit dracut
59
60examples/yocto/postinst-intercepts/execute_dracut
61 The "intercept" script used during "do_rootfs" mentioned above.
62
63examples/yocto/recipes/cross-compiler-ldd_git.bb
64 Package recipe for the cross-compiler-ldd script from the above link.
65
66All the above three need to be added to a Yocto layer to their
67proper locations.
68
69They were tested on Yocto 2.7 with MACHINE="intel-core2-32" and
70MACHINE="genericx86-64".