From f54ecb32819ae8a0e8a3bd4330a21e49c70efaf4 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sun, 8 Sep 2024 14:04:04 +0800 Subject: [PATCH 1/2] kernel-config: Add support to set arch To be used for multilib. --- chapter10/kernel/kernel-config.py | 15 ++++++++++----- chapter10/kernel/kernel.version | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/chapter10/kernel/kernel-config.py b/chapter10/kernel/kernel-config.py index 814484b84..6ba7fb573 100755 --- a/chapter10/kernel/kernel-config.py +++ b/chapter10/kernel/kernel-config.py @@ -26,6 +26,8 @@ if_stack = [] expand_var_mp = { 'SRCARCH': 'x86' } main_dep = {} +attr_key = ['revision', 'arch'] + def expand_var(s): for k in expand_var_mp: s = s.replace('$(' + k + ')', expand_var_mp[k]) @@ -242,7 +244,7 @@ for _, val, _, _, _, _, menu, _ in r: max_line = 80 buf = [] -done = [x[5] for x in r] + ['revision'] +done = [x[5] for x in r] + attr_key for i in known_config: if i not in done: raise Exception("%s seems not exist" % i) @@ -298,8 +300,11 @@ t = Template(''' "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> -{{ '\n'.join(buf) }}''') +{{ '\n'.join(buf) }}''') -rev = known_config.get('revision') -rev = ' revision="%s"' % rev if rev else '' -print(t.render(rev = rev, buf = buf)) +attr = '' +for k in attr_key: + v = known_config.get(k) + if v: + attr += ' %s="%s"' % (k, v) +print(t.render(attr = attr, buf = buf)) diff --git a/chapter10/kernel/kernel.version b/chapter10/kernel/kernel.version index 22cb9e553..8421878a1 100644 --- a/chapter10/kernel/kernel.version +++ b/chapter10/kernel/kernel.version @@ -1 +1 @@ -6.10.2 +6.10.7 From 0b4c2e218b53dfdc3b9bceb0d051853e1761d788 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sun, 8 Sep 2024 14:21:09 +0800 Subject: [PATCH 2/2] multilib: Update host kernel requirement for multilib Switch to the new kernel config rendering infrastructure. Remove the "IA32 a.out support" which is already removed and was completely useless for multilib even before the removal. Mention the new "IA32 emulation disabled by default" option. Separate mx32 and m32 kernel configuration. Fix the consequences building a multilib when lacking the corresponding kernel feature. --- chapter02/hostreqs.xml | 40 +++++++++++++++++++----------- chapter10/kernel/multilib-32.toml | 3 +++ chapter10/kernel/multilib-32.xml | 8 ++++++ chapter10/kernel/multilib-x32.toml | 2 ++ chapter10/kernel/multilib-x32.xml | 7 ++++++ 5 files changed, 45 insertions(+), 15 deletions(-) create mode 100644 chapter10/kernel/multilib-32.toml create mode 100644 chapter10/kernel/multilib-32.xml create mode 100644 chapter10/kernel/multilib-x32.toml create mode 100644 chapter10/kernel/multilib-x32.xml diff --git a/chapter02/hostreqs.xml b/chapter02/hostreqs.xml index 1225352a5..0d765085b 100644 --- a/chapter02/hostreqs.xml +++ b/chapter02/hostreqs.xml @@ -276,24 +276,34 @@ EOF bash version-check.sh - - Building multilib support requires the kernel of the host system - to have 32-bit emulation support included. + + Building the m32 multilib support requires the kernel of the host + system to have the 32-bit emulation support included: -Binary Emulations ---> - [*] IA32 Emulation - <M> IA32 a.out support - [*] x32 ABI for 64-bit mode - - The option 'IA32 a.out support' is - optional. In case your kernel does not have 'x32 ABI for 64-bit mode' - enabled but only 'IA32 Emulation', you can continue to build your + + + + Building the mx32 multilib support requires the kernel of the host + system to have the x32 ABI support included: + + + + + + In case your kernel does not have the x32 ABI support enabled but + only the 32-bit emulation support, you can continue to build your system but you have to leave out any sections showing instructions - for building x32 objects. If neither 'IA32 Emulation' nor - 'x32 ABI for 64-bit mode' is enabled, you will run in errors - latest when building glibc in Chapter 6, - so an upgrade of your host system kernel is required. + for building x32 objects, vice versa. + + + + If the kernel feature required by a multilib is not enabled, + building the multilib for a package in Chapter 8 may either fail + immediately, or cause hidden breakages because autoconf cannot + probe the system features properly. diff --git a/chapter10/kernel/multilib-32.toml b/chapter10/kernel/multilib-32.toml new file mode 100644 index 000000000..ba6ec9cd7 --- /dev/null +++ b/chapter10/kernel/multilib-32.toml @@ -0,0 +1,3 @@ +IA32_EMULATION='*' +IA32_EMULATION_DEFAULT_DISABLED=' ' +arch='ml_32,ml_all' diff --git a/chapter10/kernel/multilib-32.xml b/chapter10/kernel/multilib-32.xml new file mode 100644 index 000000000..e884833db --- /dev/null +++ b/chapter10/kernel/multilib-32.xml @@ -0,0 +1,8 @@ + + + +Binary Emulations ---> + [*] IA32 Emulation [IA32_EMULATION] + [ ] IA32 emulation disabled by default [IA32_EMULATION_DEFAULT_DISABLED] diff --git a/chapter10/kernel/multilib-x32.toml b/chapter10/kernel/multilib-x32.toml new file mode 100644 index 000000000..08f8b6640 --- /dev/null +++ b/chapter10/kernel/multilib-x32.toml @@ -0,0 +1,2 @@ +X86_X32_ABI='*' +arch='ml_x32,ml_all' diff --git a/chapter10/kernel/multilib-x32.xml b/chapter10/kernel/multilib-x32.xml new file mode 100644 index 000000000..9b082af6a --- /dev/null +++ b/chapter10/kernel/multilib-x32.xml @@ -0,0 +1,7 @@ + + + +Binary Emulations ---> + [*] x32 ABI for 64-bit mode [X86_X32_ABI]