Page 1 of 5

Kernel Builder script -- simple version

Posted: 17 Dec 2021, 08:34
by fulalas
The idea is not to replace neko's application, but just to provide a straightforward non-UI approach that doesn't require updates when a new kernel is released.

https://www.mediafire.com/file/r1ui4kaf ... 206.tar.gz
(398 KB)

Usage:

Code: Select all

./kernel.sh [kernelVersionYouWantToCompile]
Example:

Code: Select all

./kernel.sh 5.12.14
It will download the kernel source code, AUFS path for the given kernel version, firmware, compile everything and generate:
  • vmlinuz
  • 000-kernel.xzm
  • 06-crippled_sources-[kernelVersion].xzm.
Typical output:

Code: Select all

Initial setup...
Downloading kernel source code...
Extracting kernel source code...
Copying .config file...
Downloading AUFS...
Patching AUFS...
Building kernel (this may take a while)...
Creating symlinks...
Downloading firmware...
Extracting firmware...
Adding firmware...
Blacklisting...
Copying cryptsetup...
Creating kernel xzm module...
Creating crippled xzm module...
Cleaning up...
All finished.

Files generated:
vmlinuz -> should go into boot/syslinux
000-kernel.xzm -> should go into porteus/base
06-crippled_sources-5.12.14.xzm -> should go into porteus/base
Tips:
1- If the script detects either the kernel source package or firmware package in the script folder it won't download them again.
2- All the temporary files will be created in /tmp/kernel-builder, and they should be deleted when the process finishes.
3- If you forget to run it as sudo it will ask for sudo pass.
4- You only need 3 files for this to work (they're all included in the package above):
  • kernel.sh (of course)
  • 64bit.config or 32bit.config (which contains kernel configuration)
  • cryptsetup (for handling encrypted save changes)
It should be able to build any version of the kernel that is still buildable nowadays, either 32 or 64 bit. I haven't tested with many different kernel versions so I can't guarantee much. It's still very experimental and any feedback is welcome.

Next version should include a way to log the output -- at the moment the script is swallowing all the output for a cleaner experience.

I would like to thank neko for his generous patience to teach me all the tricks that involve building Linux kernel. He's the man! :)

Kernel builder script -- simple version

Posted: 17 Dec 2021, 17:17
by Ed_P
:o

Kernel builder script -- simple version

Posted: 17 Dec 2021, 20:53
by fulalas
It's failing to build (actually, link) 5.15.x with the following error:

Code: Select all

ld: fs/inode.o: in function `__ksymtab_update_time':
inode.c:(___ksymtab_gpl+update_time+0x0): undefined reference to `update_time'
ld: fs/aufs/i_op.o: in function `aufs_update_time':
i_op.c:(.text+0x19c): undefined reference to `update_time'
make: *** [Makefile:1183: vmlinux] Error 1
I reported the issue: https://github.com/sfjro/aufs5-standalone/issues/8

Kernel builder script -- simple version

Posted: 17 Dec 2021, 22:39
by beny
hi,the issue of aufs patch is start with the 5.15.6 and also neko don't have the hint to solve this, but he have the overlay option,the 5.16-rc5 do not have issue with aufs, you can try to build it i have tried to download it via your script but no way... error

Kernel builder script -- simple version

Posted: 17 Dec 2021, 22:59
by roadie
fulalas,

I just compiled the 5.15.8 kernel using the aufs5.15.5 patch.......no errors on patching and the kernel booted well.

https://github.com/sfjro/aufs5-standalone/branches

Kernel builder script -- simple version

Posted: 17 Dec 2021, 23:39
by beny
hi i can confirm that aufs 5.15.5 work on 5.15.10 with roadie advice

Kernel builder script -- simple version

Posted: 18 Dec 2021, 05:27
by fulalas
Yeah, confirmed. Working version now uploaded (first post).

In the future I'm going to add more specific verifications for these broken versions... Zzzzz :P

Kernel builder script -- simple version

Posted: 24 Jan 2022, 11:34
by fulalas
Does anyone know why kernel is failing to build? No matter what version I'm trying, including 5.12.14 which I tested countless times during the development of this script!

That's the error output if I remove > /dev/null 2>&1 from the make olddefconfig command (line 88):

Code: Select all

  ...
  HOSTLD  scripts/kconfig/conf
make[1]: *** [scripts/kconfig/Makefile:63: olddefconfig] Segmentation fault
make: *** [Makefile:602: olddefconfig] Error 2
EDIT: never mind. It's something in our current developer base.

Kernel builder script -- simple version

Posted: 04 Feb 2022, 22:30
by UrUtusUbU
in line 19 get i a error about a space,

code WITH ERROR

Code: Select all

	if [ ! -f 32bit.config]; then
code WITHOUT ERROR

Code: Select all

	if [ ! -f 32bit.config ]; then
ONLY put A SPACE AFTER config

Building kernel (this may take a while)...
iam building 5.15.8 at the moment no problems,
waiting the end...........
Building kernel (this may take a while)...

thanks

why use ausfs neither??

Kernel builder script -- simple version

Posted: 05 Feb 2022, 06:19
by Blaze
I stuck on this

Code: Select all

Building kernel (this may take a while)...
   HOSTCC scripts/basic/fixdep
   HOSTCC scripts/kconfig/conf.o
   HOSTCC scripts/kconfig/confdata.o
   HOSTCC scripts/kconfig/expr.o
   LEX scripts/kconfig/lexer.lex.c
   YACC scripts/kconfig/parser.tab.[ch]
   HOSTCC scripts/kconfig/lexer.lex.o
   HOSTCC scripts/kconfig/menu.o
   HOSTCC scripts/kconfig/parser.tab.o
   HOSTCC scripts/kconfig/preprocess.o
   HOSTCC scripts/kconfig/symbol.o
   HOSTCC scripts/kconfig/util.o
   HOSTLD scripts/kconfig/conf
make[1]: *** [scripts/kconfig/Makefile:77: olddefconfig] Segmentation error
make: *** [Makefile:619: olddefconfig] Error 2
Fail to build kernel. 

Kernel builder script -- simple version

Posted: 05 Feb 2022, 12:10
by UrUtusUbU
I at the end the same
Fail to build kernel.

Kernel builder script -- simple version

Posted: 05 Feb 2022, 18:07
by beny

Code: Select all

  uest@porteus:~/Downloads/kernelbuild$ sh '/home/guest/Downloads/kernelbuild/kernel.sh' 5.15.20
glibtop(c=4231): [DEBUG] open.c:50 glibtop_open_l(): SIZEOF: 40 - 65648 - 248 - 65624 - 296 - 65624
glibtop(c=4231): [DEBUG] open.c:163 glibtop_open_l(): Calling sysdeps open function.
glibtop(c=4231): [DEBUG] init.c:229 glibtop_init_s(): init_s with features=0xfffffff and flags=0

gksu-run: gksu/|home|guest|Downloads|kernelbuild|kernel.sh '5.15.20' '|home|guest|Downloads|kernelbuild'/4231-0-porteus.example.net_TIME0
gksu-run: a05c78660723308b616860d084a073d5

Initial setup...
Downloading kernel source code...
Extracting kernel source code...
Copying .config file...
Downloading AUFS...
Patching AUFS...
Building kernel (this may take a while)...
Creating symlinks...
Downloading firmware...
Extracting firmware...
Adding firmware...
/home/guest/Downloads/kernelbuild/kernel.sh: line 119: [: too many arguments
Blacklisting...
Copying cryptsetup...
Creating kernel xzm module...
Creating crippled xzm module...
Cleaning up...
All finished.

Files generated:
vmlinuz -> should go into boot/syslinux
000-kernel.xzm -> should go into porteus/base
06-crippled_sources-5.15.20.xzm -> should go into porteus/base
guest@porteus:~/Downloads/kernelbuild$ 

                                                                                        

Kernel builder script -- simple version

Posted: 06 Feb 2022, 01:46
by fulalas
@UrUtusUbU, thanks for the bug report. It's fixed now (first post).

@all, kernel will fail to build if you use wrong combination of devel module and core/xorg modules. EDIT: it seems there's something in the new core module that is breaking kernel build. I still don't know what :(

Kernel builder script -- simple version

Posted: 06 Feb 2022, 04:12
by Ed_P
fulalas wrote:
06 Feb 2022, 01:46
@all, kernel will fail to build if you use wrong combination of devel module and core/xorg modules.
How does one know what devel mod goes with which core/xorg mods?

Kernel builder script -- simple version

Posted: 06 Feb 2022, 10:07
by Blaze
Yep

Code: Select all

+ cat aufs/aufs5-base.patch aufs/aufs5-kbuild.patch aufs/aufs5-loopback.patch aufs/aufs5-mmap.patch aufs/aufs5-standalone.patch aufs/tmpfs-idr.patch aufs/vfs-ino.patch
+ cd linux-5.16.7
+ patch -p1
+ echo 'Building kernel (this may take a while)...'
Building kernel (this may take a while)...
++ nproc --all
+ cpuThreads=4
+ make olddefconfig
+ echo 'Fail to build kernel.'
Fail to build kernel.
+ exit 1