2 * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
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.
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.
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.
22 * Linux bzImage image format
30 #include <gpxe/uaccess.h>
31 #include <gpxe/image.h>
32 #include <gpxe/segment.h>
33 #include <gpxe/memmap.h>
34 #include <gpxe/shutdown.h>
36 struct image_type bzimage_image_type __image_type ( PROBE_NORMAL );
39 * Execute bzImage image
41 * @v image bzImage image
42 * @ret rc Return status code
44 static int bzimage_exec ( struct image *image ) {
48 * Load bzImage image into memory
50 * @v image bzImage file
51 * @ret rc Return status code
53 int bzimage_load ( struct image *image ) {
54 struct bzimage_header bzhdr;
57 if ( image->len < ( BZHDR_OFFSET + sizeof ( bzhdr ) ) ) {
58 DBGC ( image, "BZIMAGE %p too short\n", image );
62 /* Read and verify header */
63 copy_from_user ( &bzhdr, image->data, BZHDR_OFFSET, sizeof ( bzhdr ) );
64 if ( bzhdr.header != BZIMAGE_SIGNATURE ) {
65 DBGC ( image, "BZIMAGE %p not a bzImage\n", image );
69 /* This is a bzImage image, valid or otherwise */
71 image->type = &bzimage_image_type;
76 /** Linux bzImage image type */
77 struct image_type bzimage_image_type __image_type ( PROBE_NORMAL ) = {