Re: multiboot2

2009-03-04 Thread phcoder

In 4 and 7 I meant parameters passed from the bootloader to the OS.

With that, you also don't need to worry about "higher numbers are newer
version", as we can determine our own versioning, and load appropriate
features.
With that we can avoid alternative bootloaders with version passing like 
13b5.1.1rc2

Which would be an unnecessary hassle for the OS to parse.


I'm not really understanding what you're saying here.  Are you proposing
that the OS lets us know what command-line options it allows, for use in
tab completion?  Or that they're listing the default command line (for
editing perhaps?)  Or am I thinking in the wrong direction here?
Yes you're. I mean command line parameters. E.g. if you launch the 
kernel like

multiboot /mykernel root=myroot debug=ttyS0
Then kernel should be able to know what's passed after the kernel name I 
propose it to be exported as a tag 0x0005 and contents

"root=myroot debug=ttyS0" as a NUL-terminated UTF-8 string
--

Regards
Vladimir 'phcoder' Serbinenko


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH]: Fix several warnings on sparc64.

2009-03-04 Thread David Miller

Many of these warnings are for two reasons:

1) grub_ssize_t is != 'int' on sparc64, and many pieces of code
   try to pass an int pointer in for the final arg of several
   ieee1275 "get property" functions which take a grub_ssize_t
   pointer.

2) The third arg to grub_ieee1275_get_integer_property is
   "uint32_t *" but we try passing pointers to grub_ieee1275_ihandle_t
   objects there, but those are of grub_ieee1275_cell_t type,
   which is uint64_t on sparc64.

2009-03-04  David S. Miller  

* kern/ieee1275/cmain.c (grub_ieee1275_init): Third arg to
grub_ieee1275_get_integer_property is a uint32_t pointer.
* kern/ieee1275/init.c (grub_machine_init): Fix type of
'actual'.
* kern/ieee1275/openfw.c (grub_children_iterate): Likewise.
(grub_devalias_iterate): Likewise.
* term/ieee1275/ofconsole.c (grub_ofconsole_init_input):
Fix third arg to grub_ieee1275_get_integer_property.
(grub_ofconsole_init_output): Likewise.
---
 kern/ieee1275/cmain.c |6 +-
 kern/ieee1275/init.c  |2 +-
 kern/ieee1275/openfw.c|4 ++--
 term/ieee1275/ofconsole.c |   10 --
 4 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/kern/ieee1275/cmain.c b/kern/ieee1275/cmain.c
index b5e2ba6..847d9fd 100644
--- a/kern/ieee1275/cmain.c
+++ b/kern/ieee1275/cmain.c
@@ -157,11 +157,15 @@ grub_ieee1275_find_options (void)
 void
 grub_ieee1275_init (void)
 {
+  uint32_t val;
+
   grub_ieee1275_finddevice ("/chosen", &grub_ieee1275_chosen);
 
-  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "mmu", 
&grub_ieee1275_mmu,
+  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "mmu", &val,
  sizeof grub_ieee1275_mmu, 0) < 0)
 grub_ieee1275_mmu = 0;
+  else
+grub_ieee1275_mmu = val;
 
   grub_ieee1275_find_options ();
 }
diff --git a/kern/ieee1275/init.c b/kern/ieee1275/init.c
index d345ba2..27783cc 100644
--- a/kern/ieee1275/init.c
+++ b/kern/ieee1275/init.c
@@ -213,7 +213,7 @@ void
 grub_machine_init (void)
 {
   char args[256];
-  int actual;
+  grub_ssize_t actual;
 
   grub_ieee1275_init ();
 
diff --git a/kern/ieee1275/openfw.c b/kern/ieee1275/openfw.c
index e88f3b3..4229c6e 100644
--- a/kern/ieee1275/openfw.c
+++ b/kern/ieee1275/openfw.c
@@ -53,7 +53,7 @@ grub_children_iterate (char *devpath,
   char childname[64];
   char fullname[64];
   struct grub_ieee1275_devalias alias;
-  int actual;
+  grub_ssize_t actual;
 
   if (grub_ieee1275_get_property (child, "device_type", &childtype,
  sizeof childtype, &actual))
@@ -86,7 +86,7 @@ grub_devalias_iterate (int (*hook) (struct 
grub_ieee1275_devalias *alias))
 {
   grub_ieee1275_phandle_t aliases;
   char aliasname[32];
-  int actual;
+  grub_ssize_t actual;
   struct grub_ieee1275_devalias alias;
 
   if (grub_ieee1275_finddevice ("/aliases", &aliases))
diff --git a/term/ieee1275/ofconsole.c b/term/ieee1275/ofconsole.c
index 70fda9a..c24a4c2 100644
--- a/term/ieee1275/ofconsole.c
+++ b/term/ieee1275/ofconsole.c
@@ -341,12 +341,15 @@ static grub_err_t
 grub_ofconsole_init_input (void)
 {
   grub_ssize_t actual;
+  uint32_t val;
 
-  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", 
&stdin_ihandle,
+  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", &val,
  sizeof stdin_ihandle, &actual)
   || actual != sizeof stdin_ihandle)
 return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
 
+  stdin_ihandle = val;
+
   return 0;
 }
 
@@ -354,6 +357,7 @@ static grub_err_t
 grub_ofconsole_init_output (void)
 {
   grub_ssize_t actual;
+  uint32_t val;
   int col;
 
   /* The latest PowerMacs don't actually initialize the screen for us, so we
@@ -362,11 +366,13 @@ grub_ofconsole_init_output (void)
   if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_OUTPUT))
 grub_ieee1275_interpret ("output-device output", 0);
 
-  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdout", 
&stdout_ihandle,
+  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdout", &val,
  sizeof stdout_ihandle, &actual)
   || actual != sizeof stdout_ihandle)
 return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdout");
 
+  stdout_ihandle = val;
+
   /* Initialize colors.  */
   if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS))
 {
-- 
1.6.1.2.253.ga34a



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH]: Allow targets to define boot block image format.

2009-03-04 Thread David Miller

This facility will be used on sparc because the bootblocks
I will generate will be in A.OUT, so we need to pass that
to objcopy instead of 'binary'.

2009-03-04  David S. Miller  

* genmk.rb: Allow rmk file to specify pkglib_IMAGES object
file format in IMG_FMT.
* conf/i386-pc.rmk (IMG_FMT): Define.
* conf/i386-pc.mk: Regenerate.
---
 conf/i386-pc.mk  |   13 +++--
 conf/i386-pc.rmk |1 +
 genmk.rb |2 +-
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/conf/i386-pc.mk b/conf/i386-pc.mk
index 7b56782..98dcbd2 100644
--- a/conf/i386-pc.mk
+++ b/conf/i386-pc.mk
@@ -11,6 +11,7 @@ COMMON_LDFLAGS = -m32 -nostdlib
 normal/lexer.c_DEPENDENCIES = grub_script.tab.h
 
 # Images.
+IMG_FMT = binary
 pkglib_IMAGES = boot.img diskboot.img kernel.img pxeboot.img lnxboot.img \
cdboot.img
 
@@ -20,7 +21,7 @@ CLEANFILES += boot.img boot.exec boot_img-boot_i386_pc_boot.o
 MOSTLYCLEANFILES += boot_img-boot_i386_pc_boot.d
 
 boot.img: boot.exec
-   $(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
+   $(OBJCOPY) -O $(IMG_FMT) -R .note -R .comment -R .note.gnu.build-id $< 
$@
 
 boot.exec: boot_img-boot_i386_pc_boot.o
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(boot_img_LDFLAGS)
@@ -38,7 +39,7 @@ CLEANFILES += pxeboot.img pxeboot.exec 
pxeboot_img-boot_i386_pc_pxeboot.o
 MOSTLYCLEANFILES += pxeboot_img-boot_i386_pc_pxeboot.d
 
 pxeboot.img: pxeboot.exec
-   $(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
+   $(OBJCOPY) -O $(IMG_FMT) -R .note -R .comment -R .note.gnu.build-id $< 
$@
 
 pxeboot.exec: pxeboot_img-boot_i386_pc_pxeboot.o
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(pxeboot_img_LDFLAGS)
@@ -56,7 +57,7 @@ CLEANFILES += diskboot.img diskboot.exec 
diskboot_img-boot_i386_pc_diskboot.o
 MOSTLYCLEANFILES += diskboot_img-boot_i386_pc_diskboot.d
 
 diskboot.img: diskboot.exec
-   $(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
+   $(OBJCOPY) -O $(IMG_FMT) -R .note -R .comment -R .note.gnu.build-id $< 
$@
 
 diskboot.exec: diskboot_img-boot_i386_pc_diskboot.o
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(diskboot_img_LDFLAGS)
@@ -74,7 +75,7 @@ CLEANFILES += lnxboot.img lnxboot.exec 
lnxboot_img-boot_i386_pc_lnxboot.o
 MOSTLYCLEANFILES += lnxboot_img-boot_i386_pc_lnxboot.d
 
 lnxboot.img: lnxboot.exec
-   $(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
+   $(OBJCOPY) -O $(IMG_FMT) -R .note -R .comment -R .note.gnu.build-id $< 
$@
 
 lnxboot.exec: lnxboot_img-boot_i386_pc_lnxboot.o
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(lnxboot_img_LDFLAGS)
@@ -92,7 +93,7 @@ CLEANFILES += cdboot.img cdboot.exec 
cdboot_img-boot_i386_pc_cdboot.o
 MOSTLYCLEANFILES += cdboot_img-boot_i386_pc_cdboot.d
 
 cdboot.img: cdboot.exec
-   $(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
+   $(OBJCOPY) -O $(IMG_FMT) -R .note -R .comment -R .note.gnu.build-id $< 
$@
 
 cdboot.exec: cdboot_img-boot_i386_pc_cdboot.o
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(cdboot_img_LDFLAGS)
@@ -121,7 +122,7 @@ CLEANFILES += kernel.img kernel.exec 
kernel_img-kern_i386_pc_startup.o kernel_im
 MOSTLYCLEANFILES += kernel_img-kern_i386_pc_startup.d kernel_img-kern_main.d 
kernel_img-kern_device.d kernel_img-kern_disk.d kernel_img-kern_dl.d 
kernel_img-kern_file.d kernel_img-kern_fs.d kernel_img-kern_err.d 
kernel_img-kern_misc.d kernel_img-kern_mm.d kernel_img-kern_loader.d 
kernel_img-kern_rescue.d kernel_img-kern_term.d kernel_img-kern_time.d 
kernel_img-kern_list.d kernel_img-kern_handler.d kernel_img-kern_i386_dl.d 
kernel_img-kern_i386_pc_init.d kernel_img-kern_i386_pc_mmap.d 
kernel_img-kern_parser.d kernel_img-kern_partition.d kernel_img-kern_i386_tsc.d 
kernel_img-kern_i386_pit.d kernel_img-kern_generic_rtc_get_time_ms.d 
kernel_img-kern_generic_millisleep.d kernel_img-kern_env.d 
kernel_img-term_i386_pc_console.d kernel_img-term_i386_vga_common.d 
kernel_img-symlist.d
 
 kernel.img: kernel.exec
-   $(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
+   $(OBJCOPY) -O $(IMG_FMT) -R .note -R .comment -R .note.gnu.build-id $< 
$@
 
 kernel.exec: kernel_img-kern_i386_pc_startup.o kernel_img-kern_main.o 
kernel_img-kern_device.o kernel_img-kern_disk.o kernel_img-kern_dl.o 
kernel_img-kern_file.o kernel_img-kern_fs.o kernel_img-kern_err.o 
kernel_img-kern_misc.o kernel_img-kern_mm.o kernel_img-kern_loader.o 
kernel_img-kern_rescue.o kernel_img-kern_term.o kernel_img-kern_time.o 
kernel_img-kern_list.o kernel_img-kern_handler.o kernel_img-kern_i386_dl.o 
kernel_img-kern_i386_pc_init.o kernel_img-kern_i386_pc_mmap.o 
kernel_img-kern_parser.o kernel_img-kern_partition.o kernel_img-kern_i386_tsc.o 
kernel_img-kern_i386_pit.o kernel_img-kern_generic_rtc_get_time_ms.o 
kernel_img-kern_generic_millisleep.o kernel_img-kern_env.o 
kernel_img-term_i386_pc_console.o kernel_img-term_i386_vga_commo

[PATCH]: Add sparc64 boot block code.

2009-03-04 Thread David Miller

2009-03-04  David S. Miller  

* include/grub/sparc64/ieee1275/boot.h: New file.
* boot/sparc/ieee1275/boot.S: Likewise.
* boot/sparc/ieee1275/diskboot.S: Likewise.
* conf/sparc64-ieee1275.rmk: Build sparc boot blocks.
* conf/sparc64-ieee1275.mk: Regenerate.
---
 boot/sparc/ieee1275/boot.S   |  196 ++
 boot/sparc/ieee1275/diskboot.S   |  145 +
 conf/sparc64-ieee1275.mk |   38 +++
 conf/sparc64-ieee1275.rmk|   12 ++
 include/grub/sparc64/ieee1275/boot.h |   60 ++
 5 files changed, 451 insertions(+), 0 deletions(-)
 create mode 100644 boot/sparc/ieee1275/boot.S
 create mode 100644 boot/sparc/ieee1275/diskboot.S
 create mode 100644 include/grub/sparc64/ieee1275/boot.h

diff --git a/boot/sparc/ieee1275/boot.S b/boot/sparc/ieee1275/boot.S
new file mode 100644
index 000..66a07a6
--- /dev/null
+++ b/boot/sparc/ieee1275/boot.S
@@ -0,0 +1,196 @@
+/* -*-Asm-*- */
+/*
+ *  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 .
+ */
+
+#include 
+#include 
+   
+   .text
+   .align  4
+   .globl  _start
+_start:
+   /* OF CIF entry point arrives in %o4 */
+pic_base:
+   callboot_continue
+mov%o4, CIF_REG
+
+   . = _start + GRUB_BOOT_MACHINE_VER_MAJ
+boot_version:  .byte   GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR
+
+   /* The offsets to these locations are defined by the
+* GRUB_BOOT_MACHINE_foo macros in include/grub/sparc/ieee1275/boot.h,
+* and grub-setup uses this to patch these next three values as needed.
+*
+* The boot_path will be the OF device path of the partition where the
+* rest of the GRUB kernel image resides.  kernel_sector will be set to
+* the location of the first block of the GRUB kernel, and
+* kernel_address is the location where we should load that first block.
+*
+* After loading in that block we will execute it by jumping to the
+* load address plus the size of the prepended A.OUT header (32 bytes).
+*/
+boot_path:
+   . = _start + GRUB_BOOT_MACHINE_KERNEL_ADDRESS
+kernel_sector: .xword 2
+kernel_address:.word  GRUB_BOOT_MACHINE_KERNEL_ADDR
+
+prom_finddev_name: .asciz "finddevice"
+prom_chosen_path:  .asciz "/chosen"
+prom_getprop_name: .asciz "getprop"
+prom_stdout_name:  .asciz "stdout"
+prom_write_name:   .asciz "write"
+prom_bootpath_name:.asciz "bootpath"
+prom_open_name:.asciz "open"
+prom_seek_name:.asciz "seek"
+prom_read_name:.asciz "read"
+prom_exit_name:.asciz "exit"
+grub_name: .asciz "GRUB "
+#define GRUB_NAME_LEN  5
+
+   .align  4
+
+prom_open_error:
+   GET_ABS(prom_open_name, %o2)
+   callconsole_write
+mov4, %o3
+   /* fallthru */
+
+prom_error:
+   GET_ABS(prom_exit_name, %o0)
+   /* fallthru */
+
+   /* %o0: OF call name
+* %o1: input arg 1
+*/
+prom_call_1_1:
+   mov 1, %g1
+   ba  prom_call
+mov1, %o5
+
+   /* %o2: message string
+* %o3: message length
+*/
+console_write:
+   GET_ABS(prom_write_name, %o0)
+   mov STDOUT_NODE_REG, %o1
+   /* fallthru */
+
+   /* %o0: OF call name
+* %o1: input arg 1
+* %o2: input arg 2
+* %o3: input arg 3
+*/
+prom_call_3_1:
+   mov 3, %g1
+   mov 1, %o5
+   /* fallthru */
+   
+   /* %o0: OF call name
+* %g1: num inputs
+* %o5: num outputs
+* %o1-%o4: inputs
+*/
+prom_call:
+   stx %o0, [%l1 + 0x00]
+   stx %g1, [%l1 + 0x08]
+   stx %o5, [%l1 + 0x10]
+   stx %o1, [%l1 + 0x18]
+   stx %o2, [%l1 + 0x20]
+   stx %o3, [%l1 + 0x28]
+   stx %o4, [%l1 + 0x30]
+   jmplCIF_REG, %g0
+mov%l1, %o0
+
+boot_continue:
+   mov %o7, PIC_REG/* PIC base */
+   sethi   %hi(SCRATCH_PAD), %l1   /* OF argument slots */
+
+   /* Find the /chosen node so we can fetch the stdout handle,
+* and thus perform console output.
+*
+* cho

[PATCH]: Strip boot block built objects.

2009-03-04 Thread David Miller

In order for the boot block images for sparc to work properly,
we have to strip them out before doing the objcopy.

This is harmless on i386-pc and some other future grub
targets might need this too, so do it universally.

2009-03-04  David S. Miller  

* genmk.rb: Strip object files built for boot images.
* conf/i386-pc.mk: Rebuilt.
* conf/sparc64-ieee1275.mk: Likewise.
---
 conf/i386-pc.mk  |6 ++
 conf/sparc64-ieee1275.mk |2 ++
 genmk.rb |1 +
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/conf/i386-pc.mk b/conf/i386-pc.mk
index 98dcbd2..dab7d40 100644
--- a/conf/i386-pc.mk
+++ b/conf/i386-pc.mk
@@ -25,6 +25,7 @@ boot.img: boot.exec
 
 boot.exec: boot_img-boot_i386_pc_boot.o
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(boot_img_LDFLAGS)
+   $(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 boot_img-boot_i386_pc_boot.o: boot/i386/pc/boot.S 
$(boot/i386/pc/boot.S_DEPENDENCIES)
$(TARGET_CC) -Iboot/i386/pc -I$(srcdir)/boot/i386/pc $(TARGET_CPPFLAGS) 
-DASM_FILE=1 $(TARGET_ASFLAGS) $(boot_img_ASFLAGS) -MD -c -o $@ $<
@@ -43,6 +44,7 @@ pxeboot.img: pxeboot.exec
 
 pxeboot.exec: pxeboot_img-boot_i386_pc_pxeboot.o
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(pxeboot_img_LDFLAGS)
+   $(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 pxeboot_img-boot_i386_pc_pxeboot.o: boot/i386/pc/pxeboot.S 
$(boot/i386/pc/pxeboot.S_DEPENDENCIES)
$(TARGET_CC) -Iboot/i386/pc -I$(srcdir)/boot/i386/pc $(TARGET_CPPFLAGS) 
-DASM_FILE=1 $(TARGET_ASFLAGS) $(pxeboot_img_ASFLAGS) -MD -c -o $@ $<
@@ -61,6 +63,7 @@ diskboot.img: diskboot.exec
 
 diskboot.exec: diskboot_img-boot_i386_pc_diskboot.o
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(diskboot_img_LDFLAGS)
+   $(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 diskboot_img-boot_i386_pc_diskboot.o: boot/i386/pc/diskboot.S 
$(boot/i386/pc/diskboot.S_DEPENDENCIES)
$(TARGET_CC) -Iboot/i386/pc -I$(srcdir)/boot/i386/pc $(TARGET_CPPFLAGS) 
-DASM_FILE=1 $(TARGET_ASFLAGS) $(diskboot_img_ASFLAGS) -MD -c -o $@ $<
@@ -79,6 +82,7 @@ lnxboot.img: lnxboot.exec
 
 lnxboot.exec: lnxboot_img-boot_i386_pc_lnxboot.o
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(lnxboot_img_LDFLAGS)
+   $(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 lnxboot_img-boot_i386_pc_lnxboot.o: boot/i386/pc/lnxboot.S 
$(boot/i386/pc/lnxboot.S_DEPENDENCIES)
$(TARGET_CC) -Iboot/i386/pc -I$(srcdir)/boot/i386/pc $(TARGET_CPPFLAGS) 
-DASM_FILE=1 $(TARGET_ASFLAGS) $(lnxboot_img_ASFLAGS) -MD -c -o $@ $<
@@ -97,6 +101,7 @@ cdboot.img: cdboot.exec
 
 cdboot.exec: cdboot_img-boot_i386_pc_cdboot.o
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(cdboot_img_LDFLAGS)
+   $(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 cdboot_img-boot_i386_pc_cdboot.o: boot/i386/pc/cdboot.S 
$(boot/i386/pc/cdboot.S_DEPENDENCIES)
$(TARGET_CC) -Iboot/i386/pc -I$(srcdir)/boot/i386/pc $(TARGET_CPPFLAGS) 
-DASM_FILE=1 $(TARGET_ASFLAGS) $(cdboot_img_ASFLAGS) -MD -c -o $@ $<
@@ -126,6 +131,7 @@ kernel.img: kernel.exec
 
 kernel.exec: kernel_img-kern_i386_pc_startup.o kernel_img-kern_main.o 
kernel_img-kern_device.o kernel_img-kern_disk.o kernel_img-kern_dl.o 
kernel_img-kern_file.o kernel_img-kern_fs.o kernel_img-kern_err.o 
kernel_img-kern_misc.o kernel_img-kern_mm.o kernel_img-kern_loader.o 
kernel_img-kern_rescue.o kernel_img-kern_term.o kernel_img-kern_time.o 
kernel_img-kern_list.o kernel_img-kern_handler.o kernel_img-kern_i386_dl.o 
kernel_img-kern_i386_pc_init.o kernel_img-kern_i386_pc_mmap.o 
kernel_img-kern_parser.o kernel_img-kern_partition.o kernel_img-kern_i386_tsc.o 
kernel_img-kern_i386_pit.o kernel_img-kern_generic_rtc_get_time_ms.o 
kernel_img-kern_generic_millisleep.o kernel_img-kern_env.o 
kernel_img-term_i386_pc_console.o kernel_img-term_i386_vga_common.o 
kernel_img-symlist.o
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(kernel_img_LDFLAGS)
+   $(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 kernel_img-kern_i386_pc_startup.o: kern/i386/pc/startup.S 
$(kern/i386/pc/startup.S_DEPENDENCIES)
$(TARGET_CC) -Ikern/i386/pc -I$(srcdir)/kern/i386/pc $(TARGET_CPPFLAGS) 
-DASM_FILE=1 $(TARGET_ASFLAGS) $(kernel_img_ASFLAGS) -MD -c -o $@ $<
diff --git a/conf/sparc64-ieee1275.mk b/conf/sparc64-ieee1275.mk
index 0d69eac..3d9c400 100644
--- a/conf/sparc64-ieee1275.mk
+++ b/conf/sparc64-ieee1275.mk
@@ -23,6 +23,7 @@ boot.img: boot.exec
 
 boot.exec: boot_img-boot_sparc_ieee1275_boot.o
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(boot_img_LDFLAGS)
+   $(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 boot_img-boot_sparc_ieee1275_boot.o: boot/sparc/ieee1275/boot.S 
$(boot/sparc/ieee1275/boot.S_DEPENDENCIES)
$(TARGET_CC) -Iboot/sparc/ieee1275 -I$(srcdir)/boot/sparc/ieee1275 
$(TARGET_CPPFLAGS) -DASM_FI

Re: [PATCH]: Add sparc64 boot block code.

2009-03-04 Thread David Miller
From: David Miller 
Date: Wed, 04 Mar 2009 01:07:35 -0800 (PST)

> 
> 2009-03-04  David S. Miller  
> 
>   * include/grub/sparc64/ieee1275/boot.h: New file.
>   * boot/sparc/ieee1275/boot.S: Likewise.
>   * boot/sparc/ieee1275/diskboot.S: Likewise.
>   * conf/sparc64-ieee1275.rmk: Build sparc boot blocks.
>   * conf/sparc64-ieee1275.mk: Regenerate.

Here is a document, extracted from a blog entry I wrote when I wrote
this code, which explains how this GRUB sparc64 boot block assembler
works.

Enjoy.


The first task is to get the first stage boot block going. There are
two choices on how to do this. When you type "boot" for a block
device, the firmware loads 7.5K starting at the second 512-byte
block. If this block device is the third partition (the "all disk"
partition in the Sun disk label) this bootblock starts after the disk
label.

Under Linux we really can only use 512 bytes of that boot block area,
because it's possible for the filesystem superblock to show up as
early as the very next 512 byte block.

The firmware lets you put in the block some sparc executable image
(tried by the firmware as 64-bit ELF, then 32-bit ELF, and finally as
A.OUT) or tokenized forth. Since 1) we only have 512 bytes and 2)
there are no fully GPL'd forth tokenizer implementations (the openbios
folks use something that is BSD and MIT licensed) we'll need to go the
sparc image route.

The task of this 512 byte sequence of code is to load the next stage
of the bootloader. For GRUB I've choosen a multi-tiered scheme similar
to how the x86 stuff works. The first stage bootloader loads a single
block from the disk and jumps to it. This block we load is actually a
header block of the main boot loader binary, a second stage loader,
which loads the rest of the image.

This first stage loader therefore needs a few parameters. It needs to
know the OF device path where the second stage header block
resides. It needs to know the block to read, and finally it needs to
know where to load that block and thus where to jump to it for
execution.

We'd also like to print some status messages to the screen while this
happens and have at least some minimal error handling. Not a small
feat in 512 bytes.

We put everything in the text section, and the first thing we do is
jump over our embedded data bits:

.text
.align  4
.globl  _start
_start:
/* OF CIF entry point arrives in %o4 */
pic_base:
callboot_continue
 mov%o4, CIF_REG

The "CIF" is the client interface to openfirmware. Calls are made by
initializing an array of cells (64-bits on sparc64) in memory which
describe the call to be made, the input arguments, and the return
values (if any). This value provided in %o4 is the OF entry point we
jump to when making calls. The only register argument goes in %o0 and
is the base of the aforementioned array of cells.

The offsets into the bits coming up are defined in a GRUB boot.h
header file so that tools can patch in values during bootblock
installation.

. = _start + GRUB_BOOT_MACHINE_VER_MAJ
boot_version:   .byte   GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR
boot_path:
. = _start + GRUB_BOOT_MACHINE_KERNEL_ADDRESS
kernel_sector:  .xword 2
kernel_address: .word  GRUB_BOOT_MACHINE_KERNEL_ADDR

The boot_version is just a version blob that various tools and
sub-bootloaders could validate for compatibility if they wanted to. It
is unused currently.

The boot_path will be filled in by the boot block installation tools
with the boot device OF path. kernel_sector and kernel_address tell
where to load the image from the device into memory. Next, we have
string constants we'll need to make OF calls and put messages onto the
console:

prom_finddev_name:  .asciz "finddevice"
prom_chosen_path:   .asciz "/chosen"
prom_getprop_name:  .asciz "getprop"
prom_stdout_name:   .asciz "stdout"
prom_write_name:.asciz "write"
prom_bootpath_name: .asciz "bootpath"
prom_open_name: .asciz "open"
prom_seek_name: .asciz "seek"
prom_read_name: .asciz "read"
prom_exit_name: .asciz "exit"
grub_name:  .asciz "GRUB "

To simplify things we'll write all of our code as position
independent. There are other macros in the boot.h header which
describe these register name macros such as CIF_REG, PIC_REG,
etc. most are local registers which are not volatils across OF calls,
so we can keep stable values in them. It also defines macros to
compute absolute addresses of a symbol using this PIC_REG, into a
register.

The next chunk of code are helpers for doing OF calls with various
sets of input and output arguments.

prom_open_error:
GET_ABS(prom_open_name, %o2)
callconsole_write
 mov4, %o3
/* fallthru */

prom_error:
GET_ABS(prom_exit_name, %o0)
/* fallthru */

/* %o0: OF call name
 * %o1: input arg 1
  

Re: [PATCH] implement grub_millisleep in util/misc.c for grub-emu

2009-03-04 Thread Felix Zielcke
Am Samstag, den 28.02.2009, 21:51 +0100 schrieb Christian Franke:

> I would suggest to remove the #define and commit the patch.
> 

Ok commited.

-- 
Felix Zielcke



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 1/7]: Fix sparc64 setjmp implementation.

2009-03-04 Thread Vesa Jääskeläinen
David Miller wrote:

> + stx %g1, [%sp + 2047 + (14 * 8)]
> +retl
> +  restore %o1, 0, %o0

Please check your white spaces. As we can see here those three commands
are on different columns (mixed tabs and spaces). This applies to every
other patch you sent too...



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 1/7]: Fix sparc64 setjmp implementation.

2009-03-04 Thread David Miller
From: Vesa Jääskeläinen 
Date: Wed, 04 Mar 2009 12:59:37 +0200

> David Miller wrote:
> 
> > +   stx %g1, [%sp + 2047 + (14 * 8)]
> > +retl
> > +restore %o1, 0, %o0
> 
> Please check your white spaces. As we can see here those three commands
> are on different columns (mixed tabs and spaces). This applies to every
> other patch you sent too...

I used plain ASCII text for my patch postings.

I just double checked and they are perfectly fine and applyable in my
email client.

Also note that in the delay slot of control transfer instructions, I
do intentionally use TAB then one space, as this is common practice
for sparc assembler to visually denote the delay slot instruction.

Even GCC outputs assembler using this convention :-)


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 1/7]: Fix sparc64 setjmp implementation.

2009-03-04 Thread Vesa Jääskeläinen
David Miller wrote:
> This corrects the sparc64 setjmp implementation.
> 
> We need to store the return address register, the
> stack pointer, and frame pointer into the jump buf.
> 
> And on longjmp we need restore those registers, flush the register
> window state, and pull in the top-most register window.
> 
> 2009-03-03  David S. Miller  
> 
>   * normal/sparc64/setjmp.S: Fix setjmp implementation.
>   * include/grub/sparc64/setjmp.h: Update grub_jmp_buf[].
> ---
>  include/grub/sparc64/setjmp.h |3 +--
>  normal/sparc64/setjmp.S   |   18 +-
>  2 files changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/include/grub/sparc64/setjmp.h b/include/grub/sparc64/setjmp.h
> index 12d8e01..183a820 100644
> --- a/include/grub/sparc64/setjmp.h
> +++ b/include/grub/sparc64/setjmp.h
> @@ -19,8 +19,7 @@
>  #ifndef GRUB_SETJMP_CPU_HEADER
>  #define GRUB_SETJMP_CPU_HEADER   1
>  
> -/* FIXME (sparc64).  */
> -typedef unsigned long grub_jmp_buf[20];
> +typedef unsigned long grub_jmp_buf[3];

I assume unsigned long is 64bit in sparc?

Would it be more practical to use grub_uint64_t?

Are there any other registers that needs to be preserved ?

Other than that I cannot decipher more from that asm :). If you have
tested it and it works. It probably ain't bad idea to commit this patch.


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 1/7]: Fix sparc64 setjmp implementation.

2009-03-04 Thread David Miller
From: Vesa Jääskeläinen 
Date: Wed, 04 Mar 2009 13:34:46 +0200

> David Miller wrote:
> > diff --git a/include/grub/sparc64/setjmp.h b/include/grub/sparc64/setjmp.h
> > index 12d8e01..183a820 100644
> > --- a/include/grub/sparc64/setjmp.h
> > +++ b/include/grub/sparc64/setjmp.h
> > @@ -19,8 +19,7 @@
> >  #ifndef GRUB_SETJMP_CPU_HEADER
> >  #define GRUB_SETJMP_CPU_HEADER 1
> >  
> > -/* FIXME (sparc64).  */
> > -typedef unsigned long grub_jmp_buf[20];
> > +typedef unsigned long grub_jmp_buf[3];
> 
> I assume unsigned long is 64bit in sparc?

Yes, for sparc64 long is always 64-bit, no exceptions.

> Would it be more practical to use grub_uint64_t?

This is a "sparc64" file, so I don't think so.

> Are there any other registers that needs to be preserved ?

Not for GRUB, no.


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 0/7]: Get sparc building again.

2009-03-04 Thread Vesa Jääskeläinen
David Miller wrote:
> Here is a series of patches that fix the most obvious sparc bugs and
> get the grub2 tree building again.
> 
> I have code for boot/ that will implement the sparc boot blocks and
> things of that nature, but that will come later.
> 
> First things first, let's get it to actually build. :)

Thanks for looking at it. It has been rotting for some time now.

Basic principle is to look how it is done on other archs (mainly x86 at
this time). And adapt same principle there too. If those match quite
close each other it is easier to keep them all in sync...



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 3/7]: Implement proper sparc64 kern startup.

2009-03-04 Thread Vesa Jääskeläinen
David Miller wrote:
> This replaces the C implementation with a proper assembler
> one.  Also add missing grub_prefix[] declaration to
> kernel.h
> 
> 2009-03-03  David S. Miller  
> 
>   * kern/sparc64/ieee1275/init.c: Delete, replace with...
>   * kern/sparc64/ieee1275/crt0.S: assembler implementation.
>   * include/grub/sparc64/ieee1275/kernel.h: Declare grub_prefix[].

I must say that I am not familiar with sparc. But there were lots of
functions inside of init.c. Are those all not needed at all?

And if this is true. This patch is missing matching .rmk modifications...

Please have a look at other archs how it is done there.


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 3/7]: Implement proper sparc64 kern startup.

2009-03-04 Thread David Miller
From: Vesa Jääskeläinen 
Date: Wed, 04 Mar 2009 13:40:20 +0200

> David Miller wrote:
> > This replaces the C implementation with a proper assembler
> > one.  Also add missing grub_prefix[] declaration to
> > kernel.h
> > 
> > 2009-03-03  David S. Miller  
> > 
> > * kern/sparc64/ieee1275/init.c: Delete, replace with...
> > * kern/sparc64/ieee1275/crt0.S: assembler implementation.
> > * include/grub/sparc64/ieee1275/kernel.h: Declare grub_prefix[].
> 
> I must say that I am not familiar with sparc. But there were lots of
> functions inside of init.c. Are those all not needed at all?

Nope, things have changed a lot since that file was written
so many years ago.  Some of it has moved into generic
ieee1275 code in fact.

> And if this is true. This patch is missing matching .rmk modifications...

See patch 7, it does that and ties everything together.

> Please have a look at other archs how it is done there.

I most certainly did.


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 5/7]: Add sparc64 loader implementation.

