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