Linux loader for OLPC
PATCH 1/1 Linux loader for OLPC
Hi,
This patch add support for the linux loader in OLPC.
2008-03-28 Bean <[email protected]>
* conf/i386-ieee1275.rmk (pkglib_MODULES): Add _linux.mod and linux.mod. (_linux_mod_SOURCES): New variable.
(_linux_mod_CFLAGS): Likewise.
(_linux_mod_LDFLAGS): Likewise.
(linux_mod_SOURCES): Likewise.
(linux_mod_CFLAGS): Likewise.
(linux_mod_LDFLAGS): Likewise.
* include/grub/i386/ieee1275/loader.h (grub_rescue_cmd_linux): New function prototype.
(grub_rescue_cmd_initrd): Likewise.
* include/grub/i386/linux.h (GRUB_LINUX_OFW_SIGNATURE): New macro. (linux_kernel_params): Add new member ofw_signature, ofw_num_items, ofw_cif_handler and ofw_idt, adjust padding number.
* include/grub/i386/pc/memory.h (grub_upper_mem): Export it if GRUB_MACHINE_IEEE1275 is defined.
* include/grub/ieee1275/ieee1275.h (grub_available_iterate):
Use NESTED_FUNC_ATTR attribute on the hook parameter.
* kern/powerpc/ieee1275/init.c (grub_claim_heap): Use NESTED_FUNC_ATTR on nested function heap_init.
(grub_upper_mem): New variable for i386-ieee1275. (grub_get_extended_memory): New function for i386-ieee1275. (grub_machine_init): Call grub_get_extended_memory for i386-ieee1275.
* kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Use NESTED_FUNC_ATTR on the hook parameter.
* loader/i386/ieee1275/linux.c: New file.
* loader/i386/ieee1275/linux_normal.c: New file.
Signature · 1 line
Bean
conf/i386-ieee1275.rmk +12 -1
@@ -97,7 +97,8 @@ grub_emu_LDFLAGS = $(LIBCURSES) # Modules. pkglib_MODULES = normal.mod halt.mod reboot.mod suspend.mod cpuid.mod \ - multiboot.mod _multiboot.mod aout.mod serial.mod + multiboot.mod _multiboot.mod aout.mod serial.mod linux.mod \ + _linux.mod # For normal.mod. normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \
@@ -151,4 +152,14 @@ serial_mod_SOURCES = term/i386/pc/serial.c serial_mod_CFLAGS = $(COMMON_CFLAGS) serial_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For _linux.mod. +_linux_mod_SOURCES = loader/i386/ieee1275/linux.c +_linux_mod_CFLAGS = $(COMMON_CFLAGS) +_linux_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For linux.mod. +linux_mod_SOURCES = loader/i386/ieee1275/linux_normal.c +linux_mod_CFLAGS = $(COMMON_CFLAGS) +linux_mod_LDFLAGS = $(COMMON_LDFLAGS) + include $(srcdir)/conf/common.mk
include/grub/i386/ieee1275/loader.h +3 -0
@@ -27,4 +27,7 @@ void EXPORT_FUNC(grub_multiboot2_real_boot) (grub_addr_t entry, struct grub_multiboot_info *mbi) __attribute__ ((noreturn)); +void grub_rescue_cmd_linux (int argc,char *argv[]); +void grub_rescue_cmd_initrd (int argc,char *argv[]); +#endif /* ! GRUB_LOADER_MACHINE_HEADER */
include/grub/i386/linux.h +14 -4
@@ -47,6 +47,9 @@#define GRUB_LINUX_EFI_SIGNATURE \ ('E' << 24 | 'F' << 16 | 'I' << 8 | 'L') +#define GRUB_LINUX_OFW_SIGNATURE \ + (' ' << 24 | 'W' << 16 | 'F' << 8 | 'O') +#ifndef ASM_FILE /* For the Linux/i386 boot protocol version 2.03. */
@@ -154,7 +157,14 @@ struct linux_kernel_paramsgrub_uint8_t hd1_drive_info[0x10 ];/* 90 */ grub_uint16_t rom_config_len;/* a0 */ -grub_uint8_t padding6[0x1c0 -0xa2 ]; +grub_uint8_t padding6[0xb0 -0xa2 ]; + +grub_uint32_t ofw_signature;/* b0 */ +grub_uint32_t ofw_num_items;/* b4 */ +grub_uint32_t ofw_cif_handler;/* b8 */ +grub_uint32_t ofw_idt;/* bc */ + +grub_uint8_t padding7[0x1c0 -0xc0 ];grub_uint32_t efi_signature;/* 1c0 */ grub_uint32_t efi_system_table;/* 1c4 */
@@ -163,15 +173,15 @@ struct linux_kernel_paramsgrub_uint32_t efi_mmap;/* 1d0 */ grub_uint32_t efi_mmap_size;/* 1d4 */ -grub_uint8_t padding7[0x1e0 -0x1d8 ]; +grub_uint8_t padding8[0x1e0 -0x1d8 ];grub_uint32_t alt_mem;/* 1e0 */ -grub_uint8_t padding8[0x1e8 -0x1e4 ]; +grub_uint8_t padding9[0x1e8 -0x1e4 ];grub_uint32_t mmap_size;/* 1e8 */ -grub_uint8_t padding9[0x1ff -0x1ec ]; +grub_uint8_t padding10[0x1ff -0x1ec ];grub_uint8_t ps_mouse;/* 1ff */ } __attribute__ ((packed));
include/grub/i386/pc/memory.h +5 -2
@@ -76,11 +76,14 @@/* The data segment of the pseudo real mode. */ #define GRUB_MEMORY_MACHINE_PSEUDO_REAL_DSEG 0x20 -#ifndef GRUB_MACHINE_IEEE1275 #ifndef ASM_FILE + +#ifndef GRUB_MACHINE_IEEE1275 extern grub_size_t EXPORT_VAR (grub_lower_mem ); -extern grub_size_t EXPORT_VAR (grub_upper_mem );#endif + +extern grub_size_t EXPORT_VAR (grub_upper_mem ); +#endif #endif /* ! GRUB_MEMORY_MACHINE_HEADER */
include/grub/ieee1275/ieee1275.h +1 -1
@@ -158,7 +158,7 @@ grub_err_t EXPORT_FUNC(grub_devalias_iterate)grub_err_t EXPORT_FUNC (grub_children_iterate ) (char *devpath,int (*hook) (struct grub_ieee1275_devalias *alias));grub_err_t EXPORT_FUNC (grub_available_iterate ) - (int (*hook) (grub_uint64_t ,grub_uint64_t )); + (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t));int EXPORT_FUNC (grub_claimmap ) (grub_addr_t addr,grub_size_t size);char *EXPORT_FUNC (grub_ieee1275_encode_devname ) (const char *path);
kern/powerpc/ieee1275/init.c +28 -2
@@ -128,8 +128,8 @@ static void grub_claim_heap (void) {unsigned long total =0 ; - autoint heap_init (grub_uint64_t addr,grub_uint64_t len); -int heap_init (grub_uint64_t addr,grub_uint64_t len) + auto int NESTED_FUNC_ATTR heap_init (grub_uint64_t addr, grub_uint64_t len); + int NESTED_FUNC_ATTR heap_init (grub_uint64_t addr, grub_uint64_t len) { len -=1 ;/* Required for some firmware. */
@@ -174,6 +174,31 @@ static void grub_claim_heap (void)grub_available_iterate (heap_init); } +#ifdef __i386__ + +grub_uint32_t grub_upper_mem; + +/* We need to call this before grub_claim_memory. */ +static void +grub_get_extended_memory (void ) +{ + auto int NESTED_FUNC_ATTR find_ext_mem (grub_uint64_t addr, grub_uint64_t len); + int NESTED_FUNC_ATTR find_ext_mem (grub_uint64_t addr, grub_uint64_t len) + { +if (addr ==0x100000 ) + { + grub_upper_mem = len; +return 1 ; + } + +return 0 ; + } + +grub_available_iterate (find_ext_mem); +} + +#endif +void grub_machine_init (void ) {
@@ -182,6 +207,7 @@ grub_machine_init (void)grub_console_init ();#ifdef __i386__ +grub_get_extended_memory ();grub_keyboard_controller_init ();#endif grub_claim_heap ();
kern/powerpc/ieee1275/openfw.c +1 -1
@@ -147,7 +147,7 @@ nextprop:return 0 ; } -grub_err_t grub_available_iterate (int (*hook) (grub_uint64_t ,grub_uint64_t )) +grub_err_t grub_available_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t)) {grub_ieee1275_phandle_t root;grub_ieee1275_phandle_t memory;
loader/i386/ieee1275/linux.c new file +271 -0
271 lines not on this page · raw message
loader/i386/ieee1275/linux_normal.c new file +60 -0
60 lines not on this page · raw message
Hi,
Small bug fix for the loader, now I can boot the internal linux system using the following commands:
set root=nand
linux (sd,1)/vmlinuz ro root=mtd0 fbcon=font:SUN12x22 initrd (sd,1)/olpcrd.img
boot
The root variable is used to set the bootpath. If root device is usb, it should be set to /pci/usbxxx, if root device is sd, it should be /pci/sdxxx.
Signature · 1 line
Bean
conf/i386-ieee1275.rmk +12 -1
@@ -97,7 +97,8 @@ grub_emu_LDFLAGS = $(LIBCURSES) # Modules. pkglib_MODULES = normal.mod halt.mod reboot.mod suspend.mod cpuid.mod \ - multiboot.mod _multiboot.mod aout.mod serial.mod + multiboot.mod _multiboot.mod aout.mod serial.mod linux.mod \ + _linux.mod # For normal.mod. normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \
@@ -151,4 +152,14 @@ serial_mod_SOURCES = term/i386/pc/serial.c serial_mod_CFLAGS = $(COMMON_CFLAGS) serial_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For _linux.mod. +_linux_mod_SOURCES = loader/i386/ieee1275/linux.c +_linux_mod_CFLAGS = $(COMMON_CFLAGS) +_linux_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For linux.mod. +linux_mod_SOURCES = loader/i386/ieee1275/linux_normal.c +linux_mod_CFLAGS = $(COMMON_CFLAGS) +linux_mod_LDFLAGS = $(COMMON_LDFLAGS) + include $(srcdir)/conf/common.mk
include/grub/i386/ieee1275/loader.h +3 -0
@@ -27,4 +27,7 @@ void EXPORT_FUNC(grub_multiboot2_real_boot) (grub_addr_t entry, struct grub_multiboot_info *mbi) __attribute__ ((noreturn)); +void grub_rescue_cmd_linux (int argc,char *argv[]); +void grub_rescue_cmd_initrd (int argc,char *argv[]); +#endif /* ! GRUB_LOADER_MACHINE_HEADER */
include/grub/i386/linux.h +14 -4
@@ -47,6 +47,9 @@#define GRUB_LINUX_EFI_SIGNATURE \ ('E' << 24 | 'F' << 16 | 'I' << 8 | 'L') +#define GRUB_LINUX_OFW_SIGNATURE \ + (' ' << 24 | 'W' << 16 | 'F' << 8 | 'O') +#ifndef ASM_FILE /* For the Linux/i386 boot protocol version 2.03. */
@@ -154,7 +157,14 @@ struct linux_kernel_paramsgrub_uint8_t hd1_drive_info[0x10 ];/* 90 */ grub_uint16_t rom_config_len;/* a0 */ -grub_uint8_t padding6[0x1c0 -0xa2 ]; +grub_uint8_t padding6[0xb0 -0xa2 ]; + +grub_uint32_t ofw_signature;/* b0 */ +grub_uint32_t ofw_num_items;/* b4 */ +grub_uint32_t ofw_cif_handler;/* b8 */ +grub_uint32_t ofw_idt;/* bc */ + +grub_uint8_t padding7[0x1c0 -0xc0 ];grub_uint32_t efi_signature;/* 1c0 */ grub_uint32_t efi_system_table;/* 1c4 */
@@ -163,15 +173,15 @@ struct linux_kernel_paramsgrub_uint32_t efi_mmap;/* 1d0 */ grub_uint32_t efi_mmap_size;/* 1d4 */ -grub_uint8_t padding7[0x1e0 -0x1d8 ]; +grub_uint8_t padding8[0x1e0 -0x1d8 ];grub_uint32_t alt_mem;/* 1e0 */ -grub_uint8_t padding8[0x1e8 -0x1e4 ]; +grub_uint8_t padding9[0x1e8 -0x1e4 ];grub_uint32_t mmap_size;/* 1e8 */ -grub_uint8_t padding9[0x1ff -0x1ec ]; +grub_uint8_t padding10[0x1ff -0x1ec ];grub_uint8_t ps_mouse;/* 1ff */ } __attribute__ ((packed));
include/grub/i386/pc/memory.h +5 -2
@@ -76,11 +76,14 @@/* The data segment of the pseudo real mode. */ #define GRUB_MEMORY_MACHINE_PSEUDO_REAL_DSEG 0x20 -#ifndef GRUB_MACHINE_IEEE1275 #ifndef ASM_FILE + +#ifndef GRUB_MACHINE_IEEE1275 extern grub_size_t EXPORT_VAR (grub_lower_mem ); -extern grub_size_t EXPORT_VAR (grub_upper_mem );#endif + +extern grub_size_t EXPORT_VAR (grub_upper_mem ); +#endif #endif /* ! GRUB_MEMORY_MACHINE_HEADER */
include/grub/ieee1275/ieee1275.h +1 -1
@@ -158,7 +158,7 @@ grub_err_t EXPORT_FUNC(grub_devalias_iterate)grub_err_t EXPORT_FUNC (grub_children_iterate ) (char *devpath,int (*hook) (struct grub_ieee1275_devalias *alias));grub_err_t EXPORT_FUNC (grub_available_iterate ) - (int (*hook) (grub_uint64_t ,grub_uint64_t )); + (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t));int EXPORT_FUNC (grub_claimmap ) (grub_addr_t addr,grub_size_t size);char *EXPORT_FUNC (grub_ieee1275_encode_devname ) (const char *path);
kern/powerpc/ieee1275/init.c +28 -2
@@ -128,8 +128,8 @@ static void grub_claim_heap (void) {unsigned long total =0 ; - autoint heap_init (grub_uint64_t addr,grub_uint64_t len); -int heap_init (grub_uint64_t addr,grub_uint64_t len) + auto int NESTED_FUNC_ATTR heap_init (grub_uint64_t addr, grub_uint64_t len); + int NESTED_FUNC_ATTR heap_init (grub_uint64_t addr, grub_uint64_t len) { len -=1 ;/* Required for some firmware. */
@@ -174,6 +174,31 @@ static void grub_claim_heap (void)grub_available_iterate (heap_init); } +#ifdef __i386__ + +grub_uint32_t grub_upper_mem; + +/* We need to call this before grub_claim_memory. */ +static void +grub_get_extended_memory (void ) +{ + auto int NESTED_FUNC_ATTR find_ext_mem (grub_uint64_t addr, grub_uint64_t len); + int NESTED_FUNC_ATTR find_ext_mem (grub_uint64_t addr, grub_uint64_t len) + { +if (addr ==0x100000 ) + { + grub_upper_mem = len; +return 1 ; + } + +return 0 ; + } + +grub_available_iterate (find_ext_mem); +} + +#endif +void grub_machine_init (void ) {
@@ -182,6 +207,7 @@ grub_machine_init (void)grub_console_init ();#ifdef __i386__ +grub_get_extended_memory ();grub_keyboard_controller_init ();#endif grub_claim_heap ();
kern/powerpc/ieee1275/openfw.c +1 -1
@@ -147,7 +147,7 @@ nextprop:return 0 ; } -grub_err_t grub_available_iterate (int (*hook) (grub_uint64_t ,grub_uint64_t )) +grub_err_t grub_available_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t)) {grub_ieee1275_phandle_t root;grub_ieee1275_phandle_t memory;
loader/i386/ieee1275/linux.c new file +289 -0
289 lines not on this page · raw message
loader/i386/ieee1275/linux_normal.c new file +60 -0
60 lines not on this page · raw message
Hi,
The new patch add support for the nand flash device in OLPC. However, the flash use jffs2 file system, so you can't list file in it yet, but you can dump the disk with hexdump.
This patch also include an improvement for hexdump that would allow it to dump device as well as file, for example:
hexdump (nand)
I also add a new function grub_getcrc32 in kern/misc.c, this function is useful in many places, for example, jffs2 use it to verify data. A new command crc is also included that would allow user to calculate the crc checksum of file.
Signature · 1 line
Bean
Makefile.in +1 -1
@@ -91,7 +91,7 @@ enable_grub_fstest = @enable_grub_fstest@ ### General variables. RMKFILES = $(addprefix conf/,common.rmk i386-pc.rmk powerpc-ieee1275.rmk \ - sparc64-ieee1275.rmk i386-efi.rmk) + sparc64-ieee1275.rmk i386-efi.rmk i386-ieee1275.rmk i386-linuxbios.rmk) MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES)) PKGLIB = $(pkglib_IMAGES) $(pkglib_MODULES) $(pkglib_PROGRAMS) \
commands/crc.c new file +65 -0
65 lines not on this page · raw message
commands/hexdump.c +47 -13
88 lines not on this page · raw message
conf/common.rmk +6 -1
@@ -276,7 +276,7 @@ pkglib_MODULES += hello.mod boot.mod terminal.mod ls.mod \ cmp.mod cat.mod help.mod font.mod search.mod \ loopback.mod configfile.mod echo.mod \ terminfo.mod test.mod blocklist.mod hexdump.mod \ - read.mod sleep.mod + read.mod sleep.mod crc.mod # For hello.mod. hello_mod_SOURCES = hello/hello.c
@@ -380,3 +380,8 @@ read_mod_LDFLAGS = $(COMMON_LDFLAGS) sleep_mod_SOURCES = commands/sleep.c sleep_mod_CFLAGS = $(COMMON_CFLAGS) sleep_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For crc.mod. +crc_mod_SOURCES = commands/crc.c +crc_mod_CFLAGS = $(COMMON_CFLAGS) +crc_mod_LDFLAGS = $(COMMON_LDFLAGS)
conf/i386-ieee1275.rmk +17 -1
@@ -97,7 +97,8 @@ grub_emu_LDFLAGS = $(LIBCURSES) # Modules. pkglib_MODULES = normal.mod halt.mod reboot.mod suspend.mod cpuid.mod \ - multiboot.mod _multiboot.mod aout.mod serial.mod + multiboot.mod _multiboot.mod aout.mod serial.mod linux.mod \ + _linux.mod nand.mod # For normal.mod. normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \
@@ -151,4 +152,19 @@ serial_mod_SOURCES = term/i386/pc/serial.c serial_mod_CFLAGS = $(COMMON_CFLAGS) serial_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For _linux.mod. +_linux_mod_SOURCES = loader/i386/ieee1275/linux.c +_linux_mod_CFLAGS = $(COMMON_CFLAGS) +_linux_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For linux.mod. +linux_mod_SOURCES = loader/i386/ieee1275/linux_normal.c +linux_mod_CFLAGS = $(COMMON_CFLAGS) +linux_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For nand.mod. +nand_mod_SOURCES = disk/ieee1275/nand.c +nand_mod_CFLAGS = $(COMMON_CFLAGS) +nand_mod_LDFLAGS = $(COMMON_LDFLAGS) + include $(srcdir)/conf/common.mk
disk/ieee1275/nand.c new file +216 -0
216 lines not on this page · raw message
disk/ieee1275/ofdisk.c +1 -1
@@ -109,7 +109,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)if (grub_ieee1275_get_property (dev,"device_type" , prop,sizeof (prop), &actual)) { -grub_error (GRUB_ERR_BAD_DEVICE ,"Can't read the device type" ); +grub_error (GRUB_ERR_UNKNOWN_DEVICE ,"Can't read the device type" ); goto fail; }
include/grub/disk.h +1 -0
@@ -37,6 +37,7 @@ enum grub_disk_dev_idGRUB_DISK_DEVICE_HOST_ID ,GRUB_DISK_DEVICE_ATA_ID ,GRUB_DISK_DEVICE_MEMDISK_ID , + GRUB_DISK_DEVICE_NAND_ID, };struct grub_disk ;
include/grub/i386/ieee1275/loader.h +3 -0
@@ -27,4 +27,7 @@ void EXPORT_FUNC(grub_multiboot2_real_boot) (grub_addr_t entry, struct grub_multiboot_info *mbi) __attribute__ ((noreturn)); +void grub_rescue_cmd_linux (int argc,char *argv[]); +void grub_rescue_cmd_initrd (int argc,char *argv[]); +#endif /* ! GRUB_LOADER_MACHINE_HEADER */
include/grub/i386/linux.h +14 -4
@@ -47,6 +47,9 @@#define GRUB_LINUX_EFI_SIGNATURE \ ('E' << 24 | 'F' << 16 | 'I' << 8 | 'L') +#define GRUB_LINUX_OFW_SIGNATURE \ + (' ' << 24 | 'W' << 16 | 'F' << 8 | 'O') +#ifndef ASM_FILE /* For the Linux/i386 boot protocol version 2.03. */
@@ -154,7 +157,14 @@ struct linux_kernel_paramsgrub_uint8_t hd1_drive_info[0x10 ];/* 90 */ grub_uint16_t rom_config_len;/* a0 */ -grub_uint8_t padding6[0x1c0 -0xa2 ]; +grub_uint8_t padding6[0xb0 -0xa2 ]; + +grub_uint32_t ofw_signature;/* b0 */ +grub_uint32_t ofw_num_items;/* b4 */ +grub_uint32_t ofw_cif_handler;/* b8 */ +grub_uint32_t ofw_idt;/* bc */ + +grub_uint8_t padding7[0x1c0 -0xc0 ];grub_uint32_t efi_signature;/* 1c0 */ grub_uint32_t efi_system_table;/* 1c4 */
@@ -163,15 +173,15 @@ struct linux_kernel_paramsgrub_uint32_t efi_mmap;/* 1d0 */ grub_uint32_t efi_mmap_size;/* 1d4 */ -grub_uint8_t padding7[0x1e0 -0x1d8 ]; +grub_uint8_t padding8[0x1e0 -0x1d8 ];grub_uint32_t alt_mem;/* 1e0 */ -grub_uint8_t padding8[0x1e8 -0x1e4 ]; +grub_uint8_t padding9[0x1e8 -0x1e4 ];grub_uint32_t mmap_size;/* 1e8 */ -grub_uint8_t padding9[0x1ff -0x1ec ]; +grub_uint8_t padding10[0x1ff -0x1ec ];grub_uint8_t ps_mouse;/* 1ff */ } __attribute__ ((packed));
include/grub/i386/pc/memory.h +5 -2
@@ -76,11 +76,14 @@/* The data segment of the pseudo real mode. */ #define GRUB_MEMORY_MACHINE_PSEUDO_REAL_DSEG 0x20 -#ifndef GRUB_MACHINE_IEEE1275 #ifndef ASM_FILE + +#ifndef GRUB_MACHINE_IEEE1275 extern grub_size_t EXPORT_VAR (grub_lower_mem ); -extern grub_size_t EXPORT_VAR (grub_upper_mem );#endif + +extern grub_size_t EXPORT_VAR (grub_upper_mem ); +#endif #endif /* ! GRUB_MEMORY_MACHINE_HEADER */
include/grub/ieee1275/ieee1275.h +1 -1
@@ -158,7 +158,7 @@ grub_err_t EXPORT_FUNC(grub_devalias_iterate)grub_err_t EXPORT_FUNC (grub_children_iterate ) (char *devpath,int (*hook) (struct grub_ieee1275_devalias *alias));grub_err_t EXPORT_FUNC (grub_available_iterate ) - (int (*hook) (grub_uint64_t ,grub_uint64_t )); + (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t));int EXPORT_FUNC (grub_claimmap ) (grub_addr_t addr,grub_size_t size);char *EXPORT_FUNC (grub_ieee1275_encode_devname ) (const char *path);
include/grub/misc.h +2 -0
@@ -82,6 +82,8 @@ grub_ssize_t EXPORT_FUNC(grub_utf8_to_ucs4) (grub_uint32_t *dest,grub_uint64_t EXPORT_FUNC (grub_divmod64 ) (grub_uint64_t n,grub_uint32_t d,grub_uint32_t *r); +grub_uint32_t EXPORT_FUNC (grub_getcrc32 ) (grub_uint32_t crc,void *buf,int size); +/* Inline functions. */ static inline unsigned int
kern/misc.c +54 -0
57 lines not on this page · raw message
kern/powerpc/ieee1275/init.c +28 -2
@@ -128,8 +128,8 @@ static void grub_claim_heap (void) {unsigned long total =0 ; - autoint heap_init (grub_uint64_t addr,grub_uint64_t len); -int heap_init (grub_uint64_t addr,grub_uint64_t len) + auto int NESTED_FUNC_ATTR heap_init (grub_uint64_t addr, grub_uint64_t len); + int NESTED_FUNC_ATTR heap_init (grub_uint64_t addr, grub_uint64_t len) { len -=1 ;/* Required for some firmware. */
@@ -174,6 +174,31 @@ static void grub_claim_heap (void)grub_available_iterate (heap_init); } +#ifdef __i386__ + +grub_uint32_t grub_upper_mem; + +/* We need to call this before grub_claim_memory. */ +static void +grub_get_extended_memory (void ) +{ + auto int NESTED_FUNC_ATTR find_ext_mem (grub_uint64_t addr, grub_uint64_t len); + int NESTED_FUNC_ATTR find_ext_mem (grub_uint64_t addr, grub_uint64_t len) + { +if (addr ==0x100000 ) + { + grub_upper_mem = len; +return 1 ; + } + +return 0 ; + } + +grub_available_iterate (find_ext_mem); +} + +#endif +void grub_machine_init (void ) {
@@ -182,6 +207,7 @@ grub_machine_init (void)grub_console_init ();#ifdef __i386__ +grub_get_extended_memory ();grub_keyboard_controller_init ();#endif grub_claim_heap ();
kern/powerpc/ieee1275/openfw.c +3 -3
@@ -131,8 +131,8 @@ grub_devalias_iterate (int (*hook) (struct grub_ieee1275_devalias *alias))if (grub_ieee1275_get_property (dev,"device_type" , devtype,sizeof devtype, &actual)) { -grub_dprintf ("devalias" ,"get device type failed\n" ); - goto nextprop; +/* NAND device don't have device_type property. */ + devtype[0 ] =0 ; } alias.name = aliasname;
@@ -147,7 +147,7 @@ nextprop:return 0 ; } -grub_err_t grub_available_iterate (int (*hook) (grub_uint64_t ,grub_uint64_t )) +grub_err_t grub_available_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t)) {grub_ieee1275_phandle_t root;grub_ieee1275_phandle_t memory;
loader/i386/ieee1275/linux.c new file +289 -0
289 lines not on this page · raw message
loader/i386/ieee1275/linux_normal.c new file +60 -0
60 lines not on this page · raw message
Quoted 10 lines · Bean
Hi,
The new patch add support for the nand flash device in OLPC. However, the flash use jffs2 file system, so you can't list file in it yet, but you can dump the disk with hexdump.
This patch also include an improvement for hexdump that would allow it to dump device as well as file, for example:
hexdump (nand)
I'm surprised that the nand works via ieee1275 calls. See my comment in cmain.c:
if (is_olpc)
{
/* OLPC / XO laptops have three kinds of storage devices:
- NAND flash. These are accessible via OFW callbacks, but:
- Follow strange semantics, imposed by hardware constraints.
- Its ABI is undocumented, and not stable.
They lack "device_type" property, which conveniently makes GRUB skip them.
- USB drives. Not accessible, because OFW shuts down the controller in order to prevent collisions with applications accessing it directly. Even worse, attempts to access it will NOT return control to the caller, so we have to avoid probing them.
- SD cards. These work fine.
To avoid brekage, we only need to skip USB probing. However, since detecting SD cards is more reliable, we do that instead.
*/
grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY);
}
but your patch doesn't seem to disable the GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY hack.
Also, I'm not sure how stable this will be. Perhaps it breaks in the future with firmware updates :-(
Quoted 4 lines
I also add a new function
grub_getcrc32inkern/misc.c, this function is useful in many places, for example, jffs2 use it to verify data. A new command crc is also included that would allow user to calculate the crc checksum of file.
That sounds very useful. But I'm not sure if it's a good idea to put it in kernel. Perhaps a "crypt" module would be better? (so that we can add more crypto-related functions when we support LUKS, etc).
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoted 36 lines · Robert Millan
Quoted 10 lines · Bean
Hi,
The new patch add support for the nand flash device in OLPC. However, the flash use jffs2 file system, so you can't list file in it yet, but you can dump the disk with hexdump.
This patch also include an improvement for hexdump that would allow it to dump device as well as file, for example:
hexdump (nand)
I'm surprised that the nand works via ieee1275 calls. See my comment in
cmain.c:if (
is_olpc)
{
/* OLPC / XO laptops have three kinds of storage devices:- NAND flash. These are accessible via OFW callbacks, but:
- Follow strange semantics, imposed by hardware constraints.
- Its ABI is undocumented, and not stable.
They lack "device_type" property, which conveniently makes GRUB skip them.- USB drives. Not accessible, because OFW shuts down the controller in order to prevent collisions with applications accessing it directly. Even worse, attempts to access it will NOT return control to the caller, so we have to avoid probing them.
- SD cards. These work fine.
To avoid brekage, we only need to skip USB probing. However, since detecting SD cards is more reliable, we do that instead.
*/
Quoted 8 lines
grub_ieee1275_set_flag(GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY);
}but your patch doesn't seem to disable the
GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLYhack.Also, I'm not sure how stable this will be. Perhaps it breaks in the future with firmware updates :-(
nand access is different from normal disk, it uses pio-read to read a page which is normally 2048 bytes.
: pio-read ( adr len page# offset -- )
nand device doesn't have device_type property, it won't be detected by ofdisk.c, so i put it in a separate module nand.c.
as for GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY, perhaps we can rename it GRUB_IEEE1275_FLAG_OLPC to indicate OLPC platform, we might need to use it for other things.
Quoted 10 lines
Quoted 6 lines
I also add a new function
grub_getcrc32inkern/misc.c, this function is useful in many places, for example, jffs2 use it to verify data. A new command crc is also included that would allow user to calculate the crc checksum of file.That sounds very useful. But I'm not sure if it's a good idea to put it in kernel. Perhaps a "crypt" module would be better? (so that we can add more crypto-related functions when we support LUKS, etc).
That's a good idea.
Signature · 1 line
Bean
Quoted 25 lines · Bean
Quoted 25 lines
/* OLPC / XO laptops have three kinds of storage devices:
- NAND flash. These are accessible via OFW callbacks, but:
- Follow strange semantics, imposed by hardware constraints.
- Its ABI is undocumented, and not stable.
They lack "device_type" property, which conveniently makes GRUB skip them.- USB drives. Not accessible, because OFW shuts down the controller in order to prevent collisions with applications accessing it directly. Even worse, attempts to access it will NOT return control to the caller, so we have to avoid probing them.
- SD cards. These work fine.
To avoid brekage, we only need to skip USB probing. However, since detecting SD cards is more reliable, we do that instead.
*/
grub_ieee1275_set_flag(GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY);
}but your patch doesn't seem to disable the
GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLYhack.
Quoted 7 lines
Quoted 2 lines
Also, I'm not sure how stable this will be. Perhaps it breaks in the future with firmware updates :-(
nand access is different from normal disk, it uses pio-read to read a page which is normally 2048 bytes.
: pio-read ( adr len page# offset -- )
I see. As for the "strange semantics" I mentioned, IIRC they're applicable to write operations. It might turn out to produce funny effects when writing, but fortunately we don't do that too often :-)
Quoted 3 lines
as for
GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY, perhaps we can rename itGRUB_IEEE1275_FLAG_OLPCto indicate OLPC platform, we might need to use it for other things.
Using flags to describe specific problems has the advantage that if they're fixed in a more recent version of the firmware, we just need to check for that in grub_ieee1275_find_options() (the SmartFirmware check there is a nice example of how nasty it gets).
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Hi,
This is the new patch which takes into account the location change of files in kern/powerpc/ieee1275. Also, the crc part is removed, it's better to use a separate patch.
Signature · 1 line
Bean
disk/ieee1275/nand.c new file +216 -0
@@ -0,0 +1,216 @@ +/* nand.c - NAND flash disk access. */ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2008 Free Software Foundation, Inc. +* +* GRUB 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 3 of the License, or +* (at your option) any later version. +* +* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <grub/misc.h> +#include <grub/disk.h> +#include <grub/mm.h> +#include <grub/dl.h> +#include <grub/ieee1275/ieee1275.h> + +struct grub_nand_data +{ +grub_ieee1275_ihandle_t handle; +grub_uint32_t block_size; +}; + +static int +grub_nand_iterate (int (*hook) (const char *name)) +{ + autoint dev_iterate (struct grub_ieee1275_devalias *alias); +int dev_iterate (struct grub_ieee1275_devalias *alias) + { +if (!grub_strcmp (alias->name,"nand" )) + { +hook (alias->name); +return 1 ; + } + +return 0 ; + } + +grub_devalias_iterate (dev_iterate); +return 0 ; +} + +static grub_err_t +grub_nand_read (grub_disk_t disk,grub_disk_addr_t sector, +grub_size_t size,char *buf); + +static grub_err_t +grub_nand_open (const char *name,grub_disk_t disk) +{ +grub_ieee1275_ihandle_t dev_ihandle =0 ; +struct grub_nand_data *data =0 ; +struct size_args + { +struct grub_ieee1275_common_hdr common; +char *method; +grub_ieee1275_ihandle_t ihandle; +grub_ieee1275_cell_t result; +grub_ieee1275_cell_t size1; +grub_ieee1275_cell_t size2; + } args; + +if (!grub_strstr (name,"nand" )) +return grub_error (GRUB_ERR_UNKNOWN_DEVICE ,"Not a nand device" ); + + data =grub_malloc (sizeof (*data)); +if (! data) + goto fail; + +grub_ieee1275_open (name, &dev_ihandle); +if (! dev_ihandle) + { +grub_error (GRUB_ERR_UNKNOWN_DEVICE ,"Can't open device" ); + goto fail; + } + + data->handle = dev_ihandle; + +INIT_IEEE1275_COMMON (&args.common,"call-method" ,2 ,2 ); + args.method ="block-size" ; + args.ihandle = dev_ihandle; + args.result =1 ; + +if ((IEEE1275_CALL_ENTRY_FN (&args) ==-1 ) || (args.result)) + { +grub_error (GRUB_ERR_UNKNOWN_DEVICE ,"Can't get block size" ); + goto fail; + } + + data->block_size = (args.size1 >>GRUB_DISK_SECTOR_BITS ); + +INIT_IEEE1275_COMMON (&args.common,"call-method" ,2 ,3 ); + args.method ="size" ; + args.ihandle = dev_ihandle; + args.result =1 ; + +if ((IEEE1275_CALL_ENTRY_FN (&args) ==-1 ) || (args.result)) + { +grub_error (GRUB_ERR_UNKNOWN_DEVICE ,"Can't get disk size" ); + goto fail; + } + + disk->total_sectors = args.size1; + disk->total_sectors <<=32 ; + disk->total_sectors += args.size2; + disk->total_sectors >>=GRUB_DISK_SECTOR_BITS ; + + disk->id = dev_ihandle; + + disk->has_partitions =0 ; + disk->data = data; + +return 0 ; + +fail: +if (dev_ihandle) +grub_ieee1275_close (dev_ihandle); +grub_free (data); +return grub_errno; +} + +static void +grub_nand_close (grub_disk_t disk) +{ +grub_ieee1275_close (((struct grub_nand_data *) disk->data)->handle); +grub_free (disk->data); +} + +static grub_err_t +grub_nand_read (grub_disk_t disk,grub_disk_addr_t sector, +grub_size_t size,char *buf) +{ +struct grub_nand_data *data = disk->data; +grub_size_t bsize, ofs; + +struct read_args + { +struct grub_ieee1275_common_hdr common; +char *method; +grub_ieee1275_ihandle_t ihandle; +grub_ieee1275_cell_t ofs; +grub_ieee1275_cell_t page; +grub_ieee1275_cell_t len; +grub_ieee1275_cell_t buf; +grub_ieee1275_cell_t result; + } args; + +INIT_IEEE1275_COMMON (&args.common,"call-method" ,6 ,1 ); + args.method ="pio-read" ; + args.ihandle = data->handle; + args.buf = (grub_ieee1275_cell_t ) buf; + args.page = (grub_ieee1275_cell_t) ((grub_size_t ) sector / data->block_size); + + ofs = ((grub_size_t ) sector % data->block_size) <<GRUB_DISK_SECTOR_BITS ; + size <<=GRUB_DISK_SECTOR_BITS ; + bsize = (data->block_size <<GRUB_DISK_SECTOR_BITS ); + +do + { +grub_size_t len; + + len = (ofs + size > bsize) ? (bsize - ofs) : size; + + args.len = (grub_ieee1275_cell_t ) len; + args.ofs = (grub_ieee1275_cell_t ) ofs; + args.result =1 ; + +if ((IEEE1275_CALL_ENTRY_FN (&args) ==-1 ) || (args.result)) +return grub_error (GRUB_ERR_READ_ERROR ,"Read error" ); + + ofs =0 ; + size -= len; + args.buf += len; + args.page++; + }while (size); + +return GRUB_ERR_NONE ; +} + +static grub_err_t +grub_nand_write (grub_disk_t disk __attribute ((unused)), +grub_disk_addr_t sector __attribute ((unused)), +grub_size_t size __attribute ((unused)), +const char *buf __attribute ((unused))) +{ +return GRUB_ERR_NOT_IMPLEMENTED_YET ; +} + +static struct grub_disk_dev grub_nand_dev = + { + .name ="nand" , + .id =GRUB_DISK_DEVICE_NAND_ID , + .iterate = grub_nand_iterate, + .open = grub_nand_open, + .close = grub_nand_close, + .read = grub_nand_read, + .write = grub_nand_write, + .next =0 + }; + +GRUB_MOD_INIT (nand) +{ +grub_disk_dev_register (&grub_nand_dev); +} + +GRUB_MOD_FINI (nand) +{ +grub_disk_dev_unregister (&grub_nand_dev); +}
loader/i386/ieee1275/linux.c new file +289 -0
289 lines not on this page · raw message
loader/i386/ieee1275/linux_normal.c new file +60 -0
60 lines not on this page · raw message
Quoted 9 lines · Bean
Hi,
This is the new patch which takes into account the location change of files in kern/powerpc/ieee1275. Also, the crc part is removed, it's better to use a separate patch.
--
Bean
Oh, I forget to add some files, this is the right patch.
Signature · 1 line
Bean
Makefile.in +1 -1
@@ -91,7 +91,7 @@ enable_grub_fstest = @enable_grub_fstest@ ### General variables. RMKFILES = $(addprefix conf/,common.rmk i386-pc.rmk powerpc-ieee1275.rmk \ - sparc64-ieee1275.rmk i386-efi.rmk) + sparc64-ieee1275.rmk i386-efi.rmk i386-ieee1275.rmk i386-linuxbios.rmk) MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES)) PKGLIB = $(pkglib_IMAGES) $(pkglib_MODULES) $(pkglib_PROGRAMS) \
commands/hexdump.c +47 -13
88 lines not on this page · raw message
conf/i386-ieee1275.rmk +17 -1
@@ -97,7 +97,8 @@ grub_emu_LDFLAGS = $(LIBCURSES) # Modules. pkglib_MODULES = normal.mod halt.mod reboot.mod suspend.mod cpuid.mod \ - multiboot.mod _multiboot.mod aout.mod serial.mod + multiboot.mod _multiboot.mod aout.mod serial.mod linux.mod \ + _linux.mod nand.mod # For normal.mod. normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \
@@ -151,4 +152,19 @@ serial_mod_SOURCES = term/i386/pc/serial.c serial_mod_CFLAGS = $(COMMON_CFLAGS) serial_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For _linux.mod. +_linux_mod_SOURCES = loader/i386/ieee1275/linux.c +_linux_mod_CFLAGS = $(COMMON_CFLAGS) +_linux_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For linux.mod. +linux_mod_SOURCES = loader/i386/ieee1275/linux_normal.c +linux_mod_CFLAGS = $(COMMON_CFLAGS) +linux_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For nand.mod. +nand_mod_SOURCES = disk/ieee1275/nand.c +nand_mod_CFLAGS = $(COMMON_CFLAGS) +nand_mod_LDFLAGS = $(COMMON_LDFLAGS) + include $(srcdir)/conf/common.mk
disk/ieee1275/nand.c new file +216 -0
216 lines not on this page · raw message
disk/ieee1275/ofdisk.c +1 -1
@@ -109,7 +109,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)if (grub_ieee1275_get_property (dev,"device_type" , prop,sizeof (prop), &actual)) { -grub_error (GRUB_ERR_BAD_DEVICE ,"Can't read the device type" ); +grub_error (GRUB_ERR_UNKNOWN_DEVICE ,"Can't read the device type" ); goto fail; }
include/grub/disk.h +1 -0
@@ -37,6 +37,7 @@ enum grub_disk_dev_idGRUB_DISK_DEVICE_HOST_ID ,GRUB_DISK_DEVICE_ATA_ID ,GRUB_DISK_DEVICE_MEMDISK_ID , + GRUB_DISK_DEVICE_NAND_ID, };struct grub_disk ;
include/grub/i386/ieee1275/loader.h +3 -0
@@ -27,4 +27,7 @@ void EXPORT_FUNC(grub_multiboot2_real_boot) (grub_addr_t entry, struct grub_multiboot_info *mbi) __attribute__ ((noreturn)); +void grub_rescue_cmd_linux (int argc,char *argv[]); +void grub_rescue_cmd_initrd (int argc,char *argv[]); +#endif /* ! GRUB_LOADER_MACHINE_HEADER */
include/grub/i386/linux.h +14 -4
@@ -47,6 +47,9 @@#define GRUB_LINUX_EFI_SIGNATURE \ ('E' << 24 | 'F' << 16 | 'I' << 8 | 'L') +#define GRUB_LINUX_OFW_SIGNATURE \ + (' ' << 24 | 'W' << 16 | 'F' << 8 | 'O') +#ifndef ASM_FILE /* For the Linux/i386 boot protocol version 2.03. */
@@ -154,7 +157,14 @@ struct linux_kernel_paramsgrub_uint8_t hd1_drive_info[0x10 ];/* 90 */ grub_uint16_t rom_config_len;/* a0 */ -grub_uint8_t padding6[0x1c0 -0xa2 ]; +grub_uint8_t padding6[0xb0 -0xa2 ]; + +grub_uint32_t ofw_signature;/* b0 */ +grub_uint32_t ofw_num_items;/* b4 */ +grub_uint32_t ofw_cif_handler;/* b8 */ +grub_uint32_t ofw_idt;/* bc */ + +grub_uint8_t padding7[0x1c0 -0xc0 ];grub_uint32_t efi_signature;/* 1c0 */ grub_uint32_t efi_system_table;/* 1c4 */
@@ -163,15 +173,15 @@ struct linux_kernel_paramsgrub_uint32_t efi_mmap;/* 1d0 */ grub_uint32_t efi_mmap_size;/* 1d4 */ -grub_uint8_t padding7[0x1e0 -0x1d8 ]; +grub_uint8_t padding8[0x1e0 -0x1d8 ];grub_uint32_t alt_mem;/* 1e0 */ -grub_uint8_t padding8[0x1e8 -0x1e4 ]; +grub_uint8_t padding9[0x1e8 -0x1e4 ];grub_uint32_t mmap_size;/* 1e8 */ -grub_uint8_t padding9[0x1ff -0x1ec ]; +grub_uint8_t padding10[0x1ff -0x1ec ];grub_uint8_t ps_mouse;/* 1ff */ } __attribute__ ((packed));
include/grub/i386/pc/memory.h +5 -2
@@ -76,11 +76,14 @@/* The data segment of the pseudo real mode. */ #define GRUB_MEMORY_MACHINE_PSEUDO_REAL_DSEG 0x20 -#ifndef GRUB_MACHINE_IEEE1275 #ifndef ASM_FILE + +#ifndef GRUB_MACHINE_IEEE1275 extern grub_size_t EXPORT_VAR (grub_lower_mem ); -extern grub_size_t EXPORT_VAR (grub_upper_mem );#endif + +extern grub_size_t EXPORT_VAR (grub_upper_mem ); +#endif #endif /* ! GRUB_MEMORY_MACHINE_HEADER */
include/grub/ieee1275/ieee1275.h +1 -1
@@ -158,7 +158,7 @@ grub_err_t EXPORT_FUNC(grub_devalias_iterate)grub_err_t EXPORT_FUNC (grub_children_iterate ) (char *devpath,int (*hook) (struct grub_ieee1275_devalias *alias));grub_err_t EXPORT_FUNC (grub_available_iterate ) - (int (*hook) (grub_uint64_t ,grub_uint64_t )); + (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t));int EXPORT_FUNC (grub_claimmap ) (grub_addr_t addr,grub_size_t size);char *EXPORT_FUNC (grub_ieee1275_encode_devname ) (const char *path);
kern/ieee1275/init.c +28 -2
@@ -128,8 +128,8 @@ static void grub_claim_heap (void) {unsigned long total =0 ; - autoint heap_init (grub_uint64_t addr,grub_uint64_t len); -int heap_init (grub_uint64_t addr,grub_uint64_t len) + auto int NESTED_FUNC_ATTR heap_init (grub_uint64_t addr, grub_uint64_t len); + int NESTED_FUNC_ATTR heap_init (grub_uint64_t addr, grub_uint64_t len) { len -=1 ;/* Required for some firmware. */
@@ -174,6 +174,31 @@ static void grub_claim_heap (void)grub_available_iterate (heap_init); } +#ifdef __i386__ + +grub_uint32_t grub_upper_mem; + +/* We need to call this before grub_claim_memory. */ +static void +grub_get_extended_memory (void ) +{ + auto int NESTED_FUNC_ATTR find_ext_mem (grub_uint64_t addr, grub_uint64_t len); + int NESTED_FUNC_ATTR find_ext_mem (grub_uint64_t addr, grub_uint64_t len) + { +if (addr ==0x100000 ) + { + grub_upper_mem = len; +return 1 ; + } + +return 0 ; + } + +grub_available_iterate (find_ext_mem); +} + +#endif +void grub_machine_init (void ) {
@@ -182,6 +207,7 @@ grub_machine_init (void)grub_console_init ();#ifdef __i386__ +grub_get_extended_memory ();grub_keyboard_controller_init ();#endif grub_claim_heap ();
kern/ieee1275/openfw.c +3 -3
@@ -131,8 +131,8 @@ grub_devalias_iterate (int (*hook) (struct grub_ieee1275_devalias *alias))if (grub_ieee1275_get_property (dev,"device_type" , devtype,sizeof devtype, &actual)) { -grub_dprintf ("devalias" ,"get device type failed\n" ); - goto nextprop; +/* NAND device don't have device_type property. */ + devtype[0 ] =0 ; } alias.name = aliasname;
@@ -147,7 +147,7 @@ nextprop:return 0 ; } -grub_err_t grub_available_iterate (int (*hook) (grub_uint64_t ,grub_uint64_t )) +grub_err_t grub_available_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t)) {grub_ieee1275_phandle_t root;grub_ieee1275_phandle_t memory;
loader/i386/ieee1275/linux.c new file +289 -0
289 lines not on this page · raw message
loader/i386/ieee1275/linux_normal.c new file +60 -0
60 lines not on this page · raw message
Quoted 3 lines · Bean
Hi,
This patch add support for the linux loader in OLPC.
Just in 2 days! You're truly impressive :-)
Note that the following files you modify were recently moved out of their powerpc/ directories:
kern/powerpc/ieee1275/init.c
kern/powerpc/ieee1275/openfw.c
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)