2009-03-04 Thread Vesa Jääskeläinen
David Miller wrote:
> 2009-03-03  David S. Miller  
> 
>   * include/grub/sparc64/ieee1275/loader.h: New file.
>   * include/grub/sparc64/ieee1275/memory.h: Likewise.
>   * include/grub/sparc64/kernel.h: Likewise.
>   * loader/sparc64/ieee1275/linux.c: Likewise.
>   * loader/sparc64/ieee1275/linux_normal.c: Likewise.

Please re-use as much as possible of common code. In example
linux_normal.c is there in loader/linux_normal.c.

I think Robert committed some changes that unified a bit these.


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 5/7]: Add sparc64 loader implementation.

2009-03-04 Thread David Miller
From: Vesa Jääskeläinen 
Date: Wed, 04 Mar 2009 13:44:16 +0200

> David Miller wrote:
> > 2009-03-03  David S. Miller  
> > 
> > * include/grub/sparc64/ieee1275/loader.h: New file.
> > * include/grub/sparc64/ieee1275/memory.h: Likewise.
> > * include/grub/sparc64/kernel.h: Likewise.
> > * loader/sparc64/ieee1275/linux.c: Likewise.
> > * loader/sparc64/ieee1275/linux_normal.c: Likewise.
> 
> Please re-use as much as possible of common code. In example
> linux_normal.c is there in loader/linux_normal.c.
> 
> I think Robert committed some changes that unified a bit these.

Sure, then powerpc needs the same.  I'll unify both sparc
and powerpc in this way after my patches are added, promise :-)


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 5/7]: Add sparc64 loader implementation.

2009-03-04 Thread phcoder


Sure, then powerpc needs the same.  I'll unify both sparc
and powerpc in this way after my patches are added, promise :-)


If you need powerpc testing you can contact me. I can offer testing on 
iMac G3. But I'm not yet familiar with powerpc.



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel



--

Regards
Vladimir 'phcoder' Serbinenko


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 7/7]: Get cob-webs out of sparc64-ieee1275.rmk

2009-03-04 Thread Vesa Jääskeläinen
David Miller wrote:
> There is no way anyone tried to build the sparc target in
> years :-)  This updates sparc64-ieee1275.rmk with modern
> times and regenerates sparc64-ieee1275.mk as well as
> DISTLIST.
> 
> 2009-03-03 David S. Miller 
> 
>   * conf/sparc64-ieee1275.rmk: Update.
>   * conf/sparc64-ieee1275.mk: Rebuilt.
>   * DISTLIST: Rebuilt.

There is no need to include .mk files in patches. They just make it a
bit chaotic.

Please make sure to sync in example normal.mod to be exactly how x86 is.
This way that is much easier to maintain.

Please compare those to each other and look that they match as much as
possible. If you see it sensible to differentiate common arch stuff to
own file like in:

i386-pc.rmk
i386.rmk
common.rmk

Then please do so.


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH]: Fix several warnings on sparc64.

2009-03-04 Thread Vesa Jääskeläinen
David Miller wrote:
> Many of these warnings are for two reasons:
> 
> 1) grub_ssize_t is != 'int' on sparc64, and many pieces of code
>try to pass an int pointer in for the final arg of several
>ieee1275 "get property" functions which take a grub_ssize_t
>pointer.
> 
> 2) The third arg to grub_ieee1275_get_integer_property is
>"uint32_t *" but we try passing pointers to grub_ieee1275_ihandle_t
>objects there, but those are of grub_ieee1275_cell_t type,
>which is uint64_t on sparc64.
> 
> diff --git a/kern/ieee1275/cmain.c b/kern/ieee1275/cmain.c
> index b5e2ba6..847d9fd 100644
> --- a/kern/ieee1275/cmain.c
> +++ b/kern/ieee1275/cmain.c
> @@ -157,11 +157,15 @@ grub_ieee1275_find_options (void)
>  void
>  grub_ieee1275_init (void)
>  {
> +  uint32_t val;

Please use grub_uint32_t instead... (I know..)

This same applies to other instances of that same type too...

> diff --git a/term/ieee1275/ofconsole.c b/term/ieee1275/ofconsole.c
> index 70fda9a..c24a4c2 100644
> --- a/term/ieee1275/ofconsole.c
> +++ b/term/ieee1275/ofconsole.c
> @@ -341,12 +341,15 @@ static grub_err_t
>  grub_ofconsole_init_input (void)
>  {
>grub_ssize_t actual;
> +  uint32_t val;
>  
> -  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", 
> &stdin_ihandle,
> +  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", 
> &val,
> sizeof stdin_ihandle, &actual)
>|| actual != sizeof stdin_ihandle)
>  return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
>  
> +  stdin_ihandle = val;

Why stdin_ihandle is not in proper type ? Or was there some other reason
for this change?


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 7/7]: Get cob-webs out of sparc64-ieee1275.rmk

2009-03-04 Thread David Miller
From: Vesa Jääskeläinen 
Date: Wed, 04 Mar 2009 13:50:37 +0200

> David Miller wrote:
> > There is no way anyone tried to build the sparc target in
> > years :-)  This updates sparc64-ieee1275.rmk with modern
> > times and regenerates sparc64-ieee1275.mk as well as
> > DISTLIST.
> > 
> > 2009-03-03 David S. Miller 
> > 
> > * conf/sparc64-ieee1275.rmk: Update.
> > * conf/sparc64-ieee1275.mk: Rebuilt.
> > * DISTLIST: Rebuilt.
> 
> There is no need to include .mk files in patches. They just make it a
> bit chaotic.

Ok, I won't include them in the future.

> Please make sure to sync in example normal.mod to be exactly how x86 is.
> This way that is much easier to maintain.
> 
> Please compare those to each other and look that they match as much as
> possible. If you see it sensible to differentiate common arch stuff to
> own file like in:
> 
> i386-pc.rmk
> i386.rmk
> common.rmk
> 
> Then please do so.

I will work on commonization as much as possible as I do more
sparc grub work.

Are you going to apply my patches or do I have to rewrite
everything?


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH]: Fix several warnings on sparc64.

2009-03-04 Thread David Miller
From: Vesa Jääskeläinen 
Date: Wed, 04 Mar 2009 13:56:08 +0200

> David Miller wrote:
> > Many of these warnings are for two reasons:
> > 
> > 1) grub_ssize_t is != 'int' on sparc64, and many pieces of code
> >try to pass an int pointer in for the final arg of several
> >ieee1275 "get property" functions which take a grub_ssize_t
> >pointer.
> > 
> > 2) The third arg to grub_ieee1275_get_integer_property is
> >"uint32_t *" but we try passing pointers to grub_ieee1275_ihandle_t
> >objects there, but those are of grub_ieee1275_cell_t type,
> >which is uint64_t on sparc64.
> > 
> > diff --git a/kern/ieee1275/cmain.c b/kern/ieee1275/cmain.c
> > index b5e2ba6..847d9fd 100644
> > --- a/kern/ieee1275/cmain.c
> > +++ b/kern/ieee1275/cmain.c
> > @@ -157,11 +157,15 @@ grub_ieee1275_find_options (void)
> >  void
> >  grub_ieee1275_init (void)
> >  {
> > +  uint32_t val;
> 
> Please use grub_uint32_t instead... (I know..)
> 
> This same applies to other instances of that same type too...
> 
> > diff --git a/term/ieee1275/ofconsole.c b/term/ieee1275/ofconsole.c
> > index 70fda9a..c24a4c2 100644
> > --- a/term/ieee1275/ofconsole.c
> > +++ b/term/ieee1275/ofconsole.c
> > @@ -341,12 +341,15 @@ static grub_err_t
> >  grub_ofconsole_init_input (void)
> >  {
> >grub_ssize_t actual;
> > +  uint32_t val;
> >  
> > -  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", 
> > &stdin_ihandle,
> > +  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", 
> > &val,
> >   sizeof stdin_ihandle, &actual)
> >|| actual != sizeof stdin_ihandle)
> >  return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
> >  
> > +  stdin_ihandle = val;
> 
> Why stdin_ihandle is not in proper type ? Or was there some other reason
> for this change?

A cell is the proper type, but that's 64-bit on sparc.

It's actually really a 32-bit integer property, but when
it's passed into the firmware via the ieee1275 interfaces
it gets pass in 64-bit extended as a cell, so the type
is correct.


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH]: Strip boot block built objects.

2009-03-04 Thread Vesa Jääskeläinen
David Miller wrote:
> In order for the boot block images for sparc to work properly,
> we have to strip them out before doing the objcopy.
> 
> This is harmless on i386-pc and some other future grub
> targets might need this too, so do it universally.

Please have a look at mail from me with subject "qemu + gdb
debugging..." on 22.2.2009 17:34.


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH]: Strip boot block built objects.

2009-03-04 Thread David Miller
From: Vesa Jääskeläinen 
Date: Wed, 04 Mar 2009 13:59:43 +0200

> David Miller wrote:
> > In order for the boot block images for sparc to work properly,
> > we have to strip them out before doing the objcopy.
> > 
> > This is harmless on i386-pc and some other future grub
> > targets might need this too, so do it universally.
> 
> Please have a look at mail from me with subject "qemu + gdb
> debugging..." on 22.2.2009 17:34.

My patch only strips information for the foo.img boot block
images built in the grub tree.

Your debugging hacks are only for the rest of the grub kernel
and don't even come close to touching the areas I am interested
in and changing.


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 7/7]: Get cob-webs out of sparc64-ieee1275.rmk

2009-03-04 Thread Vesa Jääskeläinen
David Miller wrote:
> Are you going to apply my patches or do I have to rewrite
> everything?

Personally I have nothing against resurrecting sparc support  :)

Lets see what kind of other comments they generate...


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH]: Strip boot block built objects.

2009-03-04 Thread Vesa Jääskeläinen
David Miller wrote:
> From: Vesa Jääskeläinen 
> Date: Wed, 04 Mar 2009 13:59:43 +0200
> 
>> David Miller wrote:
>>> In order for the boot block images for sparc to work properly,
>>> we have to strip them out before doing the objcopy.
>>>
>>> This is harmless on i386-pc and some other future grub
>>> targets might need this too, so do it universally.
>> Please have a look at mail from me with subject "qemu + gdb
>> debugging..." on 22.2.2009 17:34.
> 
> My patch only strips information for the foo.img boot block
> images built in the grub tree.
> 
> Your debugging hacks are only for the rest of the grub kernel
> and don't even come close to touching the areas I am interested
> in and changing.

Ok. Just wanted to inform you about that. If there is existing debug
image that matches quite nicely to boot image then it is easier to debug
as code matches quite nicely to assembly. It is much nicer to debug when
debugger can follow actual code lines.

Anyway. Idea there was that strip was not used, but objcopy was used to
generate matching image.



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 1/7]: Fix sparc64 setjmp implementation.

2009-03-04 Thread Javier Martín
El mié, 04-03-2009 a las 03:36 -0800, David Miller escribió:
> From: Vesa Jääskeläinen 
> Date: Wed, 04 Mar 2009 13:34:46 +0200
> 
> > David Miller wrote:
> > > diff --git a/include/grub/sparc64/setjmp.h b/include/grub/sparc64/setjmp.h
> > > index 12d8e01..183a820 100644
> > > --- a/include/grub/sparc64/setjmp.h
> > > +++ b/include/grub/sparc64/setjmp.h
> > > @@ -19,8 +19,7 @@
> > >  #ifndef GRUB_SETJMP_CPU_HEADER
> > >  #define GRUB_SETJMP_CPU_HEADER   1
> > >  
> > > -/* FIXME (sparc64).  */
> > > -typedef unsigned long grub_jmp_buf[20];
> > > +typedef unsigned long grub_jmp_buf[3];
> > 
> > I assume unsigned long is 64bit in sparc?
> 
> Yes, for sparc64 long is always 64-bit, no exceptions.
> 
> > Would it be more practical to use grub_uint64_t?
> 
> This is a "sparc64" file, so I don't think so.
Next month, or maybe next year, someone will need to fix some bug on
sparc64 code without being sparc64-savvy, maybe because (like it's
already happened) there are no sparc people available. That day people
like Bean, Felix, Marco or Robert (to name just a few of the big gurus
here) may have to decide between editing a sparc64 file or give up on
maintaining the platform. That day it would be really good for them to
visually know that "unsigned long" is 64-bit in sparc, instead of having
to go see the docs. This is the real utility of typedefs (and the
[u]intNN_t types from C99): if you statically _know_ that some variable
is going to be 64 bits long because the _platform_ requires it, why not
make it explicit? It will be easier for readers and maintainers.

As an example of what this entails, the failure to think with the future
in mind has extraordinarily hampered the 32->64 bit transition: many
Windows apps (among them the Vorbis codecs!) had be nearly rewritten
because they used "unsigned long" interchangeably with pointer types. I
still wonder if it would have been so difficult to use "void*", and the
proper types for pointer arithmetic.

-- 
-- Lazy, Oblivious, Rational Disaster -- Habbit


signature.asc
Description: Esta parte del mensaje está firmada digitalmente
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH] Support up to 256 SCSI disks on Linux

