]> git.ozlabs.org Git - yaboot.git/commitdiff
Commit yaboot 1.3.4-pre3
authorEthan Benson <erbenson@alaska.net>
Tue, 26 Mar 2002 15:00:49 +0000 (15:00 +0000)
committerEthan Benson <erbenson@alaska.net>
Tue, 26 Mar 2002 15:00:49 +0000 (15:00 +0000)
Commit yaboot 1.3.4-pre3.
git-archimport-id: erbenson@alaska.net--public/yaboot--devel--1.3--patch-7

19 files changed:
ChangeLog
Makefile
changelog
include/debug.h [new file with mode: 0644]
include/errors.h
include/file.h
include/fs.h
include/partition.h
include/prom.h
second/cfg.c
second/file.c
second/fs_ext2.c
second/fs_of.c
second/fs_reiserfs.c
second/fs_xfs.c
second/partition.c
second/prom.c
second/yaboot.c
ybin/ybin

index 5daeea07171dc8afa9a00f3dc2b8e29417b72933..5cfcdca6253b6e2e91bf25f158181808daa72c34 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,26 @@
 # tag: automatic-ChangeLog--erbenson@alaska.net--public/yaboot--devel--1.3
 #
 
+2002-03-26 15:00:49 GMT        Ethan Benson <erbenson@alaska.net>      patch-7
+
+    Summary:
+      Commit yaboot 1.3.4-pre3
+    Revision:
+      yaboot--devel--1.3--patch-7
+
+    Commit yaboot 1.3.4-pre3.
+
+    new files:
+     include/.arch-ids/debug.h.id include/debug.h
+
+    modified files:
+     ChangeLog Makefile changelog include/errors.h include/file.h
+     include/fs.h include/partition.h include/prom.h second/cfg.c
+     second/file.c second/fs_ext2.c second/fs_of.c
+     second/fs_reiserfs.c second/fs_xfs.c second/partition.c
+     second/prom.c second/yaboot.c ybin/ybin
+
+
 2002-03-26 14:42:58 GMT        Ethan Benson <erbenson@alaska.net>      patch-6
 
     Summary:
index ff0287244218484fb4aa426e7b62fd5917511f7d..5f6fc9a753316b604ec35bf6cfb07083f0564a20 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 
 include Config
 
-VERSION = 1.3.4pre2
+VERSION = 1.3.4pre3
 # Debug mode (spam/verbose)
 DEBUG = 0
 # make install vars
index 9f42c595589a4b31aed317b057416ed396191739..477ca6cc7ac290efd467ee4b1cc40672d13f17c2 100644 (file)
--- a/changelog
+++ b/changelog
@@ -1,3 +1,13 @@
+2001-10-12  Ethan Benson  <erbenson@alaska.net>
+
+       * Version 1.3.4pre3
+
+       * ybin: Correct a verbosity message.
+
+       * yaboot:
+         - Add non-fatal warning when bootstrap partition has wrong type (pmac only).
+         - Minor code rearrangment.
+
 2001-10-10  Ethan Benson  <erbenson@alaska.net>
 
        * Version 1.3.4pre2
diff --git a/include/debug.h b/include/debug.h
new file mode 100644 (file)
index 0000000..7b5665d
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ *  Debug defines
+ *
+ *  Copyright (C) 2001  Ethan Benson
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#if DEBUG
+# define DEBUG_ENTER prom_printf( "--> %s\n", __PRETTY_FUNCTION__ )
+# define DEBUG_LEAVE(str) \
+    prom_printf( "<-- %s - %s\n", __PRETTY_FUNCTION__, #str )
+# define DEBUG_LEAVE_F(args...)\
+{\
+    prom_printf( "<-- %s - %d\n", __PRETTY_FUNCTION__, ## args );\
+}
+# define DEBUG_F(fmt, args...)\
+{\
+    prom_printf( "    %s - ", __PRETTY_FUNCTION__ );\
+    prom_printf( fmt, ## args );\
+}
+# define DEBUG_OPEN DEBUG_F( "dev=%s, part=0x%p (%d), file_name=%s\n",\
+                             dev_name, part, part ? part->part_number : -1,\
+                             file_name)
+# define DEBUG_SLEEP prom_sleep(3)
+#else
+#define DEBUG_ENTER
+#define DEBUG_LEAVE(x)
+#define DEBUG_LEAVE_F(args...)
+#define DEBUG_F(fmt, args...)
+#define DEBUG_OPEN
+#define DEBUG_SLEEP
+#endif
index c4950e5ad24b3cf3a5b78a63532715d6b43d37ab..866b379014de38903fe17db6c5f51614ce717a7e 100644 (file)
@@ -34,3 +34,7 @@
 #define FILE_ERR_LENGTH         -10
 #define FILE_ERR_FSBUSY         -11
 #define FILE_ERR_BADDEV         -12
+
+/* Device kind */
+#define FILE_DEVICE_BLOCK       1
+#define FILE_DEVICE_NET         2
index 03c5c6fe3e40877d317237b17196503384cb8e7a..8717dd3caebab76f1303084692cceddb6e6e655a 100644 (file)
@@ -31,10 +31,6 @@ struct boot_file_t;
 
 #define FILE_MAX_PATH          1024
 
-/* Device kind */
-#define FILE_DEVICE_BLOCK      1
-#define FILE_DEVICE_NET                2
-
 struct boot_fspec_t {
        char*   dev;            /* OF device path */
        int     part;           /* Partition number or -1 */
index 647c37a02d412ab3c13961a962a06d69d79f8a07..6aad90e2587bc43ce2d3f656dfbbc0d9a078d1b1 100644 (file)
@@ -50,30 +50,4 @@ extern const struct fs_t *fs_of_netboot;
 const struct fs_t *fs_open(struct boot_file_t *file, const char *dev_name,
                          struct partition_t *part, const char *file_name);
 
-#if DEBUG
-# define DEBUG_ENTER prom_printf( "--> %s\n", __PRETTY_FUNCTION__ )
-# define DEBUG_LEAVE(str) \
-    prom_printf( "<-- %s - %s\n", __PRETTY_FUNCTION__, #str )
-# define DEBUG_LEAVE_F(args...)\
-{\
-    prom_printf( "<-- %s - %d\n", __PRETTY_FUNCTION__, ## args );\
-}
-# define DEBUG_F(fmt, args...)\
-{\
-    prom_printf( "    %s - ", __PRETTY_FUNCTION__ );\
-    prom_printf( fmt, ## args );\
-}
-# define DEBUG_OPEN DEBUG_F( "dev=%s, part=0x%p (%d), file_name=%s\n",\
-                             dev_name, part, part ? part->part_number : -1,\
-                             file_name)
-# define DEBUG_SLEEP prom_sleep(3)
-#else
-#define DEBUG_ENTER
-#define DEBUG_LEAVE(x)
-#define DEBUG_LEAVE_F(args...)
-#define DEBUG_F(fmt, args...)
-#define DEBUG_OPEN
-#define DEBUG_SLEEP
-#endif
-
 #endif
index 244227faf7a96d3728f0b43c009069a12c713a1e..cc4fc3a2b7f7dc0f0c4493556d8d37a58d58adc2 100644 (file)
@@ -33,15 +33,15 @@ struct partition_t;
 struct partition_t {
        struct partition_t*     next;
        int                     part_number;
-       char                    part_name[MAX_PART_NAME];
+       char                    part_type[MAX_PART_NAME];
+        char                    part_name[MAX_PART_NAME];
        unsigned long           part_start; /* In blocks */
        unsigned long           part_size; /* In blocks */
        unsigned short          blocksize;
 };
 
 extern struct partition_t*     partitions_lookup(const char *device);
+extern char                     *get_part_type(char *device, int partition);
 extern void                    partitions_free(struct partition_t* list);
 
-
-
 #endif
index 546d082e4a26cf63c719b57895166ebd9b32f23a..69a812079779e41a2b277b040873945680ae7fbb 100644 (file)
@@ -87,6 +87,7 @@ void prom_map (void *phys, void *virt, int size);
 prom_handle prom_finddevice (char *name);
 prom_handle prom_findpackage (char *path);
 int prom_getprop (prom_handle dev, char *name, void *buf, int len);
+int prom_get_devtype (char *device);
 
 /* misc */
 
index 00414be021bbe285b90cb01a04eec91879f2d9da..58b3d601312da00451612f092f27ef704bc28aae 100644 (file)
@@ -64,6 +64,7 @@ CONFIG cf_options[] =
     {cft_strg, "init-message", NULL},
     {cft_strg, "fgcolor", NULL},
     {cft_strg, "bgcolor", NULL},
+    {cft_strg, "ptypewarning", NULL},
     {cft_end, NULL, NULL}};
 
 CONFIG cf_image[] =
index e4c379f4900b94c8c7a15c7807fa49afc68f343a..712222caf83b4fcfdee80fc458e690b92cee77a4 100644 (file)
@@ -26,6 +26,7 @@
 #include "partition.h"
 #include "fs.h"
 #include "errors.h"
+#include "debug.h"
 
 extern char bootdevice[1024];
 
@@ -91,76 +92,6 @@ parse_device_path(char *imagepath, char *defdevice, int defpart,
      return 1;
 }
 
-#if 0
-char *
-parse_device_path(char *of_device, char **file_spec, int *partition)
-{
-       char *p, *last;
-
-       if (file_spec)
-               *file_spec = NULL;
-       if (partition)
-               *partition = -1;
-
-       DEBUG_F("of_device before parsing: %s\n", of_device);
-       p = strchr(of_device, ':');
-       DEBUG_F("of_device after parsing: %s\n", p);
-
-       if (!p) {                          /* if null terminated we are finished */
-            DEBUG_F("of_device: %s\n", of_device);
-            return of_device;
-       }
-#if 0 /* this is broken crap, breaks netboot entirely */
-       else if (strstr(of_device, "ethernet") != NULL)
-            p = strchr(of_device, ',');  /* skip over ip all the way to the ',' */
-       else if (strstr(of_device, "enet") != NULL)
-            p = strchr(of_device, ',');  /* skip over ip all the way to the ',' */
-#endif
-       *p = 0;
-       last = ++p;                       /* sets to start of second part */
-       while(*p && *p != ',') {
-        if (!isdigit (*p)) {
-            p = last;
-            break;
-       }
-       ++p;
-       }
-       if (p != last) {
-            *(p++) = 0;
-            if (partition)
-                 *partition = simple_strtol(last, NULL, 10);
-       }
-       if (*p && file_spec)
-            *file_spec = p;
-
-       DEBUG_F("of_device: %s\n", of_device);
-       strcat(of_device, ":");
-       DEBUG_F("of_device after strcat: %s\n", of_device);
-       return of_device;
-}
-
-int
-validate_fspec(                struct boot_fspec_t*    spec,
-                       char*                   default_device,
-                       int                     default_part)
-{
-    if (!spec->file) {
-       spec->file = spec->dev;
-       spec->dev = NULL;
-    }
-    if (spec->part == -1)
-       spec->part = default_part;
-    if (!spec->dev)
-       spec->dev = default_device;
-    if (!spec->file)
-       return FILE_BAD_PATH;
-    else if (spec->file[0] == ',')
-       spec->file++;
-
-    return FILE_ERR_OK;
-}
-
-#endif
 
 static int
 file_block_open(       struct boot_file_t*     file,
@@ -253,71 +184,26 @@ static struct fs_t fs_default =
 };
 
 
-int open_file( const struct boot_fspec_t*      spec,
-               struct boot_file_t*             file)
+int open_file(const struct boot_fspec_t* spec, struct boot_file_t* file)
 {
-//     static char     temp[1024];
-       static char     temps[64];
-//     char            *dev_name;
-//     char            *file_name = NULL;
-       phandle         dev;
        int             result;
-       int             partition;
        
        memset(file, 0, sizeof(struct boot_file_t*));
         file->fs        = &fs_default;
 
-       /* Lookup the OF device path */
-       /* First, see if a device was specified for the kernel
-        * if not, we hope that the user wants a kernel on the same
-        * drive and partition as yaboot itself */
-#if 0 /* this is crap */
-       if (!spec->dev)
-               strcpy(spec->dev, bootdevice);
-       strncpy(temp,spec->dev,1024);
-       dev_name = parse_device_path(temp, &file_name, &partition);
-       if (file_name == NULL)
-               file_name = (char *)spec->file;
-       if (file_name == NULL) {
-            prom_printf("Configuration error: null filename\n");
-            return FILE_ERR_NOTFOUND;
-       }
-       if (partition == -1)
-#endif
-               partition = spec->part;
-
-
        DEBUG_F("dev_path = %s\nfile_name = %s\npartition = %d\n",
-               spec->dev, spec->file, partition);
-
-       /* Find OF device phandle */
-       dev = prom_finddevice(spec->dev);
-       if (dev == PROM_INVALID_HANDLE) {
-               return FILE_ERR_BADDEV;
-       }
-
-       DEBUG_F("dev_phandle = %p\n", dev);
+               spec->dev, spec->file, spec->part);
 
-       /* Check the kind of device */
-       result = prom_getprop(dev, "device_type", temps, 63);
-       if (result == -1) {
-               prom_printf("can't get <device_type> for device\n");
-               return FILE_ERR_BADDEV;
-       }
-       temps[result] = 0;
-       if (!strcmp(temps, "block"))
-               file->device_kind = FILE_DEVICE_BLOCK;
-       else if (!strcmp(temps, "network"))
-               file->device_kind = FILE_DEVICE_NET;
-       else {
-               prom_printf("Unkown device type <%s>\n", temps);
-               return FILE_ERR_BADDEV;
-       }
+       result = prom_get_devtype(spec->dev);
+       if (result > 0)
+            file->device_kind = result;
+       else
+            return result;
        
        switch(file->device_kind) {
            case FILE_DEVICE_BLOCK:
                DEBUG_F("device is a block device\n");
-               return file_block_open(file, spec->dev, spec->file, partition);
+               return file_block_open(file, spec->dev, spec->file, spec->part);
            case FILE_DEVICE_NET:
                DEBUG_F("device is a network device\n");
                return file_net_open(file, spec->dev, spec->file);
index af3d115acb171f9f9cdbb6a83bb427ae3736287b..66e1ba8950532dcda2b7e6b283bc7c0c8923a352 100644 (file)
@@ -34,6 +34,7 @@
 #include "partition.h"
 #include "fs.h"
 #include "errors.h"
+#include "debug.h"
 
 #define FAST_VERSION
 #define MAX_READ_RANGE 256
index 2dbc33389169f3387218b9e3e7ddbf0d942eeb65..7b7f169684537be79361b6128fa437207dfb2d6e 100644 (file)
@@ -36,6 +36,7 @@
 #include "partition.h"
 #include "fs.h"
 #include "errors.h"
+#include "debug.h"
 
 #define LOAD_BUFFER_POS                0x600000
 #define LOAD_BUFFER_SIZE       0x400000
index 28f6d4e8778d6521c5d8970d2a4c48ab1b2626ea..fd5c0794b7a005db30c82d8484cb1637fe78fafe 100644 (file)
@@ -27,9 +27,9 @@
 #include "stdlib.h"
 #include "fs.h"
 #include "errors.h"
+#include "debug.h"
 #include "reiserfs/reiserfs.h"
 
-
 /* Exported in struct fs_t */
 static int reiserfs_open( struct boot_file_t *file, const char *dev_name,
                          struct partition_t *part, const char *file_name );
index 866ceacfb1406b469f5cd64d6ec30b7d5e928ef9..98684a20ce36def600b5848243f4ca539e08bbb8 100644 (file)
@@ -29,6 +29,7 @@
 #include "fs.h"
 #include "xfs/xfs.h"
 #include "errors.h"
+#include "debug.h"
 
 #define SECTOR_BITS 9
 
index 39f23ca1083e108384b187bc8d87435e7af4b844..fff169c965cde965914b0f0564df345256b645ab 100644 (file)
@@ -29,6 +29,8 @@
 #include "prom.h"
 #include "string.h"
 #include "linux/iso_fs.h"
+#include "debug.h"
+#include "errors.h"
 
 /* We currently don't check the partition type, some users
  * are putting crap there and still expect it to work...
@@ -54,14 +56,16 @@ static unsigned long swab32(unsigned long value);
 static unsigned char block_buffer[MAX_BLOCK_SIZE];
 
 static void
-add_new_partition( struct partition_t**        list, int part_number,
-                   unsigned long part_start, unsigned long part_size,
-                   unsigned short part_blocksize )
+add_new_partition(struct partition_t** list, int part_number, const char *part_type,
+                 const char *part_name, unsigned long part_start, unsigned long part_size,
+                 unsigned short part_blocksize)
 {
        struct partition_t*     part;
        part = (struct partition_t*)malloc(sizeof(struct partition_t));
        
        part->part_number = part_number;
+       strncpy(part->part_type, part_type, MAX_PART_NAME);
+       strncpy(part->part_name, part_name, MAX_PART_NAME);
        part->part_start = part_start;
        part->part_size = part_size;
        part->blocksize = part_blocksize;
@@ -132,6 +136,8 @@ partition_mac_lookup( const char *dev_name, prom_handle disk,
                     add_new_partition(
                         list, /* partition list */
                         block, /* partition number */
+                       part->type, /* type */
+                       part->name, /* name */
                         part->start_block + part->data_start, /* start */
                         part->data_count, /* size */
                         ptable_block_size );
@@ -158,6 +164,8 @@ partition_fdisk_lookup( const char *dev_name, prom_handle disk,
            if (part->sys_ind == LINUX_NATIVE) {
                add_new_partition(  list,
                                    partition,
+                                   "Linux", /* type */
+                                   '\0', /* name */
                                     swab32(*(unsigned int *)(part->start4)),
                                     swab32(*(unsigned int *)(part->size4)),
                                    512 /*blksize*/ );
@@ -217,9 +225,8 @@ partitions_lookup(const char *device)
                goto bail;
        }
        prom_blksize = prom_getblksize(disk);
-#if DEBUG
-       prom_printf("block size of device is %d\n", prom_blksize);
-#endif 
+       DEBUG_F("block size of device is %d\n", prom_blksize);
+
        if (prom_blksize <= 1)
                prom_blksize = 512;
        if (prom_blksize > MAX_BLOCK_SIZE) {
@@ -229,7 +236,7 @@ partitions_lookup(const char *device)
        
        /* Read boot blocs */
        if (prom_readblocks(disk, 0, 1, block_buffer) != 1) {
-               prom_printf("Can't read boot blocs\n");
+               prom_printf("Can't read boot blocks\n");
                goto bail;
        }       
        if (desc->signature == MAC_DRIVER_MAGIC) {
@@ -239,11 +246,13 @@ partitions_lookup(const char *device)
                /* fdisk partition format */
                partition_fdisk_lookup(device, disk, prom_blksize, &list);
        } else if (prom_blksize == 2048 && identify_iso_fs(disk, &iso_root_block)) {
-               add_new_partition(      &list,
-                               0,
-                               iso_root_block,
-                               0,
-                               prom_blksize);
+               add_new_partition(&list,
+                                 0,
+                                 '\0',
+                                 '\0',
+                                 iso_root_block,
+                                 0,
+                                 prom_blksize);
                prom_printf("ISO9660 disk\n");
        } else {
                prom_printf("No supported partition table detected\n");
@@ -256,6 +265,36 @@ bail:
        return list;
 }
 
+char *
+get_part_type(char *device, int partition)
+{
+     struct partition_t*       parts;
+     struct partition_t*       p;
+     struct partition_t*       found;
+     char *type = NULL;
+
+     if (prom_get_devtype(device) != FILE_DEVICE_BLOCK)
+         return NULL;
+
+     parts = partitions_lookup(device);
+     found = NULL;
+
+     if (!parts)
+         return '\0';
+
+     for (p = parts; p && !found; p=p->next) {
+         DEBUG_F("number: %02d, start: 0x%08lx, length: 0x%08lx, type: %s, name: %s\n",
+                 p->part_number, p->part_start, p->part_size, p->part_type, p->part_name);
+         if ((partition >= 0) && (partition == p->part_number)) {
+              type = strdup(p->part_type);
+              break;
+         }       
+     }
+     if (parts)
+         partitions_free(parts);
+     return type;
+}
+
 /* Freed in reverse order of allocation to help malloc'ator */
 void
 partitions_free(struct partition_t* list)
@@ -282,3 +321,9 @@ swab32(unsigned long value)
 }
 
 
+/* 
+ * Local variables:
+ * c-file-style: "K&R"
+ * c-basic-offset: 5
+ * End:
+ */
index cd12279c7d413ee32d2c4b90de8a96c4d4653fcf..33dfcda6d4dd0f5343dad627c24cff96a707a436 100644 (file)
@@ -164,6 +164,36 @@ prom_get_options (char *name, void *mem, int len)
   return prom_getprop (prom_options, name, mem, len);
 }
 
+int
+prom_get_devtype (char *device)
+{
+     phandle    dev;
+     int        result;
+     char       tmp[64];
+
+     /* Find OF device phandle */
+     dev = prom_finddevice(device);
+     if (dev == PROM_INVALID_HANDLE) {
+         return FILE_ERR_BADDEV;
+     }
+
+     /* Check the kind of device */
+     result = prom_getprop(dev, "device_type", tmp, 63);
+     if (result == -1) {
+         prom_printf("can't get <device_type> for device: %s\n", device);
+         return FILE_ERR_BADDEV;
+     }
+     tmp[result] = 0;
+     if (!strcmp(tmp, "block"))
+         return FILE_DEVICE_BLOCK;
+     else if (!strcmp(tmp, "network"))
+         return FILE_DEVICE_NET;
+     else {
+         prom_printf("Unkown device type <%s>\n", tmp);
+         return FILE_ERR_BADDEV;
+     }
+}
+
 void
 prom_init (prom_entry pp)
 {
index 5eed2a3c9ae5e7e68af1c2a52545b33570098d6b..23a6322d68e08a835fcbe191d44c0978e3af7ecb 100644 (file)
@@ -12,7 +12,7 @@
 
    Because this program is derived from the corresponding file in the
    silo-0.64 distribution, it is also
-sys
+
    Copyright (C) 1996 Pete A. Zaitcev
                 1996 Maurizio Plaza
                 1996 David S. Miller
@@ -46,6 +46,7 @@ sys
 #include "yaboot.h"
 #include "linux/elf.h"
 #include "bootinfo.h"
+#include "debug.h"
 
 #define CONFIG_FILE_NAME       "yaboot.conf"
 #define CONFIG_FILE_MAX                0x8000          /* 32k */
@@ -104,9 +105,7 @@ static void     setup_display(void);
 
 int useconf = 0;
 char bootdevice[1024];
-//char *bootpath = NULL;
 char *password = NULL;
-//int bootpartition = -1;
 struct boot_fspec_t boot;
 int _machine = _MACH_Pmac;
 
@@ -291,7 +290,7 @@ load_config_file(char *device, char* path, int partition)
     fspec.part = partition;
     result = open_file(&fspec, &file);
     if (result != FILE_ERR_OK) {
-        prom_printf("%s:%d", fspec.dev, fspec.part);
+        prom_printf("%s:%d,", fspec.dev, fspec.part);
         prom_perror(result, fspec.file);
         prom_printf("Can't open config file\n");
         goto bail;
@@ -1361,58 +1360,78 @@ setup_display(void)
 int
 yaboot_main(void)
 {
-       if (_machine == _MACH_Pmac)
-               setup_display();
-       
-       prom_get_chosen("bootpath", bootdevice, sizeof(bootdevice));
-       DEBUG_F("/chosen/bootpath = %s\n", bootdevice);
-       if (bootdevice[0] == 0)
-               prom_get_options("boot-device", bootdevice, sizeof(bootdevice));
-       if (bootdevice[0] == 0) {
-           prom_printf("Couldn't determine boot device\n");
-           return -1;
-       }
-
-       if (!parse_device_path(bootdevice, (_machine == _MACH_Pmac) ? "hd" : "disc",
-                              -1, "", &boot)) {
-            prom_printf("%s: Unable to parse\n", bootdevice);
-            return -1;
-       }
-       DEBUG_F("After parse_device_path: dev=%s, part=%d, file=%s\n",
-               boot.dev, boot.part, boot.file);
+     char *ptype;
 
-       if (strlen(boot.file)) {
-            if (!strncmp(boot.file, "\\\\", 2))
-                 boot.file = "\\\\";
-            else {
-                 char *p, *last;
-                 p = last = boot.file;
-                 while(*p) {
-                      if (*p == '\\')
-                           last = p;
-                      p++;
-                 }
-                 if (p)
-                      *(last) = 0;
-                 else
-                      boot.file = "";
-                 if (strlen(boot.file))
-                      strcat(boot.file, "\\");
-            }
-       }
-       DEBUG_F("After path fixup: dev=%s, part=%d, file=%s\n",
-               boot.dev, boot.part, boot.file);
-
-       useconf = load_config_file(boot.dev, boot.file, boot.part);
-
-       prom_printf("Welcome to yaboot version " VERSION "\n");
-       prom_printf("Enter \"help\" to get some basic usage information\n");
+     if (_machine == _MACH_Pmac)
+         setup_display();
        
-       yaboot_text_ui();
+     prom_get_chosen("bootpath", bootdevice, sizeof(bootdevice));
+     DEBUG_F("/chosen/bootpath = %s\n", bootdevice);
+     if (bootdevice[0] == 0)
+         prom_get_options("boot-device", bootdevice, sizeof(bootdevice));
+     if (bootdevice[0] == 0) {
+         prom_printf("Couldn't determine boot device\n");
+         return -1;
+     }
+
+     if (!parse_device_path(bootdevice, (_machine == _MACH_Pmac) ? "hd" : "disc",
+                           -1, "", &boot)) {
+         prom_printf("%s: Unable to parse\n", bootdevice);
+         return -1;
+     }
+     DEBUG_F("After parse_device_path: dev=%s, part=%d, file=%s\n",
+            boot.dev, boot.part, boot.file);
+
+     if (strlen(boot.file)) {
+         if (!strncmp(boot.file, "\\\\", 2))
+              boot.file = "\\\\";
+         else {
+              char *p, *last;
+              p = last = boot.file;
+              while(*p) {
+                   if (*p == '\\')
+                        last = p;
+                   p++;
+              }
+              if (p)
+                   *(last) = 0;
+              else
+                   boot.file = "";
+              if (strlen(boot.file))
+                   strcat(boot.file, "\\");
+         }
+     }
+     DEBUG_F("After path fixup: dev=%s, part=%d, file=%s\n",
+            boot.dev, boot.part, boot.file);
+
+     useconf = load_config_file(boot.dev, boot.file, boot.part);
+
+     prom_printf("Welcome to yaboot version " VERSION "\n");
+     prom_printf("Enter \"help\" to get some basic usage information\n");
+
+     /* I am fed up with lusers using the wrong partition type and
+       mailing me *when* it breaks */
+
+     if (_machine == _MACH_Pmac) {
+         char *entry = cfg_get_strg(0, "ptypewarning");
+         int warn = 1;
+         if (entry)
+              warn = strcmp(entry,
+                            "I_know_the_partition_type_is_wrong_and_will_NOT_send_mail_when_booting_breaks");
+         if (warn) {
+              ptype = get_part_type(boot.dev, boot.part);
+              if ((ptype != NULL) && (strcmp(ptype, "Apple_Bootstrap")))
+                   prom_printf("\nWARNING: Bootstrap partition type is wrong: \"%s\"\n"
+                               "         type should be: \"Apple_Bootstrap\"\n\n", ptype);
+         }
+     }
+
+     yaboot_text_ui();
        
-       prom_printf("Bye.\n");
-       return 0;
+     prom_printf("Bye.\n");
+     return 0;
 }
+
 /* 
  * Local variables:
  * c-file-style: "K&R"
index 3da965e5fe4b0043c8e6c26a192d95a5e12af353..424acc80cf63cd17efdc3e88b8811bc81e5be9a4 100755 (executable)
--- a/ybin/ybin
+++ b/ybin/ybin
@@ -28,7 +28,7 @@ if [ -n "$PATH_PREFIX" ] ; then
 fi
 PRG="${0##*/}"
 SIGINT="$PRG: Interrupt caught ... exiting"
-VERSION=1.3.4pre2
+VERSION=1.3.4pre3
 DEBUG=0
 VERBOSE=0
 TMP="${TMPDIR:-/tmp}"
@@ -1052,7 +1052,7 @@ mnt_install()
        fi
     fi
 
-    [ "$VERBOSE" = 1 ] && echo "$INSTALLFIRST"
+    [ "$VERBOSE" = 1 ] && echo "$INSTALLPRIMARY"
     cp -f "$install" "$TARGET/$BTFILE"
     if [ $? != 0 ] ; then
        echo 1>&2 "$PRG: An error occured while writing to $boot"