Tiny Core Linux

Tiny Core Base => Micro Core => Topic started by: lid on September 03, 2014, 03:45:11 PM

Title: How to recompile the kernel?
Post by: lid on September 03, 2014, 03:45:11 PM
Hi,

I have a microcore pxebooted. Now I need to enable TPM and TELNETD in the kernel support.  I think I will need to recompile the kernel source with updated .config. Can anyone show me if there is a Tinycore Linux wiki link how to do this? I searched around the wiki pages but haven't been able to find it yet. 

Also am I right that TELNETD should be enabled this way? I can't find a telnet extension.

Thanks.
Title: Re: How to recompile the kernel?
Post by: gerald_clark on September 03, 2014, 04:01:14 PM
Telnet is not provided in the repo.  I suggest you use dropbear or openssh instead.
Title: Re: How to recompile the kernel?
Post by: Rich on September 03, 2014, 05:04:02 PM
Hi lid
Are you looking for  telnetd ? It's in inetutils-servers.tcz
Title: Re: How to recompile the kernel?
Post by: lid on September 04, 2014, 08:28:29 AM
Hi lid
Are you looking for  telnetd ? It's in inetutils-servers.tcz

Found it! Thanks.

Any idea where to find the kernel source tree used by Tinycore?
Title: Re: How to recompile the kernel?
Post by: Rich on September 04, 2014, 11:51:42 AM
Hi lid
Kernel source and config files can be found here:
http://tinycorelinux.net/5.x/x86/release/src/kernel/
Title: Re: How to recompile the kernel?
Post by: lid on September 04, 2014, 02:35:16 PM
Hi lid
Are you looking for  telnetd ? It's in inetutils-servers.tcz

I packaged it as a second initrd. I do see the files after bootup but this doesn't seem to work correctly. For instance, I don't see "telnetd" after booting up.  syslog doesn't show any errors.

I suspect that the tcz wasn't loaded because it has dependencies such as ncurses.tcz that might also be needed. The question is Should I package all the dependencies in the same initrd? My device is embedded and it does't have the outside network connections.
Title: Re: How to recompile the kernel?
Post by: gerald_clark on September 04, 2014, 02:42:16 PM
You are pxe booting, so use nfs based persistence as described here:
http://wiki.tinycorelinux.net/wiki:netbooting
Title: Re: How to recompile the kernel?
Post by: lid on September 04, 2014, 04:00:45 PM
Hi lid
Kernel source and config files can be found here:
http://tinycorelinux.net/5.x/x86/release/src/kernel/

Rich,

A few questions how to rebuild the kernel for TC. My goal is to rebuild the "vmlinuz" image with updated .config file.

I downloaded linux-3.8.13-patched and unpacked it. I also downloaded config-3.8.13-tinycore64 as .config file and made a few changes.  My target platform is x86_64. 

Questions are:
1. Did I download the right files?
2. Are there any specific steps to build the kernel image for TC? E.g. should I just do "make ARCH=x86_64"?

Thanks!

Title: Re: How to recompile the kernel?
Post by: Misalf on September 04, 2014, 05:08:47 PM
Coreplayer2, You made an extension contianing a script for downloadin and/or using availabe data to populate the current Core kernel source files into the file system. I just have the script in my local bin dir. What's the nae of the TCZ?
Title: Re: How to recompile the kernel?
Post by: coreplayer2 on September 04, 2014, 06:58:08 PM
Yes it's "linux-kernel-sources-env.tcz"  (I wish I would have named it differently, but there you go..)  it has been updated to work in current 32bit and 64bit architectures.  I use it to prepare the system for building kernel modules in lieu of kernel headers, it can used or be modified or extended for this purpose too I guess
Title: Re: How to recompile the kernel?
Post by: lid on September 05, 2014, 01:08:37 PM
Yes it's "linux-kernel-sources-env.tcz"  (I wish I would have named it differently, but there you go..)  it has been updated to work in current 32bit and 64bit architectures.  I use it to prepare the system for building kernel modules in lieu of kernel headers, it can used or be modified or extended for this purpose too I guess

Hi coreplayer2,

I downloaded your extension. My issue is that I don't have a TC environment as a build machine. I have a RHEL6 machine and need to cross-compile for the target machine which is x86_64.  Do you have the steps to do that?
Title: Re: How to recompile the kernel?
Post by: coreplayer2 on September 05, 2014, 02:33:24 PM
You can build a temporary build system booting to  " TinyCorePure64-5.3.iso "  from http://tinycorelinux.net/5.x/x86_64/release/ (http://tinycorelinux.net/5.x/x86_64/release/)

Title: Re: How to recompile the kernel?
Post by: lid on September 07, 2014, 07:44:22 AM
You can build a temporary build system booting to  " TinyCorePure64-5.3.iso "  from http://tinycorelinux.net/5.x/x86_64/release/ (http://tinycorelinux.net/5.x/x86_64/release/)

Ok, I will do that.

Just curious, are there any instructions that I can use to take a stock Linux kernel, patch and cross-build it for TC?
Title: Re: How to recompile the kernel?
Post by: gerald_clark on September 07, 2014, 09:16:51 AM
http://wiki.tinycorelinux.net/wiki:custom_kernel
Title: Re: How to recompile the kernel?
Post by: lid on September 07, 2014, 10:22:25 AM
http://wiki.tinycorelinux.net/wiki:custom_kernel

Thanks!

What's http://tinycorelinux.net/5.x/x86/release/src/kernel/Module.symvers-3.8.13-tinycore64 at the TC kernel download site?  Do I need it to rebuild the kernel?
Title: Re: How to recompile the kernel?
Post by: Juanito on September 07, 2014, 11:20:53 AM
No, this can be used if you want to build one module without needing to compile all of them
Title: Re: How to recompile the kernel?
Post by: lid on September 07, 2014, 02:52:49 PM
No, this can be used if you want to build one module without needing to compile all of them

So this file has all the modules from the kernel make process?

Another quick question: Is linux-3.8.13-patched.txz  the kernel already patched for TC? In other words, do I need to patch it with the TC patches?



Title: Re: How to recompile the kernel?
Post by: Rich on September 07, 2014, 04:58:45 PM
hi lid
The patches are already applied to that version.
Title: Re: How to recompile the kernel?
Post by: Juanito on September 07, 2014, 09:10:59 PM
No, the file has the deps for all of the modules rather than the modules themselves
Title: Re: How to recompile the kernel?
Post by: lid on September 08, 2014, 01:39:19 PM
No, the file has the deps for all of the modules rather than the modules themselves

Here is my first build attempt on a RHEL6 server. My target machine is also a x86_64.

1. Downloaded config-3.8.13-tinycore64 (renamed it to .config) and linux-3.8.13-patched.
2. make ARCH=x86_64 silientoldconfig
3. make ARCH=x86_64 and copied the arch/x86_64/boot/bzImage to my PXEboot server as vmlinuz
4. The initrd files are the same as before. The first initrd file was extracted from Core-current.iso and second one is what I built myself that includes the Broadcom NIC driver.  They both worked well in previous PXE boots using the vmlinuz extracted from Core-current.iso.
5. Now reboot using the newly built vmlinuz.  It booted up ok but it didn't seem to load my second initrd and so my NIC card doesn't work anymore.
6. Also this new vmlinuz is 3.3 MB compare to 2.9 MB of the previous one.

Any idea what's wrong with step 5?



Title: Re: How to recompile the kernel?
Post by: Juanito on September 08, 2014, 09:40:30 PM
The gcc version used with rhel is causing the problem?
Title: Re: How to recompile the kernel?
Post by: lid on September 09, 2014, 09:40:55 AM
The gcc version used with rhel is causing the problem?

Hmm, not quite sure why GCC version might have caused this. Here is the info:

$ gcc --version
gcc (GCC) 4.4.5 20110214 (Red Hat 4.4.5-6)

Title: Re: How to recompile the kernel?
Post by: Juanito on September 09, 2014, 10:26:10 AM
I mentioned it because we've seen issues with re-compiling the x86_64 kernel using the tc gcc extension that do not appear with the x86 kernel, not with Curaga's cross-compiler extension
Title: Re: How to recompile the kernel?
Post by: lid on September 10, 2014, 10:15:31 AM
The gcc version used with rhel is causing the problem?

I set up a VM using microcore, installed coreplay2's linux-kernel-source-env extension and ran the script. It seems it sets up the build environment nicely. Great work!

I wonder what's the next step for me. Should I go to /usr/src/linux-3.8.13 and do "make" and then use the "bzImage" as my new vmlinuz in the PXEboot?
Title: Re: How to recompile the kernel?
Post by: lid on September 10, 2014, 02:30:33 PM
The gcc version used with rhel is causing the problem?

I set up a VM using microcore, installed coreplay2's linux-kernel-source-env extension and ran the script. It seems it sets up the build environment nicely. Great work!

I wonder what's the next step for me. Should I go to /usr/src/linux-3.8.13 and do "make" and then use the "bzImage" as my new vmlinuz in the PXEboot?

This time the kernel image booted up OK.