* RE: [PATCH] swap=<device> kernel commandline
@ 2000-11-19 12:20 Anders Eriksson
0 siblings, 0 replies; 10+ messages in thread
From: Anders Eriksson @ 2000-11-19 12:20 UTC (permalink / raw)
To: Eric W. Biederman, Werner Almesberger; +Cc: Linux kernel list
>===== Original Message From ebiederm@xmission.com (Eric W. Biederman) =====
>Werner Almesberger <Werner.Almesberger@epfl.ch> writes:
>
>> Eric W. Biederman wrote:
>> > I have one that loads a second kernel over the network using dhcp
>> > to configure it's interface and tftp to fetch the image and boots
>> > that is only 20kb uncompressed....
>>
>> Neat ;-) My goal is actually not only size, but also to have a relatively
>> normal build environment, e.g. my example is with shared newlib, regular
>> ash, and - unfortunately rather wasteful - glibc's ld.so.
>>
>> But a tftp loader in 20kB is rather good. Now the next challenge is the
>> same thing with NFS. Then we can finally kill nfsroot ;-)
>
>Hmm. What does it take to mount an NFS partition?
>
>Anyway. All I did was wrote a tiny libc that is just a bunch of
>wrappers for syscalls, and some string functions. Then I just wrote
>a straight forward C program to do the job. Except for my added
>kexec call I can compile with glibc :)
>
>Now if glibc wouldn't link in 200k of unused crap when you make a
>trivial static binary I'd much prefer to use it...
>
>Though I wish it was possible to have a ramfs preloader instead of
>initrd. An initramfs would allow me to not even compile in the block
>device driver layer, and be more efficient.
>
A discussion on l-k two months ago revealed that someone actually had made a
patch that took a tarball (masquaraded as an initrd image) and unpacked it
into a ramfs. I've got the mail samewhere if you want it.
/Anders
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] swap=<device> kernel commandline
@ 2000-11-18 11:46 Kaj-Michael Lang
2000-11-18 14:15 ` Francois romieu
0 siblings, 1 reply; 10+ messages in thread
From: Kaj-Michael Lang @ 2000-11-18 11:46 UTC (permalink / raw)
To: Linux kernel list
[-- Attachment #1: Type: TEXT/PLAIN, Size: 260 bytes --]
This patch adds a swap kernel commandline option, so that you can add a
swap partition before init starts running on a low-memory machine.
The patch is against 2.4.0-test11-pre7
This is my first try at a kernel patch so... I hope someone finds it
usefull.
[-- Attachment #2: Type: TEXT/PLAIN, Size: 1362 bytes --]
--- init/main.c-2.4.0test11-pre7 Sat Nov 18 12:30:59 2000
+++ init/main.c Sat Nov 18 12:35:08 2000
@@ -131,6 +131,7 @@
int root_mountflags = MS_RDONLY;
char *execute_command;
char root_device_name[64];
+char swap_device_name[64];
static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
@@ -297,6 +298,25 @@
__setup("root=", root_dev_setup);
+static int __init swap_dev_setup(char *line)
+{
+ int i;
+ char ch;
+
+ memset (swap_device_name, 0, sizeof swap_device_name);
+ for (i = 0; i < sizeof swap_device_name - 1; ++i)
+ {
+ ch = line[i];
+ if ( isspace (ch) || (ch == ',') || (ch == '\0') ) break;
+ swap_device_name[i] = ch;
+ }
+ return 1;
+}
+
+
+__setup("swap=", swap_dev_setup);
+
+
static int __init checksetup(char *line)
{
struct kernel_param *p;
@@ -725,6 +745,15 @@
mount_devfs_fs ();
+ if (swap_device_name[0]!=0) {
+ printk("Setting up swap: %s \n",swap_device_name);
+ if ( sys_swapon(swap_device_name,0)==0 ) {
+ printk("Swapon ok\n");
+ } else {
+ printk("Swapon failed!\n");
+ }
+ }
+
#ifdef CONFIG_BLK_DEV_INITRD
root_mountflags = real_root_mountflags;
if (mount_initrd && ROOT_DEV != real_root_dev
@@ -780,3 +809,4 @@
execve("/bin/sh",argv_init,envp_init);
panic("No init found. Try passing init= option to kernel.");
}
+
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] swap=<device> kernel commandline
2000-11-18 11:46 Kaj-Michael Lang
@ 2000-11-18 14:15 ` Francois romieu
2000-11-18 20:05 ` Rik van Riel
0 siblings, 1 reply; 10+ messages in thread
From: Francois romieu @ 2000-11-18 14:15 UTC (permalink / raw)
To: Kaj-Michael Lang; +Cc: Linux kernel list
Hi,
The Sat, Nov 18, 2000 at 01:46:40PM +0200, Kaj-Michael Lang wrote :
> This patch adds a swap kernel commandline option, so that you can add a
> swap partition before init starts running on a low-memory machine.
Did you try and add swap from an initrd image ? It should work and it's
already there.
--
Ueimor
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] swap=<device> kernel commandline
2000-11-18 14:15 ` Francois romieu
@ 2000-11-18 20:05 ` Rik van Riel
2000-11-18 21:34 ` Werner Almesberger
0 siblings, 1 reply; 10+ messages in thread
From: Rik van Riel @ 2000-11-18 20:05 UTC (permalink / raw)
To: Francois romieu; +Cc: Kaj-Michael Lang, Linux kernel list
On Sat, 18 Nov 2000, Francois romieu wrote:
> The Sat, Nov 18, 2000 at 01:46:40PM +0200, Kaj-Michael Lang wrote :
> > This patch adds a swap kernel commandline option, so that you can add a
> > swap partition before init starts running on a low-memory machine.
^^^^^^^^^^
> Did you try and add swap from an initrd image ? It should work
> and it's already there.
Did you try to load an initrd on a low-memory machine?
It shouldn't work and it probably won't ;)
regards,
Rik
--
"What you're running that piece of shit Gnome?!?!"
-- Miguel de Icaza, UKUUG 2000
http://www.conectiva.com/ http://www.surriel.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] swap=<device> kernel commandline
2000-11-18 20:05 ` Rik van Riel
@ 2000-11-18 21:34 ` Werner Almesberger
2000-11-18 18:54 ` Pavel Machek
2000-11-19 0:29 ` Eric W. Biederman
0 siblings, 2 replies; 10+ messages in thread
From: Werner Almesberger @ 2000-11-18 21:34 UTC (permalink / raw)
To: Rik van Riel; +Cc: Linux kernel list
Rik van Riel wrote:
> Did you try to load an initrd on a low-memory machine?
> It shouldn't work and it probably won't ;)
You must be really low on memory ;-)
# zcat initrd.gz | wc -c
409600
(ash, pwd, chroot, pivot_root, smount, and still about 82 kB free.)
- Werner
--
_________________________________________________________________________
/ Werner Almesberger, ICA, EPFL, CH Werner.Almesberger@epfl.ch /
/_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] swap=<device> kernel commandline
2000-11-18 21:34 ` Werner Almesberger
@ 2000-11-18 18:54 ` Pavel Machek
2000-11-19 0:29 ` Eric W. Biederman
1 sibling, 0 replies; 10+ messages in thread
From: Pavel Machek @ 2000-11-18 18:54 UTC (permalink / raw)
To: Werner Almesberger; +Cc: Rik van Riel, Linux kernel list
Hi1
> > Did you try to load an initrd on a low-memory machine?
> > It shouldn't work and it probably won't ;)
>
> You must be really low on memory ;-)
>
> # zcat initrd.gz | wc -c
> 409600
>
> (ash, pwd, chroot, pivot_root, smount, and still about 82 kB free.)
Your solution requires 400K initrd _plus_ memory for ash and swapon. That
might be easily 600K total. Yes I could imagine machine with freemem less
than that. However such machines do not usually have swap available.
Pavel
--
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt,
details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] swap=<device> kernel commandline
2000-11-18 21:34 ` Werner Almesberger
2000-11-18 18:54 ` Pavel Machek
@ 2000-11-19 0:29 ` Eric W. Biederman
2000-11-19 2:03 ` Werner Almesberger
1 sibling, 1 reply; 10+ messages in thread
From: Eric W. Biederman @ 2000-11-19 0:29 UTC (permalink / raw)
To: Werner Almesberger; +Cc: Rik van Riel, Linux kernel list
Werner Almesberger <Werner.Almesberger@epfl.ch> writes:
> Rik van Riel wrote:
> > Did you try to load an initrd on a low-memory machine?
> > It shouldn't work and it probably won't ;)
>
> You must be really low on memory ;-)
>
> # zcat initrd.gz | wc -c
> 409600
>
> (ash, pwd, chroot, pivot_root, smount, and still about 82 kB free.)
Hmm.... And that's without trying to be small.
I have one that loads a second kernel over the network using dhcp
to configure it's interface and tftp to fetch the image and boots
that is only 20kb uncompressed....
Compressed I can fit that and a kernel all in plus a minimal
BIOS all in 512K with some room to spare...
Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] swap=<device> kernel commandline
2000-11-19 0:29 ` Eric W. Biederman
@ 2000-11-19 2:03 ` Werner Almesberger
2000-11-19 7:30 ` Eric W. Biederman
0 siblings, 1 reply; 10+ messages in thread
From: Werner Almesberger @ 2000-11-19 2:03 UTC (permalink / raw)
To: Eric W. Biederman; +Cc: Linux kernel list
Eric W. Biederman wrote:
> I have one that loads a second kernel over the network using dhcp
> to configure it's interface and tftp to fetch the image and boots
> that is only 20kb uncompressed....
Neat ;-) My goal is actually not only size, but also to have a relatively
normal build environment, e.g. my example is with shared newlib, regular
ash, and - unfortunately rather wasteful - glibc's ld.so.
But a tftp loader in 20kB is rather good. Now the next challenge is the
same thing with NFS. Then we can finally kill nfsroot ;-)
- Werner
--
_________________________________________________________________________
/ Werner Almesberger, ICA, EPFL, CH Werner.Almesberger@epfl.ch /
/_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] swap=<device> kernel commandline
2000-11-19 2:03 ` Werner Almesberger
@ 2000-11-19 7:30 ` Eric W. Biederman
2000-11-19 12:27 ` Werner Almesberger
0 siblings, 1 reply; 10+ messages in thread
From: Eric W. Biederman @ 2000-11-19 7:30 UTC (permalink / raw)
To: Werner Almesberger; +Cc: Linux kernel list
Werner Almesberger <Werner.Almesberger@epfl.ch> writes:
> Eric W. Biederman wrote:
> > I have one that loads a second kernel over the network using dhcp
> > to configure it's interface and tftp to fetch the image and boots
> > that is only 20kb uncompressed....
>
> Neat ;-) My goal is actually not only size, but also to have a relatively
> normal build environment, e.g. my example is with shared newlib, regular
> ash, and - unfortunately rather wasteful - glibc's ld.so.
>
> But a tftp loader in 20kB is rather good. Now the next challenge is the
> same thing with NFS. Then we can finally kill nfsroot ;-)
Hmm. What does it take to mount an NFS partition?
Anyway. All I did was wrote a tiny libc that is just a bunch of
wrappers for syscalls, and some string functions. Then I just wrote
a straight forward C program to do the job. Except for my added
kexec call I can compile with glibc :)
Now if glibc wouldn't link in 200k of unused crap when you make a
trivial static binary I'd much prefer to use it...
Though I wish it was possible to have a ramfs preloader instead of
initrd. An initramfs would allow me to not even compile in the block
device driver layer, and be more efficient.
Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] swap=<device> kernel commandline
2000-11-19 7:30 ` Eric W. Biederman
@ 2000-11-19 12:27 ` Werner Almesberger
0 siblings, 0 replies; 10+ messages in thread
From: Werner Almesberger @ 2000-11-19 12:27 UTC (permalink / raw)
To: Eric W. Biederman; +Cc: Linux kernel list
Eric W. Biederman wrote:
> Hmm. What does it take to mount an NFS partition?
Mainly Sun RPC :-(
> Anyway. All I did was wrote a tiny libc that is just a bunch of
> wrappers for syscalls, and some string functions.
Certainly a good approach. It's also basically the idea behind newlib,
although newlib has more overhead.
Ultimately, I want to be able to compile regular Unix/Linux programs
out of the box. Right now, this works for a bunch of trivial programs,
and it almost works for ash.
> Now if glibc wouldn't link in 200k of unused crap when you make a
> trivial static binary I'd much prefer to use it...
Precisely why I went to newlib ... It's really a pity that glibc is
such a monster.
> Though I wish it was possible to have a ramfs preloader instead of
> initrd. An initramfs would allow me to not even compile in the block
> device driver layer, and be more efficient.
Hmm, this would be tricky. You could do it by implementing a simple
tar file reader in the kernel, which reads from /dev/initrd (well, it's
in-kernel representation), but I'm not sure if this buys you that much
in the end. (How much overhead is in block devices anyway ?)
- Werner
--
_________________________________________________________________________
/ Werner Almesberger, ICA, EPFL, CH Werner.Almesberger@epfl.ch /
/_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2000-11-19 20:36 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-11-19 12:20 [PATCH] swap=<device> kernel commandline Anders Eriksson
-- strict thread matches above, loose matches on Subject: below --
2000-11-18 11:46 Kaj-Michael Lang
2000-11-18 14:15 ` Francois romieu
2000-11-18 20:05 ` Rik van Riel
2000-11-18 21:34 ` Werner Almesberger
2000-11-18 18:54 ` Pavel Machek
2000-11-19 0:29 ` Eric W. Biederman
2000-11-19 2:03 ` Werner Almesberger
2000-11-19 7:30 ` Eric W. Biederman
2000-11-19 12:27 ` Werner Almesberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox