From f58cbc10f5ed1df28cb5440948bf765e87d05079 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Wed, 25 Aug 2021 01:04:37 +0800 Subject: [PATCH] cross-ng: chapter 6: build temporary Linux kernel --- chapter06/chapter06.xml | 1 + chapter06/kernel.xml | 161 ++++++++++++++++++++++++++++++++++++++++ packages.ent | 2 + 3 files changed, 164 insertions(+) create mode 100644 chapter06/kernel.xml diff --git a/chapter06/chapter06.xml b/chapter06/chapter06.xml index c020eb799..e470214f0 100644 --- a/chapter06/chapter06.xml +++ b/chapter06/chapter06.xml @@ -33,5 +33,6 @@ + diff --git a/chapter06/kernel.xml b/chapter06/kernel.xml new file mode 100644 index 000000000..8c7950422 --- /dev/null +++ b/chapter06/kernel.xml @@ -0,0 +1,161 @@ + + + %general-entities; +]> + + + + + + kernel + &linux-version; +
&linux-url;
+
+ + Linux-&linux-version; + + + Linux + tools + + + + + + <para>The Linux package contains the Linux kernel.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&linux-tmp-sbu;</seg> + <seg>&linux-tmp-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of the kernel + + Building the kernel involves a few steps—configuration, + compilation, and installation. Read the README file + in the kernel source tree for alternative methods to the way this book + configures the kernel. + + Prepare for compilation by running the following command: + +make mrproper + + This ensures that the kernel tree is absolutely clean. The + kernel team recommends that this command be issued prior to each + kernel compilation. Do not rely on the source tree being clean after + un-tarring. + + There are several ways to configure the kernel options. Usually, + This is done through a menu-driven interface, for example: + +make ARCH=x86 CROSS_COMPILE=$LFS_TGT- menuconfig + + + The meaning of make environment variables: + + + ARCH=x86 + + Configure the kernel for running on the target machine. + + + + + CROSS_COMPILE=$LFS_TGT- + + Build the kernel with Binutils and GCC built in + . + + + + + menuconfig + + This launches an ncurses menu-driven interface. For other + (graphical) interfaces, type make help. + + + + + (optional) LANG=<host_LANG_value> LC_ALL= + + This establishes the locale setting to the one used on the + host. This may be needed for a proper menuconfig ncurses interface + line drawing on a UTF-8 linux text console. + + If used, be sure to replace + <host_LANG_value> by the value of + the $LANG variable from your host. You can + alternatively use instead the host's value of $LC_ALL + or $LC_CTYPE. + + + + + + + + A good starting place for setting up the kernel configuration is to + run make ARCH=x86 CROSS_COMPILE=$LFS_TGT- defconfig. This will set the base + configuration to a good state that takes your target system architecture + into account. + + + + Read for more information + about kernel configuration. You should enable or disable some kernel + configuration options now: + + + Kernel configuration options and explanation: + + + Set CONFIG_MODULES=n + + Modular kernel needs modprobe tool from + Kmod to load modules, which is not + installed in the temporary system. + + + + + Enable CONFIG_EXT2, + CONFIG_EXT4, + and CONFIG_VFAT_FS + + They are needed to access the filesystems we'll make for the + target system. + + + + + Compile the kernel image: + +make ARCH=x86 CROSS_COMPILE=$LFS_TGT- + + Install the kernel image into the + $LFS/boot directory: + + install -vm644 arch/x86/boot/bzImage $LFS/boot/vmlinuz + + + + + + + <para>Details on this package are located in + <xref linkend="contents-kernel" role="."/></para> + + </sect2> + +</sect1> diff --git a/packages.ent b/packages.ent index fb2ab4413..bb91fba7c 100644 --- a/packages.ent +++ b/packages.ent @@ -441,6 +441,8 @@ max is allmodconfig --> <!ENTITY linux-knl-du "1200 - 8800 MB (typically about 1700 MB)"> <!ENTITY linux-knl-sbu "1.5 - 130.0 SBU (typically about 12 SBU)"> +<!ENTITY linux-tmp-du "1200 MB"> +<!ENTITY linux-tmp-sbu "1.5 SBU"> <!ENTITY linux-headers-tmp-du "1.2 GB"> <!ENTITY linux-headers-tmp-sbu "0.1 SBU">