Skip to contentSkip to conversation

Booting uncompressed kernel image on i386?

DISCUSSION Ondrej Zary 2 participants 4 messages Jun 28, 2005 – Jul 1, 2005 Kbuild

lore
Share & tools
lore
#0 lore raw

Is there an easy way to boot uncompressed kernel (2.6) image instead of the compressed one (bzImage) - using e.g. LILO?
I'm trying to do that because the decompression takes about 15 seconds on my i386 (it's really an i386 - i386DX/25 :-) The uncompressed kernel is about 1.5MB. I've already tried compressing it using gzip -1 instead of gzip -9 but that didn't make decompression any faster.

Signature · 1 line
Ondrej Zary
#1 lore raw
Quoted 3 lines · Ondrej Zary

Is there an easy way to boot uncompressed kernel (2.6) image instead of the compressed one (bzImage) - using e.g. LILO?
I'm trying to do that because the decompression takes about 15 seconds on my i386 (it's really an i386 - i386DX/25 :-) The uncompressed kernel is about 1.5MB. I've already tried compressing it using gzip -1 instead of gzip -9 but that didn't make decompression any faster.

Nobody answered, time to look at the code :-)
The attached patch is a quick hack so "make" will create uncompressed kernel that can be booted in regular way.

Signature · 1 line
Ondrej Zary
scripts/Makefile.lib +1 -1
@@ -177,7 +177,7 @@
 # ---------------------------------------------------------------------------
 
 quiet_cmd_gzip = GZIP    $@
-cmd_gzip = gzip -f -9 < $< > $@
+cmd_gzip = cat < $< > $@
 
 # ===========================================================================
 # Generic stuff
arch/i386/boot/compressed/misc.c +9 -1
@@ -374,7 +374,15 @@
 
 	makecrc();
 	putstr("Uncompressing Linux... ");
-	gunzip();
+	int i;
+	for (i = 0; i < input_len / WSIZE; i++) {
+		memcpy(window, input_data+i*WSIZE, WSIZE);
+		outcnt = WSIZE;
+		flush_window();
+	}
+	memcpy(window, input_data+i*WSIZE, input_len % WSIZE);
+	outcnt = input_len % WSIZE;
+	flush_window();
 	putstr("Ok, booting the kernel.\n");
 	if (high_loaded) close_output_buffer_if_we_run_high(mv);
 	return high_loaded;
#2 lore raw

arch/i386/boot/compressed/misc.c line 376

Quoted 10 lines · Ondrej Zary

Nobody answered, time to look at the code :-)
The attached patch is a quick hack so "make" will create uncompressed kernel that can be booted in regular way.

arch/i386/boot/compressed/misc.c +0 -0
@@ -374,7 +374,15 @@
 
 	makecrc();
 	putstr("Uncompressing Linux... ");

Would it not make sense to remove the above line? You're not actually uncompressing anything.

Quoted 13 lines
arch/i386/boot/compressed/misc.c +9 -1
-	gunzip();
+	int i;
+	for (i = 0; i < input_len / WSIZE; i++) {
+		memcpy(window, input_data+i*WSIZE, WSIZE);
+		outcnt = WSIZE;
+		flush_window();
+	}
+	memcpy(window, input_data+i*WSIZE, input_len % WSIZE);
+	outcnt = input_len % WSIZE;
+	flush_window();
 	putstr("Ok, booting the kernel.\n");
 	if (high_loaded) close_output_buffer_if_we_run_high(mv);
 	return high_loaded;
Signature · 1 line
 Lab tests show that use of micro$oft causes cancer in lab animals
#3 lore raw
Quoted 10 lines · Wakko Warner
Quoted 8 lines · Ondrej Zary

Nobody answered, time to look at the code :-)
The attached patch is a quick hack so "make" will create uncompressed kernel that can be booted in regular way.

arch/i386/boot/compressed/misc.c +0 -0
@@ -374,7 +374,15 @@
 
Quoted 7 lines

arch/i386/boot/compressed/misc.c line 376

Quoted 2 lines
arch/i386/boot/compressed/misc.c +0 -0
 	makecrc();
 	putstr("Uncompressing Linux... ");

Would it not make sense to remove the above line? You're not actually uncompressing anything.

It would but I kept it there for debugging (to see where it crashed :-)
Anyway, I'd like to add new target "make uImage" (or something like that) but that requires more work. Something like this might be interesting for embedded systems which want to minimalize boot time.

Quoted 15 lines
Quoted 13 lines
arch/i386/boot/compressed/misc.c +9 -1
-	gunzip();
+	int i;
+	for (i = 0; i < input_len / WSIZE; i++) {
+		memcpy(window, input_data+i*WSIZE, WSIZE);
+		outcnt = WSIZE;
+		flush_window();
+	}
+	memcpy(window, input_data+i*WSIZE, input_len % WSIZE);
+	outcnt = input_len % WSIZE;
+	flush_window();
 	putstr("Ok, booting the kernel.\n");
 	if (high_loaded) close_output_buffer_if_we_run_high(mv);
 	return high_loaded;
Signature · 1 line
Ondrej Zary