WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Compile custom Linux Kernel inside Tiny Core Linux  (Read 5140 times)

Offline idoit

  • Newbie
  • *
  • Posts: 13
Compile custom Linux Kernel inside Tiny Core Linux
« on: May 19, 2012, 04:37:06 PM »
Hello all,

I want to compile Kernel 3.3.6 [32 bit] and I want to do this inside my Tiny Core Linux 4.2.5 64 bit that I am virtually running with Virtual Box in Windows 7 [32 bit] Host OS. I tried to follow a lot of documents and manuals in order to compile it but I'm simply failing.

The error I get is:

Quote
kenrel/bounds.c:1.0: error: code model 'kernel' not supported in the 32 mode
kenrel/bounds.c:1.0: sorry, unimplemented: 64-bit mode not compiled in
make[1]: *** [kernel/bound.s] Error 1

Now, why I'm asking! Ummm because one of the motivations for me to use TCL is to be able to compile Kernels as I'm working on my Windows.

My second question: Assuming I boot into my 64 bit TCL as my main OS (not as a Guest OS in a 32 bit Windows), can anyone please guide me to a document that I can use to finally compile Kernel? I'm getting really disappointed as no matter what platform I use, I can't compile my custom kernel.  :'(  ;)

Thanks in advance for your help.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: Compile custom Linux Kernel inside Tiny Core Linux
« Reply #1 on: May 19, 2012, 05:19:28 PM »
The compiler is 32-bit, and you're trying to build a 64-bit kernel. If I understood you right, you want to build a 32-bit kernel.

Use "linux32 sh" and make menuconfig, etc from that shell.
The only barriers that can stop you are the ones you create yourself.

Offline idoit

  • Newbie
  • *
  • Posts: 13
Re: Compile custom Linux Kernel inside Tiny Core Linux
« Reply #2 on: May 19, 2012, 06:31:11 PM »
The compiler is 32-bit, and you're trying to build a 64-bit kernel. If I understood you right, you want to build a 32-bit kernel.

Use "linux32 sh" and make menuconfig, etc from that shell.

So, As my TCL is 64 bit, if I boot it by itself (not VM), is there a 64 bit compiler? (Is it gcc64 or compiletc64 or or toolchain64 [http://forum.tinycorelinux.net/index.php?topic=4931.0]?) Well, initially my preference was to compile 64 bit Kernel, but because I was running TCL as VM on 32 bit Windows, I wanted it to be safe so in the interim I decided to first build 32 bit and if it worked I'd build 64 bit Kernel.

I followed the text file called Changes (kernel.org/doc/Documentation/Changes) in Documentation folder of Kernel source codes, and to compile Kernel, I need the following packages that I couldn't find in TCZ Repository:
quota-tools
btrfs-progs
isdn4k-utils (isdnctrl)
pcmciautils
grub || grub-install
mcelog

Also for some of the mentioned commands (for example ps --version), TCL uses busybox instead!!! what should I do about them? Is there a way to replace busybox with original bash commands in TCL?

As I said, I've tried many instructions for compiling Kernel, but couldn't succeed and I'm helpless. I'm getting my feet wet in Kernel hacking, so ... Let's say I want to compile a Kernel for TCL 3.3.6 64 bit on my Ubuntu 64 bit desktop. Could you please give me a very detailed document (step by step explaining all the subtle things) to get me going? I could built the vmlinuz part but couldn't build the modules (core64.gz), so what i did was to use the Tinycore iso from Svolli and the provided core64.gz (which obviously was for Kernel 3.0.21-tinycore64 not for my Kernel 3.3.6-tinycore64). Therefore, when I wanted to boot that compiled TCL, I got a lot of warnings and ended up in the command line instead of going to Xfbdev environment).

Thanks again
« Last Edit: May 19, 2012, 06:38:15 PM by 800 »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: Compile custom Linux Kernel inside Tiny Core Linux
« Reply #3 on: May 20, 2012, 05:06:44 AM »
Quote
I followed the text file called Changes (kernel.org/doc/Documentation/Changes) in Documentation folder of Kernel source codes, and to compile Kernel, I need the following packages that I couldn't find in TCZ Repository:
quota-tools
btrfs-progs
isdn4k-utils (isdnctrl)
pcmciautils
grub || grub-install
mcelog

As the doc says, many of those are optional (only used when you need ISDN at runtime, etc). None are needed to build a kernel.

Quote
Is there a way to replace busybox with original bash commands in TCL?
coreutils and util-linux. BTW this is a FAQ question.

Sorry, I'm not an Ubuntu user, for instructions on that distro you better ask at their forums. We do have a wiki page on custom kernels:
http://wiki.tinycorelinux.net/wiki:custom_kernel

Though it is not a step-by-step but more of a general background.
The only barriers that can stop you are the ones you create yourself.

Offline idoit

  • Newbie
  • *
  • Posts: 13
Re: Compile custom Linux Kernel inside Tiny Core Linux
« Reply #4 on: May 22, 2012, 05:59:36 PM »
Ok thanks curaga!  :)

So I'm not trying to compile kernel in my Ubuntu laptop.

Hi again,
I applied all 12 patch files from distro.ibiblio.org/tinycorelinux/4.x/x86/release/src/kernel/3021-patches/ to my the Linux Kernel 3.4 that was just released yesterday. :)
When trying to 'make bzImage', I get this error:

Code: [Select]
mm/shmem.c: In function ‘init_rootfs’:
mm/shmem.c:2628: error: implicit declaration of function ‘init_inodecache’
make[1]: *** [mm/shmem.o] Error 1
make: *** [mm] Error 2

So I dug into the shmem.c source and changed init_inodecache() function to shmem_init_inodecache(). I tried to make it again and now it goes Ok but then I get this new error:
Code: [Select]
CC      fs/ramfs/inode.o
fs/ramfs/inode.c:280: error: redefinition of ‘ramfs_fs_type’
fs/ramfs/inode.c:247: note: previous definition of ‘ramfs_fs_type’ was here
fs/ramfs/inode.c:283: error: ‘ramfs_kill_sb’ undeclared here (not in a function)
fs/ramfs/inode.c:287: error: ‘rootfs_mount’ undeclared here (not in a function)
fs/ramfs/inode.c:291: error: redefinition of ‘init_ramfs_fs’
fs/ramfs/inode.c:267: note: previous definition of ‘init_ramfs_fs’ was here
fs/ramfs/inode.c:295: error: redefinition of ‘__initcall_init_ramfs_fs6’
fs/ramfs/inode.c:277: note: previous definition of ‘__initcall_init_ramfs_fs6’ was here
make[2]: *** [fs/ramfs/inode.o] Error 1
make[1]: *** [fs/ramfs] Error 2
make: *** [fs] Error 2

Can any body make compatitible Tiny Core patches for Kernel v3.4 please?
Thanks
« Last Edit: May 22, 2012, 06:01:09 PM by 800 »