source: chapter07/kernfs.xml@ febac51

xry111/clfs-ng
Last change on this file since febac51 was febac51, checked in by Xi Ruoyao <xry111@…>, 2 years ago

cross-ng: chapter 7: adjust introduction for cross build

  • Property mode set to 100644
File size: 3.2 KB
RevLine 
[fcc02767]1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-tools-kernfs">
9 <?dbhtml filename="kernfs.html"?>
10
11 <title>Preparing Virtual Kernel File Systems</title>
12
13 <indexterm zone="ch-tools-kernfs">
14 <primary sortas="e-/dev/">/dev/*</primary>
15 </indexterm>
16
17 <para>Various file systems exported by the kernel are used to communicate to
18 and from the kernel itself. These file systems are virtual in that no disk
19 space is used for them. The content of the file systems resides in
20 memory.</para>
21
22 <para>Begin by creating directories onto which the file systems will be
23 mounted:</para>
24
[febac51]25<screen><userinput>mkdir -pv /{proc,sys,run}</userinput></screen>
[fcc02767]26
[bfab1b2]27 <sect2 id="ch-tools-kernfsmount">
[fcc02767]28 <title>Mounting Virtual Kernel File Systems</title>
29
[febac51]30 <para>The kernel has already mounted
31 <systemitem class="filesystem">devtmpfs</systemitem>.
32 Mount the remaining virtual kernel filesystems:</para>
33
34<screen><userinput>mkdir -pv /dev/{pts,shm}
35mount -vt devpts /dev/pts /dev/pts -o gid=5,mode=620
36mount -vt proc proc /proc
37mount -vt sysfs sysfs /sys
38mount -vt tmpfs tmpfs /run
39mount -vt tmpfs tmpfs /dev/shm</userinput></screen>
[fcc02767]40
41 <variablelist>
42 <title>The meaning of the mount options for devpts:</title>
43
44 <varlistentry>
45 <term><parameter>gid=5</parameter></term>
46 <listitem>
47 <para>This ensures that all devpts-created device nodes are owned by
48 group ID 5. This is the ID we will use later on for the <systemitem
49 class="groupname">tty</systemitem> group. We use the group ID instead
50 of a name, since the host system might use a different ID for its
51 <systemitem class="groupname">tty</systemitem> group.</para>
52 </listitem>
53 </varlistentry>
54
55 <varlistentry>
56 <term><parameter>mode=0620</parameter></term>
57 <listitem>
58 <para>This ensures that all devpts-created device nodes have mode 0620
59 (user readable and writable, group writable). Together with the
60 option above, this ensures that devpts will create device nodes that
61 meet the requirements of grantpt(), meaning the Glibc
62 <command>pt_chown</command> helper binary (which is not installed by
63 default) is not necessary.</para>
64 </listitem>
65 </varlistentry>
66
67 </variablelist>
[febac51]68
69 </sect2>
70
71 <sect2 id="ch-tools-devadjust">
72 <title>Adjusting devtmpfs</title>
73
74 <para>Now <systemitem class='filesystem'>proc</systemitem> filesystem
75 is mounted, we can replace the device nodes for standard I/O streams
76 with symlinks to pseudo files in
77 <filename class="directory">/proc/self/fd</filename> (which are symlinks
78 to the files connected to the standard I/O streams for the current
79 process). This is necessary for I/O redirection in the building system
80 of some packages to function properly:</para>
81
82<screen><userinput>ln -sfv /proc/self/fd/0 /dev/stdin
83ln -sfv /proc/self/fd/1 /dev/stdout
84ln -sfv /proc/self/fd/2 /dev/stderr</userinput></screen>
[fcc02767]85
86 </sect2>
87
88</sect1>
Note: See TracBrowser for help on using the repository browser.