1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2025-04-21 12:27:27 +03:00

add-ext2-fs.patch

This adds ext2 support from U-Boot and stitches it into the
partition stuff.  It also upgrades the board definitions so they
can define the path to look for in the ext2 filesystem being
mounted.  I used /boot/uImage.bin because this is already in use
by the packaged kernel.

We now mount, open and pull the kernel from ext2 in phase2.c if
the kernel source defines it.

Signed-off-by: Andy Green <andy@openmoko.com>
This commit is contained in:
Andy Green
2008-11-28 10:16:37 +00:00
committed by Andy Green
parent 935ef0e12d
commit ec8ea0c281
12 changed files with 1269 additions and 73 deletions
+80
View File
@@ -0,0 +1,80 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
*
* (C) Copyright 2003 Sysgo Real-Time Solutions, AG <www.elinos.com>
* Pavel Bartusek <pba@sysgo.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* An implementation for the Ext2FS filesystem ported from GRUB.
* Some parts of this code (mainly the structures and defines) are
* from the original ext2 fs code, as found in the linux kernel.
*/
#define SECTOR_SIZE 0x200
#define SECTOR_BITS 9
/* Error codes */
typedef enum
{
ERR_NONE = 0,
ERR_BAD_FILENAME,
ERR_BAD_FILETYPE,
ERR_BAD_GZIP_DATA,
ERR_BAD_GZIP_HEADER,
ERR_BAD_PART_TABLE,
ERR_BAD_VERSION,
ERR_BELOW_1MB,
ERR_BOOT_COMMAND,
ERR_BOOT_FAILURE,
ERR_BOOT_FEATURES,
ERR_DEV_FORMAT,
ERR_DEV_VALUES,
ERR_EXEC_FORMAT,
ERR_FILELENGTH,
ERR_FILE_NOT_FOUND,
ERR_FSYS_CORRUPT,
ERR_FSYS_MOUNT,
ERR_GEOM,
ERR_NEED_LX_KERNEL,
ERR_NEED_MB_KERNEL,
ERR_NO_DISK,
ERR_NO_PART,
ERR_NUMBER_PARSING,
ERR_OUTSIDE_PART,
ERR_READ,
ERR_SYMLINK_LOOP,
ERR_UNRECOGNIZED,
ERR_WONT_FIT,
ERR_WRITE,
ERR_BAD_ARGUMENT,
ERR_UNALIGNED,
ERR_PRIVILEGED,
ERR_DEV_NEED_INIT,
ERR_NO_DISK_SPACE,
ERR_NUMBER_OVERFLOW,
MAX_ERR_NUM
} ext2fs_error_t;
extern int ext2fs_ls(char *dirname);
extern int ext2fs_open(const char *filename);
extern int ext2fs_read(char *buf, unsigned len);
extern int ext2fs_mount(void);
extern int ext2fs_close(void);
+2 -4
View File
@@ -33,8 +33,6 @@
#ifndef __IMAGE_H__
#define __IMAGE_H__
#include <arpa/inet.h>
/*
* Operating System Codes
*/
@@ -204,8 +202,8 @@ typedef struct bootm_headers {
*/
#define CHUNKSZ (64 * 1024)
#define uimage_to_cpu(x) ntohl(x)
#define cpu_to_uimage(x) htonl(x)
#define uimage_to_cpu(x) __be32_to_cpu(x)
#define cpu_to_uimage(x) __cpu_to_be32(x)
const char *genimg_get_os_name (uint8_t os);
const char *genimg_get_arch_name (uint8_t arch);
+8 -3
View File
@@ -23,11 +23,15 @@
#include <stdarg.h>
#include <qi-ctype.h>
#include <asm/byteorder.h>
#define u32 unsigned int
#define u16 unsigned short
#define u8 unsigned char
typedef unsigned int uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
@@ -41,11 +45,12 @@ enum filesystem {
struct kernel_source {
const char *name; /* NULL name means invalid */
const char *filepath;
int (*block_init)(void);
int (*block_read)(unsigned char * buf, unsigned long start512,
int blocks512);
int partition_index; /* -1 means no partition table */
int offset_if_no_partition; /* used if partition_index is -1 */
int offset_blocks512_if_no_partition; /* used if partition_index is -1 */
enum filesystem filesystem;
const char * commandline;
};
@@ -75,6 +80,7 @@ struct board_api {
/* this is the board we are running on */
extern struct board_api const * this_board;
extern struct kernel_source const * this_kernel;
int printk(const char *fmt, ...);
int vsprintf(char *buf, const char *fmt, va_list args);
@@ -84,8 +90,7 @@ void print8(unsigned char u);
void print32(unsigned int u);
void printdec(int n);
void hexdump(unsigned char *start, int len);
unsigned int _ntohl(unsigned int n);
unsigned int _letocpu(unsigned int n);
unsigned long crc32(unsigned long crc, const unsigned char *buf,
unsigned int len);
int nand_read_ll(unsigned char *buf, unsigned long start512, int blocks512);