[HOWTO] - Compile and use custom Porteus kernel
- fanthom
- Moderator Team
- Posts: 5622
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
[HOWTO] - Compile and use custom Porteus kernel
HOWTO moved to the docs section of the main site:
http://www.porteus.org/component/conten ... ernel.html
http://www.porteus.org/component/conten ... ernel.html
Please add [Solved] to your thread title if the solution was found.
Re: [HOWTO] - Compile and use custom Porteus kernel
That link gives me an HTTP 500 error.
Please, are there current instructions on how to build a custom kernel for Porteus 1.2?
Please, are there current instructions on how to build a custom kernel for Porteus 1.2?
- brokenman
- Site Admin
- Posts: 6104
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
- Contact:
Re: [HOWTO] - Compile and use custom Porteus kernel
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
Re: [HOWTO] - Compile and use custom Porteus kernel
It looks to me like the link is the same, but it's working now (no HTTP error 500 today). Thank you.
Meanwhile I also found this:
http://forum.porteus.org/viewtopic.php?f=53&t=1553
"[Solved]How to build the kernel 3.4.4(Portues v1.20)?"
I wonder whether to add "Unsolved" to a "Solved" thread. So I'll ask here first.
I downloaded two files
http://www.kernel.org/pub/linux/kernel/ ... .4.tar.bz2
http://dl.porteus.org/i486/current/pack ... 6-1ftm.xzm
While running Porteus 1.2, I expanded those, found the patches inside the crippled sources and copied the patches to the appropriate directories.
I tried to patch aufs. The patch program patched a bunch of files and then started giving errors. The patch program didn't find some files, so I just used the mouse to copy and paste part of the pathname, and then it worked. This is weird. The patch program warned that some files would be created, but the files already existed, so the patch program asked whether to overwrite? But overwriting might lose contents that would be preserved by an ordinary patch. Is the aufs patch really meant for a different kernel version?
I didn't try to patch BFS yet because the aufs patch was too weird.
Does it matter which order I do these in, BFS patch and then aufs, or vice versa?
Meanwhile I also found this:
http://forum.porteus.org/viewtopic.php?f=53&t=1553
"[Solved]How to build the kernel 3.4.4(Portues v1.20)?"
I wonder whether to add "Unsolved" to a "Solved" thread. So I'll ask here first.
I downloaded two files
http://www.kernel.org/pub/linux/kernel/ ... .4.tar.bz2
http://dl.porteus.org/i486/current/pack ... 6-1ftm.xzm
While running Porteus 1.2, I expanded those, found the patches inside the crippled sources and copied the patches to the appropriate directories.
I tried to patch aufs. The patch program patched a bunch of files and then started giving errors. The patch program didn't find some files, so I just used the mouse to copy and paste part of the pathname, and then it worked. This is weird. The patch program warned that some files would be created, but the files already existed, so the patch program asked whether to overwrite? But overwriting might lose contents that would be preserved by an ordinary patch. Is the aufs patch really meant for a different kernel version?
I didn't try to patch BFS yet because the aufs patch was too weird.
Does it matter which order I do these in, BFS patch and then aufs, or vice versa?
- fanthom
- Moderator Team
- Posts: 5622
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Re: [HOWTO] - Compile and use custom Porteus kernel
@ndiamond
you do not need crippled-sources to compile new kernel. crippled-sources is a stripped down version of kernel compiled by me for porteus-1.2.
please follow kernel compilation HOWTO "line by line" and you should not have any problems.
you do not need crippled-sources to compile new kernel. crippled-sources is a stripped down version of kernel compiled by me for porteus-1.2.
please follow kernel compilation HOWTO "line by line" and you should not have any problems.
Please add [Solved] to your thread title if the solution was found.
- Slaxmax
- Contributor
- Posts: 408
- Joined: 03 Jan 2013, 09:51
- Distribution: KDE4
- Location: Campinas Brazil https://goo.gl/yrxwKi
Re: [HOWTO] - Compile and use custom Porteus kernel
I tried this procedure
http://www.porteus.org/component/conten ... ernel.html
But
...Navigate to "File systems" menu and make sure that FUSE will be compiled in (*). Then go to -> "Miscellaneous filesystems". Aufs and Squashfs must also be compiled in (*), as well as xz compression for Squashfs (*)
in menuconfig "Miscellaneous filesystems" does not show Aufs, only Squashfs.
Terminates the entire procedure without errors. Reboot shows Aufs error.
http://www.porteus.org/component/conten ... ernel.html
But
...Navigate to "File systems" menu and make sure that FUSE will be compiled in (*). Then go to -> "Miscellaneous filesystems". Aufs and Squashfs must also be compiled in (*), as well as xz compression for Squashfs (*)
in menuconfig "Miscellaneous filesystems" does not show Aufs, only Squashfs.
Terminates the entire procedure without errors. Reboot shows Aufs error.
“DNA is like a computer program but far, far more advanced than any software ever created.”
― Bill Gates, The Road Ahead
― Bill Gates, The Road Ahead
- fanthom
- Moderator Team
- Posts: 5622
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Re: [HOWTO] - Compile and use custom Porteus kernel
hello Slaxmax,
looks like aufs patch was not applied cleanly on your kernel sources. which kernel version are you trying to compile?in menuconfig "Miscellaneous filesystems" does not show Aufs, only Squashfs.
Please add [Solved] to your thread title if the solution was found.
- Slaxmax
- Contributor
- Posts: 408
- Joined: 03 Jan 2013, 09:51
- Distribution: KDE4
- Location: Campinas Brazil https://goo.gl/yrxwKi
Re: [HOWTO] - Compile and use custom Porteus kernel
I tried compile kernel 3.7.8 running Porteus 2.1 i486
But exactly now I succeeded in compiling. I used porteus 2.0 i486 that has the same kernel 3.7.8. 8)
Thanks
But exactly now I succeeded in compiling. I used porteus 2.0 i486 that has the same kernel 3.7.8. 8)
Thanks
“DNA is like a computer program but far, far more advanced than any software ever created.”
― Bill Gates, The Road Ahead
― Bill Gates, The Road Ahead
-
- Samurai
- Posts: 134
- Joined: 18 Sep 2012, 20:56
- Distribution: Porteus 64bit KDE4
- Location: Absurdistan
Re: [HOWTO] - Compile and use custom Porteus kernel
Nice tutorial but how can i make the crippled-sources ?
How is the right way to strip the source down ?
How is the right way to strip the source down ?
- fanthom
- Moderator Team
- Posts: 5622
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Re: [HOWTO] - Compile and use custom Porteus kernel
please run this script inside the folder where kernel was compiled (maybe do a backup first so it wont become crippled):
Code: Select all
#!/bin/bash
dest=`pwd`
cd $dest
echo "do you want to create crippled sources module? Answer y/n"
read ans
if [ "$ans" = "y" ]; then
name=`echo $dest | rev | cut -d/ -f1 | rev`
mkdir Porteus-patches && chmod -x *.patch && mv *.patch Porteus-patches
cp .config Porteus-patches/kernel.config
rm .config.old 2>/dev/null
mv System.map ../
make clean
mv ../System.map .
make prepare
make scripts
# remove a lot of stuff
rm -Rf Documentation drivers fs net sound firmware
ls -1d arch/* | grep -v x86 | xargs rm -Rf
ls -1d include/* | grep asm- | grep -v x86 | grep -v generic | xargs rm -Rf
cp -a include/generated/* include/linux
pushd include/linux && ln -sf uapi/linux/version.h version.h && popd
mkdir -p new/usr/src/$name
mv * new/usr/src/$name 2>/dev/null
mv .* new/usr/src/$name 2>/dev/null
cd new/usr/src
ln -s $name linux
cd ../../../
rm -f new/usr/src/$name/p_devel
mksquashfs new crippled_sources.xzm -b 256K -Xbcj x86
rm -r new
echo "all jobs done"
fi
Please add [Solved] to your thread title if the solution was found.
-
- Samurai
- Posts: 134
- Joined: 18 Sep 2012, 20:56
- Distribution: Porteus 64bit KDE4
- Location: Absurdistan
Re: [HOWTO] - Compile and use custom Porteus kernel
Thanks. I will try it in the next weeks.
-
- Samurai
- Posts: 134
- Joined: 18 Sep 2012, 20:56
- Distribution: Porteus 64bit KDE4
- Location: Absurdistan
Re: [HOWTO] - Compile and use custom Porteus kernel
I have not tested the pxeinitrd but when one of the modules not exist: "dca mii libphy sungem_phy ssb uio crc-ccitt" the code copy all modules.
I used this:
I used this:
Code: Select all
#!/bin/sh
cd `pwd`
mkdir pxe
cd pxe
cp -a --parents /lib/modules/`uname -r`/kernel/drivers/net/ethernet .
for x in dca mii libphy sungem_phy ssb uio crc-ccitt; do
pth="/lib/modules/`uname -r`/$(grep $x.ko: /lib/modules/`uname -r`/modules.dep | cut -d: -f1)"
test -n "$pth" && cp -a --parents $pth .
done
depmod -b .
find | cpio -H newc -o | xz --check=crc32 --x86 --lzma2 > ../../initrdpxe.xz
cd ..
rm -r pxe
mv ../initrdpxe.xz .
mv /root/initrd.xz /mnt/sdb1/boot/syslinux/pxelinux.cfg/initrdpxe.xz
-
- Samurai
- Posts: 134
- Joined: 18 Sep 2012, 20:56
- Distribution: Porteus 64bit KDE4
- Location: Absurdistan
Re: [HOWTO] - Compile and use custom Porteus kernel
Here a supplement if you install 2 kernels on the same LiveCD.
For example if you would to make a small change on the same Kernel version (for this example 3.17.4).
changing the localversion (for default the localversion are "-porteus")
You can change them to for example "-custom1" by using
CONFIG_LOCALVERSION=-custom1 insteat of CONFIG_LOCALVERSION=-porteus
that causes that 'uname -r' prints 3.17.4-custom1
and the modules are in /lib/modules/3.17.4-custom1
for 000-kernel module i use this:
The name of 000-kernel should normally not changed because the name will used by initrd.
For this reason the name must change in initrd
and of course the kernel should change:
change the /mnt/sdb1/boot/syslinux/porteus.cfg
by adding for the
old:new:
but no idea whether i save me the renaming in initrd
when i use the 000-kernel and do this: dir2xzm /root/000-kernel /mnt/sdb1/porteus/base/000-kernel-$LOCALV.xzm
instead of: dir2xzm /root/000-kernel-$LOCALV /mnt/sdb1/porteus/base/000-kernel-$LOCALV.xzm
For example if you would to make a small change on the same Kernel version (for this example 3.17.4).
changing the localversion (for default the localversion are "-porteus")
You can change them to for example "-custom1" by using
CONFIG_LOCALVERSION=-custom1 insteat of CONFIG_LOCALVERSION=-porteus
Code: Select all
# cd into kernel source dir
LOCALV=-custom1
sed s/"CONFIG_LOCALVERSION=\".*\""/"CONFIG_LOCALVERSION=\"$LOCALV\""/ -i ./.config
and the modules are in /lib/modules/3.17.4-custom1
for 000-kernel module i use this:
Code: Select all
LOCALV=-custom1
cp -r /mnt/live/memory/images/000-kernel.xzm/ /root/000-kernel-$LOCALV
rm -r /root/000-kernel-$LOCALV/lib/modules/*
rm -r /root/000-kernel-$LOCALV/lib/firmware/*
make INSTALL_MOD_PATH=/root/000-kernel-$LOCALV KERNELRELEASE=3.17.4-custom1 modules_install
make INSTALL_MOD_PATH=/root/000-kernel-$LOCALV firmware_install
dir2xzm /root/000-kernel-$LOCALV /mnt/sdb1/porteus/base/000-kernel-$LOCALV.xzm
For this reason the name must change in initrd
Code: Select all
# provided the right intrd.xz is in /mnt/sdb1/boot/syslinux/intrd.xz
LOCALV=-custom1
mkdir ./initrd-$LOCALV
cd ./initrd-$LOCALV
xz -d < /mnt/sdb1/boot/syslinux/intrd.xz | cpio -i
### changes in initrd
sed s/"000-kernel"/"000-kernel-$LOCALV"/g -i ./linuxrc
sed s/"000-kernel"/"000-kernel-$LOCALV"/g -i ./cleanup
mv ./opt/000-kernel ./opt/000-kernel-$LOCALV
### changes end
find | cpio -H newc -o | xz --check=crc32 --x86 --lzma2 > /mnt/sdb1/boot/syslinux/intrd-$LOCALV.xz"
Code: Select all
cp arch/x86/boot/bzImage /mnt/sdb1/boot/syslinux/vmlinuz-1custom
by adding for the
old:
Code: Select all
KERNEL vmlinuz
APPEND initrd=initrd.xz noload=000-kernel-1custom.xzm ...
Code: Select all
KERNEL vmlinuz-1custom
APPEND initrd=initrd-1custom.xz noload=000-kernel.xzm ...
when i use the 000-kernel and do this: dir2xzm /root/000-kernel /mnt/sdb1/porteus/base/000-kernel-$LOCALV.xzm
instead of: dir2xzm /root/000-kernel-$LOCALV /mnt/sdb1/porteus/base/000-kernel-$LOCALV.xzm
-
- Samurai
- Posts: 134
- Joined: 18 Sep 2012, 20:56
- Distribution: Porteus 64bit KDE4
- Location: Absurdistan
Re: [HOWTO] - Compile and use custom Porteus kernel
and then the next question how was the graphic driver build especially the nvidia driver.
- fanthom
- Moderator Team
- Posts: 5622
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Re: [HOWTO] - Compile and use custom Porteus kernel
GPU drivers is a story for another topic. you can have a look on this thread:
http://forum.porteus.org/viewtopic.php?f=39&t=33
i have stopped updating the script as new driver release means new patches and different procedures. i wont publish 'ready to go script' as it would be outdated quickly.
http://forum.porteus.org/viewtopic.php?f=39&t=33
i have stopped updating the script as new driver release means new patches and different procedures. i wont publish 'ready to go script' as it would be outdated quickly.
Please add [Solved] to your thread title if the solution was found.