Signed-off-by: Doug Maxey <dwm@austin.ibm.com>
49 files changed:
# Set this to the prefix of your cross-compiler, if you have one.
# Else leave it empty.
#
# Set this to the prefix of your cross-compiler, if you have one.
# Else leave it empty.
#
CC := $(CROSS)gcc
LD := $(CROSS)ld
CC := $(CROSS)gcc
LD := $(CROSS)ld
-LFLAGS = -Ttext $(TEXTADDR) -Bstatic
+LFLAGS = -Ttext $(TEXTADDR) -Bstatic
* Automatic configuration by ybin. This script should NOT be edited
by the user. It should also not be used without ybin, its not
* Automatic configuration by ybin. This script should NOT be edited
by the user. It should also not be used without ybin, its not
- directly useable by OpenFirmware.
+ directly useable by OpenFirmware.
* Configurable colors. (see the yaboot.conf(5) man page).
The multiboot menu is only presented when an extra OS is defined in
/etc/yaboot.conf, otherwise this script loads yaboot without any user
* Configurable colors. (see the yaboot.conf(5) man page).
The multiboot menu is only presented when an extra OS is defined in
/etc/yaboot.conf, otherwise this script loads yaboot without any user
To enable a multi boot menu add bsd=ofpath and/or macos=ofpath and/or
macosx=ofpath, and/or darwin=ofpath where ofpath is the OpenFirmware
To enable a multi boot menu add bsd=ofpath and/or macos=ofpath and/or
macosx=ofpath, and/or darwin=ofpath where ofpath is the OpenFirmware
respectively) cannot be be configured. (others are D for Darwin, C
for CDROM, N for network, and O for OpenFirmware)
respectively) cannot be be configured. (others are D for Darwin, C
for CDROM, N for network, and O for OpenFirmware)
-The Forth code in this script was written by Chris Emerson and iNOUE Koich!.
+The Forth code in this script was written by Chris Emerson and iNOUE Koich!.
This script has only been formally tested on a Rev 1 Blue G3, a G4,
and an ibook, please report any incompatibilities.
This script has only been formally tested on a Rev 1 Blue G3, a G4,
and an ibook, please report any incompatibilities.
This utility is used to find the OpenFirmware device path to a unix
This utility is used to find the OpenFirmware device path to a unix
-device node (ie /dev/hda2).
+device node (ie /dev/hda2).
Ofpath will work on Newworld PowerMacs only if yaboot is used as the
bootloader, it will not work on newworld macs booted with BootX.
Ofpath will work on Newworld PowerMacs only if yaboot is used as the
bootloader, it will not work on newworld macs booted with BootX.
version unlike show_of_path.sh works with /bin/ash and is fully
functional on stripped down systems such as boot or rescue floppies.
It has been tested on the Debian GNU/Linux 2.2 (potato) boot
version unlike show_of_path.sh works with /bin/ash and is fully
functional on stripped down systems such as boot or rescue floppies.
It has been tested on the Debian GNU/Linux 2.2 (potato) boot
This script is deprecated in favor of a much nicer and more robust
This script is deprecated in favor of a much nicer and more robust
-script ofboot, see README.ofboot for more information.
+script ofboot, see README.ofboot for more information.
This script was written by Benjamin Herrenschmidt, I added a X to the
OpenFirmware pathnames, you should replace that X with the proper
This script was written by Benjamin Herrenschmidt, I added a X to the
OpenFirmware pathnames, you should replace that X with the proper
being far to picky about the format of this file, while it will load a
ELF executable just fine when directed to, if the tbxi file it finds
is just a plain ELF executable, as yaboot is, then it refuses to load
being far to picky about the format of this file, while it will load a
ELF executable just fine when directed to, if the tbxi file it finds
is just a plain ELF executable, as yaboot is, then it refuses to load
The best longterm solution is to embed a small CHRP boot script to the
head of of the yaboot executable, but until we can find the right way
The best longterm solution is to embed a small CHRP boot script to the
head of of the yaboot executable, but until we can find the right way
## timeout is the amount of time in tenths of a second that yaboot
## will wait before booting the default kernel image (the first image=
## timeout is the amount of time in tenths of a second that yaboot
## will wait before booting the default kernel image (the first image=
-## section in this config file or the value of default=).
+## section in this config file or the value of default=).
timeout=20
install=/usr/local/lib/yaboot/yaboot
timeout=20
install=/usr/local/lib/yaboot/yaboot
## timeout is the amount of time in tenths of a second that yaboot
## will wait before booting the default kernel image (the first image=
## timeout is the amount of time in tenths of a second that yaboot
## will wait before booting the default kernel image (the first image=
-## section in this config file or the value of default=).
+## section in this config file or the value of default=).
timeout=20
install=/usr/local/lib/yaboot/yaboot
timeout=20
install=/usr/local/lib/yaboot/yaboot
<!DOCTYPE debiandoc PUBLIC "-//DebianDoc//DTD DebianDoc//EN" [
<!DOCTYPE debiandoc PUBLIC "-//DebianDoc//DTD DebianDoc//EN" [
document conventions:
file, directory, device == file
program, command == prgn
document conventions:
file, directory, device == file
program, command == prgn
The NewWorld PowerMacs, for which <prgn>yaboot</prgn> is designed, are
any PowerMacs in translucent colored plastic cases. That includes all
iMacs, iBooks, G4 systems, blue colored G3 systems, and most
The NewWorld PowerMacs, for which <prgn>yaboot</prgn> is designed, are
any PowerMacs in translucent colored plastic cases. That includes all
iMacs, iBooks, G4 systems, blue colored G3 systems, and most
-PowerBooks manufactured in and after 1999.
+PowerBooks manufactured in and after 1999.
with <prgn>mac-fdisk</prgn> should be the bootstrap partition. Just use the
<prgn>mac-fdisk</prgn> <tt>b</tt> command to automatically create a
bootstrap partition of the proper size and type. If your version of
with <prgn>mac-fdisk</prgn> should be the bootstrap partition. Just use the
<prgn>mac-fdisk</prgn> <tt>b</tt> command to automatically create a
bootstrap partition of the proper size and type. If your version of
-<prgn>mac-fdisk</prgn> doesn't include the <tt>b</tt> command, use:
+<prgn>mac-fdisk</prgn> doesn't include the <tt>b</tt> command, use:
- Command (? for help): C xxxx 800k bootstrap Apple_Bootstrap
+ Command (? for help): C xxxx 800k bootstrap Apple_Bootstrap
cd /
gzip -dc mac-fdisk.tar.gz | tar -xvp
</example>
cd /
gzip -dc mac-fdisk.tar.gz | tar -xvp
</example>
<p>
The bootstrap partition only takes 800k of space. If you are adding a
bootstrap partition to your existing setup, you may have enough free
<p>
The bootstrap partition only takes 800k of space. If you are adding a
bootstrap partition to your existing setup, you may have enough free
if you create or edit it within MacOS.
if you create or edit it within MacOS.
-<sect>Linux Style Device Paths
+<sect>Linux Style Device Paths
<p>
For those unfamiliar with Linux device naming, partition paths are in
<p>
For those unfamiliar with Linux device naming, partition paths are in
hdc secondary controller, master disk (often used for CD-ROM)
hdd secondary controller, slave disk (often used for Zip drive)
sda first SCSI disk (SCSI ID address-wise)
hdc secondary controller, master disk (often used for CD-ROM)
hdd secondary controller, slave disk (often used for Zip drive)
sda first SCSI disk (SCSI ID address-wise)
scd0 first CD-ROM (or sr0)
fd0 first floppy drive
fd1 second floppy drive
scd0 first CD-ROM (or sr0)
fd0 first floppy drive
fd1 second floppy drive
given Linux device path is provided: <prgn>ofpath</prgn>. <prgn>ybin</prgn>
uses <prgn>ofpath</prgn>
internally to convert Linux device names you use in <file>yaboot.conf</file> to
given Linux device path is provided: <prgn>ofpath</prgn>. <prgn>ybin</prgn>
uses <prgn>ofpath</prgn>
internally to convert Linux device names you use in <file>yaboot.conf</file> to
-OpenFirmware equivalents. Example: <tt>ofpath /dev/hda</tt> (should return hd:).
-You can also figure out OpenFirmware device paths yourself, see
+OpenFirmware equivalents. Example: <tt>ofpath /dev/hda</tt> (should return hd:).
+You can also figure out OpenFirmware device paths yourself, see
Recovering From Misconfiguration below.
<sect>Required Settings
Recovering From Misconfiguration below.
<sect>Required Settings
-For PowerMacs, a magicboot line such as
+For PowerMacs, a magicboot line such as
<tt>magicboot=/usr/local/lib/yaboot/ofboot</tt> is also required. Several
models cannot execute a straight ELF, and need a CHRP script (which this
line in the <file>yaboot.conf</file> makes available).
<tt>magicboot=/usr/local/lib/yaboot/ofboot</tt> is also required. Several
models cannot execute a straight ELF, and need a CHRP script (which this
line in the <file>yaboot.conf</file> makes available).
A CHRP script (<file>ofboot</file>) has been provided which
<prgn>ybin</prgn> will modify using <file>yaboot.conf</file> settings, to
A CHRP script (<file>ofboot</file>) has been provided which
<prgn>ybin</prgn> will modify using <file>yaboot.conf</file> settings, to
-display a very handy multi-OS boot menu.
+display a very handy multi-OS boot menu.
If you are setting up a multi-OS boot menu, you'll need to identify the
partitions where each OS lives. You can use Linux-style or OpenFirmware
If you are setting up a multi-OS boot menu, you'll need to identify the
partitions where each OS lives. You can use Linux-style or OpenFirmware
options are available to pass additional boot parameters to the kernel
(<tt>append=</tt>), specify initial ramdisk size (<tt>ramdisk=</tt>), load a
ramdisk image (<tt>initrd=</tt>), and others. Refer to the yaboot.conf man
options are available to pass additional boot parameters to the kernel
(<tt>append=</tt>), specify initial ramdisk size (<tt>ramdisk=</tt>), load a
ramdisk image (<tt>initrd=</tt>), and others. Refer to the yaboot.conf man
-page for details on kernel image options.
+page for details on kernel image options.
# How long to wait at the boot: prompt (tenths of a second)
timeout=50
# Globally identified root partition
# How long to wait at the boot: prompt (tenths of a second)
timeout=50
# Globally identified root partition
# The device where the kernel lives
device=hd:
# The device where the kernel lives
device=hd:
path on the tftp server) and <tt>device=enet:10.0.0.1</tt>
(substituting the tftp boot server IP address).
path on the tftp server) and <tt>device=enet:10.0.0.1</tt>
(substituting the tftp boot server IP address).
Normally the first image specified in the <file>yaboot.conf</file> will be the
image booted if no entry is made at the boot: prompt. To have another
image loaded by default, add a <tt>default=label</tt> line in the global
Normally the first image specified in the <file>yaboot.conf</file> will be the
image booted if no entry is made at the boot: prompt. To have another
image loaded by default, add a <tt>default=label</tt> line in the global
<sect>Optional and Cool Settings
<sect>Optional and Cool Settings
-Booting password protection is available using a <tt>password=</tt> line.
+Booting password protection is available using a <tt>password=</tt> line.
When you add <tt>password=</tt>, a password will be required for all booting.
Automatic booting is not possible unless a <tt>restricted</tt> line is added.
When you add <tt>password=</tt>, a password will be required for all booting.
Automatic booting is not possible unless a <tt>restricted</tt> line is added.
<example>
$ perl -e 'printf("%s\n", crypt("secret", "\$1\$saltstrg"))'
<example>
$ perl -e 'printf("%s\n", crypt("secret", "\$1\$saltstrg"))'
-</example>
-The saltstrg should be a random string, for example one generated by
+</example>
+The saltstrg should be a random string, for example one generated by
<example>
makepasswd --chars=8
<example>
makepasswd --chars=8
<p>
If you have a problem booting, don't panic. Yaboot can boot any
<p>
If you have a problem booting, don't panic. Yaboot can boot any
-installed Linux kernel and system from the boot: prompt.
+installed Linux kernel and system from the boot: prompt.
<sect>Resetting the NVRAM
<p>
<sect>Resetting the NVRAM
<p>
If a <tt>boot:</tt> prompt isn't presented, then <prgn>yaboot</prgn> isn't
being loaded. You can load it manually from
OpenFirmware. Holding the Command-Option-o-f keys all together after
If a <tt>boot:</tt> prompt isn't presented, then <prgn>yaboot</prgn> isn't
being loaded. You can load it manually from
OpenFirmware. Holding the Command-Option-o-f keys all together after
-pressing the power-on key will give you an OpenFirmware prompt
+pressing the power-on key will give you an OpenFirmware prompt
-(Command is the key with the cloverleaf and/or apple engraved on it).
+(Command is the key with the cloverleaf and/or apple engraved on it).
-The full OpenFirmware path consists of three parts in the format
+The full OpenFirmware path consists of three parts in the format
<example>
device-name:partition-number,/filesystem-path
<example>
device-name:partition-number,/filesystem-path
ultra1 internal ide drive (primary controller, slave disk)
ide0 ide drive (secondary controller, master disk)
ide1 ide drive (secondary controller, slave disk)
ultra1 internal ide drive (primary controller, slave disk)
ide0 ide drive (secondary controller, master disk)
ide1 ide drive (secondary controller, slave disk)
zip Zip drive
fw FireWire interface
fd Floppy drive
zip Zip drive
fw FireWire interface
fd Floppy drive
file on the boot partition.
<example>
file on the boot partition.
<example>
<file>boot:</file> prompt. If you don't know the partition number, just
start at 2 and work your way up until you hit it.
<file>boot:</file> prompt. If you don't know the partition number, just
start at 2 and work your way up until you hit it.
-<sect>Manually Loading a Kernel Image
+<sect>Manually Loading a Kernel Image
<p>
Once you have the boot: prompt, you can enter a label defined in your
<p>
Once you have the boot: prompt, you can enter a label defined in your
To pass parameters to the kernel, add them on to the <tt>boot:</tt> prompt
line after the kernel label or path. You'll need to specify <tt>root=</tt>
as a minimum, but you can add any kernel parameters desired. Here's an
To pass parameters to the kernel, add them on to the <tt>boot:</tt> prompt
line after the kernel label or path. You'll need to specify <tt>root=</tt>
as a minimum, but you can add any kernel parameters desired. Here's an
<example>
boot: hd:3,/vmlinux root=/dev/hda3 ro
</example>
<example>
boot: hd:3,/vmlinux root=/dev/hda3 ro
</example>
-<chapt>Yaboot as a Temporary Bootloader
+<chapt>Yaboot as a Temporary Bootloader
<p>
It's very convenient for certain tasks like installing a new system
the first time without a CD, or rescuing an existing system, to boot a
<p>
It's very convenient for certain tasks like installing a new system
the first time without a CD, or rescuing an existing system, to boot a
-The <file>yaboot.conf</file> file for this purpose contains just
+The <file>yaboot.conf</file> file for this purpose contains just
four lines:
<example>
image=linux
four lines:
<example>
image=linux
(just carriage returns), <prgn>yaboot</prgn> will be unable to read the file.
<p>
(just carriage returns), <prgn>yaboot</prgn> will be unable to read the file.
<p>
-You must pick a partition that is formatted with either HFS or HFS+. If
+You must pick a partition that is formatted with either HFS or HFS+. If
you have Mac OS X installed on a UFS partition (You can use the OS X "Disk
Utility" app to check this), you will have to find another partition to use.
you have Mac OS X installed on a UFS partition (You can use the OS X "Disk
Utility" app to check this), you will have to find another partition to use.
-If Mac OS X is installed on UFS, you probably have one or two partitions
+If Mac OS X is installed on UFS, you probably have one or two partitions
of the "Apple_Boot" type. They have HFS filesystems on them. Pick one,
mount it under MacOS X, and store the files there.
of the "Apple_Boot" type. They have HFS filesystems on them. Pick one,
mount it under MacOS X, and store the files there.
## timeout is the amount of time in tenths of a second that yaboot
## will wait before booting the default kernel image (the first image=
## timeout is the amount of time in tenths of a second that yaboot
## will wait before booting the default kernel image (the first image=
-## section in this config file or the value of default=).
+## section in this config file or the value of default=).
timeout=40
install=/usr/local/lib/yaboot/yaboot
timeout=40
install=/usr/local/lib/yaboot/yaboot
#endif /* __ASM_PPC_PROCESSOR_H */
#endif /* __ASM_PPC_PROCESSOR_H */
#endif /* _PPC_BOOTINFO_H */
#endif /* _PPC_BOOTINFO_H */
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
#define DEBUG_SLEEP
#endif
#define DEBUG_SLEEP
#endif
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
/*
* bitops.h --- Bitmap frobbing code. The byte swapping routines are
* also included here.
/*
* bitops.h --- Bitmap frobbing code. The byte swapping routines are
* also included here.
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
* i386 bitops operations taken from <asm/bitops.h>, Copyright 1992,
* Linus Torvalds.
*/
* i386 bitops operations taken from <asm/bitops.h>, Copyright 1992,
* Linus Torvalds.
*/
/*
* The inline routines themselves...
/*
* The inline routines themselves...
* If NO_INLINE_FUNCS is defined, then we won't try to do inline
* functions at all; they will be included as normal functions in
* inline.c
* If NO_INLINE_FUNCS is defined, then we won't try to do inline
* functions at all; they will be included as normal functions in
* inline.c
*/
struct __dummy_h { unsigned long a[100]; };
#define EXT2FS_ADDR (*(struct __dummy_h *) addr)
*/
struct __dummy_h { unsigned long a[100]; };
#define EXT2FS_ADDR (*(struct __dummy_h *) addr)
-#define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr)
+#define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr)
_INLINE_ int ext2fs_set_bit(int nr, void * addr)
{
_INLINE_ int ext2fs_set_bit(int nr, void * addr)
{
return 0;
/* This looks at memory. Mark it volatile to tell gcc not to move it around */
__asm__ __volatile__(
return 0;
/* This looks at memory. Mark it volatile to tell gcc not to move it around */
__asm__ __volatile__(
"xorl %%eax,%%eax\n\t"
"xorl %%edx,%%edx\n\t"
"repe; scasl\n\t"
"xorl %%eax,%%eax\n\t"
"xorl %%edx,%%edx\n\t"
"repe; scasl\n\t"
{
unsigned long * p = ((unsigned long *) addr) + (offset >> 5);
int set = 0, bit = offset & 31, res;
{
unsigned long * p = ((unsigned long *) addr) + (offset >> 5);
int set = 0, bit = offset & 31, res;
if (bit) {
/*
* Look for zero in first byte
if (bit) {
/*
* Look for zero in first byte
: "0" (ADDR), "r" (mask)
: "g5", "g6");
return (int) ADDR;
: "0" (ADDR), "r" (mask)
: "g5", "g6");
return (int) ADDR;
#else
int mask, retval;
unsigned char *ADDR = (unsigned char *) addr;
#else
int mask, retval;
unsigned char *ADDR = (unsigned char *) addr;
d0 = ffs(*cp);
if (d0 == 0)
return size;
d0 = ffs(*cp);
if (d0 == 0)
return size;
{
unsigned char * p;
int set = 0, bit = offset & 7, res = 0, d0;
{
unsigned char * p;
int set = 0, bit = offset & 7, res = 0, d0;
res = offset >> 3;
p = ((unsigned char *) addr) + res;
res = offset >> 3;
p = ((unsigned char *) addr) + res;
if (bit) {
set = ffs(*p & ~((1 << bit) - 1));
if (set)
if (bit) {
set = ffs(*p & ~((1 << bit) - 1));
if (set)
/* These two routines moved to gen_bitmap.c */
extern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
/* These two routines moved to gen_bitmap.c */
extern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
_INLINE_ int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
_INLINE_ int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
- return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
+ return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
block);
}
_INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
block);
}
_INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
- return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
+ return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
block);
}
_INLINE_ int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
block);
}
_INLINE_ int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
- return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
+ return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
inode);
}
_INLINE_ int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
- return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
+ return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
inode);
}
_INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
- return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
+ return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
bitmap->description);
return;
}
bitmap->description);
return;
}
ext2fs_set_bit(block - bitmap->start, bitmap->bitmap);
}
ext2fs_set_bit(block - bitmap->start, bitmap->bitmap);
}
blk_t block, int num)
{
int i;
blk_t block, int num)
{
int i;
if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
bitmap->description);
if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
bitmap->description);
blk_t block, int num)
{
int i;
blk_t block, int num)
{
int i;
#ifdef EXT2FS_DEBUG_FAST_OPS
if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
bitmap->description);
return;
}
#ifdef EXT2FS_DEBUG_FAST_OPS
if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
bitmap->description);
return;
}
for (i=0; i < num; i++)
ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap);
}
for (i=0; i < num; i++)
ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap);
}
blk_t block, int num)
{
int i;
blk_t block, int num)
{
int i;
if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block,
bitmap->description);
if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block,
bitmap->description);
blk_t block, int num)
{
int i;
blk_t block, int num)
{
int i;
#ifdef EXT2FS_DEBUG_FAST_OPS
if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block,
bitmap->description);
return;
}
#ifdef EXT2FS_DEBUG_FAST_OPS
if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block,
bitmap->description);
return;
}
for (i=0; i < num; i++)
ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap);
}
for (i=0; i < num; i++)
ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap);
}
/*
* io.h --- the I/O manager abstraction
/*
* io.h --- the I/O manager abstraction
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
#define io_channel_flush(c) ((c)->manager->flush((c)))
#define io_channel_write_byte(c,b,n,d) ((c)->manager->write_byte((c),b,n,d))
#define io_channel_bumpcount(c) ((c)->refcount++)
#define io_channel_flush(c) ((c)->manager->flush((c)))
#define io_channel_write_byte(c,b,n,d) ((c)->manager->write_byte((c),b,n,d))
#define io_channel_bumpcount(c) ((c)->refcount++)
/* unix_io.c */
extern io_manager unix_io_manager;
/* unix_io.c */
extern io_manager unix_io_manager;
(int blksize, errcode_t err);
#endif /* _EXT2FS_EXT2_IO_H */
(int blksize, errcode_t err);
#endif /* _EXT2FS_EXT2_IO_H */
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
* This is used by ext2fs_expand_dir() to be able to add a new block
* to an inode. It can also be used for programs that want to be able
* to deal with files that contain "holes".
* This is used by ext2fs_expand_dir() to be able to add a new block
* to an inode. It can also be used for programs that want to be able
* to deal with files that contain "holes".
* BLOCK_FLAG_TRAVERSE indicates that the iterator function for the
* indirect, doubly indirect, etc. blocks should be called after all
* of the blocks containined in the indirect blocks are processed.
* BLOCK_FLAG_TRAVERSE indicates that the iterator function for the
* indirect, doubly indirect, etc. blocks should be called after all
* of the blocks containined in the indirect blocks are processed.
/*
* Flags for ext2fs_move_blocks
*/
/*
* Flags for ext2fs_move_blocks
*/
-#define EXT2_BMOVE_GET_DBLIST 0x0001
+#define EXT2_BMOVE_GET_DBLIST 0x0001
#define EXT2_BMOVE_DEBUG 0x0002
#endif
#define EXT2_BMOVE_DEBUG 0x0002
#endif
/* bmap.c */
extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino,
/* bmap.c */
extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino,
- struct ext2_inode *inode,
+ struct ext2_inode *inode,
char *block_buf, int bmap_flags,
blk_t block, blk_t *phys_blk);
char *block_buf, int bmap_flags,
blk_t block, blk_t *phys_blk);
void *buf);
/* dir_iterate.c */
void *buf);
/* dir_iterate.c */
-extern errcode_t ext2fs_dir_iterate(ext2_filsys fs,
+extern errcode_t ext2fs_dir_iterate(ext2_filsys fs,
ext2_ino_t dir,
int flags,
char *block_buf,
ext2_ino_t dir,
int flags,
char *block_buf,
/* ext_attr.c */
void ext2fs_swap_ext_attr(ext2_filsys fs, char *to, char *from);
extern errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf);
/* ext_attr.c */
void ext2fs_swap_ext_attr(ext2_filsys fs, char *to, char *from);
extern errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf);
-extern errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block, void *buf);
+extern errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block, void *buf);
/* fileio.c */
extern errcode_t ext2fs_file_open(ext2_filsys fs, ext2_ino_t ino,
int flags, ext2_file_t *ret);
/* fileio.c */
extern errcode_t ext2fs_file_open(ext2_filsys fs, ext2_ino_t ino,
int flags, ext2_file_t *ret);
ext2_badblocks_list *bb_list);
/* read_bb_file.c */
ext2_badblocks_list *bb_list);
/* read_bb_file.c */
-extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f,
+extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f,
ext2_badblocks_list *bb_list,
void *private,
void (*invalid)(ext2_filsys fs,
blk_t blk,
char *badstr,
void *private));
ext2_badblocks_list *bb_list,
void *private,
void (*invalid)(ext2_filsys fs,
blk_t blk,
char *badstr,
void *private));
-extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f,
+extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f,
ext2_badblocks_list *bb_list,
void (*invalid)(ext2_filsys fs,
blk_t blk));
ext2_badblocks_list *bb_list,
void (*invalid)(ext2_filsys fs,
blk_t blk));
const char* dev_name,
struct partition_t* part,
const char* file_name);
const char* dev_name,
struct partition_t* part,
const char* file_name);
int (*read)( struct boot_file_t* file,
unsigned int size,
void* buffer);
int (*read)( struct boot_file_t* file,
unsigned int size,
void* buffer);
int (*seek)( struct boot_file_t* file,
unsigned int newpos);
int (*seek)( struct boot_file_t* file,
unsigned int newpos);
int (*close)( struct boot_file_t* file);
};
int (*close)( struct boot_file_t* file);
};
#define SHN_COMMON 0xfff2
#define SHN_HIRESERVE 0xffff
#define SHN_MIPS_ACCOMON 0xff00
#define SHN_COMMON 0xfff2
#define SHN_HIRESERVE 0xffff
#define SHN_MIPS_ACCOMON 0xff00
typedef struct {
Elf32_Word sh_name;
Elf32_Word sh_type;
typedef struct {
Elf32_Word sh_name;
Elf32_Word sh_type;
#define EXT2_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
#define EXT2_NOCOMP_FL 0x00000400 /* Don't compress */
#define EXT2_ECOMPR_FL 0x00000800 /* Compression error */
#define EXT2_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
#define EXT2_NOCOMP_FL 0x00000400 /* Don't compress */
#define EXT2_ECOMPR_FL 0x00000800 /* Compression error */
-/* End compression flags --- maybe not all used */
+/* End compression flags --- maybe not all used */
#define EXT2_BTREE_FL 0x00001000 /* btree format dir */
#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
#define EXT2_BTREE_FL 0x00001000 /* btree format dir */
#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
* the incompatible feature set is that if there is a bit set
* in the incompatible feature set that the kernel doesn't
* know about, it should refuse to mount the filesystem.
* the incompatible feature set is that if there is a bit set
* in the incompatible feature set that the kernel doesn't
* know about, it should refuse to mount the filesystem.
* e2fsck's requirements are more strict; if it doesn't know
* about a feature in either the compatible or incompatible
* feature set, it must abort and not try to meddle with
* e2fsck's requirements are more strict; if it doesn't know
* about a feature in either the compatible or incompatible
* feature set, it must abort and not try to meddle with
|| ih_version(ih) == ITEM_VERSION_1) \
? le32_to_cpu ((ih)->ih_key.u.k_offset_v1.k_offset) \
: offset_v2_k_offset(&(ih)->ih_key.u.k_offset_v2))
|| ih_version(ih) == ITEM_VERSION_1) \
? le32_to_cpu ((ih)->ih_key.u.k_offset_v1.k_offset) \
: offset_v2_k_offset(&(ih)->ih_key.u.k_offset_v2))
#define IH_KEY_ISTYPE(ih, type) ((INFO->version < 2 \
|| ih_version(ih) == ITEM_VERSION_1) \
? le32_to_cpu((ih)->ih_key.u.k_offset_v1.k_uniqueness) == V1_##type \
#define IH_KEY_ISTYPE(ih, type) ((INFO->version < 2 \
|| ih_version(ih) == ITEM_VERSION_1) \
? le32_to_cpu((ih)->ih_key.u.k_offset_v1.k_uniqueness) == V1_##type \
#define TYPE_DIRECT 2
#define TYPE_DIRENTRY 3
#define TYPE_ANY 15 // FIXME: comment is required
#define TYPE_DIRECT 2
#define TYPE_DIRENTRY 3
#define TYPE_ANY 15 // FIXME: comment is required
//
// in old version uniqueness field shows key type
//
//
// in old version uniqueness field shows key type
//
/* Header of a disk block. More precisely, header of a formatted leaf
or internal node, and not the header of an unformatted node. */
/* Header of a disk block. More precisely, header of a formatted leaf
or internal node, and not the header of an unformatted node. */
__u16 blk_level; /* Level of a block in the tree */
__u16 blk_nr_item; /* Number of keys/items in a block */
__u16 blk_free_space; /* Block free space in bytes */
__u16 blk_level; /* Level of a block in the tree */
__u16 blk_nr_item; /* Number of keys/items in a block */
__u16 blk_free_space; /* Block free space in bytes */
#define DOT_OFFSET 1
#define DOT_DOT_OFFSET 2
#define DIRENTRY_UNIQUENESS 500
#define DOT_OFFSET 1
#define DOT_DOT_OFFSET 2
#define DIRENTRY_UNIQUENESS 500
#define V1_TYPE_STAT_DATA 0x0
#define V1_TYPE_DIRECT 0xffffffff
#define V1_TYPE_INDIRECT 0xfffffffe
#define V1_TYPE_STAT_DATA 0x0
#define V1_TYPE_DIRECT 0xffffffff
#define V1_TYPE_INDIRECT 0xfffffffe
#define V2_TYPE_DIRECT 2
#define V2_TYPE_DIRENTRY 3
#define V2_TYPE_DIRECT 2
#define V2_TYPE_DIRENTRY 3
#define REISERFS_ROOT_OBJECTID 2
#define REISERFS_ROOT_PARENT_OBJECTID 1
#define REISERFS_SUPERBLOCK_BLOCK 16
/* the spot for the super in versions 3.5 - 3.5.11 (inclusive) */
#define REISERFS_OLD_SUPERBLOCK_BLOCK 2
#define REISERFS_OLD_BLOCKSIZE 4096
#define REISERFS_ROOT_OBJECTID 2
#define REISERFS_ROOT_PARENT_OBJECTID 1
#define REISERFS_SUPERBLOCK_BLOCK 16
/* the spot for the super in versions 3.5 - 3.5.11 (inclusive) */
#define REISERFS_OLD_SUPERBLOCK_BLOCK 2
#define REISERFS_OLD_BLOCKSIZE 4096
#define S_ISREG(mode) (((mode) & 0170000) == 0100000)
#define S_ISDIR(mode) (((mode) & 0170000) == 0040000)
#define S_ISLNK(mode) (((mode) & 0170000) == 0120000)
#define S_ISREG(mode) (((mode) & 0170000) == 0100000)
#define S_ISDIR(mode) (((mode) & 0170000) == 0040000)
#define S_ISLNK(mode) (((mode) & 0170000) == 0120000)
__u32 journal_block_count; /* The size of the journal */
__u32 journal_first_desc; /* The first valid descriptor block in journal
(relative to journal_block) */
__u32 journal_block_count; /* The size of the journal */
__u32 journal_first_desc; /* The first valid descriptor block in journal
(relative to journal_block) */
__u16 version; /* The ReiserFS version. */
__u16 tree_depth; /* The current depth of the reiser tree. */
__u8 blocksize_shift; /* 1 << blocksize_shift == blocksize. */
__u16 version; /* The ReiserFS version. */
__u16 tree_depth; /* The current depth of the reiser tree. */
__u8 blocksize_shift; /* 1 << blocksize_shift == blocksize. */
* xfs.h - an extraction from xfsprogs-1.3.5/include/xfs* into one file
*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
* xfs.h - an extraction from xfsprogs-1.3.5/include/xfs* into one file
*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement
* or the like. Any license provided herein, whether implied or
* otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever.
* Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement
* or the like. Any license provided herein, whether implied or
* otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
* Mountain View, CA 94043, or:
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
* Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
__uint8_t sb_shared_vn; /* shared version number */
xfs_extlen_t sb_inoalignmt; /* inode chunk alignment, fsblocks */
__uint32_t sb_unit; /* stripe or raid unit */
__uint8_t sb_shared_vn; /* shared version number */
xfs_extlen_t sb_inoalignmt; /* inode chunk alignment, fsblocks */
__uint32_t sb_unit; /* stripe or raid unit */
- __uint32_t sb_width; /* stripe or raid width */
+ __uint32_t sb_width; /* stripe or raid width */
__uint8_t sb_dirblklog; /* log2 of dir block size (fsbs) */
__uint8_t sb_dummy[7]; /* padding */
} xfs_sb_t;
__uint8_t sb_dirblklog; /* log2 of dir block size (fsbs) */
__uint8_t sb_dummy[7]; /* padding */
} xfs_sb_t;
- * Yaboot - secondary boot loader for Linux on PowerPC.
+ * Yaboot - secondary boot loader for Linux on PowerPC.
*
* Copyright (C) 2001 Ethan Benson
*
* Copyright (C) 1999, 2000, 2001 Benjamin Herrenschmidt
*
* Copyright (C) 2001 Ethan Benson
*
* Copyright (C) 1999, 2000, 2001 Benjamin Herrenschmidt
* Copyright (C) 2001 Peter Bergner
*
* portions based on poof
* Copyright (C) 2001 Peter Bergner
*
* portions based on poof
* Copyright (C) 1999 Marius Vollmer
* Copyright (C) 1999 Marius Vollmer
* Copyright (C) 1996 Paul Mackerras.
* Copyright (C) 1996 Paul Mackerras.
* Because this program is derived from the corresponding file in the
* silo-0.64 distribution, it is also
* Because this program is derived from the corresponding file in the
* silo-0.64 distribution, it is also
* Copyright (C) 1996 Pete A. Zaitcev
* 1996 Maurizio Plaza
* 1996 David S. Miller
* Copyright (C) 1996 Pete A. Zaitcev
* 1996 Maurizio Plaza
* 1996 David S. Miller
/* malloc.c - Dumb memory allocation routines
/* malloc.c - Dumb memory allocation routines
* Copyright (C) 1997 Paul Mackerras
* 1996 Maurizio Plaza
* 1996 Jakub Jelinek
* Copyright (C) 1997 Paul Mackerras
* 1996 Maurizio Plaza
* 1996 Jakub Jelinek
*str++ = *fmt;
continue;
}
*str++ = *fmt;
continue;
}
/* process flags */
flags = 0;
repeat:
/* process flags */
flags = 0;
repeat:
case '#': flags |= SPECIAL; goto repeat;
case '0': flags |= ZEROPAD; goto repeat;
}
case '#': flags |= SPECIAL; goto repeat;
case '0': flags |= ZEROPAD; goto repeat;
}
/* get field width */
field_width = -1;
if (isdigit(*fmt))
/* get field width */
field_width = -1;
if (isdigit(*fmt))
/* get the precision */
precision = -1;
if (*fmt == '.') {
/* get the precision */
precision = -1;
if (*fmt == '.') {
if (isdigit(*fmt))
precision = skip_atoi(&fmt);
else if (*fmt == '*') {
if (isdigit(*fmt))
precision = skip_atoi(&fmt);
else if (*fmt == '*') {
default OpenFirmware attempts to load a file with HFS file type
\*(lqtbxi\*(rq in the \*(lqblessed\*(rq directory from each partition
of each disk OpenFirmware is aware of, the first partition/disk that
default OpenFirmware attempts to load a file with HFS file type
\*(lqtbxi\*(rq in the \*(lqblessed\*(rq directory from each partition
of each disk OpenFirmware is aware of, the first partition/disk that
-is found to be bootable is booted immediately.
+is found to be bootable is booted immediately.
.BR Ybin (8)
configures a \fBbootstrap\fR partition to pass all of OpenFirmware's
.BR Ybin (8)
configures a \fBbootstrap\fR partition to pass all of OpenFirmware's
Since OpenFirmware boots the first partition it finds to be bootable
it is important that the \fBbootstrap\fR partition be first on the
disk before any MacOS partition, otherwise MacOS will be booted
Since OpenFirmware boots the first partition it finds to be bootable
it is important that the \fBbootstrap\fR partition be first on the
disk before any MacOS partition, otherwise MacOS will be booted
-instead of a dual boot menu used with \fByaboot\fR(8).
+instead of a dual boot menu used with \fByaboot\fR(8).
The \fBbootstrap\fR partition should also NOT be mountable by MacOS,
the reason is MacOS will (almost always) closely inspect any blessed
The \fBbootstrap\fR partition should also NOT be mountable by MacOS,
the reason is MacOS will (almost always) closely inspect any blessed
\fBYbin\fR also includes a utility \fBofpath\fR(8) which can in most
cases find the OpenFirmware device path from a unix device node (ie
\fBYbin\fR also includes a utility \fBofpath\fR(8) which can in most
cases find the OpenFirmware device path from a unix device node (ie
In addition to binary executables OpenFirmware can also execute a CHRP
script. This is somewhat similar to a shell script. A CHRP script is
In addition to binary executables OpenFirmware can also execute a CHRP
script. This is somewhat similar to a shell script. A CHRP script is
\fBbootstrap\fR partition large enough to hold the bootloader
(typically \fByaboot\fR(8)). The bootloader is copied onto the raw
partition as there is no filesystem. This is done either with \fBdd\fR(1)
\fBbootstrap\fR partition large enough to hold the bootloader
(typically \fByaboot\fR(8)). The bootloader is copied onto the raw
partition as there is no filesystem. This is done either with \fBdd\fR(1)
.SH BUGS
OpenFirmware
.SH AUTHORS
.SH BUGS
OpenFirmware
.SH AUTHORS
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" 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
+.\" 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.\"
.TH MKOFBOOT 8 "21 November 2001" "GNU/Linux PowerPC" "System Manager's Manual"
.\" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.\"
.TH MKOFBOOT 8 "21 November 2001" "GNU/Linux PowerPC" "System Manager's Manual"
.B mkofboot
\- format bootstrap partition and install the yaboot boot loader
.SH SYNOPSIS
.B mkofboot
\- format bootstrap partition and install the yaboot boot loader
.SH SYNOPSIS
.RB [ \ \-b | \-\-boot\ \fIdevice\ ]
.RB [ \ \-o | \-\-ofboot\ \fIof-path\ ]
.RB [ \ \-i | \-\-install\ \fIboot-file\ ]
.RB [ \ \-b | \-\-boot\ \fIdevice\ ]
.RB [ \ \-o | \-\-ofboot\ \fIof-path\ ]
.RB [ \ \-i | \-\-install\ \fIboot-file\ ]
.RB [ \ \-h | \-\-help\ ]
.RB [ \ \-V | \-\-version\ ]
.SH DESCRIPTION
.RB [ \ \-h | \-\-help\ ]
.RB [ \ \-V | \-\-version\ ]
.SH DESCRIPTION
-This manual page explains
+This manual page explains
-the initial installer for the
-.BR yaboot (8)
+the initial installer for the
+.BR yaboot (8)
boot loader enabling GNU/Linux to be booted by OpenFirmware.
.B mkofboot
boot loader enabling GNU/Linux to be booted by OpenFirmware.
.B mkofboot
-does exactly the same thing as
+does exactly the same thing as
.BR ybin (8)
except that it erases and creates a new filesystem (specified by
\-\-filesystem) on the \fBbootstrap\fR(8) partition before copying the
.BR ybin (8)
except that it erases and creates a new filesystem (specified by
\-\-filesystem) on the \fBbootstrap\fR(8) partition before copying the
uses the exact same command line options as
.BR ybin (8)
so if you have already read the \fBybin\fR(8) man page you can skip this
uses the exact same command line options as
.BR ybin (8)
so if you have already read the \fBybin\fR(8) man page you can skip this
.TP
.BR \-b ,\ \-\-boot\ \fIdevice
Install the boot loader onto the specified device. This device should
be that of your \fBbootstrap\fR(8) partition. For example, if your
.TP
.BR \-b ,\ \-\-boot\ \fIdevice
Install the boot loader onto the specified device. This device should
be that of your \fBbootstrap\fR(8) partition. For example, if your
-\fBbootstrap\fR partition is located on your first primary IDE drive in the
+\fBbootstrap\fR partition is located on your first primary IDE drive in the
second partition, your device would be: \fI/dev/hda2\fR.
.TP
.BR \-o ,\ \-\-ofboot\ \fIof-path
second partition, your device would be: \fI/dev/hda2\fR.
.TP
.BR \-o ,\ \-\-ofboot\ \fIof-path
.SH SECURITY
Temporary files are created with
.BR mktemp (1)
.SH SECURITY
Temporary files are created with
.BR mktemp (1)
-it is important that your system use a secure
+it is important that your system use a secure
.BR mktemp (1)
program otherwise \fBmkofboot\fR will be vulnerable to race conditions.
The Debian mktemp is derived from OpenBSD and thus should be secure.
.BR mktemp (1)
program otherwise \fBmkofboot\fR will be vulnerable to race conditions.
The Debian mktemp is derived from OpenBSD and thus should be secure.
hardware.
.SH AUTHORS
.BR mkofboot (8)
hardware.
.SH AUTHORS
.BR mkofboot (8)
-, and this man page written by Ethan Benson.
+, and this man page written by Ethan Benson.
.br
.BR yaboot (8)
was written by Benjamin Herrenschmidt.
.br
.BR yaboot (8)
was written by Benjamin Herrenschmidt.
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" 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
+.\" 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.\"
.TH OFPATH 8 "27 May 2001" "GNU/Linux PowerPC" "System Manager's Manual"
.\" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.\"
.TH OFPATH 8 "27 May 2001" "GNU/Linux PowerPC" "System Manager's Manual"
.RB [ \ \-V | \-\-version\ ]
.IB FILE
.SH DESCRIPTION
.RB [ \ \-V | \-\-version\ ]
.IB FILE
.SH DESCRIPTION
-This manual page explains
+This manual page explains
.BR ofpath ,
the utility used to find the OpenFirmware device path corresponding to
a unix device node, such as \fI/dev/hda2\fR.
.BR ofpath ,
the utility used to find the OpenFirmware device path corresponding to
a unix device node, such as \fI/dev/hda2\fR.
not well tested and may not give accurate results.
\fBYbin\fR(8) uses this utility to automatically convert unix device
not well tested and may not give accurate results.
\fBYbin\fR(8) uses this utility to automatically convert unix device
-nodes to OpenFirmware paths as needed.
+nodes to OpenFirmware paths as needed.
.SH OPTIONS
.TP
.BR \-\-debug
.SH OPTIONS
.TP
.BR \-\-debug
may not accurately find all SCSI devices, and does not support all
SCSI adapters/drivers.
may not accurately find all SCSI devices, and does not support all
SCSI adapters/drivers.
-.B Ofpath
-also does not support all IDE devices.
+.B Ofpath
+also does not support all IDE devices.
.B Ofpath
does not support IBM hardware. Send a tarball of /proc/device-tree
along with /proc/cpuinfo to <erbenson@alaska.net>
.SH AUTHORS
.B Ofpath
does not support IBM hardware. Send a tarball of /proc/device-tree
along with /proc/cpuinfo to <erbenson@alaska.net>
.SH AUTHORS
is based on show_of_path.sh written by Olaf Hering, it was
rewritten to work with /bin/ash and stripped down systems such as
boot/rescue floppies by Ethan Benson. This man page was written by
is based on show_of_path.sh written by Olaf Hering, it was
rewritten to work with /bin/ash and stripped down systems such as
boot/rescue floppies by Ethan Benson. This man page was written by
.B Yaboot
is an OpenFirmware ELF executable that bootstraps the Linux kernel.
.SH DESCRIPTION
.B Yaboot
is an OpenFirmware ELF executable that bootstraps the Linux kernel.
.SH DESCRIPTION
-This manual page explains the \fByaboot\fR OpenFirmware boot loader.
+This manual page explains the \fByaboot\fR OpenFirmware boot loader.
.B yaboot
is \fInot\fR a Linux or MacOS executable file. Attempting to execute
.B yaboot
is \fInot\fR a Linux or MacOS executable file. Attempting to execute
.SH EXAMPLES
boot \fByaboot\fR from internal ATA disk, partition 2:
.SH EXAMPLES
boot \fByaboot\fR from internal ATA disk, partition 2:
boot \fByaboot\fR from partition 2 of a disk with SCSI ID 2 attached to a
Adaptec 2930 SCSI Host adapter (this is on a rev1 blue G3, it may vary
boot \fByaboot\fR from partition 2 of a disk with SCSI ID 2 attached to a
Adaptec 2930 SCSI Host adapter (this is on a rev1 blue G3, it may vary
.I boot /pci@80000000/pci-bridge@d/ADPT,2930CU@2/@2:2,yaboot
.I boot /pci@80000000/pci-bridge@d/ADPT,2930CU@2/@2:2,yaboot
The \fByaboot.conf\fP file is a configuration file for \fByaboot\fP
which is read during booting, and for \fBybin\fR(8) to generate a boot
menu and to properly install \fByaboot\fP onto the \fBbootstrap\fP(8)
The \fByaboot.conf\fP file is a configuration file for \fByaboot\fP
which is read during booting, and for \fBybin\fR(8) to generate a boot
menu and to properly install \fByaboot\fP onto the \fBbootstrap\fP(8)
\fByaboot.conf\fP provides instructions for \fByaboot\fP. This
includes which kernels to load and what options to pass to them.
\fByaboot.conf\fP provides instructions for \fByaboot\fP. This
includes which kernels to load and what options to pass to them.
The first form refers to a file or directory on some supported filesystem
(currently \fIext2\fP, \fIhfs\fP, \fIhfs+\fP or \fIiso9660\fP), the latter
refers to a range of 512B blocks on a device. For a device block range,
The first form refers to a file or directory on some supported filesystem
(currently \fIext2\fP, \fIhfs\fP, \fIhfs+\fP or \fIiso9660\fP), the latter
refers to a range of 512B blocks on a device. For a device block range,
-either <devicename>, or <part>, or [<m>-<n>] must be given.
+either <devicename>, or <part>, or [<m>-<n>] must be given.
Optional <devicename> is the OpenFirmware name of the device the file or range
is located on. See below for its syntax. For OpenFirmware the device
Optional <devicename> is the OpenFirmware name of the device the file or range
is located on. See below for its syntax. For OpenFirmware the device
option if the OSX menu entry breaks after booting MacOS. You should
not use this option if OSX is installed on a UFS filesystem, for UFS
installs you specify the OSX bootstrap partition which is protected
option if the OSX menu entry breaks after booting MacOS. You should
not use this option if OSX is installed on a UFS filesystem, for UFS
installs you specify the OSX bootstrap partition which is protected
-against MacOS. This option requires \fImacosx=\fR to be set.
+against MacOS. This option requires \fImacosx=\fR to be set.
.TP
.BI "darwin=" of-path
The OpenFirmware or unix device path to a Darwin boot partition.
.TP
.BI "darwin=" of-path
The OpenFirmware or unix device path to a Darwin boot partition.
path.
.TP
.B "enablecdboot"
path.
.TP
.B "enablecdboot"
-This option adds an entry to the multiboot menu to boot from the CDROM drive.
+This option adds an entry to the multiboot menu to boot from the CDROM drive.
.TP
.B "enablenetboot"
This option adds an entry to the multiboot menu to boot from the network.
.TP
.B "enablenetboot"
This option adds an entry to the multiboot menu to boot from the network.
.SH NOTES
The format defined in this man page will not work with versions of
\fByaboot\fR(8) older then 0.6. The color options only work with
.SH NOTES
The format defined in this man page will not work with versions of
\fByaboot\fR(8) older then 0.6. The color options only work with
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" 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
+.\" 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.\"
.TH YABOOTCONFIG 8 "24 November 2001" "GNU/Linux PowerPC" "System Manager's Manual"
.\" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.\"
.TH YABOOTCONFIG 8 "24 November 2001" "GNU/Linux PowerPC" "System Manager's Manual"
.RB [ \ \-h | \-\-help\ ]
.RB [ \ \-V | \-\-version\ ]
.SH DESCRIPTION
.RB [ \ \-h | \-\-help\ ]
.RB [ \ \-V | \-\-version\ ]
.SH DESCRIPTION
-This manual page explains
+This manual page explains
-the configurator for the
-.BR yaboot (8)
+the configurator for the
+.BR yaboot (8)
boot loader enabling GNU/Linux to be booted by OpenFirmware.
Specifically it inspects the running system, generates a working
.BR /etc/yaboot.conf (5)
boot loader enabling GNU/Linux to be booted by OpenFirmware.
Specifically it inspects the running system, generates a working
.BR /etc/yaboot.conf (5)
.B yabootconfig
requires \fBofpath\fR(8) in order to get the OpenFirmware device name
.B yabootconfig
requires \fBofpath\fR(8) in order to get the OpenFirmware device name
-for the root disk on PowerMacs.
+for the root disk on PowerMacs.
.SH OPTIONS
.TP
.BR \-t ,\ \-\-chroot\ \fIdirectory
.SH OPTIONS
.TP
.BR \-t ,\ \-\-chroot\ \fIdirectory
.fi
.SH AUTHORS
.B yabootconfig
.fi
.SH AUTHORS
.B yabootconfig
-and this man page was written by Ethan Benson.
+and this man page was written by Ethan Benson.
.br
.B yaboot
was written by Benjamin Herrenschmidt.
.br
.B yaboot
was written by Benjamin Herrenschmidt.
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" 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
+.\" 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.\"
.TH YBIN 8 "21 November 2001" "GNU/Linux PowerPC" "System Manager's Manual"
.\" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.\"
.TH YBIN 8 "21 November 2001" "GNU/Linux PowerPC" "System Manager's Manual"
.B ybin
\- install the yaboot boot loader to a bootstrap partition.
.SH SYNOPSIS
.B ybin
\- install the yaboot boot loader to a bootstrap partition.
.SH SYNOPSIS
.RB [ \ \-b | \-\-boot\ \fIdevice\ ]
.RB [ \ \-o | \-\-ofboot\ \fIof-path\ ]
.RB [ \ \-i | \-\-install\ \fIboot-file\ ]
.RB [ \ \-b | \-\-boot\ \fIdevice\ ]
.RB [ \ \-o | \-\-ofboot\ \fIof-path\ ]
.RB [ \ \-i | \-\-install\ \fIboot-file\ ]
.RB [ \ \-h | \-\-help\ ]
.RB [ \ \-V | \-\-version\ ]
.SH DESCRIPTION
.RB [ \ \-h | \-\-help\ ]
.RB [ \ \-V | \-\-version\ ]
.SH DESCRIPTION
-This manual page explains
-.B ybin
-the installer for the
-.BR yaboot (8)
+This manual page explains
+.B ybin
+the installer for the
+.BR yaboot (8)
boot loader enabling GNU/Linux to be booted by OpenFirmware.
boot loader enabling GNU/Linux to be booted by OpenFirmware.
-Specifically it copies the
+Specifically it copies the
-and usually a \*(lqmagicboot\*(rq script to a
+and usually a \*(lqmagicboot\*(rq script to a
.B Ybin
will set attributes on the boot loader files and to the
.B Ybin
will set attributes on the boot loader files and to the
of the \fBbootstrap\fR(8) partition using \fBnvsetenv\fR(8) when a
NewWorld compatible version of \fBnvsetenv\fR(8) is available.
of the \fBbootstrap\fR(8) partition using \fBnvsetenv\fR(8) when a
NewWorld compatible version of \fBnvsetenv\fR(8) is available.
-.B Ybin
-requires that the
+.B Ybin
+requires that the
.BR bootstrap (8)
partition have an HFS filesystem already on it. For IBM
hardware there is no filesystem on the \fBbootstrap\fR(8) partition,
in this case use fstype=raw. When using the raw filesystem type
\fBybin\fR requires that an ELF binary have already been installed on
the \fBbootstrap\fR(8) partition. Use the companion
.BR bootstrap (8)
partition have an HFS filesystem already on it. For IBM
hardware there is no filesystem on the \fBbootstrap\fR(8) partition,
in this case use fstype=raw. When using the raw filesystem type
\fBybin\fR requires that an ELF binary have already been installed on
the \fBbootstrap\fR(8) partition. Use the companion
-.BR mkofboot (8)
-utility to install the boot loader onto a new
+.BR mkofboot (8)
+utility to install the boot loader onto a new
The \fBbootstrap\fR(8) need not and should not be mounted anywhere on
your filesystem, especially not on top of /boot. \fBYaboot\fR is able
The \fBbootstrap\fR(8) need not and should not be mounted anywhere on
your filesystem, especially not on top of /boot. \fBYaboot\fR is able
.BR \-b ,\ \-\-boot\ \fIdevice
Install the boot loader onto the specified device, this device should
be that of your \fBbootstrap\fR(8) partition. For example, if your
.BR \-b ,\ \-\-boot\ \fIdevice
Install the boot loader onto the specified device, this device should
be that of your \fBbootstrap\fR(8) partition. For example, if your
-\fBbootstrap\fR partition is located on your first primary IDE drive in the
+\fBbootstrap\fR partition is located on your first primary IDE drive in the
second partition, your device would be: \fI/dev/hda2\fR.
.TP
.BR \-o ,\ \-\-ofboot\ \fIof-path
second partition, your device would be: \fI/dev/hda2\fR.
.TP
.BR \-o ,\ \-\-ofboot\ \fIof-path
.SH SECURITY
Temporary files are created with
.BR mktemp (1).
.SH SECURITY
Temporary files are created with
.BR mktemp (1).
-It is important that your system use a secure
+It is important that your system use a secure
.BR mktemp (1)
program, otherwise \fBybin\fR will be vulnerable to race conditions.
The Debian mktemp is derived from OpenBSD and thus should be secure.
.BR mktemp (1)
program, otherwise \fBybin\fR will be vulnerable to race conditions.
The Debian mktemp is derived from OpenBSD and thus should be secure.
by anyone but root since a different \fIofboot\fR script could be
specified there.
.SH BUGS
by anyone but root since a different \fIofboot\fR script could be
specified there.
.SH BUGS
should be able to take care of OpenFirmware variables as needed on IBM
hardware.
.SH AUTHORS
.B ybin
should be able to take care of OpenFirmware variables as needed on IBM
hardware.
.SH AUTHORS
.B ybin
-and this man page was written by Ethan Benson.
+and this man page was written by Ethan Benson.
.br
.B yaboot
was written by Benjamin Herrenschmidt.
.br
.B yaboot
was written by Benjamin Herrenschmidt.
- * cache.S - PowerPC version
+ * cache.S - PowerPC version
*
* Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
*
*
* Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
*
#include "asm/ppc_asm.tmpl"
#include "asm/processor.h"
#include "asm/ppc_asm.tmpl"
#include "asm/processor.h"
/*
* Write any modified data cache blocks out to memory
* and invalidate the corresponding instruction cache blocks.
/*
* Write any modified data cache blocks out to memory
* and invalidate the corresponding instruction cache blocks.
if (!cfg_set (item, value)) {
#if DEBUG
prom_printf("Can't set item %s to value %s\n", item, value);
if (!cfg_set (item, value)) {
#if DEBUG
prom_printf("Can't set item %s to value %s\n", item, value);
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
}
if (!password)
prom_printf(buff, x);
}
if (!password)
prom_printf(buff, x);
for (;;) {
c = prom_getchar ();
if (c == -1)
for (;;) {
c = prom_getchar ();
if (c == -1)
/* This function follows the device path in the devtree and separates
the device name, partition number, and other datas (mostly file name)
the string passed in parameters is changed since 0 are put in place
/* This function follows the device path in the devtree and separates
the device name, partition number, and other datas (mostly file name)
the string passed in parameters is changed since 0 are put in place
- of some separators to terminate the various strings.
+ of some separators to terminate the various strings.
when a default device is supplied imagepath will be assumed to be a
plain filename unless it contains a : otherwise if defaultdev is
when a default device is supplied imagepath will be assumed to be a
plain filename unless it contains a : otherwise if defaultdev is
if (!imagepath)
return 0;
if (!imagepath)
return 0;
- else if (!(ipath = strdup(imagepath)))
+ else if (!(ipath = strdup(imagepath)))
return 0;
if (defdevice) {
return 0;
if (defdevice) {
if (*(ptr+1))
result->part = simple_strtol(ptr+1, NULL, 10);
} else if (!defdev) {
if (*(ptr+1))
result->part = simple_strtol(ptr+1, NULL, 10);
} else if (!defdev) {
- result->dev = strdup(ipath);
+ result->dev = strdup(ipath);
} else if (strlen(ipath)) {
result->file = strdup(ipath);
} else {
} else if (strlen(ipath)) {
result->file = strdup(ipath);
} else {
if (!result->dev && defdev)
result->dev = strdup(defdev);
if (!result->dev && defdev)
result->dev = strdup(defdev);
if (result->part < 0)
result->part = defpart;
if (result->part < 0)
result->part = defpart;
if (!result->file)
result->file = strdup(deffile);
if (!result->file)
result->file = strdup(deffile);
struct partition_t* parts;
struct partition_t* p;
struct partition_t* found;
struct partition_t* parts;
struct partition_t* p;
struct partition_t* found;
parts = partitions_lookup(dev_name);
found = NULL;
parts = partitions_lookup(dev_name);
found = NULL;
#if DEBUG
if (parts)
prom_printf("partitions:\n");
#if DEBUG
if (parts)
prom_printf("partitions:\n");
#if DEBUG
if (found)
prom_printf(" (match)\n");
#if DEBUG
if (found)
prom_printf(" (match)\n");
}
/* Note: we don't skip when found is NULL since we can, in some
}
/* Note: we don't skip when found is NULL since we can, in some
int open_file(const struct boot_fspec_t* spec, struct boot_file_t* file)
{
int result;
int open_file(const struct boot_fspec_t* spec, struct boot_file_t* file)
{
int result;
memset(file, 0, sizeof(struct boot_file_t*));
file->fs = &fs_default;
memset(file, 0, sizeof(struct boot_file_t*));
file->fs = &fs_default;
file->device_kind = result;
else
return result;
file->device_kind = result;
else
return result;
switch(file->device_kind) {
case FILE_DEVICE_BLOCK:
DEBUG_F("device is a block device\n");
switch(file->device_kind) {
case FILE_DEVICE_BLOCK:
DEBUG_F("device is a block device\n");
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
};
/* IO manager structure for the ext2 library */
};
/* IO manager structure for the ext2 library */
static errcode_t linux_open (const char *name, int flags, io_channel * channel);
static errcode_t linux_close (io_channel channel);
static errcode_t linux_set_blksize (io_channel channel, int blksize);
static errcode_t linux_open (const char *name, int flags, io_channel * channel);
static errcode_t linux_close (io_channel channel);
static errcode_t linux_set_blksize (io_channel channel, int blksize);
int error = FILE_ERR_NOTFOUND;
static char buffer[1024];
int ofopened = 0;
int error = FILE_ERR_NOTFOUND;
static char buffer[1024];
int ofopened = 0;
/* We don't care too much about the device block size since we run
* thru the deblocker. We may have to change that is we plan to be
* compatible with older versions of OF
/* We don't care too much about the device block size since we run
* thru the deblocker. We may have to change that is we plan to be
* compatible with older versions of OF
return FILE_IOERR;
}
ofopened = 1;
return FILE_IOERR;
}
ofopened = 1;
/* Open the ext2 filesystem */
result = ext2fs_open (buffer, EXT2_FLAG_RW, 0, 0, linux_io_manager, &fs);
if (result) {
/* Open the ext2 filesystem */
result = ext2fs_open (buffer, EXT2_FLAG_RW, 0, 0, linux_io_manager, &fs);
if (result) {
error = FILE_IOERR;
goto bail;
}
error = FILE_IOERR;
goto bail;
}
/* Lookup file by pathname */
root = cwd = EXT2_ROOT_INO;
result = ext2fs_namei_follow(fs, root, cwd, file_name, &file->inode);
/* Lookup file by pathname */
root = cwd = EXT2_ROOT_INO;
result = ext2fs_namei_follow(fs, root, cwd, file_name, &file->inode);
error = FILE_ERR_NOTFOUND;
goto bail;
}
error = FILE_ERR_NOTFOUND;
goto bail;
}
#ifndef FAST_VERSION
result = ext2fs_read_inode(fs, file->inode, &cur_inode);
#ifndef FAST_VERSION
result = ext2fs_read_inode(fs, file->inode, &cur_inode);
}
#endif /* FAST_VERSION */
file->pos = 0;
}
#endif /* FAST_VERSION */
file->pos = 0;
opened = 1;
bail:
if (!opened) {
opened = 1;
bail:
if (!opened) {
free(block_buffer);
block_buffer = NULL;
cur_file = NULL;
free(block_buffer);
block_buffer = NULL;
cur_file = NULL;
DEBUG_LEAVE_F(error);
return error;
}
DEBUG_LEAVE_F(error);
return error;
}
if ((count * bs) > read_max)
count--;
if (count) {
if ((count * bs) > read_max)
count--;
if (count) {
read_result = io_channel_read_blk(fs->io, read_range_start, count, read_buffer);
if (read_result)
return BLOCK_ABORT;
read_result = io_channel_read_blk(fs->io, read_range_start, count, read_buffer);
if (read_result)
return BLOCK_ABORT;
read_range_count -= count;
read_range_start += count;
read_last_logical += count;
read_range_count -= count;
read_range_start += count;
read_last_logical += count;
/* Handle remaining block */
if (read_max && read_range_count) {
read_result = io_channel_read_blk(fs->io, read_range_start, 1, block_buffer);
/* Handle remaining block */
if (read_max && read_range_count) {
read_result = io_channel_read_blk(fs->io, read_range_start, 1, block_buffer);
++read_range_count;
return ((read_range_count * bs) >= read_max) ? BLOCK_ABORT : 0;
}
++read_range_count;
return ((read_range_count * bs) >= read_max) ? BLOCK_ABORT : 0;
}
/* Range doesn't match. Dump existing range */
if (read_range_start) {
#ifdef VERBOSE_DEBUG
/* Range doesn't match. Dump existing range */
if (read_range_start) {
#ifdef VERBOSE_DEBUG
read_range_count = 1;
return (bs >= read_max) ? BLOCK_ABORT : 0;
}
read_range_count = 1;
return (bs >= read_max) ? BLOCK_ABORT : 0;
}
#ifdef VERBOSE_DEBUG
DEBUG_F("\n");
#endif
#ifdef VERBOSE_DEBUG
DEBUG_F("\n");
#endif
read_max = size;
read_buffer = (unsigned char*)buffer;
read_result = 0;
read_max = size;
read_buffer = (unsigned char*)buffer;
read_result = 0;
retval = ext2fs_block_iterate(fs, file->inode, 0, 0, read_iterator, 0);
if (retval == BLOCK_ABORT)
retval = read_result;
retval = ext2fs_block_iterate(fs, file->inode, 0, 0, read_iterator, 0);
if (retval == BLOCK_ABORT)
retval = read_result;
}
if (retval)
prom_printf ("ext2: i/o error %ld in read\n", (long) retval);
}
if (retval)
prom_printf ("ext2: i/o error %ld in read\n", (long) retval);
return read_total;
#else /* FAST_VERSION */
int status;
unsigned int read = 0;
return read_total;
#else /* FAST_VERSION */
int status;
unsigned int read = 0;
if (!opened)
return FILE_IOERR;
if (!opened)
return FILE_IOERR;
DEBUG_F("ext_read() from pos 0x%x, size: 0x%x\n", file->pos, size);
DEBUG_F("ext_read() from pos 0x%x, size: 0x%x\n", file->pos, size);
blk_t fblock = file->pos / bs;
blk_t pblock;
unsigned int blkorig, s, b;
blk_t fblock = file->pos / bs;
blk_t pblock;
unsigned int blkorig, s, b;
pblock = 0;
status = ext2fs_bmap(fs, file->inode, &cur_inode,
block_buffer, 0, fblock, &pblock);
pblock = 0;
status = ext2fs_bmap(fs, file->inode, &cur_inode,
block_buffer, 0, fblock, &pblock);
file->pos += s;
}
return read;
file->pos += s;
}
return read;
-#endif /* FAST_VERSION */
+#endif /* FAST_VERSION */
if (fs)
ext2fs_close(fs);
fs = NULL;
if (fs)
ext2fs_close(fs);
fs = NULL;
prom_close(file->of_device);
DEBUG_F("ext2_close called\n");
opened = 0;
prom_close(file->of_device);
DEBUG_F("ext2_close called\n");
opened = 0;
if (block_buffer) {
free(block_buffer);
block_buffer = malloc(bs * 2);
if (block_buffer) {
free(block_buffer);
block_buffer = malloc(bs * 2);
if (count == 0)
return 0;
if (count == 0)
return 0;
tempb = (((unsigned long long) block) *
((unsigned long long)bs)) + (unsigned long long)doff;
size = (count < 0) ? -count : count * bs;
tempb = (((unsigned long long) block) *
((unsigned long long)bs)) + (unsigned long long)doff;
size = (count < 0) ? -count : count * bs;
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
* BrokenFirmware cannot "read" from the network. We use tftp "load"
* method for network boot for now, we may provide our own NFS
* implementation in a later version. That means that we allocate a
* BrokenFirmware cannot "read" from the network. We use tftp "load"
* method for network boot for now, we may provide our own NFS
* implementation in a later version. That means that we allocate a
static char buffer[1024];
char *filename;
char *p;
static char buffer[1024];
char *filename;
char *p;
strcat(buffer, ",");
filename = strdup(file_name);
for (p = filename; *p; p++)
strcat(buffer, ",");
filename = strdup(file_name);
for (p = filename; *p; p++)
*p = '\\';
strcat(buffer, filename);
free(filename);
*p = '\\';
strcat(buffer, filename);
free(filename);
DEBUG_LEAVE(FILE_ERR_BAD_FSYS);
return FILE_ERR_BAD_FSYS;
}
DEBUG_LEAVE(FILE_ERR_BAD_FSYS);
return FILE_ERR_BAD_FSYS;
}
DEBUG_LEAVE(FILE_ERR_OK);
return FILE_ERR_OK;
}
DEBUG_LEAVE(FILE_ERR_OK);
return FILE_ERR_OK;
}
strcat(buffer, ",");
filename = strdup(file_name);
for (p = filename; *p; p++)
strcat(buffer, ",");
filename = strdup(file_name);
for (p = filename; *p; p++)
*p = '\\';
strcat(buffer, filename);
free(filename);
}
*p = '\\';
strcat(buffer, filename);
free(filename);
}
DEBUG_F("Opening: \"%s\"\n", buffer);
file->of_device = prom_open(buffer);
DEBUG_F("Opening: \"%s\"\n", buffer);
file->of_device = prom_open(buffer);
DEBUG_LEAVE(FILE_ERR_BAD_FSYS);
return FILE_ERR_BAD_FSYS;
}
DEBUG_LEAVE(FILE_ERR_BAD_FSYS);
return FILE_ERR_BAD_FSYS;
}
file->buffer = prom_claim((void *)LOAD_BUFFER_POS, LOAD_BUFFER_SIZE, 0);
if (file->buffer == (void *)-1) {
prom_printf("Can't claim memory for TFTP download\n");
file->buffer = prom_claim((void *)LOAD_BUFFER_POS, LOAD_BUFFER_SIZE, 0);
if (file->buffer == (void *)-1) {
prom_printf("Can't claim memory for TFTP download\n");
DEBUG_F("TFP...\n");
file->len = prom_loadmethod(file->of_device, file->buffer);
DEBUG_F("TFP...\n");
file->len = prom_loadmethod(file->of_device, file->buffer);
DEBUG_F("result: %Ld\n", file->len);
DEBUG_F("result: %Ld\n", file->len);
DEBUG_LEAVE(FILE_ERR_OK);
return FILE_ERR_OK;
}
DEBUG_LEAVE(FILE_ERR_OK);
return FILE_ERR_OK;
}
of_read(struct boot_file_t* file, unsigned int size, void* buffer)
{
unsigned int count;
of_read(struct boot_file_t* file, unsigned int size, void* buffer)
{
unsigned int count;
count = prom_read(file->of_device, buffer, size);
file->pos += count;
return count;
count = prom_read(file->of_device, buffer, size);
file->pos += count;
return count;
of_net_read(struct boot_file_t* file, unsigned int size, void* buffer)
{
unsigned int count, av;
of_net_read(struct boot_file_t* file, unsigned int size, void* buffer)
{
unsigned int count, av;
av = file->len - file->pos;
av = file->len - file->pos;
- count = size > av ? av : size;
+ count = size > av ? av : size;
memcpy(buffer, file->buffer + file->pos, count);
file->pos += count;
return count;
memcpy(buffer, file->buffer + file->pos, count);
file->pos += count;
return count;
file->pos = newpos;
return FILE_ERR_OK;
}
file->pos = newpos;
return FILE_ERR_OK;
}
prom_close(file->of_device);
DEBUG_F("of_close called\n");
prom_close(file->of_device);
DEBUG_F("of_close called\n");
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
/* Read a block from ReiserFS file system, taking the journal into
* account. If the block nr is in the journal, the block from the
/* Read a block from ReiserFS file system, taking the journal into
* account. If the block nr is in the journal, the block from the
*/
static int
block_read( __u32 blockNr, __u32 start, __u32 len, char *buffer )
*/
static int
block_read( __u32 blockNr, __u32 start, __u32 len, char *buffer )
DEBUG_F( "block_read: block %u is mapped to journal block %u.\n",
blockNr, translatedNr - INFO->journal_block );
DEBUG_F( "block_read: block %u is mapped to journal block %u.\n",
blockNr, translatedNr - INFO->journal_block );
- /* We must continue the search, as this block may be overwritten in
+ /* We must continue the search, as this block may be overwritten in
* later transactions. */
not_found:
desc_block = (desc_block + 2 + j_len) & journal_mask;
* later transactions. */
not_found:
desc_block = (desc_block + 2 + j_len) & journal_mask;
* we can still read the rest from the disk on demand.
*
* The first number of valid transactions and the descriptor block of the
* we can still read the rest from the disk on demand.
*
* The first number of valid transactions and the descriptor block of the
- * first valid transaction are held in INFO. The transactions are all
- * adjacent, but we must take care of the journal wrap around.
+ * first valid transaction are held in INFO. The transactions are all
+ * adjacent, but we must take care of the journal wrap around.
*/
static int
journal_init( void )
*/
static int
journal_init( void )
- /* Cache the length and the realblock numbers in the table. *
+ /* Cache the length and the realblock numbers in the table. *
* The block number of descriptor can easily be computed. *
* and need not to be stored here. */
*journal_table++ = desc.j_len;
* The block number of descriptor can easily be computed. *
* and need not to be stored here. */
*journal_table++ = desc.j_len;
* My tree node cache is organized as following
* 0 ROOT node
* 1 LEAF node (if the ROOT is also a LEAF it is copied here
* My tree node cache is organized as following
* 0 ROOT node
* 1 LEAF node (if the ROOT is also a LEAF it is copied here
- * 2-n other nodes on current path from bottom to top.
+ * 2-n other nodes on current path from bottom to top.
* if there is not enough space in the cache, the top most are
* omitted.
*
* if there is not enough space in the cache, the top most are
* omitted.
*
* next_key() gets the next key in tree order.
*
* This means, that I can only sequential reads of files are
* next_key() gets the next key in tree order.
*
* This means, that I can only sequential reads of files are
- * efficient, but this really doesn't hurt for grub.
+ * efficient, but this really doesn't hurt for grub.
*/
/* Read in the node at the current path and depth into the node cache.
*/
/* Read in the node at the current path and depth into the node cache.
}
/* Get the next key, i.e. the key following the last retrieved key in
}
/* Get the next key, i.e. the key following the last retrieved key in
- * tree order. INFO->current_ih and
+ * tree order. INFO->current_ih and
* INFO->current_info are adapted accordingly. */
static int
next_key( void )
* INFO->current_info are adapted accordingly. */
static int
next_key( void )
DEBUG_F( " depth=%u, i=%u/%u\n", depth, key_nr, nr_item );
if ( key_nr == nr_item )
DEBUG_F( " depth=%u, i=%u/%u\n", depth, key_nr, nr_item );
if ( key_nr == nr_item )
- /* This is the last item in this block, set the next_key_nr *
+ /* This is the last item in this block, set the next_key_nr *
* to 0 */
INFO->next_key_nr[depth] = 0;
* to 0 */
INFO->next_key_nr[depth] = 0;
-/* preconditions: reiserfs_read_super already executed, therefore
+/* preconditions: reiserfs_read_super already executed, therefore
- * returns: 0 if error (errnum is set),
+ * returns: 0 if error (errnum is set),
* nonzero iff we were able to find the key successfully.
* nonzero iff we were able to find the key successfully.
- * postconditions: on a nonzero return, the current_ih and
+ * postconditions: on a nonzero return, the current_ih and
* current_item fields describe the key that equals the
* searched key. INFO->next_key contains the next key after
* the searched key.
* current_item fields describe the key that equals the
* searched key. INFO->next_key contains the next key after
* the searched key.
-/* preconditions: reiserfs_read_super already executed, therefore
+/* preconditions: reiserfs_read_super already executed, therefore
* INFO block is valid
* returns: 0 if error, nonzero iff we were able to find the file successfully
* postconditions: on a nonzero return, INFO->fileinfo contains the info
* INFO block is valid
* returns: 0 if error, nonzero iff we were able to find the file successfully
* postconditions: on a nonzero return, INFO->fileinfo contains the info
- * of the file we were trying to look up, filepos is 0 and filemax is
+ * of the file we were trying to look up, filepos is 0 and filemax is
* the size of the file.
*/
static int
* the size of the file.
*/
static int
- /* Copy the remaining name to the end of the symlink data. Note *
+ /* Copy the remaining name to the end of the symlink data. Note *
* that DIRNAME and LINKBUF may overlap! */
memmove( linkbuf + INFO->file->len, dirname, len + 1 );
* that DIRNAME and LINKBUF may overlap! */
memmove( linkbuf + INFO->file->len, dirname, len + 1 );
- /* Directory names in ReiserFS are not null * terminated.
+ /* Directory names in ReiserFS are not null * terminated.
* We write a temporary 0 behind it. * NOTE: that this
* may overwrite the first block in * the tree cache.
* That doesn't hurt as long as we * don't call next_key
* We write a temporary 0 behind it. * NOTE: that this
* may overwrite the first block in * the tree cache.
* That doesn't hurt as long as we * don't call next_key
if ( cmp == 0 )
goto found;
}
if ( cmp == 0 )
goto found;
}
- /* The beginning of this name marks the end of the next name.
+ /* The beginning of this name marks the end of the next name.
*/
name_end = filename;
de_head++;
*/
name_end = filename;
de_head++;
tmp.linear = le64_to_cpu( tmp.linear );
return tmp.offset_v2.k_type;
}
tmp.linear = le64_to_cpu( tmp.linear );
return tmp.offset_v2.k_type;
}
inline loff_t
offset_v2_k_offset( struct offset_v2 *v2 )
{
inline loff_t
offset_v2_k_offset( struct offset_v2 *v2 )
{
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
DEBUG_F("%p was successfully opened\n", file->of_device);
xfs_file = file;
DEBUG_F("%p was successfully opened\n", file->of_device);
xfs_file = file;
if (xfs_mount() != 1)
{
DEBUG_F("Couldn't open XFS @ %s/%Lu\n", buffer, partition_offset);
if (xfs_mount() != 1)
{
DEBUG_F("Couldn't open XFS @ %s/%Lu\n", buffer, partition_offset);
static xfs_fsblock_t
xt_start (xfs_bmbt_rec_32_t *r)
{
static xfs_fsblock_t
xt_start (xfs_bmbt_rec_32_t *r)
{
- return (((xfs_fsblock_t)(le32 (r->l1) & mask32lo(9))) << 43) |
+ return (((xfs_fsblock_t)(le32 (r->l1) & mask32lo(9))) << 43) |
(((xfs_fsblock_t)le32 (r->l2)) << 11) |
(((xfs_fsblock_t)le32 (r->l3)) >> 21);
}
(((xfs_fsblock_t)le32 (r->l2)) << 11) |
(((xfs_fsblock_t)le32 (r->l3)) >> 21);
}
++name;
++namelen;
sfe = (xfs_dir2_sf_entry_t *)
++name;
++namelen;
sfe = (xfs_dir2_sf_entry_t *)
+ sizeof(xfs_dir2_sf_hdr_t)
- xfs.i8param);
break;
+ sizeof(xfs_dir2_sf_hdr_t)
- xfs.i8param);
break;
offset = xad->offset;
xadlen = xad->len;
if (isinxt (xfs_file->pos >> xfs.blklog, offset, xadlen)) {
offset = xad->offset;
xadlen = xad->len;
if (isinxt (xfs_file->pos >> xfs.blklog, offset, xadlen)) {
- endofcur = (offset + xadlen) << xfs.blklog;
+ endofcur = (offset + xadlen) << xfs.blklog;
toread = (endofcur >= endpos)
? len : (endofcur - xfs_file->pos);
read_disk_block(xfs_file, fsb2daddr (xad->start),
toread = (endofcur >= endpos)
? len : (endofcur - xfs_file->pos);
read_disk_block(xfs_file, fsb2daddr (xad->start),
- endofprev = offset + xadlen;
+ endofprev = offset + xadlen;
}
return xfs_file->pos - startpos;
}
return xfs_file->pos - startpos;
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 8
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 8
isonum_712 (char * p)
{
int val;
isonum_712 (char * p)
{
int val;
val = *p;
if (val & 0x80)
val |= 0xffffff00;
val = *p;
if (val & 0x80)
val |= 0xffffff00;
return (isonum_731 (p));
}
return (isonum_731 (p));
}
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 8
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 8
* md5.c - an implementation of the MD5 algorithm and MD5 crypt
*
* Copyright (C) 2001, 2002 Ethan Benson
* md5.c - an implementation of the MD5 algorithm and MD5 crypt
*
* Copyright (C) 2001, 2002 Ethan Benson
* Copyright (C) 2000 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* Copyright (C) 2000 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
static UINT4 initstate[4] =
{
static UINT4 initstate[4] =
{
- 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476
+ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476
};
static char s1[4] = { 7, 12, 17, 22 };
};
static char s1[4] = { 7, 12, 17, 22 };
{
int buflen = length & 63;
length += inputlen;
{
int buflen = length & 63;
length += inputlen;
- if (buflen + inputlen < 64)
+ if (buflen + inputlen < 64)
{
memcpy (buffer + buflen, input, inputlen);
buflen += inputlen;
return;
}
{
memcpy (buffer + buflen, input, inputlen);
buflen += inputlen;
return;
}
memcpy (buffer + buflen, input, 64 - buflen);
md5_transform (buffer);
input += 64 - buflen;
memcpy (buffer + buflen, input, 64 - buflen);
md5_transform (buffer);
input += 64 - buflen;
memset (buffer, 0, 64);
buflen = 0;
}
memset (buffer, 0, 64);
buflen = 0;
}
*(UINT4 *) (buffer + 56) = cpu_to_le32 (8 * length);
*(UINT4 *) (buffer + 60) = 0;
md5_transform (buffer);
*(UINT4 *) (buffer + 56) = cpu_to_le32 (8 * length);
*(UINT4 *) (buffer + 60) = 0;
md5_transform (buffer);
{
int keylen = strlen (key);
char *salt = crypted + 3; /* skip $1$ header */
{
int keylen = strlen (key);
char *salt = crypted + 3; /* skip $1$ header */
int saltlen;
int i, n;
unsigned char alt_result[16];
int saltlen;
int i, n;
unsigned char alt_result[16];
md5_init ();
md5_update (key, keylen);
md5_update (salt, saltlen);
md5_update (key, keylen);
digest = md5_final ();
memcpy (alt_result, digest, 16);
md5_init ();
md5_update (key, keylen);
md5_update (salt, saltlen);
md5_update (key, keylen);
digest = md5_final ();
memcpy (alt_result, digest, 16);
memcpy ((char *) state, (char *) initstate, sizeof (initstate));
length = 0;
md5_update (key, keylen);
memcpy ((char *) state, (char *) initstate, sizeof (initstate));
length = 0;
md5_update (key, keylen);
md5_update (key, keylen);
else
md5_update (alt_result, 16);
md5_update (key, keylen);
else
md5_update (alt_result, 16);
if (i % 3 != 0)
md5_update (salt, saltlen);
if (i % 3 != 0)
md5_update (salt, saltlen);
p = salt + saltlen + 1;
for (i = 0; i < 5; i++)
{
p = salt + saltlen + 1;
for (i = 0; i < 5; i++)
{
digest[i == 4 ? 5 : 12+i] | (digest[6+i] << 8) | (digest[i] << 16);
for (n = 4; n-- > 0;)
{
digest[i == 4 ? 5 : 12+i] | (digest[6+i] << 8) | (digest[i] << 16);
for (n = 4; n-- > 0;)
{
{
*p++ = b64t[w & 0x3f];
}
{
*p++ = b64t[w & 0x3f];
}
{
*p++ = b64t[w & 0x3f];
}
{
*p++ = b64t[w & 0x3f];
}
w >>= 6;
}
}
if (! check)
*p = '\0';
w >>= 6;
}
}
if (! check)
*p = '\0';
return *p;
}
#endif
#ifdef TEST
static char *
return *p;
}
#endif
#ifdef TEST
static char *
{
memcpy ((char *) state, (char *) initstate, sizeof (initstate));
length = 0;
{
memcpy ((char *) state, (char *) initstate, sizeof (initstate));
length = 0;
-test (char *buffer, char *expected)
+test (char *buffer, char *expected)
{
char result[16 * 3 +1];
unsigned char* digest = md5 (buffer);
{
char result[16 * 3 +1];
unsigned char* digest = md5 (buffer);
/* Local functions */
static unsigned long swab32(unsigned long value);
/* Local functions */
static unsigned long swab32(unsigned long value);
{
struct partition_t* part;
part = (struct partition_t*)malloc(sizeof(struct partition_t));
{
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_number = part_number;
strncpy(part->part_type, part_type, MAX_PART_NAME);
strncpy(part->part_name, part_name, MAX_PART_NAME);
struct mac_partition* part = (struct mac_partition *)block_buffer;
unsigned short ptable_block_size =
((struct mac_driver_desc *)block_buffer)->block_size;
struct mac_partition* part = (struct mac_partition *)block_buffer;
unsigned short ptable_block_size =
((struct mac_driver_desc *)block_buffer)->block_size;
map_size = 1;
for (block=1; block < map_size + 1; block++)
{
map_size = 1;
for (block=1; block < map_size + 1; block++)
{
}
if (block == 1)
map_size = part->map_count;
}
if (block == 1)
map_size = part->map_count;
#ifdef CHECK_FOR_VALID_MAC_PARTITION_TYPE
#ifdef CHECK_FOR_VALID_MAC_PARTITION_TYPE
- /* We don't bother looking at swap partitions of any type,
+ /* We don't bother looking at swap partitions of any type,
* and the rest are the ones we know about */
for (ptype = valid_mac_partition_types; ptype; ptype++)
if (!strcmp (part->type, ptype))
* and the rest are the ones we know about */
for (ptype = valid_mac_partition_types; ptype; ptype++)
if (!strcmp (part->type, ptype))
* Same function as partition_mac_lookup(), except for fdisk
* partitioned disks.
*/
* Same function as partition_mac_lookup(), except for fdisk
* partitioned disks.
*/
/* fdisk partition tables start at offset 0x1be
* from byte 0 of the boot drive.
*/
/* fdisk partition tables start at offset 0x1be
* from byte 0 of the boot drive.
*/
- struct fdisk_partition* part =
+ struct fdisk_partition* part =
(struct fdisk_partition *) (block_buffer + 0x1be);
for (partition=1; partition <= 4 ;partition++, part++) {
(struct fdisk_partition *) (block_buffer + 0x1be);
for (partition=1; partition <= 4 ;partition++, part++) {
prom_printf("Can't read volume desc block %d\n", block);
break;
}
prom_printf("Can't read volume desc block %d\n", block);
break;
}
vdp = (struct iso_volume_descriptor *)block_buffer;
vdp = (struct iso_volume_descriptor *)block_buffer;
-
- /* Due to the overlapping physical location of the descriptors,
- * ISO CDs can match hdp->id==HS_STANDARD_ID as well. To ensure
+
+ /* Due to the overlapping physical location of the descriptors,
+ * ISO CDs can match hdp->id==HS_STANDARD_ID as well. To ensure
* proper identification in this case, we first check for ISO.
*/
if (strncmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) == 0) {
* proper identification in this case, we first check for ISO.
*/
if (strncmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) == 0) {
* Detects and read amiga partition tables.
*/
* Detects and read amiga partition tables.
*/
if (prom_readblocks(disk, i, 1, block_buffer) != 1) {
prom_printf("Can't read boot block %d\n", i);
break;
if (prom_readblocks(disk, i, 1, block_buffer) != 1) {
prom_printf("Can't read boot block %d\n", i);
break;
}
if ((amiga_block[AMIGA_ID] == AMIGA_ID_RDB) && (_amiga_checksum (prom_blksize) == 0))
return 1;
}
if ((amiga_block[AMIGA_ID] == AMIGA_ID_RDB) && (_amiga_checksum (prom_blksize) == 0))
return 1;
if (prom_readblocks(disk, 0, 1, block_buffer) != 1) {
prom_printf("Can't read boot blocks\n");
return 0; /* TODO: something bad happened, should fail more verbosely */
if (prom_readblocks(disk, 0, 1, block_buffer) != 1) {
prom_printf("Can't read boot blocks\n");
return 0; /* TODO: something bad happened, should fail more verbosely */
if (prom_readblocks(disk, part, 1, block_buffer) != 1) {
prom_printf("Can't read partition block %d\n", part);
break;
if (prom_readblocks(disk, part, 1, block_buffer) != 1) {
prom_printf("Can't read partition block %d\n", part);
break;
checksum = _amiga_checksum (prom_blksize);
if ((amiga_block[AMIGA_ID] == AMIGA_ID_PART) &&
(checksum == 0) &&
checksum = _amiga_checksum (prom_blksize);
if ((amiga_block[AMIGA_ID] == AMIGA_ID_PART) &&
(checksum == 0) &&
struct mac_driver_desc *desc = (struct mac_driver_desc *)block_buffer;
struct partition_t* list = NULL;
unsigned int prom_blksize, iso_root_block;
struct mac_driver_desc *desc = (struct mac_driver_desc *)block_buffer;
struct partition_t* list = NULL;
unsigned int prom_blksize, iso_root_block;
strncpy(block_buffer, device, 2040);
strcat(block_buffer, ":0");
strncpy(block_buffer, device, 2040);
strcat(block_buffer, ":0");
/* Open device */
disk = prom_open(block_buffer);
if (disk == NULL) {
/* Open device */
disk = prom_open(block_buffer);
if (disk == NULL) {
prom_printf("block_size %d not supported !\n", prom_blksize);
goto bail;
}
prom_printf("block_size %d not supported !\n", prom_blksize);
goto bail;
}
/* Read boot blocs */
if (prom_readblocks(disk, 0, 1, block_buffer) != 1) {
prom_printf("Can't read boot blocks\n");
goto bail;
/* Read boot blocs */
if (prom_readblocks(disk, 0, 1, block_buffer) != 1) {
prom_printf("Can't read boot blocks\n");
goto bail;
if (desc->signature == MAC_DRIVER_MAGIC) {
/* pdisk partition format */
partition_mac_lookup(device, disk, prom_blksize, &list);
if (desc->signature == MAC_DRIVER_MAGIC) {
/* pdisk partition format */
partition_mac_lookup(device, disk, prom_blksize, &list);
if ((partition >= 0) && (partition == p->part_number)) {
type = strdup(p->part_type);
break;
if ((partition >= 0) && (partition == p->part_number)) {
type = strdup(p->part_type);
break;
}
if (parts)
partitions_free(parts);
}
if (parts)
partitions_free(parts);
partitions_free(struct partition_t* list)
{
struct partition_t* next;
partitions_free(struct partition_t* list)
{
struct partition_t* next;
while(list) {
next = list->next;
free(list);
while(list) {
next = list->next;
free(list);
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
va_list list;
int i;
struct prom_args prom_args;
va_list list;
int i;
struct prom_args prom_args;
prom_args.service = service;
prom_args.nargs = nargs;
prom_args.nret = nret;
prom_args.service = service;
prom_args.nargs = nargs;
prom_args.nret = nret;
int i;
void* result;
struct prom_args prom_args;
int i;
void* result;
struct prom_args prom_args;
prom_args.service = service;
prom_args.nargs = nargs;
prom_args.nret = nret;
prom_args.service = service;
prom_args.nargs = nargs;
prom_args.nret = nret;
va_list list;
int i;
struct prom_args prom_args;
va_list list;
int i;
struct prom_args prom_args;
prom_args.service = "call-method";
prom_args.nargs = nargs+2;
prom_args.nret = 2;
prom_args.service = "call-method";
prom_args.nargs = nargs+2;
prom_args.nret = 2;
va_end(list);
prom_args.args[2+nargs] = 0;
prom_args.args[2+nargs+1] = 0;
va_end(list);
prom_args.args[2+nargs] = 0;
prom_args.args[2+nargs+1] = 0;
prom (&prom_args);
if (prom_args.args[2+nargs] != 0)
prom (&prom_args);
if (prom_args.args[2+nargs] != 0)
/* Add a few OF methods (thanks Darwin) */
#if DEBUG
prom_printf ("Adding OF methods...\n");
/* Add a few OF methods (thanks Darwin) */
#if DEBUG
prom_printf ("Adding OF methods...\n");
prom_interpret (
/* All values in this forth code are in hex */
prom_interpret (
/* All values in this forth code are in hex */
/* Those are a few utilities ripped from Apple */
": D2NIP decode-int nip nip ;\r" // A useful function to save space
": GPP$ get-package-property 0= ;\r" // Another useful function to save space
/* Those are a few utilities ripped from Apple */
": D2NIP decode-int nip nip ;\r" // A useful function to save space
": GPP$ get-package-property 0= ;\r" // Another useful function to save space
{
int result = 0;
int retries = 10;
{
int result = 0;
int retries = 10;
if (n == 0)
return 0;
while(--retries) {
if (n == 0)
return 0;
while(--retries) {
break;
call_prom("interpret", 1, 1, " 10 ms");
}
break;
call_prom("interpret", 1, 1, " 10 ms");
}
#if READ_BLOCKS_USE_READ
int status;
unsigned int blksize;
#if READ_BLOCKS_USE_READ
int status;
unsigned int blksize;
blksize = prom_getblksize(dev);
if (blksize <= 1)
blksize = 512;
blksize = prom_getblksize(dev);
if (blksize <= 1)
blksize = 512;
return 0;
prom_printf("Can't seek to 0x%x\n", blockNum * blksize);
}
return 0;
prom_printf("Can't seek to 0x%x\n", blockNum * blksize);
}
status = prom_read(dev, buffer, blockCount * blksize);
// prom_printf("prom_readblocks, bl: %d, cnt: %d, status: %d\n",
// blockNum, blockCount, status);
return status == (blockCount * blksize);
status = prom_read(dev, buffer, blockCount * blksize);
// prom_printf("prom_readblocks, bl: %d, cnt: %d, status: %d\n",
// blockNum, blockCount, status);
return status == (blockCount * blksize);
int result;
int retries = 10;
int result;
int retries = 10;
if (blockCount == 0)
return blockCount;
while(--retries) {
if (blockCount == 0)
return blockCount;
while(--retries) {
break;
call_prom("interpret", 1, 1, " 10 ms");
}
break;
call_prom("interpret", 1, 1, " 10 ms");
}
- for (p = s; *p != 0; p = q)
+ for (p = s; *p != 0; p = q)
{
for (q = p; *q != 0 && *q != '\n'; ++q)
;
if (q > p)
call_prom ("write", 3, 1, file, p, q - p);
{
for (q = p; *q != 0 && *q != '\n'; ++q)
;
if (q > p)
call_prom ("write", 3, 1, file, p, q - p);
{
++q;
call_prom ("write", 3, 1, file, "\r\n", 2);
}
}
}
{
++q;
call_prom ("write", 3, 1, file, "\r\n", 2);
}
}
}
void
prom_vfprintf (prom_handle file, char *fmt, va_list ap)
{
void
prom_vfprintf (prom_handle file, char *fmt, va_list ap)
{
else if (error == FILE_IOERR)
prom_printf("%s: Input/output error\n", filename);
else if (error == FILE_BAD_PATH)
else if (error == FILE_IOERR)
prom_printf("%s: Input/output error\n", filename);
else if (error == FILE_BAD_PATH)
- prom_printf("%s: Path too long\n", filename);
+ prom_printf("%s: Path too long\n", filename);
else if (error == FILE_ERR_BAD_TYPE)
prom_printf("%s: Not a regular file\n", filename);
else if (error == FILE_ERR_NOTDIR)
else if (error == FILE_ERR_BAD_TYPE)
prom_printf("%s: Not a regular file\n", filename);
else if (error == FILE_ERR_NOTDIR)
"2dup \" unmap\" ^mmu " // Unmap the space first
"2dup \" release\" ^mmu " // Then free the virtual pages
"\" release\" ^mem " // Then free the physical pages
"2dup \" unmap\" ^mmu " // Unmap the space first
"2dup \" release\" ^mmu " // Then free the virtual pages
"\" release\" ^mem " // Then free the physical pages
);
#endif /* bullshit */
}
);
#endif /* bullshit */
}
call_prom("enter", 0, 0);
}
call_prom("enter", 0, 0);
}
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
- * Yaboot - secondary boot loader for Linux on PowerPC.
+ * Yaboot - secondary boot loader for Linux on PowerPC.
*
* Copyright (C) 2001, 2002 Ethan Benson
*
* Copyright (C) 1999, 2000, 2001 Benjamin Herrenschmidt
*
* Copyright (C) 2001, 2002 Ethan Benson
*
* Copyright (C) 1999, 2000, 2001 Benjamin Herrenschmidt
* Copyright (C) 2001 Peter Bergner
*
* portions based on poof
* Copyright (C) 2001 Peter Bergner
*
* portions based on poof
* Copyright (C) 1999 Marius Vollmer
* Copyright (C) 1999 Marius Vollmer
* Copyright (C) 1996 Paul Mackerras.
* Copyright (C) 1996 Paul Mackerras.
* Because this program is derived from the corresponding file in the
* silo-0.64 distribution, it is also
* Because this program is derived from the corresponding file in the
* silo-0.64 distribution, it is also
* Copyright (C) 1996 Pete A. Zaitcev
* 1996 Maurizio Plaza
* 1996 David S. Miller
* Copyright (C) 1996 Pete A. Zaitcev
* 1996 Maurizio Plaza
* 1996 David S. Miller
/* OF seems to do it, but I'm not very confident */
memset(&__bss_start, 0, &_end - &__bss_start);
/* OF seems to do it, but I'm not very confident */
memset(&__bss_start, 0, &_end - &__bss_start);
/* Check for quik first stage bootloader (but I don't think we are
* compatible with it anyway, I'll look into backporting to older OF
* versions later
/* Check for quik first stage bootloader (but I don't think we are
* compatible with it anyway, I'll look into backporting to older OF
* versions later
/* Initialize OF interface */
prom_init ((prom_entry) r5);
/* Initialize OF interface */
prom_init ((prom_entry) r5);
/* Allocate some memory for malloc'ator */
malloc_base = prom_claim((void *)MALLOCADDR, MALLOCSIZE, 0);
if (malloc_base == (void *)-1) {
/* Allocate some memory for malloc'ator */
malloc_base = prom_claim((void *)MALLOCADDR, MALLOCSIZE, 0);
if (malloc_base == (void *)-1) {
malloc_init(malloc_base, MALLOCSIZE);
DEBUG_F("Malloc buffer allocated at %p (%d bytes)\n",
malloc_base, MALLOCSIZE);
malloc_init(malloc_base, MALLOCSIZE);
DEBUG_F("Malloc buffer allocated at %p (%d bytes)\n",
malloc_base, MALLOCSIZE);
/* A few useless DEBUG_F's */
DEBUG_F("reloc_offset : %ld (should be 0)\n", reloc_offset());
DEBUG_F("test_bss : %d (should be 0)\n", test_bss);
/* A few useless DEBUG_F's */
DEBUG_F("reloc_offset : %ld (should be 0)\n", reloc_offset());
DEBUG_F("test_bss : %d (should be 0)\n", test_bss);
_machine = _MACH_chrp;
}
}
_machine = _MACH_chrp;
}
}
DEBUG_F("Running on _machine = %d\n", _machine);
DEBUG_SLEEP;
DEBUG_F("Running on _machine = %d\n", _machine);
DEBUG_SLEEP;
/* Return to OF */
prom_exit();
/* Return to OF */
prom_exit();
}
#ifdef CONFIG_COLOR_TEXT
}
#ifdef CONFIG_COLOR_TEXT
#endif /* CONFIG_COLOR_TEXT */
void print_message_file(char *filename)
{
#endif /* CONFIG_COLOR_TEXT */
void print_message_file(char *filename)
{
char *p, *endp;
char *defdev = boot.dev;
int defpart = boot.part;
char *p, *endp;
char *defdev = boot.dev;
int defpart = boot.part;
if (p) {
n = simple_strtol(p, &endp, 10);
if (endp != p && *endp == 0)
if (p) {
n = simple_strtol(p, &endp, 10);
if (endp != p && *endp == 0)
}
strncpy(msgpath, filename, sizeof(msgpath));
}
strncpy(msgpath, filename, sizeof(msgpath));
prom_interpret(p);
password = cfg_get_strg(0, "password");
prom_interpret(p);
password = cfg_get_strg(0, "password");
#ifdef CONFIG_COLOR_TEXT
p = cfg_get_strg(0, "fgcolor");
if (p) {
#ifdef CONFIG_COLOR_TEXT
p = cfg_get_strg(0, "fgcolor");
if (p) {
}
if (bgcolor >= 0) {
char temp[64];
}
if (bgcolor >= 0) {
char temp[64];
- sprintf(temp, "%x to background-color", bgcolor);
- prom_interpret(temp);
+ sprintf(temp, "%x to background-color", bgcolor);
+ prom_interpret(temp);
#if !DEBUG
prom_printf("\xc");
#endif /* !DEBUG */
}
if (fgcolor >= 0) {
char temp[64];
#if !DEBUG
prom_printf("\xc");
#endif /* !DEBUG */
}
if (fgcolor >= 0) {
char temp[64];
- sprintf(temp, "%x to foreground-color", fgcolor);
- prom_interpret(temp);
+ sprintf(temp, "%x to foreground-color", fgcolor);
+ prom_interpret(temp);
}
#endif /* CONFIG_COLOR_TEXT */
}
#endif /* CONFIG_COLOR_TEXT */
p = cfg_get_strg(0, "init-message");
if (p)
prom_printf("%s\n", p);
p = cfg_get_strg(0, "init-message");
if (p)
prom_printf("%s\n", p);
print_message_file(p);
result = 1;
print_message_file(p);
result = 1;
bail:
if (opened)
file.fs->close(&file);
bail:
if (opened)
file.fs->close(&file);
if (conf_file)
free(conf_file);
if (conf_file)
free(conf_file);
if (!strncmp (password, "$1$", 3)) {
if (!check_md5_password(passwdbuff, password))
return;
if (!strncmp (password, "$1$", 3)) {
if (!check_md5_password(passwdbuff, password))
return;
else if (!strcmp (password, passwdbuff))
return;
#else /* !MD5 */
else if (!strcmp (password, passwdbuff))
return;
#else /* !MD5 */
params->rd.part = -1;
params->sysmap.part = -1;
defpart = boot.part;
params->rd.part = -1;
params->sysmap.part = -1;
defpart = boot.part;
check_password ("Restricted command.");
return 1;
}
check_password ("Restricted command.");
return 1;
}
}
if (imagename[0] == '$') {
}
if (imagename[0] == '$') {
loadinfo_t loadinfo;
void *initrd_more,*initrd_want;
unsigned long initrd_read;
loadinfo_t loadinfo;
void *initrd_more,*initrd_want;
unsigned long initrd_read;
loadinfo.load_loc = 0;
for (;;) {
loadinfo.load_loc = 0;
for (;;) {
initrd_base = 0;
sysmap_base = 0;
sysmap_size = 0;
initrd_base = 0;
sysmap_base = 0;
sysmap_size = 0;
if (get_params(¶ms))
return;
if (!params.kernel.file)
continue;
if (get_params(¶ms))
return;
if (!params.kernel.file)
continue;
prom_printf("Please wait, loading kernel...\n");
memset(&file, 0, sizeof(file));
prom_printf("Please wait, loading kernel...\n");
memset(&file, 0, sizeof(file));
free(params.sysmap.file);
params.sysmap.file=loc;
}
free(params.sysmap.file);
params.sysmap.file=loc;
}
result = open_file(¶ms.sysmap, &file);
if (result != FILE_ERR_OK) {
prom_printf("%s:%d,", params.sysmap.dev, params.sysmap.part);
result = open_file(¶ms.sysmap, &file);
if (result != FILE_ERR_OK) {
prom_printf("%s:%d,", params.sysmap.dev, params.sysmap.part);
DEBUG_F(" done\n");
if (flat_vmlinux) {
DEBUG_F(" done\n");
if (flat_vmlinux) {
* Fill new boot infos (only if booting a vmlinux).
*
* The birec is low on memory, probably inside the malloc pool,
* Fill new boot infos (only if booting a vmlinux).
*
* The birec is low on memory, probably inside the malloc pool,
birec->tag = BI_FIRST;
birec->size = sizeof(struct bi_record);
birec = (struct bi_record *)((ulong)birec + birec->size);
birec->tag = BI_FIRST;
birec->size = sizeof(struct bi_record);
birec = (struct bi_record *)((ulong)birec + birec->size);
birec->tag = BI_BOOTLOADER_ID;
sprintf( (char *)birec->data, "yaboot");
birec->size = sizeof(struct bi_record) + strlen("yaboot") + 1;
birec = (struct bi_record *)((ulong)birec + birec->size);
birec->tag = BI_BOOTLOADER_ID;
sprintf( (char *)birec->data, "yaboot");
birec->size = sizeof(struct bi_record) + strlen("yaboot") + 1;
birec = (struct bi_record *)((ulong)birec + birec->size);
birec->tag = BI_MACHTYPE;
birec->data[0] = _machine;
birec->size = sizeof(struct bi_record) + sizeof(ulong);
birec->tag = BI_MACHTYPE;
birec->data[0] = _machine;
birec->size = sizeof(struct bi_record) + sizeof(ulong);
if (loadinfo->base == (void *)-1) {
prom_printf("Claim error, can't allocate kernel memory\n");
goto bail;
if (loadinfo->base == (void *)-1) {
prom_printf("Claim error, can't allocate kernel memory\n");
goto bail;
DEBUG_F("After ELF parsing, load base: %p, mem_sz: 0x%08lx\n",
loadinfo->base, loadinfo->memsize);
DEBUG_F("After ELF parsing, load base: %p, mem_sz: 0x%08lx\n",
loadinfo->base, loadinfo->memsize);
/* Return success at loading the Elf32 kernel */
return 1;
/* Return success at loading the Elf32 kernel */
return 1;
if (loadinfo->base == (void *)-1) {
prom_printf("Claim error, can't allocate kernel memory\n");
goto bail;
if (loadinfo->base == (void *)-1) {
prom_printf("Claim error, can't allocate kernel memory\n");
goto bail;
DEBUG_F("After ELF parsing, load base: %p, mem_sz: 0x%08lx\n",
loadinfo->base, loadinfo->memsize);
DEBUG_F("After ELF parsing, load base: %p, mem_sz: 0x%08lx\n",
loadinfo->base, loadinfo->memsize);
/* Return success at loading the Elf64 kernel */
return 1;
/* Return success at loading the Elf64 kernel */
return 1;
DEBUG_F("Open screen result: %p\n", scrn);
}
}
DEBUG_F("Open screen result: %p\n", scrn);
}
}
if (scrn == PROM_INVALID_HANDLE) {
prom_printf("No screen device found !/n");
return;
if (scrn == PROM_INVALID_HANDLE) {
prom_printf("No screen device found !/n");
return;
prom_set_color(scrn, i, default_colors[i*3],
default_colors[i*3+1], default_colors[i*3+2]);
}
prom_set_color(scrn, i, default_colors[i*3],
default_colors[i*3+1], default_colors[i*3+2]);
}
- prom_printf("\x1b[1;37m\x1b[2;40m");
+ prom_printf("\x1b[1;37m\x1b[2;40m");
#ifdef COLOR_TEST
for (i=0;i<16; i++) {
prom_printf("\x1b[%d;%dm\x1b[1;47m%s \x1b[2;40m %s\n",
#ifdef COLOR_TEST
for (i=0;i<16; i++) {
prom_printf("\x1b[%d;%dm\x1b[1;47m%s \x1b[2;40m %s\n",
ansi_color_table[i].name,
ansi_color_table[i].name);
}
ansi_color_table[i].name,
ansi_color_table[i].name);
}
- prom_printf("\x1b[1;37m\x1b[2;40m");
+ prom_printf("\x1b[1;37m\x1b[2;40m");
#endif /* COLOR_TEST */
#if !DEBUG
#endif /* COLOR_TEST */
#if !DEBUG
if (_machine == _MACH_Pmac)
setup_display();
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_chosen("bootpath", bootdevice, sizeof(bootdevice));
DEBUG_F("/chosen/bootpath = %s\n", bootdevice);
if (bootdevice[0] == 0) {
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
* Local variables:
* c-file-style: "k&r"
* c-basic-offset: 5
## Portions based on show_of_path.sh:
##
## Copyright (C) 2000 Olaf Hering <olh@suse.de>
## Portions based on show_of_path.sh:
##
## Copyright (C) 2000 Olaf Hering <olh@suse.de>
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## 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
## small tr replacment which handles a specific need of this script.
smalltr()
{
## small tr replacment which handles a specific need of this script.
smalltr()
{
a) echo 1 ;; b) echo 2 ;; c) echo 3 ;; d) echo 4 ;; e) echo 5 ;; f) echo 6 ;;
g) echo 7 ;; h) echo 8 ;; i) echo 9 ;; j) echo 10 ;; k) echo 11 ;; l) echo 12 ;;
m) echo 13 ;; n) echo 14 ;; o) echo 15 ;; p) echo 16 ;;
a) echo 1 ;; b) echo 2 ;; c) echo 3 ;; d) echo 4 ;; e) echo 5 ;; f) echo 6 ;;
g) echo 7 ;; h) echo 8 ;; i) echo 9 ;; j) echo 10 ;; k) echo 11 ;; l) echo 12 ;;
m) echo 13 ;; n) echo 14 ;; o) echo 15 ;; p) echo 16 ;;
- 1) echo a ;; 2) echo b ;; 3) echo c ;; 4) echo d ;; 5) echo e ;;
+ 1) echo a ;; 2) echo b ;; 3) echo c ;; 4) echo d ;; 5) echo e ;;
6) echo f ;; 7) echo g ;; 8) echo h ;; 9) echo i ;; 10) echo j ;;
11) echo k ;; 12) echo l ;; 13) echo m ;; 14) echo n ;; 15) echo o ;;
16) echo p ;;
6) echo f ;; 7) echo g ;; 8) echo h ;; 9) echo i ;; 10) echo j ;;
11) echo k ;; 12) echo l ;; 13) echo m ;; 14) echo n ;; 15) echo o ;;
16) echo p ;;
scsiinfo || return 1
## now we have the data for /@$DEVID:$PARTITION
scsiinfo || return 1
## now we have the data for /@$DEVID:$PARTITION
- ## find the actual OF path.
+ ## find the actual OF path.
scsi_ofpath || return 1
;;
hd*)
scsi_ofpath || return 1
;;
hd*)
scsiinfo || return 1
## now we have the data for /@$DEVID:$PARTITION
scsiinfo || return 1
## now we have the data for /@$DEVID:$PARTITION
- ## find the actual OF path.
+ ## find the actual OF path.
scsi_ofpath || return 1
;;
*)
scsi_ofpath || return 1
;;
*)
## make fake `id' if its missing, outputs 0 since if its missing we
## are probably running on boot floppies and thus are root.
## make fake `id' if its missing, outputs 0 since if its missing we
## are probably running on boot floppies and thus are root.
-if (command -v id > /dev/null 2>&1) ; then
+if (command -v id > /dev/null 2>&1) ; then
if [ $# != 0 ] ; then
while true ; do
if [ $# != 0 ] ; then
while true ; do
-V|--version)
version
exit 0
-V|--version)
version
exit 0
echo 1>&2 "$PRG: yaboot is not installed correctly"
exit 1
fi
echo 1>&2 "$PRG: yaboot is not installed correctly"
exit 1
fi
## check for properly (read debian) packaged yaboot.
if [ -d ${CHROOT}usr/share/doc/yaboot/examples ] ; then
## check for properly (read debian) packaged yaboot.
if [ -d ${CHROOT}usr/share/doc/yaboot/examples ] ; then
##
## run: \"man yaboot.conf\" for details. Do not make changes until you have!!
${HEADER}##
##
## run: \"man yaboot.conf\" for details. Do not make changes until you have!!
${HEADER}##
-## For a dual-boot menu, add one or more of:
+## For a dual-boot menu, add one or more of:
## bsd=/dev/hdaX, macos=/dev/hdaY, macosx=/dev/hdaZ\n
boot=${BOOT}${DEVICE:-}
partition=$PARTITION
## bsd=/dev/hdaX, macos=/dev/hdaY, macosx=/dev/hdaZ\n
boot=${BOOT}${DEVICE:-}
partition=$PARTITION
## define default configuration
boot=unconfigured
## define default configuration
boot=unconfigured
-## allow default to work on packaged and non-packaged yaboot.
+## allow default to work on packaged and non-packaged yaboot.
## no default for magicboot since it is not required everywhere.
if [ -f /usr/local/lib/yaboot/yaboot ] ; then
install=/usr/local/lib/yaboot/yaboot
## no default for magicboot since it is not required everywhere.
if [ -f /usr/local/lib/yaboot/yaboot ] ; then
install=/usr/local/lib/yaboot/yaboot
## make fake `id' if its missing, outputs 0 since if its missing we
## are probably running on boot floppies and thus are root.
## make fake `id' if its missing, outputs 0 since if its missing we
## are probably running on boot floppies and thus are root.
-if (command -v id > /dev/null 2>&1) ; then
+if (command -v id > /dev/null 2>&1) ; then
if [ `echo ${#hfscreator}` != 4 ] ; then
if [ "$ARGCT" = 1 ] ; then
echo 1>&2 "$PRG: --creator must be 4 characters"
if [ `echo ${#hfscreator}` != 4 ] ; then
if [ "$ARGCT" = 1 ] ; then
echo 1>&2 "$PRG: --creator must be 4 characters"
fi
## convert defaultos variable
fi
## convert defaultos variable
linux|Linux|GNU|Gnu|gnu)
defaultos=bootyaboot
;;
linux|Linux|GNU|Gnu|gnu)
defaultos=bootyaboot
;;
## This is gross, IBM CHRP OF needs a .note added to the yaboot
## binary, nobody knows whether this note will affect PowerMac OF or
## This is gross, IBM CHRP OF needs a .note added to the yaboot
## binary, nobody knows whether this note will affect PowerMac OF or
-## not (or could in the future).
+## not (or could in the future).
hack_yaboot()
{
local YBDIR="${install%/*}"
hack_yaboot()
{
local YBDIR="${install%/*}"
## repoint magicboot as the real first stage loader if using the
## modern automatic generating ofboot.b.
## repoint magicboot as the real first stage loader if using the
## modern automatic generating ofboot.b.
- if [ -n "$FIRST" ] ; then
+ if [ -n "$FIRST" ] ; then
magicboot="$FIRST"
[ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: set magicboot to $FIRST"
fi
magicboot="$FIRST"
[ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: set magicboot to $FIRST"
fi
if [ "$protect" = yes ] ; then
local LOCK="+l"
fi
if [ "$protect" = yes ] ; then
local LOCK="+l"
fi
if [ "$hide" = yes ] ; then
local INVISIBLE="+i"
fi
if [ "$hide" = yes ] ; then
local INVISIBLE="+i"
fi
mnt_install()
{
local BTFILE=yaboot
mnt_install()
{
local BTFILE=yaboot
## msdosfs is broken, yaboot may not support this filename.
if [ "$fstype" = msdos ] ; then
local CFFILE=yaboot.cnf
## msdosfs is broken, yaboot may not support this filename.
if [ "$fstype" = msdos ] ; then
local CFFILE=yaboot.cnf
}
## raw installation, for IBM RS/6000 hardware, yaboot is dded to the
}
## raw installation, for IBM RS/6000 hardware, yaboot is dded to the
raw_install()
{
## make sure the device is not mounted as a filesystem before
raw_install()
{
## make sure the device is not mounted as a filesystem before
[ "$VERBOSE" = 1 ] && echo "$PRG: Creating DOS filesystem on $boot..."
if (command -v dd > /dev/null 2>&1) ; then
dd if=/dev/zero of="$boot" bs=512 count=1600 > /dev/null 2>&1
[ "$VERBOSE" = 1 ] && echo "$PRG: Creating DOS filesystem on $boot..."
if (command -v dd > /dev/null 2>&1) ; then
dd if=/dev/zero of="$boot" bs=512 count=1600 > /dev/null 2>&1
mkdosfs -n bootstrap "$boot" > /dev/null
if [ $? != 0 ] ; then
echo 1>&2 "$PRG: DOS filesystem creation failed!"
mkdosfs -n bootstrap "$boot" > /dev/null
if [ $? != 0 ] ; then
echo 1>&2 "$PRG: DOS filesystem creation failed!"
## absurdly bloated case statement to parse command line options.
if [ $# != 0 ] ; then
while true ; do
## absurdly bloated case statement to parse command line options.
if [ $# != 0 ] ; then
while true ; do
-V|--version)
version
exit 0
-V|--version)
version
exit 0