Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 21 Aug 2014, 20:05
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
Recompiling the Kernel for a realtime Frugal Install
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [3 Posts]  
Author Message
brent99

Joined: 15 Oct 2009
Posts: 17

PostPosted: Mon 24 Jun 2013, 17:36    Post subject:  Recompiling the Kernel for a realtime Frugal Install
Subject description: One man's journey to create a new kernel with realtime extensions enabled
 

*** EXECUTIVE SUMMARY ***

A frugal pup need vmlinuz, the builds sfs, and the initrd.gz files. So all that needs to be done is rebuild the patched kernel with the desired options (and additional patches) to produce the new vmlinuz file and rebuild the modules. Then replace the modules in the initrd.gz and main sfs file to stay kernel compatible with a unzip-replace-rezip ninja move.


*** DETAILS AND SCRIPTS ***

I wanted to build a kernel patched with realtime extensions for a FRUGAL install. I started my journey at:

http://puppylinux.com/development/compilekernel.htm

I found it didn't tell me quite what I wanted, so I found my own way to rebuild the kernel and repatch the release frugal files with the updated modules. Here is how I did it! This may not be the best way, may not be even a decent way to do this, I don't know. I'm sure there are far better ways. However, this does seem to work and if you are attempting something similar, maybe you'll find some things in here you will think useful, so I shared it. If I missed some magic button or utility that does all this ridiculously easier than I did it, feel free to share!

*NOTE: NOT FOR THE FAINT OF HEART -- DANGEROUS --
SOME DECENT LINUX KNOWLEDGE REQUIRED!*


RECOMPILING KERNEL AND REBUILDING PUPPY LIBRARIES
Puppy Precise 5.5, Linux 3.2.29, for FRUGAL INSTALL REBUILDS

This is an example of rebuilding Puppy Precise 5.5 kernel with the RT extension patch 44 applied for a Frugal Install. Depending on what you are trying to do, you may have to modify the steps/scripts for other kernels and other patches or other Puppy Distros. Particularly names and things like that!

You will need the patched kernel source, the "3rd party" drivers (to rebuild
them -- 2modules can be skipped for just testing a kernel w/o network)

I modified the build scripts primarily to keep 1kernel.sh from applying patches so that I could do that manually. I took the puppy patched kernel source and applied the RT patch with "zcat patches.gz | patch -p1". I have /usr/src/linux soft-linked to /usr/src/linux-3.2.29-rt44 (after renaming linux-3.2.29). So 1kernel.sh is just running a modified build with simplified system checks and I put the "3.2.29" hardcoded. 2modules.sh is also modified for 3.2.29.

1. Using my modified scripts, run 1kernel.sh from /usr/src with /usr/src/linux populated with a puppy-patched kernel and RT extension patch if applicable to your goal. The DOTconfig in /usr/src should copy down to /usr/src/linux, which should be soft linked to /usr/src/linux-3.2.29. This should be done on a FULL INSTALL of Puppy 5.5. You will have a chance to modify/verify .config at the start of the install, and then it will re-build on this system. It will build vmlinuz and place it in /boot/vmlinuz after a couple hours. Issue a "depmod -a" to rebuild modules.dep.You now have vmlinuz, 1 of the 3 necessary files. Reboot and run the ./2modules.sh script that I have also modified for my purposes. This rebuilds some modules needed for a complete set. When prompted, "Enter, i686, and 1, Enter" are my responses to questions.

After rebuilding the kernel, we need to update the modules packed into
initrd.gz and puppy_precise_5.5.sfs as well as a couple name references to reflect the build change. I rebuild these myself rather than use ./3packages.

2. Create a subdirectory, enter it, and unpack initrd.gz with:
zcat ../initrd.gz | cpio -i
We will modify this. DISTRO_SPECS should reflect DISTRO_PUPPYSFS=
'puppy_precise_5.5-rt44.sfs'. Changing this name will warn puppy save files that they need to be updated, which may prove useful.


** NOTE: THE REST OF THE STEPS HERE ARE IN A ATTACHED SCRIPT CALLED 4rebuild-frugal.sh!! **


Now go to ./lib/modules and move 3.2.29 to 3.2.29-rt44.
Enter this directory and set aside modules.dep as is.
Unzip the files using:
find . -name '*.ko.gz' | xargs -i gunzip {}
Replace the files using:
find . -name '*.ko' | xargs -i cp -a /lib/modules/3.2.29-rt44/{} {}
Re-zip the files using:
find . -name '*.ko' | xargs -i gzip {}
Clear the old stuff in this /lib/modules/3.2.29 directory with:
rm *
(A 'can't remove kernel directory message' is expected!)
Replace it with:
cp /lib/modules/3.2.29-rt44/* .
(Don't copy directories! 'Omit' messages expected!)
Replace the modules.dep file that was set aside previously.
Move back to the top of the initrd subdirectory.
Rebuilding initrd gz with:
find . | cpio -H newc -o | gzip -9 > ../initrd.gz
Now you have 2 of the 3 necessary files.

3. Unsquashfs puppy_precise_5.5.sfs. This will create squashfs-root with the Puppy Precise. Update /etc/DISTRO_SPECS based on what was used in initrd. Go to ./lib/modules/3.2.29 and remove it. Replace it with:
cp -a /lib/modules/3.2.29-rt44 .
Go back to the root of squashfs-root and enter:
mksquashfs * ../puppy_precise_5.5-rt44.sfs
Note: if that filename already exists, delete it first!
You now have all 3 of the files needed for your FRUGAL!

4. Now, copy vmlinuz, initrd.gz, and puppy_precise_5.5-rt44.sfs to your frugal install. Reboot. It will automatically update the save file (not sure what this actually does and if its really needed) because it sees the name change.

You can verify the Linux build running with "dmesg | grep Linux" for key build flags and the kernels build time.
4rebuild-frugal.sh.gz
Description  All the rebuild steps above in a single script (note: hardcoded to specific linux-3.2.29-rt44 -- please modify!)
gz

 Download 
Filename  4rebuild-frugal.sh.gz 
Filesize  731 Bytes 
Downloaded  87 Time(s) 
1kernel-nopatch.zip
Description  Build scripts modified to skip patch, minimum check, set for specific kernel v.
zip

 Download 
Filename  1kernel-nopatch.zip 
Filesize  4.61 KB 
Downloaded  81 Time(s) 
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 4230
Location: Gatineau (Qc), Canada

PostPosted: Sat 29 Jun 2013, 00:04    Post subject:  

Hello, brent99.

Please forgive my ignorance, but what are real time extensions useful for?
Recording live music directly to disk? Like in the old Atari Falcon?
Does this solve a particular deficiency in Puppy?
Should the average user be concerned with this re-building process?

Thanks in advance for your reply.

Best regards.

musher0

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Sat 29 Jun 2013, 09:29    Post subject:  

Quote:
Low Latency Kernel
As of Ubuntu Studio 12.04 the default kernel is linux-lowlatency, which in essence is a generic Ubuntu linux kernel, with a tweaked configuration to allow for stable operation for audio applications at lower latencies. Since much of the realtime patch has now been implemented into the vanilla kernel, and considering the difficulties in maintaining linux-rt, Ubuntu Studio decided on using linux-lowlatency in its place.

http://en.wikipedia.org/wiki/Ubuntu_Studio#Real-time_kernel

https://rt.wiki.kernel.org/index.php/Frequently_Asked_Questions
https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO

I once looked for it but that time it stopped at some kernel 2.6.20ies .
Now there seems to be newer patches at
https://www.kernel.org/pub/linux/kernel/projects/rt/
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [3 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0589s ][ Queries: 13 (0.0035s) ][ GZIP on ]