Thread View: linux.gentoo.user
4 messages
4 total messages
Started by Pocket
Fri, 06 Nov 2026 15:20
[gentoo-user] Building a custom kernel
Author: Pocket
Date: Fri, 06 Nov 2026 15:20
Date: Fri, 06 Nov 2026 15:20
26 lines
1831 bytes
1831 bytes
I have my gentoo project going very well and I would like to rebuild the rpi kernel to have btrfs built into the kernel instead of a module. I want to use btrfs as the filesystem for the root partition as I do on my archlinux systems. I have looked at the ebuilds for kernels and I can not figure them out. I have looking into portage as a later project after I finish this desktop project. I have three options at this point. 1. Use my custom kernel build from archlinuxarm using my PKGBUILD and remove the ebuild and extract the package archive to system. 2. Modify a kernel ebuild. 3. Create a initramfs Any one have any hints or direction on how to accomplish this? -- Hindi madali ang maging ako
Re: [gentoo-user] Building a custom kernel
Author: Michael
Date: Fri, 06 Nov 2026 15:50
Date: Fri, 06 Nov 2026 15:50
89 lines
6696 bytes
6696 bytes
--nextPart0oPHS4D1SCWfADzpyuOV1Q Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8"; protected-headers="v1" From: Michael <confabulate@kintzios.com> To: gentoo-user@lists.gentoo.org Reply-To: confabulate@kintzios.com Subject: Re: [gentoo-user] Building a custom kernel Date: Fri, 06 Nov 2026 15:40:15 +0000 Message-ID: <hokyXLvHR06uCKzIA5XC-g@kintzios.com> In-Reply-To: <96dbc5af-dc8c-450e-9b4e-1e6a40be4cdd@oldfart.online> References: <96dbc5af-dc8c-450e-9b4e-1e6a40be4cdd@oldfart.online> MIME-Version: 1.0 On Friday, 6 November 2026 15:10:33 Greenwich Mean Time Pocket wrote: > I have my gentoo project going very well and I would like to rebuild > the rpi kernel to have btrfs built into the kernel instead of a > module. > > I want to use btrfs as the filesystem for the root partition as I do > on my archlinux systems. > > I have looked at the ebuilds for kernels and I can not figure them > out. I have looking into portage as a later project after I finish > this desktop project. > > I have three options at this point. > > 1. Use my custom kernel build from archlinuxarm using my PKGBUILD and > remove the ebuild and extract the package archive to system. > > 2. Modify a kernel ebuild. > > 3. Create a initramfs > > > Any one have any hints or direction on how to accomplish this? In the first instance you can read these pages a couple of times to get a grounding on what options Gentoo offers, both in its distribution kernels and DIY from source: https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel https://wiki.gentoo.org/wiki/Kernel If you know your archlinuxarm is exactly, or mostly, what you want from a kernel configuration, you can use the archlinuxarm configuration to get you ready to compile your own kernel from source. The general idea is to follow the basic steps below: 1. First emerge sys-kernel/gentoo-sources. 2. Check what modules are loaded when you boot with your archlinuxarm kernel. You may wish to build some of these in-kernel, as opposed to have them as loadable modules and exclude any modules which do not need if you want to keep the kernel image small(er) in size. 3. Copy the archlinuxarm running .config into the gentoo-sources installed in /usr/src/linux/. 4. Run 'make oldconfig', followed by 'make menuconfig' to adjust the configuration as you want. 5. Compile and install as described at the bottom of the Handbook page above. The above should get you mostly there. You can use dracut or a UKI if you need an initramfs. HTH. --nextPart0oPHS4D1SCWfADzpyuOV1Q Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQJPBAABCAA5FiEEXqhvaVh2ERicA8Ceseqq9sKVZxkFAmrt9N8bFIAAAAAABAAO bWFudTIsMi41KzEuMTIsMiwyAAoJELHqqvbClWcZuwsQANZ4/j3J62Km7QG2SnTT UDbQENWZwzBtPSXSemx/LvCKlNC+syYdWa6ek7P+8ZGbGG3Wi+c5q1Gqxaow37Ni e/95P0SpnljJn/MPtXCX006qk6hbburpmH2GTYqxo2bvqCGuA1vASVUgRGMLg8Yc Jmr9IgE/6i2mjvGjV4b1CKpcO46TmfYg0sVfzFUrejTCE7tyKro5p8kokuLAPH0U 0cfoRmK/LByDYTyN8ABTXM2tHa/Drb7LfvalackyPvu1UcbRixDmufSQWNbkMjiW iodb+17mbqyS9n0zeEZ3o5NCvn2rov0FASGu6j1Oje7l5MvWuZg3tKVuEO+Nh3Wc SVylm+efFvuawmLlcpUBKBr0keW622nDjG/0U6dS0abk09VABRkWDgZPFAUFPCnu Qm4yEuSQtcOz5iFSq/d6c2CZuOEhdLQTtUFfU0g82YRkjfIcZw/MhtUwHxg96Kv/ eZCiPVXgCXNtBuNj1iw6xZVLO87fndFJKPy7DpBybw8aOpziGj0LthBlOYzXB+Fx rIX6uDYpQzF7SXXFRvuBxCgNfNeCE/w9qooKXBkzLanb5qBI+XFfWoQ3hqyoZxFv mOUJWlQC/vOLBi8v/1au6bD/o20blx9SQ1y/wIxU8X1OdqDKydAiioVzboLtmxD9 oFzZhBUIh2Oh6fJslusv+tcM =Sd6w -----END PGP SIGNATURE----- --nextPart0oPHS4D1SCWfADzpyuOV1Q--
Re: [gentoo-user] Building a custom kernel
Author: Pocket
Date: Fri, 06 Nov 2026 18:20
Date: Fri, 06 Nov 2026 18:20
128 lines
5571 bytes
5571 bytes
On 11/6/26 10:40, Michael wrote:
> On Friday, 6 November 2026 15:10:33 Greenwich Mean Time Pocket wrote:
>> I have my gentoo project going very well and I would like to rebuild
>> the rpi kernel to have btrfs built into the kernel instead of a
>> module.
>>
>> I want to use btrfs as the filesystem for the root partition as I do
>> on my archlinux systems.
>>
>> I have looked at the ebuilds for kernels and I can not figure them
>> out. I have looking into portage as a later project after I finish
>> this desktop project.
>>
>> I have three options at this point.
>>
>> 1. Use my custom kernel build from archlinuxarm using my PKGBUILD and
>> remove the ebuild and extract the package archive to system.
>>
>> 2. Modify a kernel ebuild.
>>
>> 3. Create a initramfs
>>
>>
>> Any one have any hints or direction on how to accomplish this?
>
> In the first instance you can read these pages a couple of times to get
> a grounding on what options Gentoo offers, both in its distribution
> kernels and DIY from source:
>
> https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel
> https://wiki.gentoo.org/wiki/Kernel
>
> If you know your archlinuxarm is exactly, or mostly, what you want from
> a kernel configuration, you can use the archlinuxarm configuration to
> get you ready to compile your own kernel from source. The general idea
> is to follow the basic steps below:
>
> 1. First emerge sys-kernel/gentoo-sources.
> 2. Check what modules are loaded when you boot with your archlinuxarm
> kernel. You may wish to build some of these in-kernel, as opposed to
> have them as loadable modules and exclude any modules which do not need
> if you want to keep the kernel image small(er) in size.
> 3. Copy the archlinuxarm running .config into the gentoo-sources
> installed in /usr/src/linux/.
> 4. Run 'make oldconfig', followed by 'make menuconfig' to adjust the
> configuration as you want.
> 5. Compile and install as described at the bottom of the Handbook page
> above.
>
> The above should get you mostly there. You can use dracut or a UKI if
> you need an initramfs.
>
> HTH.
I have a archlinux PKGBUILD that I wrote to build a custom kernel.
The upstream source is from raspberrypi kernel sources and I modiify
.config to add btrfs as built in not a module.
I thought I could convert the PKGBUILD to ebuild then add it to a custom
repository, then emerge that.
Looking at the gentoo kernel ebuilds didn't give me a way forward.
I am still looking at that. My PKGBUILD file is nothing like the gentoo
ebuild.
Goes something like this......
https://github.com/raspberrypi/linux/archive/refs/tags/stable_20260911.tar.gz
prepare() {
cd "$srcdir"/"$_pkgname"_"$_pkgver"
make mrproper
make bcm2711_defconfig
sed -e '/^CONFIG_BTRFS_FS/s|m|y|' -i .config
make oldconfig
}
build() {
cd "$srcdir"/"$_pkgname"_"$_pkgver"
make Image.gz modules dtbs
}
then package that into a tar archive'
package() {
# variables
make -s kernelrelease > version
version="$(< version)"
# Install kernel modules
mkdir -vp "$pkgdir/usr"
make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
DEPMOD=/doesnt/exist modules_install # Suppress depmod
# Install kernel and firmware
mkdir -vp "${pkgdir}"/boot/overlays
cp -v arch/arm64/boot/Image.gz "${pkgdir}"/boot/$KERNEL.img
cp -v arch/arm64/boot/dts/broadcom/*.dtb "${pkgdir}"/boot/
cp -v arch/arm64/boot/dts/overlays/*.dtb* "${pkgdir}"/boot/overlays
cp -v arch/arm64/boot/dts/overlays/README "${pkgdir}"/boot/overlays
# Versioning, system map and configuration
cp -v version "${pkgdir}"/boot/
cp -v System.map "${pkgdir}"/boot/System.map-"$version"
cp -v .config "${pkgdir}"/boot/config-"$version"
# Boot and Configuration
cp -v "$srcdir"/cmdline.txt "${pkgdir}"/boot/
cp -v "$srcdir"/config.txt "${pkgdir}"/boot/
# Remove symlink that points to file in the building directory
unlink "${pkgdir}"/usr/lib/modules/6.18.50-v8/build
}
I guess I could make a shell script to install directly to /boot and
/usr but I was really looking to make an ebuild for this.
A PKGBUILD is nothing more than a shell script that makepkg calls.
I don't really need or want an initramfs
--
Hindi madali ang maging ako
Re: [gentoo-user] Building a custom kernel
Author: Michael
Date: Sat, 07 Nov 2026 09:40
Date: Sat, 07 Nov 2026 09:40
182 lines
9766 bytes
9766 bytes
--nextPartQm0sF4zQQweCj7ucuFJ4QA
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="utf-8"; protected-headers="v1"
From: Michael <confabulate@kintzios.com>
To: gentoo-user@lists.gentoo.org
Reply-To: confabulate@kintzios.com
Subject: Re: [gentoo-user] Building a custom kernel
Date: Sat, 07 Nov 2026 09:25:29 +0000
Message-ID: <-S0VXcOcTBWNNRHMUe7B8A@kintzios.com>
In-Reply-To: <06ed66b8-a78e-4a5d-9d68-3f935d397d2b@oldfart.online>
MIME-Version: 1.0
On Friday, 6 November 2026 18:16:13 Greenwich Mean Time Pocket wrote:
> On 11/6/26 10:40, Michael wrote:
> > On Friday, 6 November 2026 15:10:33 Greenwich Mean Time Pocket
wrote:
> >> I have my gentoo project going very well and I would like to
> >> rebuild
> >> the rpi kernel to have btrfs built into the kernel instead of a
> >> module.
> >>
> >> I want to use btrfs as the filesystem for the root partition as I
> >> do
> >> on my archlinux systems.
> >>
> >> I have looked at the ebuilds for kernels and I can not figure them
> >> out. I have looking into portage as a later project after I finish
> >> this desktop project.
> >>
> >> I have three options at this point.
> >>
> >> 1. Use my custom kernel build from archlinuxarm using my PKGBUILD
> >> and
> >> remove the ebuild and extract the package archive to system.
> >>
> >> 2. Modify a kernel ebuild.
> >>
> >> 3. Create a initramfs
> >>
> >>
> >> Any one have any hints or direction on how to accomplish this?
> >
> > In the first instance you can read these pages a couple of times to
> > get a grounding on what options Gentoo offers, both in its
> > distribution kernels and DIY from source:
> >
> > https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel
> > https://wiki.gentoo.org/wiki/Kernel
> >
> > If you know your archlinuxarm is exactly, or mostly, what you want
> > from a kernel configuration, you can use the archlinuxarm
> > configuration to get you ready to compile your own kernel from
> > source. The general idea is to follow the basic steps below:
> >
> > 1. First emerge sys-kernel/gentoo-sources.
> > 2. Check what modules are loaded when you boot with your
> > archlinuxarm
> > kernel. You may wish to build some of these in-kernel, as opposed
> > to
> > have them as loadable modules and exclude any modules which do not
> > need if you want to keep the kernel image small(er) in size.
> > 3. Copy the archlinuxarm running .config into the gentoo-sources
> > installed in /usr/src/linux/.
> > 4. Run 'make oldconfig', followed by 'make menuconfig' to adjust the
> > configuration as you want.
> > 5. Compile and install as described at the bottom of the Handbook
> > page above.
> >
> > The above should get you mostly there. You can use dracut or a UKI
> > if you need an initramfs.
> >
> > HTH.
>
> I have a archlinux PKGBUILD that I wrote to build a custom kernel.
>
> The upstream source is from raspberrypi kernel sources and I modiify
> .config to add btrfs as built in not a module.
>
> I thought I could convert the PKGBUILD to ebuild then add it to a
> custom repository, then emerge that.
>
> Looking at the gentoo kernel ebuilds didn't give me a way forward.
> I am still looking at that. My PKGBUILD file is nothing like the
> gentoo ebuild.
>
> Goes something like this......
>
>
> https://github.com/raspberrypi/linux/archive/refs/tags/stable_20260911
> .tar.gz
>
> prepare() {
> cd "$srcdir"/"$_pkgname"_"$_pkgver"
> make mrproper
> make bcm2711_defconfig
> sed -e '/^CONFIG_BTRFS_FS/s|m|y|' -i .config
> make oldconfig
> }
>
> build() {
> cd "$srcdir"/"$_pkgname"_"$_pkgver"
> make Image.gz modules dtbs
> }
>
> then package that into a tar archive'
> package() {
> # variables
> make -s kernelrelease > version
> version="$(< version)"
>
> # Install kernel modules
> mkdir -vp "$pkgdir/usr"
> make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
> DEPMOD=/doesnt/exist modules_install # Suppress
depmod
>
> # Install kernel and firmware
> mkdir -vp "${pkgdir}"/boot/overlays
> cp -v arch/arm64/boot/Image.gz "${pkgdir}"/boot/$KERNEL.img
> cp -v arch/arm64/boot/dts/broadcom/*.dtb "${pkgdir}"/boot/
> cp -v arch/arm64/boot/dts/overlays/*.dtb* "${pkgdir}"/boot/
overlays
> cp -v arch/arm64/boot/dts/overlays/README "${pkgdir}"/boot/
overlays
>
> # Versioning, system map and configuration
> cp -v version "${pkgdir}"/boot/
> cp -v System.map "${pkgdir}"/boot/System.map-"$version"
> cp -v .config "${pkgdir}"/boot/config-"$version"
>
> # Boot and Configuration
> cp -v "$srcdir"/cmdline.txt "${pkgdir}"/boot/
> cp -v "$srcdir"/config.txt "${pkgdir}"/boot/
>
> # Remove symlink that points to file in the building
directory
> unlink "${pkgdir}"/usr/lib/modules/6.18.50-v8/build
> }
>
> I guess I could make a shell script to install directly to /boot and
> /usr but I was really looking to make an ebuild for this.
> A PKGBUILD is nothing more than a shell script that makepkg calls.
>
>
> I don't really need or want an initramfs
If you first configure, compile and build the kernel manually as you
want it to be, you'll be able to modify your script to do the same for
you.
For ebuilds which perform similar, check the distribution kernel
ebuilds, e.g.:
/var/db/repos/gentoo/sys-kernel/gentoo-kernel/gentoo-kernel-7.3.1.ebuild
/var/db/repos/gentoo/sys-kernel/gentoo-kernel-bin/gentoo-kernel-
bin-7.3.1.ebuild
--nextPartQm0sF4zQQweCj7ucuFJ4QA
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part.
Content-Transfer-Encoding: 7Bit
-----BEGIN PGP SIGNATURE-----
iQJPBAABCAA5FiEEXqhvaVh2ERicA8Ceseqq9sKVZxkFAmru7okbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyAAoJELHqqvbClWcZMxgQAKBzCfDxvM08Ttn8xGhm
Imi75QAMsAnsC55gZXD3BOraWSv1Wkl3omdXJJeNayHff7qZsfldaJt1/hzxTPPF
C0n2t7xDELTt7xeUXwfmcaySYMo5MyeRHEp2hRC/emocoptiCwyl/Mr5zvjAc2DI
yDgWDAmU4h+ZKUOon098LpLaqefr3OCxac+0Ztnh1RGBJoGh60hfx1k9dsfSxr7o
oo3SKWMBKZJPdUJOTfkeECNnfWHQWl5mP9rL+6KgZubN2Z3WEOLBQXDJv3SYkLSj
PAdrBjplNc/cft2z9YGmsOM6/GTE2JcimrLM4c4duql5iBZ2iIiBDlQEFXxRofX5
d24rrQtRFVzlHcIPrQ8mbWeCD8nelH4Oi6VqxrTBhIW+WO3fT1Qx0F+qZIfIPVQ2
4tNJSLPZ1Itn6WfJHRTK/VXevdUMGH1Ab3Y+kvxRBuymSsxKIeUKaQcT11EeG41g
xNRGGSyaOpIbdlRdA9HizhFu7nLG+4265Doacf83HsPuEGpvlQqHqhXiHJUr0tKc
Dixe0jyBM/YUp1020uImNPt4SxRSH+yFmXSlTCqgqi4RUWlyK0vOmK5+povsZs83
5SSaq8h2iwxZlLVJt258XlR96Eez6BqXwuhKUHhgAQPh/CU4Pm77b8GurgN5onpx
w4nrgqYtABJmdt7WWwbOMYhe
=TCP5
-----END PGP SIGNATURE-----
--nextPartQm0sF4zQQweCj7ucuFJ4QA--
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads