LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 09-22-2011, 06:52 PM   #1
snikulin
LQ Newbie
 
Registered: Sep 2011
Posts: 1

Rep: Reputation: Disabled
Self-replicating kernel?


I have built a nice console-only CLFS-based Linux (2.6.39.4).
It runs on pretty much any x86 system, supports network and fits into 20MB RAM.

My goal was to make a small USB-bootable distro and its full image image has to be e-mail-able (<= 5MB in my case). The current ISO size is 4.9MB.

Now I want to add a user-invoked script for self-replication to a USB stick.
The script should find, partition and format the inserted media, install bootloader (I use extlinux), copy kernel and ramdisk images and extlinux config file.

I don't want to rely on original CD/USB disk presence.
I want to be self-contained as much as possible.
When init process is done I don't want to assume anything about inserted media. The only reliable code I have is in RAM.

Ramdisk image is easy: I'll just cpio running ramfs to the media.

The question is how to obtain the kernel image on a running system.
Since I am restricted by 5MB image size I don't want to have a static copy of kernel in my ramfs during build time.

1.
Is it possible to extract from RAM (uncompressed?) copy of the running kernel that would be equivalent to the originally built kernel?

If it's not possible, then during init scripts execution I have to find out the original boot device and copy kernel image to my ramfs.

2.
How can I reliably find the device that my running kernel was taken from (some kernel parameter passed from extlinux?)?

Do you have any other suggestions how to make self-replication without relying on post-init data outside of RAM?

Thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DNS not replicating deibertine Linux - Desktop 11 07-17-2009 01:52 PM
Replicating SVN? your_shadow03 Linux - Newbie 11 12-18-2008 10:49 PM
Replicating a Linux system Joce78 Linux - General 15 09-13-2008 06:39 AM
DNS not replicating rbblue Linux - Networking 1 05-01-2008 04:43 PM
Replicating files between servers. cpgeorge Linux - Networking 6 12-10-2004 10:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 01:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration