Parcourir la source

[bzimage] Kill off the initrd image type

We can just treat all non-kernel images as initrds, which matches our
behaviour for multiboot kernels.  This allows us to eliminate initrd as
an image type, and treat the "initrd" command as just another synonym for
"imgfetch".
tags/v0.9.4
Michael Brown il y a 16 ans
Parent
révision
dbe9269f3a
4 fichiers modifiés avec 6 ajouts et 76 suppressions
  1. 2
    3
      src/arch/i386/image/bzimage.c
  2. 4
    22
      src/hci/commands/image_cmd.c
  3. 0
    37
      src/image/initrd.c
  4. 0
    14
      src/include/gpxe/initrd.h

+ 2
- 3
src/arch/i386/image/bzimage.c Voir le fichier

@@ -34,7 +34,6 @@
34 34
 #include <gpxe/image.h>
35 35
 #include <gpxe/segment.h>
36 36
 #include <gpxe/init.h>
37
-#include <gpxe/initrd.h>
38 37
 #include <gpxe/cpio.h>
39 38
 #include <gpxe/features.h>
40 39
 
@@ -188,8 +187,8 @@ static size_t bzimage_load_initrd ( struct image *image,
188 187
 	struct cpio_header cpio;
189 188
         size_t offset = 0;
190 189
 
191
-	/* Ignore images which aren't initrds */
192
-	if ( initrd->type != &initrd_image_type )
190
+	/* Do not include kernel image itself as an initrd */
191
+	if ( initrd == image )
193 192
 		return 0;
194 193
 
195 194
 	/* Create cpio header before non-prebuilt images */

+ 4
- 22
src/hci/commands/image_cmd.c Voir le fichier

@@ -24,7 +24,6 @@
24 24
 #include <getopt.h>
25 25
 #include <gpxe/image.h>
26 26
 #include <gpxe/command.h>
27
-#include <gpxe/initrd.h>
28 27
 #include <usr/imgmgmt.h>
29 28
 
30 29
 /** @file
@@ -222,23 +221,6 @@ static int kernel_exec ( int argc, char **argv ) {
222 221
 	return 0;
223 222
 }
224 223
 
225
-/**
226
- * The "initrd" command
227
- *
228
- * @v argc		Argument count
229
- * @v argv		Argument list
230
- * @ret rc		Exit code
231
- */
232
-static int initrd_exec ( int argc, char **argv ) {
233
-	int rc;
234
-
235
-	if ( ( rc = imgfetch_core_exec ( &initrd_image_type, IMG_FETCH,
236
-					 argc, argv ) ) != 0 )
237
-		return rc;
238
-
239
-	return 0;
240
-}
241
-
242 224
 /**
243 225
  * "imgload" command syntax message
244 226
  *
@@ -557,12 +539,12 @@ struct command image_commands[] __command = {
557 539
 		.exec = imgfetch_exec, /* synonym for "imgfetch" */
558 540
 	},
559 541
 	{
560
-		.name = "kernel",
561
-		.exec = kernel_exec,
542
+		.name = "initrd",
543
+		.exec = imgfetch_exec, /* synonym for "imgfetch" */
562 544
 	},
563 545
 	{
564
-		.name = "initrd",
565
-		.exec = initrd_exec,
546
+		.name = "kernel",
547
+		.exec = kernel_exec,
566 548
 	},
567 549
 	{
568 550
 		.name = "imgload",

+ 0
- 37
src/image/initrd.c Voir le fichier

@@ -1,37 +0,0 @@
1
-/*
2
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
3
- *
4
- * This program is free software; you can redistribute it and/or
5
- * modify it under the terms of the GNU General Public License as
6
- * published by the Free Software Foundation; either version 2 of the
7
- * License, or any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful, but
10
- * WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
- * General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU General Public License
15
- * along with this program; if not, write to the Free Software
16
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
- */
18
-
19
-/**
20
- * @file
21
- *
22
- * Linux initrd image format
23
- *
24
- * This file does nothing except provide a way to mark images as being
25
- * initrds.  The actual processing is done in the Linux kernel image
26
- * code; this file exists so that we can include the "initrd" command
27
- * without necessarily dragging in the Linux image format.
28
- *
29
- */
30
-
31
-#include <gpxe/image.h>
32
-#include <gpxe/initrd.h>
33
-
34
-/** Linux initrd image type */
35
-struct image_type initrd_image_type __image_type ( PROBE_NORMAL ) = {
36
-	.name = "initrd",
37
-};

+ 0
- 14
src/include/gpxe/initrd.h Voir le fichier

@@ -1,14 +0,0 @@
1
-#ifndef _GPXE_INITRD_H
2
-#define _GPXE_INITRD_H
3
-
4
-/**
5
- * @file
6
- *
7
- * Linux initrd image format
8
- *
9
- */
10
-
11
-#include <gpxe/image.h>
12
-extern struct image_type initrd_image_type __image_type ( PROBE_NORMAL );
13
-
14
-#endif /* _GPXE_INITRD_H */

Chargement…
Annuler
Enregistrer