* [gentoo-dev] [PATCH 0/3] eclass changes for supporting dist kernel on loong @ 2023-12-17 12:09 WANG Xuerui 2023-12-17 12:09 ` [gentoo-dev] [PATCH 1/3] dist-kernel-utils.eclass: support loong in dist-kernel_get_image_path WANG Xuerui ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: WANG Xuerui @ 2023-12-17 12:09 UTC (permalink / raw) To: dist-kernel; +Cc: gentoo-dev, WANG Xuerui Hi, In order to make dist-kernel working for loong, I've just done some preliminary work to enable builds with locally-provisioned savedconfig. Properly made and maintained defconfig (ideally, across distros that have a LoongArch port) will come later. For now, with these eclass changes and trivial ebuild additions, in the GitHub PR [1], I've been able to produce working kernels for both Loongson 3A6000 (desktop) and 3C5000L (server). Your review and comments are welcome! [1]: https://github.com/gentoo/gentoo/pull/34291 WANG Xuerui (3): dist-kernel-utils.eclass: support loong in dist-kernel_get_image_path kernel-install.eclass: support loong in kernel-install_get_qemu_arch kernel-build.eclass: fix KERNEL_EFI_ZBOOT not being probed on partially supported arches eclass/dist-kernel-utils.eclass | 7 +++++++ eclass/kernel-build.eclass | 12 ++++++------ eclass/kernel-install.eclass | 3 +++ 3 files changed, 16 insertions(+), 6 deletions(-) -- 2.43.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [gentoo-dev] [PATCH 1/3] dist-kernel-utils.eclass: support loong in dist-kernel_get_image_path 2023-12-17 12:09 [gentoo-dev] [PATCH 0/3] eclass changes for supporting dist kernel on loong WANG Xuerui @ 2023-12-17 12:09 ` WANG Xuerui 2023-12-17 12:09 ` [gentoo-dev] [PATCH 2/3] kernel-install.eclass: support loong in kernel-install_get_qemu_arch WANG Xuerui 2023-12-17 12:09 ` [gentoo-dev] [PATCH 3/3] kernel-build.eclass: fix KERNEL_EFI_ZBOOT not being probed on partially supported arches WANG Xuerui 2 siblings, 0 replies; 7+ messages in thread From: WANG Xuerui @ 2023-12-17 12:09 UTC (permalink / raw) To: dist-kernel; +Cc: gentoo-dev, WANG Xuerui The filenames to use are taken from upstream: https://github.com/torvalds/linux/blob/v6.6/arch/loongarch/boot/Makefile. Signed-off-by: WANG Xuerui <xen0n@gentoo.org> --- eclass/dist-kernel-utils.eclass | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass index 62750d1721a2..67cb802151b2 100644 --- a/eclass/dist-kernel-utils.eclass +++ b/eclass/dist-kernel-utils.eclass @@ -87,6 +87,13 @@ dist-kernel_get_image_path() { echo arch/${ARCH}/boot/Image.gz fi ;; + loong) + if [[ ${KERNEL_EFI_ZBOOT} ]]; then + echo arch/loongarch/boot/vmlinuz.efi + else + echo arch/loongarch/boot/vmlinux.elf + fi + ;; arm) echo arch/arm/boot/zImage ;; -- 2.43.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-dev] [PATCH 2/3] kernel-install.eclass: support loong in kernel-install_get_qemu_arch 2023-12-17 12:09 [gentoo-dev] [PATCH 0/3] eclass changes for supporting dist kernel on loong WANG Xuerui 2023-12-17 12:09 ` [gentoo-dev] [PATCH 1/3] dist-kernel-utils.eclass: support loong in dist-kernel_get_image_path WANG Xuerui @ 2023-12-17 12:09 ` WANG Xuerui 2023-12-17 12:09 ` [gentoo-dev] [PATCH 3/3] kernel-build.eclass: fix KERNEL_EFI_ZBOOT not being probed on partially supported arches WANG Xuerui 2 siblings, 0 replies; 7+ messages in thread From: WANG Xuerui @ 2023-12-17 12:09 UTC (permalink / raw) To: dist-kernel; +Cc: gentoo-dev, WANG Xuerui Right now the loong profiles in Gentoo only cover the 64-bit ISA, so we can unconditionally specify loongarch64 for QEMU. Signed-off-by: WANG Xuerui <xen0n@gentoo.org> --- eclass/kernel-install.eclass | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass index 22d8ce200016..c7118a720ba6 100644 --- a/eclass/kernel-install.eclass +++ b/eclass/kernel-install.eclass @@ -167,6 +167,9 @@ kernel-install_get_qemu_arch() { arm64) echo aarch64 ;; + loong) + echo loongarch64 + ;; *) die "${FUNCNAME}: unsupported ARCH=${ARCH}" ;; -- 2.43.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-dev] [PATCH 3/3] kernel-build.eclass: fix KERNEL_EFI_ZBOOT not being probed on partially supported arches 2023-12-17 12:09 [gentoo-dev] [PATCH 0/3] eclass changes for supporting dist kernel on loong WANG Xuerui 2023-12-17 12:09 ` [gentoo-dev] [PATCH 1/3] dist-kernel-utils.eclass: support loong in dist-kernel_get_image_path WANG Xuerui 2023-12-17 12:09 ` [gentoo-dev] [PATCH 2/3] kernel-install.eclass: support loong in kernel-install_get_qemu_arch WANG Xuerui @ 2023-12-17 12:09 ` WANG Xuerui 2023-12-17 13:11 ` Michał Górny 2 siblings, 1 reply; 7+ messages in thread From: WANG Xuerui @ 2023-12-17 12:09 UTC (permalink / raw) To: dist-kernel; +Cc: gentoo-dev, WANG Xuerui The several partially-supported arches (those relying on USE=savedconfig) directly return in src_prepare(), hence previously the CONFIG_EFI_ZBOOT probing didn't have a chance to run when building for those arches, leading to wrong kernel artifact path and failed src_install(). Move the probing to near the end of eclass src_configure(), so the flag correctly reflects the reality in all circumstances. Signed-off-by: WANG Xuerui <xen0n@gentoo.org> --- eclass/kernel-build.eclass | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass index 6b692dc4f9a0..7a041a8aacdf 100644 --- a/eclass/kernel-build.eclass +++ b/eclass/kernel-build.eclass @@ -203,6 +203,12 @@ kernel-build_src_configure() { .config) fi + # If this is set by USE=secureboot or user config this will have an effect + # on the name of the output image. Set this variable to track this setting. + if grep -q "CONFIG_EFI_ZBOOT=y" .config; then + KERNEL_EFI_ZBOOT=1 + fi + mkdir -p "${WORKDIR}"/modprep || die mv .config "${WORKDIR}"/modprep/ || die emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" olddefconfig @@ -456,12 +462,6 @@ kernel-build_merge_configs() { ./scripts/kconfig/merge_config.sh -m -r \ .config "${merge_configs[@]}" || die - - # If this is set by USE=secureboot or user config this will have an effect - # on the name of the output image. Set this variable to track this setting. - if grep -q "CONFIG_EFI_ZBOOT=y" .config; then - KERNEL_EFI_ZBOOT=1 - fi } fi -- 2.43.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [gentoo-dev] [PATCH 3/3] kernel-build.eclass: fix KERNEL_EFI_ZBOOT not being probed on partially supported arches 2023-12-17 12:09 ` [gentoo-dev] [PATCH 3/3] kernel-build.eclass: fix KERNEL_EFI_ZBOOT not being probed on partially supported arches WANG Xuerui @ 2023-12-17 13:11 ` Michał Górny 2023-12-17 16:02 ` WANG Xuerui 0 siblings, 1 reply; 7+ messages in thread From: Michał Górny @ 2023-12-17 13:11 UTC (permalink / raw) To: gentoo-dev, dist-kernel; +Cc: WANG Xuerui [-- Attachment #1: Type: text/plain, Size: 1882 bytes --] On Sun, 2023-12-17 at 20:09 +0800, WANG Xuerui wrote: > The several partially-supported arches (those relying on > USE=savedconfig) directly return in src_prepare(), hence previously the > CONFIG_EFI_ZBOOT probing didn't have a chance to run when building for > those arches, leading to wrong kernel artifact path and failed > src_install(). > > Move the probing to near the end of eclass src_configure(), so the flag > correctly reflects the reality in all circumstances. > > Signed-off-by: WANG Xuerui <xen0n@gentoo.org> > --- > eclass/kernel-build.eclass | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass > index 6b692dc4f9a0..7a041a8aacdf 100644 > --- a/eclass/kernel-build.eclass > +++ b/eclass/kernel-build.eclass > @@ -203,6 +203,12 @@ kernel-build_src_configure() { > .config) > fi > > + # If this is set by USE=secureboot or user config this will have an effect > + # on the name of the output image. Set this variable to track this setting. > + if grep -q "CONFIG_EFI_ZBOOT=y" .config; then > + KERNEL_EFI_ZBOOT=1 > + fi > + > mkdir -p "${WORKDIR}"/modprep || die > mv .config "${WORKDIR}"/modprep/ || die > emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" olddefconfig > @@ -456,12 +462,6 @@ kernel-build_merge_configs() { > > ./scripts/kconfig/merge_config.sh -m -r \ > .config "${merge_configs[@]}" || die > - > - # If this is set by USE=secureboot or user config this will have an effect > - # on the name of the output image. Set this variable to track this setting. > - if grep -q "CONFIG_EFI_ZBOOT=y" .config; then > - KERNEL_EFI_ZBOOT=1 > - fi > } > > fi This doesn't seem correct. It won't work if KERNEL_EFI_ZBOOT is set by one of the merged configs. -- Best regards, Michał Górny [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 512 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-dev] [PATCH 3/3] kernel-build.eclass: fix KERNEL_EFI_ZBOOT not being probed on partially supported arches 2023-12-17 13:11 ` Michał Górny @ 2023-12-17 16:02 ` WANG Xuerui 2023-12-17 16:08 ` Michał Górny 0 siblings, 1 reply; 7+ messages in thread From: WANG Xuerui @ 2023-12-17 16:02 UTC (permalink / raw) To: Michał Górny, gentoo-dev, dist-kernel [-- Attachment #1.1.1: Type: text/plain, Size: 2367 bytes --] On 12/17/23 21:11, Michał Górny wrote: > On Sun, 2023-12-17 at 20:09 +0800, WANG Xuerui wrote: >> The several partially-supported arches (those relying on >> USE=savedconfig) directly return in src_prepare(), hence previously the >> CONFIG_EFI_ZBOOT probing didn't have a chance to run when building for >> those arches, leading to wrong kernel artifact path and failed >> src_install(). >> >> Move the probing to near the end of eclass src_configure(), so the flag >> correctly reflects the reality in all circumstances. >> >> Signed-off-by: WANG Xuerui <xen0n@gentoo.org> >> --- >> eclass/kernel-build.eclass | 12 ++++++------ >> 1 file changed, 6 insertions(+), 6 deletions(-) >> >> diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass >> index 6b692dc4f9a0..7a041a8aacdf 100644 >> --- a/eclass/kernel-build.eclass >> +++ b/eclass/kernel-build.eclass >> @@ -203,6 +203,12 @@ kernel-build_src_configure() { >> .config) >> fi >> >> + # If this is set by USE=secureboot or user config this will have an effect >> + # on the name of the output image. Set this variable to track this setting. >> + if grep -q "CONFIG_EFI_ZBOOT=y" .config; then >> + KERNEL_EFI_ZBOOT=1 >> + fi >> + >> mkdir -p "${WORKDIR}"/modprep || die >> mv .config "${WORKDIR}"/modprep/ || die >> emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" olddefconfig >> @@ -456,12 +462,6 @@ kernel-build_merge_configs() { >> >> ./scripts/kconfig/merge_config.sh -m -r \ >> .config "${merge_configs[@]}" || die >> - >> - # If this is set by USE=secureboot or user config this will have an effect >> - # on the name of the output image. Set this variable to track this setting. >> - if grep -q "CONFIG_EFI_ZBOOT=y" .config; then >> - KERNEL_EFI_ZBOOT=1 >> - fi >> } >> >> fi > This doesn't seem correct. It won't work if KERNEL_EFI_ZBOOT is set by > one of the merged configs. But isn't the src_configure phase building upon the config already merged in src_prepare? The alternative would be keeping the kernel-build_merge_configs logic intact, but then it has to be duplicated for every early return branch in each ebuild's src_prepare, which I think is too excessive... -- WANG Xuerui xen0n@gentoo.org Gentoo Linux developer PGP: 7C52 19E3 26A0 7311 3EA3 8806 C01F 7214 BC93 1414 [-- Attachment #1.1.2: OpenPGP public key --] [-- Type: application/pgp-keys, Size: 23337 bytes --] [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 495 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-dev] [PATCH 3/3] kernel-build.eclass: fix KERNEL_EFI_ZBOOT not being probed on partially supported arches 2023-12-17 16:02 ` WANG Xuerui @ 2023-12-17 16:08 ` Michał Górny 0 siblings, 0 replies; 7+ messages in thread From: Michał Górny @ 2023-12-17 16:08 UTC (permalink / raw) To: gentoo-dev, dist-kernel [-- Attachment #1: Type: text/plain, Size: 2581 bytes --] On Mon, 2023-12-18 at 00:02 +0800, WANG Xuerui wrote: > On 12/17/23 21:11, Michał Górny wrote: > > On Sun, 2023-12-17 at 20:09 +0800, WANG Xuerui wrote: > > > The several partially-supported arches (those relying on > > > USE=savedconfig) directly return in src_prepare(), hence previously the > > > CONFIG_EFI_ZBOOT probing didn't have a chance to run when building for > > > those arches, leading to wrong kernel artifact path and failed > > > src_install(). > > > > > > Move the probing to near the end of eclass src_configure(), so the flag > > > correctly reflects the reality in all circumstances. > > > > > > Signed-off-by: WANG Xuerui <xen0n@gentoo.org> > > > --- > > > eclass/kernel-build.eclass | 12 ++++++------ > > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > > > diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass > > > index 6b692dc4f9a0..7a041a8aacdf 100644 > > > --- a/eclass/kernel-build.eclass > > > +++ b/eclass/kernel-build.eclass > > > @@ -203,6 +203,12 @@ kernel-build_src_configure() { > > > .config) > > > fi > > > > > > + # If this is set by USE=secureboot or user config this will have an effect > > > + # on the name of the output image. Set this variable to track this setting. > > > + if grep -q "CONFIG_EFI_ZBOOT=y" .config; then > > > + KERNEL_EFI_ZBOOT=1 > > > + fi > > > + > > > mkdir -p "${WORKDIR}"/modprep || die > > > mv .config "${WORKDIR}"/modprep/ || die > > > emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" olddefconfig > > > @@ -456,12 +462,6 @@ kernel-build_merge_configs() { > > > > > > ./scripts/kconfig/merge_config.sh -m -r \ > > > .config "${merge_configs[@]}" || die > > > - > > > - # If this is set by USE=secureboot or user config this will have an effect > > > - # on the name of the output image. Set this variable to track this setting. > > > - if grep -q "CONFIG_EFI_ZBOOT=y" .config; then > > > - KERNEL_EFI_ZBOOT=1 > > > - fi > > > } > > > > > > fi > > This doesn't seem correct. It won't work if KERNEL_EFI_ZBOOT is set by > > one of the merged configs. > But isn't the src_configure phase building upon the config already > merged in src_prepare? The alternative would be keeping the > kernel-build_merge_configs logic intact, but then it has to be > duplicated for every early return branch in each ebuild's src_prepare, > which I think is too excessive... > Ah, sorry, you're right. I didn't notice these were two different functions! -- Best regards, Michał Górny [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 512 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-12-17 16:08 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-12-17 12:09 [gentoo-dev] [PATCH 0/3] eclass changes for supporting dist kernel on loong WANG Xuerui 2023-12-17 12:09 ` [gentoo-dev] [PATCH 1/3] dist-kernel-utils.eclass: support loong in dist-kernel_get_image_path WANG Xuerui 2023-12-17 12:09 ` [gentoo-dev] [PATCH 2/3] kernel-install.eclass: support loong in kernel-install_get_qemu_arch WANG Xuerui 2023-12-17 12:09 ` [gentoo-dev] [PATCH 3/3] kernel-build.eclass: fix KERNEL_EFI_ZBOOT not being probed on partially supported arches WANG Xuerui 2023-12-17 13:11 ` Michał Górny 2023-12-17 16:02 ` WANG Xuerui 2023-12-17 16:08 ` Michał Górny
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox