WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Kernel repository .config bug  (Read 1147 times)

Offline teh-botol

  • WikiUser
  • *
  • Posts: 23
Kernel repository .config bug
« on: January 18, 2017, 04:22:39 AM »
Hi Guys,


Conclusion:
The value at *-piCore_v7+_.config need to be changed, from:
Code: [Select]
CONFIG_LOCALVERSION="-piCore_v7"to:
Code: [Select]
CONFIG_LOCALVERSION="-piCore_v7+"

Long story: - with BONUS on "How to recompile kernel with new boot logo" -
I'm working with piCore 7.x, and I want to change the logo at booting. The only way is to recompile the kernel.
I'am happy to do that, since I have used to compile things in TinyCoreLinux.

Based on wiki for recompile kernel http://wiki.tinycorelinux.net/wiki:custom_kernel.
At first I download the source from here http://tinycorelinux.net/7.x/armv7/releases/RPi2/src/kernel/.
With the mindset "a newer version is a better version", I download all the 4.1.20 one.
Also the patch. (hey, patch is for patching a bug right?)
(Later I found out I only need the source & .config. Patch not necessary if you know you don't need it.)

The tools (extensions) needed for this is:
Code: [Select]
compile-essentials.tcz bc.tcz *mandatory
ncurses-dev.tcz *optional to edit .config user friendly way
*You should be happy with this information, since I deal a great time to find which one is needed. I almost download all extensions to find which one is the needed one while waiting compiler to annoy me.
*Since I'am a self proclaimed a good guy (with regard to TC people here), I also create a script to ease browsing tcz repository from modern browser. http://forum.tinycorelinux.net/index.php/topic,20688.msg129082.html

Before compiling, prepare the logo first:
A good reading material http://www.arm9board.net/wiki/index.php?title=Create_your_own_boot_logo.
Long story short: just export desired image as '.ppm', and add '_clut244' as suffix (Important). Choose ASCII if asked (forgot the question :P).

And then compiling begin:
Code: [Select]
# Extract the source
$ tar -xvJf source-file.xz

# Put image file, lets say 'new_image_clut244.ppm' into <kernel-source>/drivers/video/logo/
# Edit <kernel-source>/drivers/video/logo/Kconfig, add lines:
  + config LOGO_NEWIMAGE_CLUT224
  +   bool "New Image logo"
  +   depends on LOGO
  +   default y
# Edit <kernel-source>/drivers/video/logo/Makefile, add line:
  + obj-$(CONFIG_LOGO_NEWIMAGE_CLUT224) += new_image_clut244.o
# Edit <kernel-source>/drivers/video/logo/logo.c, add lines:
  @ Inside "if (depth >= 8) {" block:
  + #ifdef CONFIG_LOGO_NEWIMAGE_CLUT224
  +     /* New Image logo */
  +     logo = &new_image_clut244;
  + #endif
# Edit <kernel-source>/include/linux/linux_logo.h, add lines:
  + extern const struct linux_logo serabi_matahari_clut224;
# A little bit hack, to disable logo repeated horizontally.
# Edit <kernel-source>/drivers/video/fbdev/core/fbmem.c, edit line:
  - fb_do_show_logo(info, &image, rotate, n);
  + fb_do_show_logo(info, &image, rotate, 1); //n); // Hack: disable logo repeat-y

# Copy TinyCore .config into <kernel-source>. Obviously, don't forget name it '.config'.
# Execute this and you will be asked if a new logo should be enabled.
$ make oldconfig

# Disable old logo either direct edit '.config' file,
#   or use below command to activate user friendly kernel configuration.
# The logo menu at "Device Drivers -> Graphics Support -> Boot Logo".
$ make nconfig

# Compile the kernel image.
# For RPi, the result file is <kernel-source>/arch/arm/boot/zImage.
#   This can be moved into /mnt/mmcblk0p1, and edit config.txt accordingly.
# WATCH OUT!!! This takes 3-5hours to compile.
#   I suggest use 'nohup ... &' or compile from machine itself.
$ make bzImage

Hey, did I mention it's takes 3-5hours to compile?
Yep. I did.
..
After restart, all USB device is not working. Including keyboard.
Hard shutdown. Move MicroSD card to desktop. Revert using original kernel.
Happily, browsing time!  :)

Based on several post on forum. I try compile the modules.
Code: [Select]
# WATCH OUT!!! Just like compiling kernel, it's takes 3-5hours to finish.
$ make modules

# Install(moved) the files into another path.
$ make INSTALL_MOD_PATH=/path modules_install firmware_install

# Those modules need to packed together with RPi initramfs (TC Base).
Just read the rest about modules and firmware from http://wiki.tinycorelinux.net/wiki:custom_kernel.
But, Hey, I made a tools to easily repack those modules into initramfs.
Check it here http://forum.tinycorelinux.net/index.php/topic,20695.0.html.

After waiting patiently, it's time to restart with new iniramfs.
All device still not working.   ???
Hard shutdown. Move MicroSD card to desktop. Revert using original kernel.
Browse again.
..
Realize the original kernel is 4.1.13.
I desperately download... recompile... and change config.txt. Restart.  :o
..
Still not working.
Hard shutdown. Move MicroSD card to desktop. Revert using original kernel.
..
Compile modules. Repack initramfs. Restart.
..
Still not working.  >:(
Hard shutdown. Move MicroSD card to desktop. Revert using original kernel.

I sat down in the corner.. thingking the meaning of life.  :'(
After regain my purpose. And with my little energy (It's the middle of the night).
..
I feels something missing inside lib/modules directory.
When I compare lib/modules between original initramfs and compiled modules.
I found a light. Emiting from the '+' sign at the end '4.1.13-piCore_v7+' .
Smiling at me. Whisper 'You still have hope. Try it!'.  :)
..
And then I check '.config' file in <kernel-source>.
And I found: CONFIG_LOCALVERSION="-piCore_v7"
With a rush, I change it. Add '+' sign at the end of value.
Recompile kernel.
Patienly waiting.
Just to be safe, recompile modules.
Change all parameter needed. Restart.
..
IT'S WORKING.  8)
Thank you, oh the great cosmic energy that sipp into me.
.
Just for my curiousity, I try using original initramfs.
It's working. Oh NOOB me.

If you reading this, thank you for listening my rant story.
Hope this will help some beginner like me. ;)


BR,
adit

NB: If some master can rectify this. Please en-light me!