2009-03-04 Thread Colin Watson
Linux's Documentation/devices.txt file says that up to 256 SCSI disks
are supported. GRUB currently only supports the first 16. Wikimedia
filed an Ubuntu bug report about this
(https://bugs.launchpad.net/bugs/335174), so here's a patch to extend
this. (I really haven't been able to test this much at all beyond
compile-testing as I don't have a suitable system myself ...)

I suppose it might be nice to macroify the stuff in
grub_util_getdiskname, but TBH I'm not sure it would shorten it all that
much or make it much more readable, so I didn't bother.

Thanks,

-- 
Colin Watson   [cjwat...@ubuntu.com]
Index: util/raid.c
===
--- util/raid.c	(revision 2016)
+++ util/raid.c	(working copy)
@@ -32,6 +32,16 @@
 #include 
 #include 
 
+static void
+grub_util_getdiskname_scsi (char *name, int scsi_major, int scsi_minor)
+{
+  int unit = scsi_major * 16 + scsi_minor;
+  if (unit < 26)
+sprintf (name, "/dev/sd%c", 'a' + unit);
+  else
+sprintf (name, "/dev/sd%c%c", 'a' + unit / 26 - 1, 'a' + unit % 26);
+}
+
 static char *
 grub_util_getdiskname (int major, int minor)
 {
@@ -48,7 +58,37 @@ grub_util_getdiskname (int major, int minor)
   else if (major == IDE3_MAJOR)
 sprintf (name, "/dev/hd%c", 'g' + minor / 64);
   else if (major == SCSI_DISK0_MAJOR)
-sprintf (name, "/dev/sd%c", 'a' + minor / 16);
+grub_util_getdiskname_scsi (name, 0, minor / 16);
+  else if (major == SCSI_DISK1_MAJOR)
+grub_util_getdiskname_scsi (name, 1, minor / 16);
+  else if (major == SCSI_DISK2_MAJOR)
+grub_util_getdiskname_scsi (name, 2, minor / 16);
+  else if (major == SCSI_DISK3_MAJOR)
+grub_util_getdiskname_scsi (name, 3, minor / 16);
+  else if (major == SCSI_DISK4_MAJOR)
+grub_util_getdiskname_scsi (name, 4, minor / 16);
+  else if (major == SCSI_DISK5_MAJOR)
+grub_util_getdiskname_scsi (name, 5, minor / 16);
+  else if (major == SCSI_DISK6_MAJOR)
+grub_util_getdiskname_scsi (name, 6, minor / 16);
+  else if (major == SCSI_DISK7_MAJOR)
+grub_util_getdiskname_scsi (name, 7, minor / 16);
+  else if (major == SCSI_DISK8_MAJOR)
+grub_util_getdiskname_scsi (name, 8, minor / 16);
+  else if (major == SCSI_DISK9_MAJOR)
+grub_util_getdiskname_scsi (name, 9, minor / 16);
+  else if (major == SCSI_DISK10_MAJOR)
+grub_util_getdiskname_scsi (name, 10, minor / 16);
+  else if (major == SCSI_DISK11_MAJOR)
+grub_util_getdiskname_scsi (name, 11, minor / 16);
+  else if (major == SCSI_DISK12_MAJOR)
+grub_util_getdiskname_scsi (name, 12, minor / 16);
+  else if (major == SCSI_DISK13_MAJOR)
+grub_util_getdiskname_scsi (name, 13, minor / 16);
+  else if (major == SCSI_DISK14_MAJOR)
+grub_util_getdiskname_scsi (name, 14, minor / 16);
+  else if (major == SCSI_DISK15_MAJOR)
+grub_util_getdiskname_scsi (name, 15, minor / 16);
   else
 grub_util_error ("Unknown device number: %d, %d", major, minor);
 
Index: util/grub-mkdevicemap.c
===
--- util/grub-mkdevicemap.c	(revision 2016)
+++ util/grub-mkdevicemap.c	(working copy)
@@ -231,7 +231,10 @@ get_scsi_disk_name (char *name, int unit)
 {
 #if defined(__linux__)
   /* GNU/Linux */
-  sprintf (name, "/dev/sd%c", unit + 'a');
+  if (unit < 26)
+sprintf (name, "/dev/sd%c", unit + 'a');
+  else
+sprintf (name, "/dev/sd%c%c", unit / 26 - 1 + 'a', unit % 26 + 'a');
 #elif defined(__GNU__)
   /* GNU/Hurd */
   sprintf (name, "/dev/sd%d", unit);
@@ -516,7 +519,11 @@ make_device_map (const char *device_map, int flopp
 #endif /* __linux__ */
 
   /* The rest is SCSI disks.  */
+#ifdef __linux__
+  for (i = 0; i < 256; i++)
+#else
   for (i = 0; i < 16; i++)
+#endif /* __linux__ */
 {
   char name[16];
   
Index: util/hostdisk.c
===
--- util/hostdisk.c	(revision 2016)
+++ util/hostdisk.c	(working copy)
@@ -709,8 +709,12 @@ convert_system_partition_to_system_disk (const cha
 	   || strncmp ("sd", p, 2) == 0)
 	  && p[2] >= 'a' && p[2] <= 'z')
 	{
-	  /* /dev/[hsv]d[a-z][0-9]* */
-	  p[3] = '\0';
+	  if (p[3] >= 'a' && p[3] <= 'z')
+	/* /dev/[hsv]d[a-z][a-z][0-9]* */
+	p[4] = '\0';
+	  else
+	/* /dev/[hsv]d[a-z][0-9]* */
+	p[3] = '\0';
 	  return path;
 	}
 
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 7/7]: Get cob-webs out of sparc64-ieee1275.rmk

2009-03-04 Thread Vincent Pelletier
Le Wednesday 04 March 2009 03:15:39 David Miller, vous avez écrit :
> There is no way anyone tried to build the sparc target in
> years :-)

Literaly years. More than 3 I think.
I gave it a try ~2 1/2 years ago, and started writing a patch... And gave up.
Thanks a lot for taking care of this. I had a very fun time discovering 
sparc64 as I wrote it, and I stopped before making anything usable. I hope 
you won't find too much bad code (sorry about that cache flush).

I guess I'll fire up my good ol' ultra 10 to celebrate this :) .

-- 
Vincent Pelletier


signature.asc
Description: This is a digitally signed message part.
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] make partition active

2009-03-04 Thread Robert Millan
On Mon, Mar 02, 2009 at 11:52:13AM +0800, Bean wrote:
> > Then we could use parttool syntax. Then parttype can be implemented like
> > grub> parttool hd0,1 type=7
> > makeactive like:
> > grub> parttool hd0,1 boot+
> > And it can even be done by one command
> > grub> parttool hd0,1 boot+ type=7
> >
> > Thank you for your attention to my patches
> 
> Hi,
> 
> In that case, you might want to use options, which save you the
> trouble of parsing parameters yourself, for example:
> 
> parttool [--boot] [--type N] partition

Why don't we make the syntax compatible with Parted?  It supports
non-interactive mode, and is also a GNU project.  Some consistency
between it and GRUB would be nice IMO.

(besides, there's also that project to integrate Parted with GRUB directly,
it used to be in gsoc)

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Handler support

2009-03-04 Thread Robert Millan
On Mon, Mar 02, 2009 at 01:52:21AM +0800, Bean wrote:
> 
> Hi,
> 
> Fixed and committed.

So what happened to the terminal module?  Is there a new way to change
terminals? :-)

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Migrating to GRUB 2 in Debian (Re: Interesting GSoC project ideas for 09)

2009-03-04 Thread Robert Millan
On Sat, Feb 28, 2009 at 11:28:05PM -0500, Pavel Roskin wrote:
> On Sat, 2009-02-28 at 12:54 +0100, phcoder wrote:
> > Robert Millan wrote:
> > > Seems nice.  Would you be willing to write a summary for these?  Then we
> > > could add it to grub-soc.html.
> > Where is this file?
> > Here is elaborated list:
> 
> In my opinion, matching all features of GRUB 1 on i386-pc should be the
> highest priority.  It would allow distributions to switch to GRUB 2,
> bringing more users and more developers.  As it stands now, GRUB 2 is
> seen as something much more experimental and dangerous than GRUB 1.
> 
> We won't win many users by the mouse and bluetooth support if distros
> don't switch to the new GRUB.  And distros are reluctant to make any
> changes that would be seen as regressions.

(Speaking as distro maintainer now)

We don't need a complete match of all the GRUB Legacy features in order to
migrate.  The things I identified as needed for migration in Debian are
listed here:

  http://wiki.debian.org/GrubTransition

I think Xen is fixed now though (someone can confirm?).  For grub-reboot
/ savedefault almost all the pieces are there already (thanks to bean).

For lock / password we need to agree on whether the proposed approach is
acceptable, or otherwise what needs to be done.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 1/7]: Fix sparc64 setjmp implementation.

2009-03-04 Thread David Miller
From: Javier Martín 
Date: Wed, 04 Mar 2009 16:58:22 +0100

> As an example of what this entails, the failure to think with the future
> in mind has extraordinarily hampered the 32->64 bit transition: many
> Windows apps (among them the Vorbis codecs!) had be nearly rewritten
> because they used "unsigned long" interchangeably with pointer types. I
> still wonder if it would have been so difficult to use "void*", and the
> proper types for pointer arithmetic.

Actually the problem is that they used "int" interchangably with
pointer types.

"unsigned long" is always safe because it is going to be
the largest natural word size on the machine, at least
as large as a pointer will be.

We've been using "unsigned long" for storing virtual addresses in the
Linux kernel for 10+ years and it works just fine.  :-)

Really, nobody is going to touch the grub_jmp_buf[] implementation
other than sparc expert.  So saying this case will cause problems for
grub non-sparc folks is something of a scarecrow.


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: Interesting GSoC project ideas for 09

2009-03-04 Thread Robert Millan
On Sun, Mar 01, 2009 at 06:15:43PM +0100, phcoder wrote:
> I personally see following features still missing from grub2 comparing  
> to grub1:
> -network

Notice that in the GRUB Legacy shipped by Debian, network is disabled anyway
(without module support, you can't ship a prebuilt image that supports all
drivers).

> -simple partition manipulation
> I started a design discussion about this subject but nobody seems to be  
> interested. If I receive no further replies I suppose that my  
> proposition with "parttool" in "Re: [PATCH] make partition active" is ok  
> and implement it

This is nice, but not an essential feature when it comes to Debian.

> -map hook

Same here.

> -setkey
> I've seen that someone already started keymap support

Yep, and gettext too.  Both are really nice, but I don't think they're
essential for Debian users either.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: Menu locks / password authentication

2009-03-04 Thread Robert Millan
On Tue, Mar 03, 2009 at 05:32:40PM +0200, Vesa Jääskeläinen wrote:
> Robert Millan wrote:
> > It's funny, we're all discussing about performing security measurements in
> > GRUB and nobody mentioned that our user interface lacks even the most basic
> > lock mechanism :-)
> > 
> > Perhaps this would be a good time to retake the discussion on implementing
> > an equivalent to "lock" and "password" commands.  I think I even sent a 
> > patch
> > a while ago!
> > 
> > Vesa, do you still think we should design an extensible framework for
> > authentication before we do anything else?  I think it'd be interesting if
> > we could implement the lock/password paradigm, even if later it would be
> > replaced, since our users commonly need this, and it's blocking the
> > transition from GRUB Legacy.
> 
> I think that most important thing at this time is to match needed
> functionality with GRUB legacy. So just make it clean and perhaps think
> a bit about how it can be easily extended :).
> 
> I think there was some hash algorithms posted previously that could be
> used for this.

Hashing is nice, but basic password support can work without hash.  If you
give grub.cfg the proper perms, that is.

Anyway, for those interested:

  http://www.mail-archive.com/grub-devel@gnu.org/msg05350.html

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: Set an LVM volume as default root device

2009-03-04 Thread Robert Millan
On Sat, Feb 28, 2009 at 06:55:09PM +0100, Aesir wrote:
> Hi everyone,
> 
> while discovering the beauties of grub2 I'm trying to get a working setup 
> with /boot partition on LVM. Unfortunately until now to boot this system I 
> had to set root device and prefix "by hand" from the rescue shell. In fact, 
> while the working values should be
> 
> root (vg0-boot)
> prefix (vg0-boot)/grub
> 
> the ones that grub2 uses by default are
> 
> root (hd0)
> prefix (hd0)/grub
> 
> I haven't figured out yet how to change that default value, even reading 
> grub-setup help I couldn't find it out. I would be really pleased if someone 
> could help me.
> 
> Sorry if this is a silly question, hope for your comprehension :-)

grub-install / grub-mkconfig should already DTRT.  Are you using those to
install and generate grub.cfg ?

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: fault on compiling grub2 of version 2010

2009-03-04 Thread Robert Millan
On Wed, Mar 04, 2009 at 01:14:43AM +0800, liu Aleaxander wrote:
> configured with --enable-grub-emu.
> 
> /home/Aleax/project/grub/grub2/commands/handler.c:46: undefined reference to
> `grub_handler_class_list'
> /home/Aleax/project/grub/grub2/commands/handler.c:62: undefined reference to
> `grub_named_list_find'
> /home/Aleax/project/grub/grub2/commands/handler.c:76: undefined reference to
> `grub_named_list_find'
> /home/Aleax/project/grub/grub2/commands/handler.c:83: undefined reference to
> `grub_handler_set_current'
> /home/Aleax/project/grub/grub2/commands/handler.c:69: undefined reference to
> `grub_list_iterate'
> /home/Aleax/project/grub/grub2/commands/handler.c:49: undefined reference to

Felix just fixed this in SVN.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: Detection and installation of Grub on Raid1 disks.

2009-03-04 Thread Robert Millan
On Wed, Mar 04, 2009 at 09:04:16AM +1300, Centurion Computer Technology (2005) 
Ltd wrote:
> 
> Has anything chaged since the december build that may have fixed this?
> 
> If not, I'll pull the latest svn and have a hack and see if I can solve
> this.

Could be, yes.  Always try latest SVN when you think you've found a bug.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH] parttool

2009-03-04 Thread phcoder
Hello here is the implementation of parttool with the syntax I proposed 
earlier and equivalent of parttype, makeactive and hide/unhide

--

Regards
Vladimir 'phcoder' Serbinenko
Index: conf/common.rmk
===
--- conf/common.rmk	(revision 2017)
+++ conf/common.rmk	(working copy)
@@ -334,7 +340,7 @@
 	cmp.mod cat.mod help.mod search.mod	\
 	loopback.mod fs_uuid.mod configfile.mod echo.mod	\
 	terminfo.mod test.mod blocklist.mod hexdump.mod		\
-	read.mod sleep.mod loadenv.mod crc.mod
+	read.mod sleep.mod loadenv.mod crc.mod parttool.mod pcpart.mod
 
 # For hello.mod.
 hello_mod_SOURCES = hello/hello.c
@@ -346,6 +352,16 @@
 boot_mod_CFLAGS = $(COMMON_CFLAGS)
 boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
+# For parttool.mod.
+parttool_mod_SOURCES = commands/parttool.c
+parttool_mod_CFLAGS = $(COMMON_CFLAGS)
+parttool_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
+# For pcpart.mod.
+pcpart_mod_SOURCES = parttool/pcpart.c
+pcpart_mod_CFLAGS = $(COMMON_CFLAGS)
+pcpart_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
 # For handler.mod.
 handler_mod_SOURCES = commands/handler.c
 handler_mod_CFLAGS = $(COMMON_CFLAGS)
Index: conf/i386-coreboot.rmk
===
--- conf/i386-coreboot.rmk	(revision 2017)
+++ conf/i386-coreboot.rmk	(working copy)
@@ -87,6 +89,7 @@
 	\
 	disk/raid.c disk/raid5_recover.c disk/raid6_recover.c		\
 	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c		\
+	commands/parttool.c parttool/pcpart.c\
 	grub_emu_init.c
 
 grub_emu_LDFLAGS = $(LIBCURSES)
Index: conf/i386-efi.rmk
===
--- conf/i386-efi.rmk	(revision 2017)
+++ conf/i386-efi.rmk	(working copy)
@@ -65,6 +66,7 @@
 	\
 	disk/raid.c disk/raid5_recover.c disk/raid6_recover.c		\
 	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c		\
+	commands/parttool.c parttool/pcpart.c\
 	grub_emu_init.c
 
 grub_emu_LDFLAGS = $(LIBCURSES)
Index: conf/i386-ieee1275.rmk
===
--- conf/i386-ieee1275.rmk	(revision 2017)
+++ conf/i386-ieee1275.rmk	(working copy)
@@ -87,6 +89,7 @@
 	\
 	disk/raid.c disk/raid5_recover.c disk/raid6_recover.c		\
 	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c		\
+	commands/parttool.c parttool/pcpart.c\
 	grub_emu_init.c
 
 grub_emu_LDFLAGS = $(LIBCURSES)
Index: conf/i386-pc.rmk
===
--- conf/i386-pc.rmk	(revision 2017)
+++ conf/i386-pc.rmk	(working copy)
@@ -146,3 +147,4 @@
 	\
 	disk/raid.c disk/raid5_recover.c disk/raid6_recover.c		\
 	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c		\
+	commands/parttool.c parttool/pcpart.c\
	grub_emu_init.c
 
 grub_emu_LDFLAGS = $(LIBCURSES) 
 
Index: conf/powerpc-ieee1275.rmk
===
--- conf/powerpc-ieee1275.rmk	(revision 2017)
+++ conf/powerpc-ieee1275.rmk	(working copy)
@@ -70,6 +70,7 @@
 	\
 	disk/raid.c disk/raid5_recover.c disk/raid6_recover.c		\
 	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c		\
+	commands/parttool.c parttool/pcpart.c\
 	grub_script.tab.c grub_emu_init.c
 
 grub_emu_LDFLAGS = $(LIBCURSES)
Index: conf/sparc64-ieee1275.rmk
===
--- conf/sparc64-ieee1275.rmk	(revision 2017)
+++ conf/sparc64-ieee1275.rmk	(working copy)
@@ -66,6 +67,7 @@
 #	partmap/acorn.c			\
 #	util/console.c util/grub-emu.c util/misc.c			\
 #	util/hostdisk.c util/getroot.c	\
+#	commands/parttool.c parttool/pcpart.c\
 #	util/sparc64/ieee1275/misc.c
 
 grub_emu_LDFLAGS = $(LIBCURSES)
Index: conf/x86_64-efi.rmk
===
--- conf/x86_64-efi.rmk	(revision 2017)
+++ conf/x86_64-efi.rmk	(working copy)
@@ -67,6 +68,7 @@
 	\
 	disk/raid.c disk/raid5_recover.c disk/raid6_recover.c		\
 	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c		\
+	commands/parttool.c parttool/pcpart.c\
 	grub_emu_init.c
 
 grub_emu_LDFLAGS = $(LIBCURSES)
Index: commands/parttool.c
===
--- commands/parttool.c	(revision 0)
+++ commands/parttool.c	(revision 0)
@@ -0,0 +1,248 @@
+/* parttool.c - common dispatcher and parser for partition operations */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2009  Free Software Foundation, Inc.
+ *
+ *  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 sh

Re: [PATCH] Support up to 256 SCSI disks on Linux

2009-03-04 Thread Robert Millan
On Wed, Mar 04, 2009 at 04:35:09PM +, Colin Watson wrote:
> Linux's Documentation/devices.txt file says that up to 256 SCSI disks
> are supported. GRUB currently only supports the first 16. Wikimedia
> filed an Ubuntu bug report about this
> (https://bugs.launchpad.net/bugs/335174), so here's a patch to extend
> this. (I really haven't been able to test this much at all beyond
> compile-testing as I don't have a suitable system myself ...)
> 
> I suppose it might be nice to macroify the stuff in
> grub_util_getdiskname, but TBH I'm not sure it would shorten it all that
> much or make it much more readable, so I didn't bother.

Hi Colin,

I feel some dejavu.  I think this is not the first max disk limit you
find ;-)

>else if (major == SCSI_DISK0_MAJOR)
> -sprintf (name, "/dev/sd%c", 'a' + minor / 16);
> +grub_util_getdiskname_scsi (name, 0, minor / 16);
> +  else if (major == SCSI_DISK1_MAJOR)
> +grub_util_getdiskname_scsi (name, 1, minor / 16);
> [...]

Can this be factorized somehow?  Space in raid.mod is quite critical; when
used it usually ends up in core.img, which needs to fit in the embed area.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Support up to 256 SCSI disks on Linux

2009-03-04 Thread Robert Millan
On Wed, Mar 04, 2009 at 10:16:29PM +0100, Robert Millan wrote:
> >else if (major == SCSI_DISK0_MAJOR)
> > -sprintf (name, "/dev/sd%c", 'a' + minor / 16);
> > +grub_util_getdiskname_scsi (name, 0, minor / 16);
> > +  else if (major == SCSI_DISK1_MAJOR)
> > +grub_util_getdiskname_scsi (name, 1, minor / 16);
> > [...]
> 
> Can this be factorized somehow?  Space in raid.mod is quite critical; when
> used it usually ends up in core.img, which needs to fit in the embed area.

Oh, I'm sorry.  I thought you were editting disk/raid.c.  util/raid.c has no
size issues.  A macro would still be nice though.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 0/7]: Get sparc building again.

2009-03-04 Thread Robert Millan
On Tue, Mar 03, 2009 at 06:15:08PM -0800, David Miller wrote:
> 
> Here is a series of patches that fix the most obvious sparc bugs and
> get the grub2 tree building again.
> 
> I have code for boot/ that will implement the sparc boot blocks and
> things of that nature, but that will come later.
> 
> First things first, let's get it to actually build. :)

Hi,

I suggest you get rid of sparc64-ieee1275.rmk and use powerpc-ieee1275.rmk
as a basis.  The sparc one has gone completely bitrot, and it'll be more
work to try to fix that than making a few adjustments to the powerpc one.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 0/7]: Get sparc building again.

2009-03-04 Thread David Miller
From: Robert Millan 
Date: Wed, 4 Mar 2009 22:26:51 +0100

> On Tue, Mar 03, 2009 at 06:15:08PM -0800, David Miller wrote:
> > 
> > Here is a series of patches that fix the most obvious sparc bugs and
> > get the grub2 tree building again.
> > 
> > I have code for boot/ that will implement the sparc boot blocks and
> > things of that nature, but that will come later.
> > 
> > First things first, let's get it to actually build. :)
> 
> Hi,
> 
> I suggest you get rid of sparc64-ieee1275.rmk and use powerpc-ieee1275.rmk
> as a basis.  The sparc one has gone completely bitrot, and it'll be more
> work to try to fix that than making a few adjustments to the powerpc one.

I did!  Look at the final sparc64-ieee1275.rmk I end up with
in my patches, it's essentially the powerpc one with
s/powerpc/sparc64/



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 0/7]: Get sparc building again.

2009-03-04 Thread Robert Millan
On Wed, Mar 04, 2009 at 01:33:29PM -0800, David Miller wrote:
> From: Robert Millan 
> Date: Wed, 4 Mar 2009 22:26:51 +0100
> 
> > On Tue, Mar 03, 2009 at 06:15:08PM -0800, David Miller wrote:
> > > 
> > > Here is a series of patches that fix the most obvious sparc bugs and
> > > get the grub2 tree building again.
> > > 
> > > I have code for boot/ that will implement the sparc boot blocks and
> > > things of that nature, but that will come later.
> > > 
> > > First things first, let's get it to actually build. :)
> > 
> > Hi,
> > 
> > I suggest you get rid of sparc64-ieee1275.rmk and use powerpc-ieee1275.rmk
> > as a basis.  The sparc one has gone completely bitrot, and it'll be more
> > work to try to fix that than making a few adjustments to the powerpc one.
> 
> I did!  Look at the final sparc64-ieee1275.rmk I end up with
> in my patches, it's essentially the powerpc one with
> s/powerpc/sparc64/

Oh, alright :-)

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH 1/10]: Fix sparc64 setjmp

2009-03-04 Thread David Miller

2009-03-03  David S. Miller  

* normal/sparc64/setjmp.S: Fix setjmp implementation.
* include/grub/sparc64/setjmp.h: Update grub_jmp_buf[].
---
 include/grub/sparc64/setjmp.h |7 ---
 normal/sparc64/setjmp.S   |   20 ++--
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/include/grub/sparc64/setjmp.h b/include/grub/sparc64/setjmp.h
index 12d8e01..c8abb12 100644
--- a/include/grub/sparc64/setjmp.h
+++ b/include/grub/sparc64/setjmp.h
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002,2004,2006,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 2002,2004,2006,2007,2009  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
@@ -19,8 +19,9 @@
 #ifndef GRUB_SETJMP_CPU_HEADER
 #define GRUB_SETJMP_CPU_HEADER 1
 
-/* FIXME (sparc64).  */
-typedef unsigned long grub_jmp_buf[20];
+#include 
+
+typedef grub_uint64_t grub_jmp_buf[3];
 
 int grub_setjmp (grub_jmp_buf env);
 void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
diff --git a/normal/sparc64/setjmp.S b/normal/sparc64/setjmp.S
index b1a9b6e..827299c 100644
--- a/normal/sparc64/setjmp.S
+++ b/normal/sparc64/setjmp.S
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2005,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 2005,2007,2009  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
@@ -26,13 +26,21 @@
  * int grub_setjmp (grub_jmp_buf env)
  */
 FUNCTION(grub_setjmp)
-ret
- nop
+   stx %o7, [%o0 + 0x00]
+   stx %sp, [%o0 + 0x08]
+   retl
+stx%fp, [%o0 + 0x10]
 
 /*
  * int grub_longjmp (grub_jmp_buf env, int val)
  */
 FUNCTION(grub_longjmp)
-ret
- nop
-
+   ldx [%o0 + 0x10], %g1
+   movrz   %o1, 1, %o1
+   ta  0x3
+   ldx [%o0 + 0x00], %o7
+   ldx [%o0 + 0x08], %fp
+   sub %fp, 192, %sp
+   stx %g1, [%sp + 2047 + (14 * 8)]
+   retl
+restore %o1, 0, %o0
-- 
1.6.2



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH 2/10]: Fix sparc64 cache flush

2009-03-04 Thread David Miller

2009-03-03 David S. Miller 

* kern/sparc64/cache.S: Fix grub_arch_sync_caches implementation.
---
 kern/sparc64/cache.S |   24 ++--
 1 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/kern/sparc64/cache.S b/kern/sparc64/cache.S
index 2ebb693..dac3f93 100644
--- a/kern/sparc64/cache.S
+++ b/kern/sparc64/cache.S
@@ -1,7 +1,7 @@
 /* cache.S - Flush the processor cache for a specific region.  */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2005,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 2005,2007,2009  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
@@ -27,17 +27,13 @@
  * void grub_arch_sync_caches (void *address, grub_size_t len)
  */
 FUNCTION(grub_arch_sync_caches)
-save%o6,-0xC,  %o6  ! Get a new register window,
-! reserve space on stack for
-! %i0, %i1, %i2
-brz,pn  %i0,return  ! Return if address == 0.
- nop
-brz,pn  %i1,return  ! Return if len == 0.
- clr %i2! index = 0.
-loop:   flush   %i0 + %i2   ! Flush address + index.
-cmp %i1,%i2 ! Compare len & index .
-bpos,a,pt   %xcc,   loop! If len > index, loop.
- add%i2,8,  %i2 ! Go to next doubleword.
-return: ret ! Restore caller's register
- restore! window and return.
+   brz,pn  %o1, 2f
+andn   %o0, 7, %o0
+   add %o1, 7, %o1
+   andn%o1, 7, %o1
+1: subcc   %o1, 8, %o1
+   bne,pt  %icc, 1b
+flush  %o0 + %o1
+2: retl
+nop
 
-- 
1.6.2



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH 3/10]: Implement proper sparc64 kern startup.

2009-03-04 Thread David Miller

2009-03-03 David S. Miller 

* kern/sparc64/ieee1275/init.c: Delete, replace with...
* kern/sparc64/ieee1275/crt0.S: assembler implementation.
* include/grub/sparc64/ieee1275/kernel.h: Declare grub_prefix[].
---
 include/grub/sparc64/ieee1275/kernel.h |6 +-
 kern/sparc64/ieee1275/crt0.S   |   54 +++
 kern/sparc64/ieee1275/init.c   |  237 
 3 files changed, 59 insertions(+), 238 deletions(-)
 create mode 100644 kern/sparc64/ieee1275/crt0.S
 delete mode 100644 kern/sparc64/ieee1275/init.c

diff --git a/include/grub/sparc64/ieee1275/kernel.h 
b/include/grub/sparc64/ieee1275/kernel.h
index 0b6bce2..1cb47e4 100644
--- a/include/grub/sparc64/ieee1275/kernel.h
+++ b/include/grub/sparc64/ieee1275/kernel.h
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2005,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 2005,2007,2009  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
@@ -24,6 +24,10 @@
 void EXPORT_FUNC (grub_reboot) (void);
 void EXPORT_FUNC (grub_halt) (void);
 
+/* The prefix which points to the directory where GRUB modules and its
+   configuration file are located.  */
+extern char grub_prefix[];
+
 /* Where grub-mkimage places the core modules in memory.  */
 #define GRUB_IEEE1275_MODULE_BASE 0x0030
 
diff --git a/kern/sparc64/ieee1275/crt0.S b/kern/sparc64/ieee1275/crt0.S
new file mode 100644
index 000..5008b81
--- /dev/null
+++ b/kern/sparc64/ieee1275/crt0.S
@@ -0,0 +1,54 @@
+/* crt0.S - Startup code for the Sparc64.  */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2009  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 .
+ */
+#include 
+#include 
+
+   .text
+   .align  4
+   .globl  _start
+_start:
+   ba  codestart
+nop
+
+   . = EXT_C(_start) + GRUB_KERNEL_CPU_PREFIX
+
+VARIABLE(grub_prefix)
+   /* to be filled by grub-mkelfimage */
+
+   /*
+*  Leave some breathing room for the prefix.
+*/
+
+   . = EXT_C(_start) + GRUB_KERNEL_CPU_DATA_END
+
+codestart:
+   sethi   %hi(__bss_start), %o2
+   or  %o2, %lo(__bss_start), %o2
+   sethi   %hi(_end), %o3
+   or  %o3, %lo(_end), %o3
+1: stx %g0, [%o2]
+   add %o2, 8, %o2
+   cmp %o2, %o3
+   blt,pt  %xcc, 1b
+nop
+   sethi   %hi(grub_ieee1275_entry_fn), %o2
+   stx %o0, [%o2 + %lo(grub_ieee1275_entry_fn)]
+   callgrub_main
+nop
+1: ba,a1b
diff --git a/kern/sparc64/ieee1275/init.c b/kern/sparc64/ieee1275/init.c
deleted file mode 100644
index a342557..000
--- a/kern/sparc64/ieee1275/init.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*  init.c -- Initialize GRUB on the Ultra Sprac (sparc64).  */
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2003,2004,2005,2007,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 .
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-/* OpenBoot entry point.  */
-int (*grub_ieee1275_entry_fn) (void *);
-grub_ieee1275_phandle_t grub_ieee1275_chosen;
-static grub_uint32_t grub_ieee1275_flags;
-/* FIXME (sparc64).  */
-static const grub_addr_t grub_heap_start = 0x4;
-static grub_addr_t grub_heap_len;
-
-void
-_start (uint64_t r0 __attribute__((unused)),
-uint64_t r1 __attribute__((unused)),
-uint64_t r2 __attribute__((unused)),
-uint64_t r3 __attribute__((unused)),
-uint64_t r4,
-uint64_t r5 __attribute__

[PATCH 0/10]: Respin of sparc patches.

2009-03-04 Thread David Miller

This is a respin of the sparc64 grub patches I posted
with changes based upon feedback (whitespace, use common
code, type police, don't include generated files, etc.)

It's also made against current top of trunk (there were
some sparc64-ieee1275.rmk changes in the past 24 hours
so this was necessary).


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH 4/10]: Add sparc64 loader implementation.

2009-03-04 Thread David Miller

2009-03-03 David S. Miller 

* include/grub/sparc64/ieee1275/loader.h: New file.
* include/grub/sparc64/ieee1275/memory.h: Likewise.
* include/grub/sparc64/kernel.h: Likewise.
* loader/sparc64/ieee1275/linux.c: Likewise.
---
 include/grub/sparc64/ieee1275/loader.h |   27 +++
 include/grub/sparc64/ieee1275/memory.h |   24 +++
 include/grub/sparc64/kernel.h  |   28 +++
 loader/sparc64/ieee1275/linux.c|  318 
 4 files changed, 397 insertions(+), 0 deletions(-)
 create mode 100644 include/grub/sparc64/ieee1275/loader.h
 create mode 100644 include/grub/sparc64/ieee1275/memory.h
 create mode 100644 include/grub/sparc64/kernel.h
 create mode 100644 loader/sparc64/ieee1275/linux.c

diff --git a/include/grub/sparc64/ieee1275/loader.h 
b/include/grub/sparc64/ieee1275/loader.h
new file mode 100644
index 000..12bb2a6
--- /dev/null
+++ b/include/grub/sparc64/ieee1275/loader.h
@@ -0,0 +1,27 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2009  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 .
+ */
+
+#ifndef GRUB_LOADER_MACHINE_HEADER
+#define GRUB_LOADER_MACHINE_HEADER 1
+
+/* The symbol shared between the normal mode and rescue mode
+   loader.  */
+void grub_rescue_cmd_linux (int argc, char *argv[]);
+void grub_rescue_cmd_initrd (int argc, char *argv[]);
+
+#endif /* ! GRUB_LOADER_MACHINE_HEADER */
diff --git a/include/grub/sparc64/ieee1275/memory.h 
b/include/grub/sparc64/ieee1275/memory.h
new file mode 100644
index 000..c997f66
--- /dev/null
+++ b/include/grub/sparc64/ieee1275/memory.h
@@ -0,0 +1,24 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2009 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 .
+ */
+
+#ifndef GRUB_MEMORY_MACHINE_HEADER
+#define GRUB_MEMORY_MACHINE_HEADER 1
+
+#define GRUB_MACHINE_MEMORY_AVAILABLE  1
+
+#endif
diff --git a/include/grub/sparc64/kernel.h b/include/grub/sparc64/kernel.h
new file mode 100644
index 000..5c03720
--- /dev/null
+++ b/include/grub/sparc64/kernel.h
@@ -0,0 +1,28 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2009  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 .
+ */
+
+#ifndef GRUB_KERNEL_CPU_HEADER
+#define GRUB_KERNEL_CPU_HEADER 1
+
+#define GRUB_MOD_ALIGN 0x2000
+#define GRUB_MOD_GAP 0x8000
+
+#define GRUB_KERNEL_CPU_PREFIX 0x8
+#define GRUB_KERNEL_CPU_DATA_END   0x48
+
+#endif
diff --git a/loader/sparc64/ieee1275/linux.c b/loader/sparc64/ieee1275/linux.c
new file mode 100644
index 000..35651f1
--- /dev/null
+++ b/loader/sparc64/ieee1275/linux.c
@@ -0,0 +1,318 @@
+/* linux.c - boot Linux */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2003, 2004, 2005, 2007, 2009  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 W

[PATCH 5/10]: Fix multiboot2 build on sparc

2009-03-04 Thread David Miller

2009-03-03 David S. Miller 

* loader/ieee1275/multiboot2.c (grub_mb2_arch_boot): Handle
sparc like powerpc.
---
 loader/ieee1275/multiboot2.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/loader/ieee1275/multiboot2.c b/loader/ieee1275/multiboot2.c
index c253fc9..6d0e781 100644
--- a/loader/ieee1275/multiboot2.c
+++ b/loader/ieee1275/multiboot2.c
@@ -115,7 +115,7 @@ grub_mb2_arch_unload (struct multiboot_tag_header *tags)
 void
 grub_mb2_arch_boot (grub_addr_t entry_addr, void *tags)
 {
-#if defined(__powerpc__)
+#if defined(__powerpc__) || defined(__sparc__)
   kernel_entry_t entry = (kernel_entry_t) entry_addr;
   entry (MULTIBOOT2_BOOTLOADER_MAGIC, tags, grub_ieee1275_entry_fn, 0, 0);
 #elif defined(__i386__)
-- 
1.6.2



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH 7/10]: Fix several warnings on sparc64.

2009-03-04 Thread David Miller

2009-03-04 David S. Miller 

* kern/ieee1275/cmain.c (grub_ieee1275_init): Third arg to
grub_ieee1275_get_integer_property is a grub_uint32_t pointer.
* kern/ieee1275/init.c (grub_machine_init): Fix type of
'actual'.
* kern/ieee1275/openfw.c (grub_children_iterate): Likewise.
(grub_devalias_iterate): Likewise.
* term/ieee1275/ofconsole.c (grub_ofconsole_init_input):
Fix third arg to grub_ieee1275_get_integer_property.
(grub_ofconsole_init_output): Likewise.
---
 kern/ieee1275/cmain.c |6 +-
 kern/ieee1275/init.c  |2 +-
 kern/ieee1275/openfw.c|4 ++--
 term/ieee1275/ofconsole.c |   10 --
 4 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/kern/ieee1275/cmain.c b/kern/ieee1275/cmain.c
index b5e2ba6..942fe02 100644
--- a/kern/ieee1275/cmain.c
+++ b/kern/ieee1275/cmain.c
@@ -157,11 +157,15 @@ grub_ieee1275_find_options (void)
 void
 grub_ieee1275_init (void)
 {
+  grub_uint32_t val;
+
   grub_ieee1275_finddevice ("/chosen", &grub_ieee1275_chosen);
 
-  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "mmu", 
&grub_ieee1275_mmu,
+  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "mmu", &val,
  sizeof grub_ieee1275_mmu, 0) < 0)
 grub_ieee1275_mmu = 0;
+  else
+grub_ieee1275_mmu = val;
 
   grub_ieee1275_find_options ();
 }
diff --git a/kern/ieee1275/init.c b/kern/ieee1275/init.c
index d345ba2..27783cc 100644
--- a/kern/ieee1275/init.c
+++ b/kern/ieee1275/init.c
@@ -213,7 +213,7 @@ void
 grub_machine_init (void)
 {
   char args[256];
-  int actual;
+  grub_ssize_t actual;
 
   grub_ieee1275_init ();
 
diff --git a/kern/ieee1275/openfw.c b/kern/ieee1275/openfw.c
index e88f3b3..4229c6e 100644
--- a/kern/ieee1275/openfw.c
+++ b/kern/ieee1275/openfw.c
@@ -53,7 +53,7 @@ grub_children_iterate (char *devpath,
   char childname[64];
   char fullname[64];
   struct grub_ieee1275_devalias alias;
-  int actual;
+  grub_ssize_t actual;
 
   if (grub_ieee1275_get_property (child, "device_type", &childtype,
  sizeof childtype, &actual))
@@ -86,7 +86,7 @@ grub_devalias_iterate (int (*hook) (struct 
grub_ieee1275_devalias *alias))
 {
   grub_ieee1275_phandle_t aliases;
   char aliasname[32];
-  int actual;
+  grub_ssize_t actual;
   struct grub_ieee1275_devalias alias;
 
   if (grub_ieee1275_finddevice ("/aliases", &aliases))
diff --git a/term/ieee1275/ofconsole.c b/term/ieee1275/ofconsole.c
index 70fda9a..5954b0c 100644
--- a/term/ieee1275/ofconsole.c
+++ b/term/ieee1275/ofconsole.c
@@ -341,12 +341,15 @@ static grub_err_t
 grub_ofconsole_init_input (void)
 {
   grub_ssize_t actual;
+  grub_uint32_t val;
 
-  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", 
&stdin_ihandle,
+  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", &val,
  sizeof stdin_ihandle, &actual)
   || actual != sizeof stdin_ihandle)
 return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
 
+  stdin_ihandle = val;
+
   return 0;
 }
 
@@ -354,6 +357,7 @@ static grub_err_t
 grub_ofconsole_init_output (void)
 {
   grub_ssize_t actual;
+  grub_uint32_t val;
   int col;
 
   /* The latest PowerMacs don't actually initialize the screen for us, so we
@@ -362,11 +366,13 @@ grub_ofconsole_init_output (void)
   if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_OUTPUT))
 grub_ieee1275_interpret ("output-device output", 0);
 
-  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdout", 
&stdout_ihandle,
+  if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdout", &val,
  sizeof stdout_ihandle, &actual)
   || actual != sizeof stdout_ihandle)
 return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdout");
 
+  stdout_ihandle = val;
+
   /* Initialize colors.  */
   if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS))
 {
-- 
1.6.2



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH 8/10]: Allow targets to define boot block image format.

2009-03-04 Thread David Miller

2009-03-04 David S. Miller 

* genmk.rb: Allow rmk file to specify pkglib_IMAGES object
file format in IMG_FMT.
* conf/i386-pc.rmk (IMG_FMT): Define.
---
 conf/i386-pc.rmk |1 +
 genmk.rb |2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk
index c996e45..d8074c9 100644
--- a/conf/i386-pc.rmk
+++ b/conf/i386-pc.rmk
@@ -10,6 +10,7 @@ COMMON_LDFLAGS = -m32 -nostdlib
 normal/lexer.c_DEPENDENCIES = grub_script.tab.h
 
 # Images.
+IMG_FMT = binary
 pkglib_IMAGES = boot.img diskboot.img kernel.img pxeboot.img lnxboot.img \
cdboot.img
 
diff --git a/genmk.rb b/genmk.rb
index c41872c..fe022cd 100644
--- a/genmk.rb
+++ b/genmk.rb
@@ -57,7 +57,7 @@ class Image
 MOSTLYCLEANFILES += #{deps_str}
 
 #...@name}: #{exe}
-   $(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
+   $(OBJCOPY) -O $(IMG_FMT) -R .note -R .comment -R .note.gnu.build-id $< 
$@
 
 #{exe}: #{objs_str}
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
-- 
1.6.2



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH 6/10]: Get cob-webs out of sparc64-ieee1275.rmk

2009-03-04 Thread David Miller

2009-03-03 David S. Miller 

* conf/sparc64-ieee1275.rmk: Update.
---
 conf/sparc64-ieee1275.rmk |  302 +---
 1 files changed, 89 insertions(+), 213 deletions(-)

diff --git a/conf/sparc64-ieee1275.rmk b/conf/sparc64-ieee1275.rmk
index 1658a66..5be3eeb 100644
--- a/conf/sparc64-ieee1275.rmk
+++ b/conf/sparc64-ieee1275.rmk
@@ -1,9 +1,9 @@
 
 # -*- makefile -*-
 
-COMMON_ASFLAGS = -nostdinc
-COMMON_CFLAGS = -ggdb -ffreestanding -m64 -mno-app-regs
-COMMON_LDFLAGS = -melf64_sparc -nostdlib
+COMMON_ASFLAGS = -nostdinc -m64
+COMMON_CFLAGS = -ffreestanding -m64 -mno-app-regs
+COMMON_LDFLAGS = -melf64_sparc -nostdlib -mno-relax
 
 # Used by various components.  These rules need to precede them.
 normal/lexer.c_DEPENDENCIES = grub_script.tab.h
@@ -21,10 +21,6 @@ kernel_elf_HEADERS = arg.h boot.h cache.h device.h disk.h 
dl.h elf.h elfload.h \
 symlist.c: $(addprefix include/grub/,$(kernel_elf_HEADERS)) config.h 
gensymlist.sh
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
 
-# For the parser.
-grub_script.tab.c grub_script.tab.h: normal/parser.y
-   $(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/normal/parser.y
-
 kernel_syms.lst: $(addprefix include/grub/,$(kernel_elf_HEADERS)) config.h 
genkernsyms.sh
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
 
@@ -42,120 +38,80 @@ grub_mkimage_SOURCES = 
util/sparc64/ieee1275/grub-mkimage.c util/misc.c \
 util/resolve.c 
 
 # For grub-emu
-#grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c  \
-#  commands/configfile.c commands/default.c commands/help.c\
-#  commands/search.c commands/terminal.c commands/ls.c \
-#  commands/timeout.c commands/test.c  \
-#  commands/halt.c commands/reboot.c   \
-#  disk/loopback.c \
-#  fs/affs.c fs/fat.c fs/ext2.c fs/fshelp.c fs/hfs.c fs/iso9660.c  \
-#  fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c  \
-#  grub_script.tab.c   \
-#  io/gzio.c   \
-#  kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c   \
-#  kern/file.c kern/fs.c kern/loader.c kern/main.c kern/misc.c \
-#  kern/parser.c kern/partition.c kern/rescue.c kern/term.c\
-#  kern/list.c kern/handler.c  \
-#  normal/arg.c normal/cmdline.c normal/command.c  \
-#  normal/completion.c normal/context.c normal/execute.c   \
-#  normal/function.c normal/lexer.c\
-#  normal/main.c normal/menu.c normal/menu_entry.c \
-#  normal/menu_text.c  \
-#  normal/menu_viewer.c normal/misc.c  \
-#  partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c  \
-#  partmap/acorn.c \
-#  util/console.c util/grub-emu.c util/misc.c  \
-#  util/hostdisk.c util/getroot.c  \
-#  util/sparc64/ieee1275/misc.c
+util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
+grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c   \
+   commands/configfile.c commands/help.c   \
+   commands/search.c commands/handler.c commands/test.c\
+   commands/ls.c commands/blocklist.c commands/hexdump.c   \
+   lib/hexdump.c commands/halt.c commands/reboot.c \
+   disk/loopback.c \
+   \
+   fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/ext2.c fs/hfs.c   \
+   fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c  \
+   fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c  \
+   fs/ufs.c fs/xfs.c fs/afs.c fs/tar.c \
+   \
+   io/gzio.c   \
+   kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c   \
+   kern/err.c kern/file.c kern/fs.c kern/loader.c kern/main.c  \
+   kern/misc.c kern/parser.c kern/partition.c kern/rescue.c\
+   kern/term.c fs/fshelp.c \
+   kern/list.c kern/handler.c  \
+   normal/arg.c normal/cmdline.c normal/command.c  \
+   normal/completion.c normal/execute.c\
+   normal/function.c normal/lexer.c normal/main.c normal/menu.c\
+   normal/menu_text.c  \
+   normal/menu_entry.c normal/menu_viewer.c normal/misc.c  \
+   normal/script.c

[PATCH 10/10]: Strip boot block built objects.

2009-03-04 Thread David Miller

2009-03-04 David S. Miller 

* genmk.rb: Strip object files built for boot images.
---
 genmk.rb |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/genmk.rb b/genmk.rb
index fe022cd..83ef639 100644
--- a/genmk.rb
+++ b/genmk.rb
@@ -61,6 +61,7 @@ MOSTLYCLEANFILES += #{deps_str}
 
 #{exe}: #{objs_str}
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
+   $(STRIP) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $@
 
 " + objs.collect_with_index do |obj, i|
   src = sources[i]
-- 
1.6.2



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH 9/10]: Add sparc64 boot block code.

2009-03-04 Thread David Miller

2009-03-04 David S. Miller 

* include/grub/sparc64/ieee1275/boot.h: New file.
* boot/sparc/ieee1275/boot.S: Likewise.
* boot/sparc/ieee1275/diskboot.S: Likewise.
* conf/sparc64-ieee1275.rmk: Build sparc boot blocks.
* conf/sparc64-ieee1275.mk: Regenerate.
---
 boot/sparc/ieee1275/boot.S   |  196 ++
 boot/sparc/ieee1275/diskboot.S   |  145 +
 conf/sparc64-ieee1275.rmk|   12 ++
 include/grub/sparc64/ieee1275/boot.h |   60 ++
 4 files changed, 413 insertions(+), 0 deletions(-)
 create mode 100644 boot/sparc/ieee1275/boot.S
 create mode 100644 boot/sparc/ieee1275/diskboot.S
 create mode 100644 include/grub/sparc64/ieee1275/boot.h

diff --git a/boot/sparc/ieee1275/boot.S b/boot/sparc/ieee1275/boot.S
new file mode 100644
index 000..a9ea0b6
--- /dev/null
+++ b/boot/sparc/ieee1275/boot.S
@@ -0,0 +1,196 @@
+/* -*-Asm-*- */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2009  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 .
+ */
+
+#include 
+#include 
+
+   .text
+   .align  4
+   .globl  _start
+_start:
+   /* OF CIF entry point arrives in %o4 */
+pic_base:
+   callboot_continue
+mov%o4, CIF_REG
+
+   . = _start + GRUB_BOOT_MACHINE_VER_MAJ
+boot_version:  .byte   GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR
+
+   /* The offsets to these locations are defined by the
+* GRUB_BOOT_MACHINE_foo macros in include/grub/sparc/ieee1275/boot.h,
+* and grub-setup uses this to patch these next three values as needed.
+*
+* The boot_path will be the OF device path of the partition where the
+* rest of the GRUB kernel image resides.  kernel_sector will be set to
+* the location of the first block of the GRUB kernel, and
+* kernel_address is the location where we should load that first block.
+*
+* After loading in that block we will execute it by jumping to the
+* load address plus the size of the prepended A.OUT header (32 bytes).
+*/
+boot_path:
+   . = _start + GRUB_BOOT_MACHINE_KERNEL_ADDRESS
+kernel_sector: .xword 2
+kernel_address:.word  GRUB_BOOT_MACHINE_KERNEL_ADDR
+
+prom_finddev_name: .asciz "finddevice"
+prom_chosen_path:  .asciz "/chosen"
+prom_getprop_name: .asciz "getprop"
+prom_stdout_name:  .asciz "stdout"
+prom_write_name:   .asciz "write"
+prom_bootpath_name:.asciz "bootpath"
+prom_open_name:.asciz "open"
+prom_seek_name:.asciz "seek"
+prom_read_name:.asciz "read"
+prom_exit_name:.asciz "exit"
+grub_name: .asciz "GRUB "
+#define GRUB_NAME_LEN  5
+
+   .align  4
+
+prom_open_error:
+   GET_ABS(prom_open_name, %o2)
+   callconsole_write
+mov4, %o3
+   /* fallthru */
+
+prom_error:
+   GET_ABS(prom_exit_name, %o0)
+   /* fallthru */
+
+   /* %o0: OF call name
+* %o1: input arg 1
+*/
+prom_call_1_1:
+   mov 1, %g1
+   ba  prom_call
+mov1, %o5
+
+   /* %o2: message string
+* %o3: message length
+*/
+console_write:
+   GET_ABS(prom_write_name, %o0)
+   mov STDOUT_NODE_REG, %o1
+   /* fallthru */
+
+   /* %o0: OF call name
+* %o1: input arg 1
+* %o2: input arg 2
+* %o3: input arg 3
+*/
+prom_call_3_1:
+   mov 3, %g1
+   mov 1, %o5
+   /* fallthru */
+
+   /* %o0: OF call name
+* %g1: num inputs
+* %o5: num outputs
+* %o1-%o4: inputs
+*/
+prom_call:
+   stx %o0, [%l1 + 0x00]
+   stx %g1, [%l1 + 0x08]
+   stx %o5, [%l1 + 0x10]
+   stx %o1, [%l1 + 0x18]
+   stx %o2, [%l1 + 0x20]
+   stx %o3, [%l1 + 0x28]
+   stx %o4, [%l1 + 0x30]
+   jmplCIF_REG, %g0
+mov%l1, %o0
+
+boot_continue:
+   mov %o7, PIC_REG/* PIC base */
+   sethi   %hi(SCRATCH_PAD), %l1   /* OF argument slots */
+
+   /* Find the /chosen node so we can fetch the stdout handle,
+* and thus perform console output.
+*
+* chosen_node = prom_finddevice("/chosen")
+*/
+   GET_ABS(pro

Re: [PATCH] Handler support

2009-03-04 Thread Bean
On Thu, Mar 5, 2009 at 4:55 AM, Robert Millan  wrote:
> On Mon, Mar 02, 2009 at 01:52:21AM +0800, Bean wrote:
>>
>> Hi,
>>
>> Fixed and committed.
>
> So what happened to the terminal module?  Is there a new way to change
> terminals? :-)

Hi,

Handler is the new generic handler manipulation command, for example:

handler terminal_output gfxterm

is the same as:

terminal_output gfxterm

The handler module also export command terminal_input and
terminal_output for backward compatibility, so you can also use the
old command.

-- 
Bean


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel