WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [Updated] Script for preparing full kernel sources in lieu of headers  (Read 4812 times)

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 2514
I thought I'd share my script for preparing full kernel sources in lieu of kernel headers, if anyone is interested.

It has been my goal to submit this script as part of a tools extention which I use regularly, but extension is not ready (I have more usful scripts to add yet).   Meanwhile this script is ready and I use it often, daily almost.

This script has been adjusted for use with 3.8.10 kernel only, though the previous version was in use compiling apps for core64 v4.7.7

Once downloaded, the source files (downloaded to /tmp may be saved for future use, or they will be downloaded next time used.

I welcome your comments

Thanks to Jason and juanito for their guidance and inspiration

edit  amended additional ping check

« Last Edit: September 25, 2017, 12:58:45 AM by Juanito »

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Script for preparing full kernel sources in lieu of headers
« Reply #1 on: July 20, 2013, 05:04:45 PM »
Consider attaching script please?
« Last Edit: September 25, 2017, 12:59:07 AM by Juanito »
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 2514
Re: Script for preparing full kernel sources in lieu of headers
« Reply #2 on: July 20, 2013, 07:15:40 PM »
sure thing, done
« Last Edit: September 25, 2017, 12:59:21 AM by Juanito »

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 2514
Re: Script for preparing full kernel sources in lieu of headers
« Reply #3 on: August 07, 2013, 10:02:06 PM »
I have submitted an extension with an updated version of this script

 linux-3.8.10-sources-env.tcz

Basically it is a script (albeit perhaps not the most efficient one) which prepares Linux 3.8.10 full sources in lieu of headers for compiling modules etc. on tc-5.x
The script will find the required sources locally or will download them as needed, also providing an option to save the sources for future use.  Symlinks and compile extensions will also be set and installed to complete the build environment.


I use the extension often to setup a build environment, so am simply sharing it.   future modifications may still be necessary to adapt for 64 modules etc etc.

attaching the current script here.  comments and suggestions welcome

PS.  opened the script on the big screen and immediately saw some duplication, will take care of that soon
« Last Edit: September 25, 2017, 12:59:33 AM by Juanito »

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 2514
Re: Script for preparing full kernel sources in lieu of headers
« Reply #4 on: September 03, 2013, 12:01:14 AM »
ok updated already

have submitted an updated extension


Many fixes and a huge clean up.
also added a second menu item which accesses an abbreviated (basic) script to accommodate previously downloaded source files and deps.
Also completed the 64 bit section of both scripts in preparation for possible future corepure64 builds??

updated scripts also attached
« Last Edit: September 25, 2017, 12:59:50 AM by Juanito »

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 2514
[Updated] Script for preparing full kernel sources in lieu of headers
« Reply #5 on: November 30, 2013, 11:23:04 AM »
Updated for Kernel-3.8.13 (x86 & x86_64)

Now a single script, no longer kernel version specific, some fixes, some feature and performance improvements.

supports Kernel-3.8.13 (x86 & x86_64) and up
disabled the ability to save sources for future use
replaced some built-in dependencies (for performance)
(and other minor fixes)
 

Will update the extension and probably modify the name to reflect the the change in kernel support

feedback welcome
« Last Edit: September 25, 2017, 01:00:01 AM by Juanito »

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1576
Re: [Updated] Script for preparing full kernel sources in lieu of headers
« Reply #6 on: November 30, 2013, 12:04:48 PM »
Thanks coreplayer2

[...]
disabled the ability to save sources for future use
[...]

Is it still possible to save the sources manually and/or let the script use locally stored files?

---

EDIT:
Yes, it is.
Needs to be in  /tmp  instead of  $HOME  as it was before.
Thats OK though.

Thanks again for your script.

« Last Edit: September 25, 2017, 01:00:17 AM by Juanito »
Download a copy and keep it handy: Core book ;)

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 2514
Re: [Updated] Script for preparing full kernel sources in lieu of headers
« Reply #7 on: November 30, 2013, 12:24:35 PM »
Thanks for the feedback

Quote
and/or let the script use locally stored files?

Absolutely,  the change is to avoid confusion and allow the script to run to completion.  The script will still look for the sources in the file system before attempting to download just as earlier version..  While disabled, the ability to choose save for future use is still present.  Is disabled only by wrapping in a here document,  therefore removal of 
:<<discard
[...]
discard
will re-enable the feature (if you choose).

the sources,
config-3.8.13-tinycore,
linux-3.8.13-patched.txz &
Module.symvers-3.8.13-tinycore
are still downloaded to /tmp dir  from there you may copy to for eg:  home/tc/kernel_sources

use the attached script until the extension is posted


« Last Edit: September 25, 2017, 01:00:32 AM by Juanito »

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1576
Re: [Updated] Script for preparing full kernel sources in lieu of headers
« Reply #8 on: December 01, 2013, 04:57:18 AM »
I currently have the 3.8.10 sources (~60MB) just symlinked to my $HOME folder (to work with your previous scripts) but stored elsewhere to avoid messy/slow backup. While that was easier than copying stuff to /tmp first, it's still better to not let the script copy big files in $HOME.
However, it would be nice though if the script will check if  ~/kernel_sources/  is available and use that istead of only checking for  tmp/kernel_sources/ .

--

I'm using  tc  (default) username on TinyCore and I don't have a reason to change that so I actually have no experience in potential privilege issues which I think to see here:
Code: [Select]
sudo chown tc:staff "$k"Shouln't thinks like that be user specific?
Code: [Select]
sudo chown $USER:staff "$k"
« Last Edit: September 25, 2017, 01:00:45 AM by Juanito »
Download a copy and keep it handy: Core book ;)

Offline Onyarian

  • Sr. Member
  • ****
  • Posts: 333
Re: [Updated] Script for preparing full kernel sources in lieu of headers
« Reply #9 on: December 01, 2013, 07:31:20 AM »
Thanks for the script, coreplayer2.

I run it to make a custom nvidia extension, without your script was impossible.

I see it creates a kernel_sources directory with the three files in the tce directory., so it's not necessary to download anymore, only copy there in /tmp and run again your script.

 ;D
« Last Edit: September 25, 2017, 01:00:58 AM by Juanito »

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1576
Re: [Updated] Script for preparing full kernel sources in lieu of headers
« Reply #10 on: December 01, 2013, 08:02:40 AM »
By looking at the code, I just noticed it will 'find /' the kernel sources package no matter where it is stored and if not already found in  /tmp  where it looks first.
Actually better than looking in $HOME - Great for lazy people like me.
(you already said that but I didn't read carfully)


I need it as well to build the nvidia drivers.

Great job & thanks once more.

--

I don't know if it's intentional - every command gets displayed in the terminal if I just run the script by issuing
Code: [Select]
$ linux-kernel-sources-env.sh
Code: [Select]
...
+ echo connection ok
connection ok
...
etc
« Last Edit: September 25, 2017, 01:01:10 AM by Juanito »
Download a copy and keep it handy: Core book ;)

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 2514
Re: [Updated] Script for preparing full kernel sources in lieu of headers
« Reply #11 on: December 01, 2013, 10:22:18 AM »
Thanks for your feedback.

Use of Set -x & set +x Is intentional, helps to identify issues.

For the longest time I've been circumventing a failure to download dependancies issue using tc-load.  Finally however I've made significant progress on that issue, so looks like the extraneous bloat around downloading required deps in all my scripts is about to be relocated to the trash can!  This will make Linux-kernel-source-env script significantly shorter and more reliable  :)

 It appears that when GNU Wget is installed, both Apps GUI and tc-load may fail to download dependencies at a significantly high rate.   

At least removal of Wget extension or perhaps  " useBusybox " may resolve the issue completely

Will upload here ASAP



Sent from my iPad using Tapatalk HD
« Last Edit: September 25, 2017, 01:01:23 AM by Juanito »

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 2514
Re: [Updated] Script for preparing full kernel sources in lieu of headers
« Reply #12 on: December 02, 2013, 12:01:08 AM »
ok, Current script is updated to utilize busybox exclusively.

therefore have rewritten dependency download and loading section.

will submit asap, have changed the name to reflect being no longer kernel version specific

the attached script may be used in the meantime

Hope this helps
« Last Edit: September 25, 2017, 01:01:35 AM by Juanito »

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 2514
Re: [Updated] Script for preparing full kernel sources in lieu of headers
« Reply #13 on: December 09, 2013, 06:05:17 PM »
New kernel sources extension submitted, renamed to

  Linux-kernel-sources-env

Supports both x86 & x86_64 architectures, single script, no choices.

Simply run from desktop menu or suggest adding

 " cliorx linux-kernel-sources-env.sh "

to a build script


« Last Edit: September 25, 2017, 01:01:47 AM by Juanito »

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 2514
Re: [Updated] Script for preparing full kernel sources in lieu of headers
« Reply #14 on: January 15, 2015, 06:35:05 PM »
linux-kernel-sources-env script has been updated to add support for tc-6 (updates src path's and compressed Module.symvers archive)


the Script / extension now supports
tc5 x86
tc5 x86_64
and
tc6 x86
tc6 x86_64

tcz extension has been submitted
« Last Edit: September 25, 2017, 01:02:00 AM by Juanito »