Compare commits

...
Sign in to create a new pull request.

15 commits

Author SHA1 Message Date
Till Maas
12fa183e80 2014-06-02: ppc32 package, ppc32 support is dropped in Fedora 21 2014-06-02 20:55:10 +02:00
Dennis Gilmore
54ff840af0 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild 2013-08-04 04:25:45 -05:00
Dennis Gilmore
1038948f76 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild 2013-02-14 22:08:02 -06:00
Tony Breeds
d96847345f More e2fsprogs compatability.
The e2fsprogs in f18/rawhide is newer than f17 (duh!) so it needs more
stub functions to link.

This isn't in upstream yet but it will be "RSN".

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
2012-09-05 15:10:59 +10:00
Tony Breeds
850985283e Merge branch 'f17'
Conflicts:
	yaboot.spec
2012-09-05 11:15:18 +10:00
Tony Breeds
b275d8e0b7 Update to link with newer e2fsprogs.
The good news is that e2fsprogs 1.43 (I think)  will have configure
options to remove the need for most of these.  Once 1.43 is available as
an RC we can look at how to integrate that in Fedora.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
2012-09-05 11:10:08 +10:00
Dennis Gilmore
52acfa14b2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild 2012-07-22 02:30:12 -05:00
Dennis Gilmore
adb2d133d4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild 2012-01-14 03:23:07 -06:00
Tony Breeds
15ed53c8e0 Fix fs_swap to not break DVD boots.
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
2011-10-19 13:51:41 +11:00
Tony Breeds
6c095a99ca Disable Werror for the near future.
Do not use Werror, the compiler in F16/Rawhide is hitting warnings that
Upstream doesn't see.  Bypass them for now.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
2011-10-18 17:22:02 +11:00
Tony Breeds
a55381a683 Update to new upstream release yaboot-1.3.17
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
2011-10-18 16:19:58 +11:00
Jiri Skala
75645bf8d2 fixes #746408 - yaboot discards parameters after CAS reboot 2011-10-17 22:41:24 +02:00
Tony Breeds
56d90079a4 Add support for PowerVM and add no-strict-aliasing to YBCFLAGS
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
2011-09-26 15:16:04 +10:00
Tony Breeds
934bf6ca3d Force the linker to use elf32
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
2011-08-31 15:28:36 +10:00
Tony Breeds
fe26fbee33 Truncate memcpy() in extract_vendor_options()
Backport patch from 1.3.17-rc1 which will stop stack smash.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
2011-08-11 10:48:02 +10:00
34 changed files with 1 additions and 5081 deletions

1
.gitignore vendored
View file

@ -1 +0,0 @@
yaboot-1.3.14.tar.gz

1
dead.package Normal file
View file

@ -0,0 +1 @@
2014-06-02: ppc32 package, ppc32 support is dropped in Fedora 21

View file

@ -1,336 +0,0 @@
\ FORTH
." Efika 5200B Device Tree Supplement 20071114" cr
." (c) 2007 Genesi USA, Inc." cr
." http://www.powerdeveloper.org/ for support" cr cr
\ headerless
s" /openprom" find-device
d# 20071114 encode-int s" device-tree-version" property
device-end
s" /builtin/ata" find-device
s" mpc5200-ata" encode-string
s" mpc5200b-ata" encode-string encode+
s" compatible" property
device-end
s" /builtin/sound" find-device
s" mpc5200-psc-ac97" encode-string
s" mpc5200b-psc-ac97" encode-string encode+
s" compatible" property
0x2 encode-int
0x2 encode-int encode+
0x3 encode-int encode+
s" interrupts" property
\ Audio is on PSC2, just for informational purposes
1 encode-int s" cell-index" property
device-end
\ Quick test to see if AC97 is enabled
0xf0000b00 dup dup l@ 0x20 and
0= if
." Enabling AC97" cr
dup l@ 0x20 or
swap l!
else
drop
then
\ SRAM compatibles
s" /builtin/sram" find-device
s" mpc5200-sram" encode-string
s" mpc5200b-sram" encode-string encode+
s" compatible" property
s" sram" device-type \ this is a contentious one
device-end
\ PIC compatibles
s" /builtin/pic" find-device
s" mpc5200-pic" encode-string
s" mpc5200b-pic" encode-string encode+
s" compatible" property
device-end
\ Serial compatibles. Also fix cell-index and port-number as per bindings
s" /builtin/serial" find-device
s" mpc5200-psc-uart" encode-string
s" mpc5200b-psc-uart" encode-string encode+
s" compatible" property
\ Serial port is PSC1 for informational purposes, Linux 0-indexes it
0 encode-int s" cell-index" property
\ Since this is the main, always there, preferred serial port..
0 encode-int s" port-number" property
device-end
\ Ethernet compatibles
s" /builtin/ethernet" find-device
s" mpc5200-fec" encode-string
s" mpc5200b-fec" encode-string encode+
s" compatible" property
device-end
\ BestComm compatibles, interrupt mess
s" /builtin/bestcomm" find-device
s" mpc5200-bestcomm" encode-string
s" mpc5200b-bestcomm" encode-string
encode+
s" compatible" property
\ make 16 interrupt property in a batch. We have to do the first one by
\ hand simply because of the way encode+ works.
0x3 encode-int 0x0 encode-int 0x3 encode-int encode+ encode+
0x10 1 do
0x3 encode-int encode+ i encode-int encode+ 0x3 encode-int encode+
loop
\ now we can store the damn thing
s" interrupts" property
device-end
\ New USB binding - change one of the numbers here to disable it for older kernels
\ as this is a destructive change
0 1 = if
s" /builtin/usb" find-device
s" usb-ohci" device-type
s" " encode-string s" big-endian" property
s" mpc5200-ohci" encode-string
s" mpc5200-usb-ohci" encode-string encode+
s" compatible" property
device-end
then
\ Go into the root node and kill off any mention of CHRP
s" /" find-device
s" efika" device-type
s" Efika 5200B" encode-string s" CODEGEN,board" property
s" Efika 5200B PowerPC System" encode-string s" CODEGEN,description" property
device-end
\ Fix the /builtin device-type for Linux
s" /builtin" find-device
s" soc" device-type
device-end
\ ADDING NEW ENTRIES TO THE DEVICE TREE
\
\ Clock Distribution Module - need this to change baud rates etc. and turn off
\ clocks for power management. Useful little thing. Needs an entry to find the
\ address without guessing (in case they change it in the 512X)
\ Clock Distribution Module
." Adding Clock Distribution Module" cr
s" /builtin" find-device
new-device
" cdm" 2dup device-name device-type
" MPC52xx Clock Distribution Module" encode-string " .description" property
0xf0000200 0x38 reg
" mpc5200-cdm" encode-string
" mpc5200b-cdm" encode-string
encode+
" compatible" property
finish-device
\ GPIO (Simple) Module
." Adding Simple GPIO Module" cr
s" /builtin" find-device
new-device
s" gpio" 2dup device-name device-type
s" MPC52xx Simple GPIO" encode-string s" .description" property
0xf0000b00 0x40 reg
s" mpc5200-gpio" encode-string
s" mpc5200b-gpio" encode-string encode+
s" compatible" property
0x10000000 encode-int s" gpio-mask" property
0x1 encode-int
0x7 encode-int
0x3 encode-int
encode+ encode+
s" interrupts" property
finish-device
\ GPIO (Wakeup) Module
." Adding Wakeup GPIO Module" cr
s" /builtin" find-device
new-device
s" gpio-wkup" 2dup device-name device-type
s" MPC52xx Wakeup GPIO" encode-string s" .description" property
0xf0000c00 0x28 reg
s" mpc5200-gpio-wkup" encode-string
s" mpc5200b-gpio-wkup" encode-string
encode+
s" compatible" property
0x30000000 encode-int s" gpio-mask" property
0x1 encode-int
0x8 encode-int encode+
0x3 encode-int encode+
0x1 encode-int encode+
0x3 encode-int encode+
0x3 encode-int encode+
s" interrupts" property
finish-device
\
\ High resolution (General Purpose and Slice) Timers
\
\ We ignore slice timer 0 since critical interrupt handling in Linux
\ is curiously missing
." Adding Slice Timer 1" cr
s" /builtin" find-device
new-device
s" slt" 2dup device-name device-type
s" MPC52xx Slice Timer 1" encode-string " .description" property
0xf0000710 0x10 reg
s" mpc5200-slt" encode-string
s" mpc5200b-slt" encode-string
encode+
s" compatible" property
1 encode-int " cell-index" property
\ The interrupt listed here is probably wrong
0x1 encode-int
0x0 encode-int encode+
0x3 encode-int encode+
s" interrupts" property
finish-device
\ Add all the GPTs to the device-tree
\ : gpt-add ( gpt-id -- )
\ depth
\ 1 > if
8 0 do i
dup 7 <= if
dup
0x9 +
swap dup
0x10 *
0xf0000600 +
swap dup
." Adding General Purpose Timer " .d cr
s" /builtin" find-device
new-device
s" gpt" 2dup device-name device-type
swap 0x10 reg
encode-int s" cell-index" property
s" MPC52xx General Purpose Timer X"
2dup + 1 - \ get the character position of the X
0x30 i + swap c! \ store ascii character of timer number
encode-string s" .description" property
s" mpc5200-gpt" encode-string
s" mpc5200b-gpt" encode-string encode+
s" fsl,mpc5200-gpt" encode-string encode+
s" fsl,mpc5200b-gpt" encode-string encode+
s" compatible" property
0x1 encode-int
2 pick encode-int encode+
0x3 encode-int encode+
s" interrupts" property
finish-device
then
loop
\ then
\ ;
\ Add watchdog marker to GPT0
s" /builtin/gpt@f0000600" find-device
s" " encode-string s" has-wdt" property
s" " encode-string s" fsl,has-wdt" property
device-end
\ PHY for ethernet. Thanks to Domen Puncer for this.
." Adding Ethernet PHY" cr
s" /builtin" find-device
new-device
1 encode-int s" #address-cells" property
0 encode-int s" #size-cells" property
s" mdio" 2dup device-name device-type
s" mpc5200b-fec-phy" encode-string s" compatible" property
0xf0003000 0x400 reg
0x2 encode-int
0x5 encode-int encode+
0x3 encode-int encode+
s" interrupts" property
new-device
s" ethernet-phy" 2dup device-name device-type
0x10 encode-int s" reg" property
my-self \ save our phandle to stack
ihandle>phandle
finish-device
finish-device
s" /builtin/ethernet" find-device
encode-int \ phy's phandle
s" phy-handle" property
device-end
\
\ HERE BE DRAGONS
\ SDRAM Controller (needed to enter deep sleep and turn off RAM clocks)
." Adding SDRAM Controller" cr
s" /builtin" find-device
new-device
s" sdram" device-name
s" memory-controller" device-type
0xf0000100 0x10 reg
s" MPC52xx SDRAM Memory Controller" encode-string s" .description" property
s" mpc5200b-sdram" encode-string
s" mpc5200-sdram" encode-string encode+
s" compatible" property
finish-device
\ XLB Arbiter (pipeline/bestcomm stuff enabled here)
." Adding XLB Arbiter" cr
s" /builtin" find-device
new-device
s" xlb" 2dup device-name device-type
0xf0001f00 0x100 reg
s" MPC52xx XLB Arbiter" encode-string s" .description" property
s" mpc5200-xlb" encode-string
s" mpc5200b-xlb" encode-string encode+
s" compatible" property
finish-device
\ Optionally uncomment and boot your Linux
\ s" hd:0 vmlinuz console= blah=" $boot

View file

@ -1,3 +0,0 @@
http://penguinppc.org/projects/yaboot/
http://penguinppc.org/~eb/yaboot-archived/
http://penguinppc.org/~eb/yaboot-archived/yaboot.old/

View file

@ -1,2 +0,0 @@
dd346812667ab3818248c9784fe8e38e yaboot-1.3.14.tar.gz
dd8f436cf23d562c8a9f6ff513e1f435 yaboot-1.3.16.tar.gz

View file

@ -1 +0,0 @@
yaboot-1.3.12.tar.gz

View file

@ -1,37 +0,0 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.4 (GNU/Linux)
mQGiBDidlFMRBADZNm3oi7R/lCOxxi5+n1O8A3CXrDKWpkYY0F1TL9dxCLg8q/Lm
uxl0up5i8PjSPBh+h8wQTSB6Yzyv0TMOobXqhKWqD9RauUZW9e3DuMcePldjgHNt
IojqREtcPrLlVzb0yA/BdNFH0JbapzvwR+LWqu6X3ybsIRs/fmy3sanLCwCgoiTg
RvVlbnwyYkJ8cgfFSso1pS0D/iAQqt44GNL+TRSMantYEWQKsBeeYe/9SmJRs+4x
OQlr5Gm8uqaSqjepytfoS435bG7ITJTjquwnKy4eR046KltSsW8vtXwuV8JhZpmm
dXsNrXFalIkToTuTWXEXSuJ/A0ZPnKlGbaVUowKQZlLXCfqBNEWMb+rtpVrosBZr
Odp2A/9ZXOAYP3uC07X8LjX9K6a6EBIlHC/Y65r48RCDLY2N3Surk1PfvpWjKyU+
ZgI7r3QbIQMMZJkC+Ijw0MSLlP5NnZ4HJb90B6I2X0Qv8dLIEBltYlpgGk6/6Na9
r5N6xT87BBfIopab/QJEIGihgJnuo/fRiG1rCGUGztpjgkRsu7QjRXRoYW4gUi4g
QmVuc29uIDxlYkBwZW5ndWlucHBjLm9yZz6IYwQTEQIAGwIXgAUCQBSuywYLCQgH
AwIDFQIDAxYCAQIeAQASB2VHUEcAAQEJECSsexosRHr8/4kAn2FFW2AeANPsSPYZ
JzWgu7MGcc06AKCVKhUz/xlf4x5QpCJZyNJBYIExc7QlRXRoYW4gUi4gQmVuc29u
IDxlcmJlbnNvbkBhbGFza2EubmV0PohmBBMRAgAeAheABgsJCAcDAgMVAgMDFgIB
Ah4BBQJAFK7gAhkBABIHZUdQRwABAQkQJKx7GixEevxFWwCgnxGwZ5JWyAGE7oWo
S4KmYGeErFEAn3Re5SCCw8rpfZaqsSON6QQ5Qf8viEYEEBECAAYFAjkHScMACgkQ
v+EgZWshSJoU4gCfVe42kGRNpXfrVJ9l3yvvtS7wfasAoLMdZqVwnxphz6b4iHK+
KM3fCvfYiEYEEBECAAYFAjm5+d4ACgkQ6yQBygtWtRjpgwCfUEsZm2SKBrPiAltJ
tdFTVEaUrr8An0MmUqN3v6YyfrhVJdr0Oiu/pJApiEYEEBECAAYFAjmZNY8ACgkQ
TCUti147Jd+a7QCfQwK6OMe8b9XOH7O8Vk2CZVIYTogAn3+ABor7DStEYbf+Sfu5
jzllBpq9uQINBDidlZsQCACStwLYiAutk+4HJ3sID4tgdD225V2Hj7dQkiz+Pb55
lk1I3M2CEXkEBDKATRhlGXGDBvriskIRLfD0wmk6fW82Hyp2JfJ/I239L6emZB11
1LYU9BLeXdInntJeSGVpIbcf0cWwhFV15w0aoogVlUV1nDra3VBHYnxEU/vKAQfr
Htc1AFfD+UCRxu8OOvmro/7V1dwUyx0wF+3w475MK9rfXzVINLuwMxSGO2HgorU2
ZfpszTP+XEdoH6DTuQbj4b4mshWUIcwx3e8UznXFy8yfXsN1WhsDmDYBBEfxyiMs
H6zXBzwTBmCIztsKSQQaWk8MPmpaDkq7X0n66hqu0cznAAMFCACMpBzDzTV1ohRk
F9XbQ7TJqBI/5FpiKrzOabBkiRmXvFV1LKSVQ2J1VO27Cbrk0QGGwCT3Xp64vtzL
VR1r0h63FUkiatIAtRqkVsMovIW4tCqJfMz14/P2zIaaCv3y5hxqt1i3oOKFvZQX
SYOjZ07ic3SyowjNbI41s6YxBkzrzuhicSIyyoFL6tjR5GAJiL/yFmqsVgid6NVG
TVKX4HTG8lrwTcdVUWt/kO+VSJSM8Vc6uXD1XxQ7UEGF+GTwyTnyT5BgvjzQc7ER
KAT/z/aN0f368I9v+qTRoDbixzVo4XMXr2E+5kTcibJgLc8E3AzZl2Rml0rq5mGv
z1A8moxxiE4EGBECAAYFAjidlZsAEgkQJKx7GixEevwHZUdQRwABAZMcAKCUUpdW
5pH6MHrz+X+FxuHswIIqIQCgoQQK1sBh8lmIIK4ESlwg/xYoAsk=
=AFhg
-----END PGP PUBLIC KEY BLOCK-----

View file

@ -1,27 +0,0 @@
--- yaboot-1.3.10/ybin/yabootconfig.configfile 2003-06-19 17:33:50.000000000 -0400
+++ yaboot-1.3.10/ybin/yabootconfig 2003-06-19 17:39:26.000000000 -0400
@@ -103,6 +103,7 @@
default: determined from {chroot}/etc/fstab
-b, --boot set bootstrap partition, Example: /dev/hda2
default: first type: Apple_Bootstrap partition
+ -C, --config set config file name (Example: /etc/yaboot.conf)
--kernel-args add an append= line with specified arguments
-q, --quiet don't ask any questions/confirmation
--noinstall don't automatically run mkofboot
@@ -330,6 +331,16 @@
exit 1
fi
;;
+ -C|--config)
+ if [ -n "$2" ]; then
+ CONFIG="$2"
+ shift 2
+ else
+ echo 1>&2 "$PRG: option requires an argument $1"
+ echo 1>&2 "Try \`$PRG --help' for more information."
+ exit 1
+ fi
+ ;;
-q|--quiet)
QUIET=1
shift 1

View file

@ -1,11 +0,0 @@
--- yaboot-1.3.10/second/fs_ext2.c.ext3 2003-04-09 21:38:48.000000000 -0400
+++ yaboot-1.3.10/second/fs_ext2.c 2003-04-09 21:40:32.000000000 -0400
@@ -189,7 +189,7 @@
ofopened = 1;
/* Open the ext2 filesystem */
- result = ext2fs_open (buffer, EXT2_FLAG_RW, 0, 0, linux_io_manager, &fs);
+ result = ext2fs_open (buffer, EXT2_FLAG_DIRTY, 0, 0, linux_io_manager, &fs);
if (result) {
if(result == EXT2_ET_BAD_MAGIC)

View file

@ -1,29 +0,0 @@
--- yaboot-1.3.10/ybin/yabootconfig~ 2004-04-20 16:20:13.619375616 -0400
+++ yaboot-1.3.10/ybin/yabootconfig 2004-04-20 16:32:40.519829488 -0400
@@ -160,6 +160,8 @@
FDISK=mac-fdisk
elif (command -v pdisk > /dev/null 2>&1) ; then
FDISK=pdisk
+ elif (command -v parted > /dev/null 2>&1) ; then
+ FDISK=parted
else
echo 1>&2 "$PRG: Unable to locate mac-fdisk"
return 1
@@ -209,9 +211,16 @@
BOOT="${DISK}${BOOT}"
fi
debug "BOOT after fixup: $BOOT\n"
- else
+ elif [ "$FDISK" = mac-fdisk ] ; then
BOOT="$(v=`$FDISK -l "$DISK" 2>/dev/null | grep '\<Apple_Bootstrap\>'` ; echo ${v%%[ ]*})"
debug "BOOT=$BOOT\n"
+ else
+ BOOT="$(v=`$FDISK "$DISK" print 2>/dev/null | grep 'bootstrap'` ; echo ${v%%[ ]*})"
+ debug "BOOT before fixup: $BOOT\n"
+ if [ -n "$BOOT" ] ; then
+ BOOT="${DISK}${BOOT}"
+ fi
+ debug "BOOT after fixup: $BOOT\n"
fi
if [ -z "$BOOT" ] ; then
echo 1>&2 "$PRG: Unable to locate bootstrap partition on $DISK..."

View file

@ -1,59 +0,0 @@
--- yaboot-1.3.10/first/ofboot.name 2003-04-09 21:29:29.000000000 -0400
+++ yaboot-1.3.10/first/ofboot 2003-04-09 21:29:55.000000000 -0400
@@ -86,6 +86,13 @@
MENU=1
fi
+if [ -f /etc/redhat-release ]; then
+ PRODUCT=`sed "s/ release.*//g" /etc/redhat-release`
+else
+ PRODUCT="PowerPC GNU/Linux"
+fi
+
+
## create the variables.
##
## OSNAME="$1"
@@ -102,7 +109,7 @@
[ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: file1: $5\n"
[ "$COUNT" = "$OSNUM" ] && c="."
BTYA=": boot$1 \" Loading second stage bootstrap...\" .printf 100 ms load-base release-load-area \" ${4}${5}\" \$boot ;"
- MENUYA="\" Press $3 for Red Hat Linux${c-,}\"(0d 0a)\" .printf"
+ MENUYA="\" Press $3 for $PRODUCT${c-,}\"(0d 0a)\" .printf"
GETYA=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
shift 5
COUNT="$(($COUNT + 1))"
@@ -315,7 +322,7 @@
MacRISC MacRISC3 MacRISC4
</COMPATIBLE>
<DESCRIPTION>
-Red Hat Linux First Stage Bootstrap
+$PRODUCT First Stage Bootstrap
</DESCRIPTION>
<BOOT-SCRIPT>
: .printf fb8-write drop ;
@@ -336,7 +343,7 @@
$BGCOLOR to background-color
\" \"(0C)\" .printf
-\" First Stage Red Hat Linux Bootstrap\"(0d 0a)\" .printf
+\" First Stage $PRODUCT Bootstrap\"(0d 0a)\" .printf
\" \"(0d 0a)\" .printf
$MENUOPTS
\" \"(0d 0a)\" .printf
--- yaboot-1.3.10/ybin/yabootconfig.name 2003-04-09 21:24:20.000000000 -0400
+++ yaboot-1.3.10/ybin/yabootconfig 2003-04-09 21:27:07.000000000 -0400
@@ -700,7 +700,12 @@
ENABLENETBOOT="enablenetboot\n"
fi
-MESG='"Welcome to Red Hat Linux!\\nHit <TAB> for boot options.\\n\\n"'
+if [ -f /etc/redhat-release ]; then
+ PRODUCT=`sed "s/ release.*//g" /etc/redhat-release`
+else
+ PRODUCT="PowerPC GNU/Linux"
+fi
+MESG="\"Welcome to $PRODUCT!\\nHit <TAB> for boot options.\\n\\n\""
## generate global section of yaboot.conf
GLOBAL="boot=${BOOT}${DEVICE:-}

View file

@ -1,51 +0,0 @@
--- yaboot-1.3.10/Makefile.sbindir 2003-04-28 18:14:43.000000000 -0400
+++ yaboot-1.3.10/Makefile 2003-04-28 18:15:44.000000000 -0400
@@ -9,6 +9,7 @@
ROOT =
PREFIX = usr/local
MANDIR = man
+SBINDIR= ${PREFIX}/sbin
# command used to get root (needed for tarball creation)
GETROOT = fakeroot
@@ -179,7 +180,7 @@
install: all strip
install -d -m 0755 ${ROOT}/etc/
- install -d -m 0755 ${ROOT}/${PREFIX}/sbin/
+ install -d -m 0755 ${ROOT}/${SBINDIR}
install -d -m 0755 ${ROOT}/${PREFIX}/lib
install -d -m 0755 ${ROOT}/${PREFIX}/lib/yaboot
install -d -m 0755 ${ROOT}/${PREFIX}/${MANDIR}/man5/
@@ -187,11 +188,11 @@
install -m 0644 second/yaboot ${ROOT}/$(PREFIX)/lib/yaboot
install -m 0755 util/addnote ${ROOT}/${PREFIX}/lib/yaboot/addnote
install -m 0644 first/ofboot ${ROOT}/${PREFIX}/lib/yaboot/ofboot
- install -m 0755 ybin/ofpath ${ROOT}/${PREFIX}/sbin/ofpath
- install -m 0755 ybin/ybin ${ROOT}/${PREFIX}/sbin/ybin
- install -m 0755 ybin/yabootconfig ${ROOT}/${PREFIX}/sbin/yabootconfig
- rm -f ${ROOT}/${PREFIX}/sbin/mkofboot
- ln -s ybin ${ROOT}/${PREFIX}/sbin/mkofboot
+ install -m 0755 ybin/ofpath ${ROOT}/${SBINDIR}/ofpath
+ install -m 0755 ybin/ybin ${ROOT}/${SBINDIR}/ybin
+ install -m 0755 ybin/yabootconfig ${ROOT}/${SBINDIR}/yabootconfig
+ rm -f ${ROOT}/${SBINDIR}/mkofboot
+ ln -s ybin ${ROOT}/${SBINDIR}/mkofboot
@gzip -9 man/*.[58]
install -m 0644 man/bootstrap.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/bootstrap.8.gz
install -m 0644 man/mkofboot.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/mkofboot.8.gz
@@ -216,10 +217,10 @@
@echo
deinstall:
- rm -f ${ROOT}/${PREFIX}/sbin/ofpath
- rm -f ${ROOT}/${PREFIX}/sbin/ybin
- rm -f ${ROOT}/${PREFIX}/sbin/yabootconfig
- rm -f ${ROOT}/${PREFIX}/sbin/mkofboot
+ rm -f ${ROOT}/${SBINDIR}/ofpath
+ rm -f ${ROOT}/${SBINDIR}/ybin
+ rm -f ${ROOT}/${SBINDIR}/yabootconfig
+ rm -f ${ROOT}/${SBINDIR}/mkofboot
rm -f ${ROOT}/${PREFIX}/lib/yaboot/yaboot
rm -f ${ROOT}/${PREFIX}/lib/yaboot/ofboot
rm -f ${ROOT}/${PREFIX}/lib/yaboot/addnote

View file

@ -1,32 +0,0 @@
--- yaboot-1.3.13/ybin/ybin~ 2005-08-10 15:09:32.000000000 +0100
+++ yaboot-1.3.13/ybin/ybin 2005-08-11 16:13:36.000000000 +0100
@@ -353,17 +353,19 @@ checkconf()
fi
## make sure $mntpoint is on $boot, this matters to nvram updating.
- if [ "$(v=`df "$mntpoint" 2> /dev/null | grep ^/dev/` ; echo ${v%%[ ]*})" != "$boot" -a -d "$mntpoint" ] ; then
- echo 1>&2 "$PRG: $mntpoint is not located on $boot"
- local CONFERR=1
- ## more then one subdirectory deep is not supported. no sed available on boot floppies ( / -> \ )
- elif [ "$mntpoint" != "$(v=`df "$mntpoint" 2> /dev/null | grep ^/dev/` ; echo ${v##*[ ]})" ] ; then
- echo "$(v=`df "$mntpoint" 2>/dev/null | grep ^/dev/`; m=${v##*[ ]}; echo "${mntpoint##*$m/}")" | grep -q /
- if [ $? = 0 ] ; then
- echo 1>&2 "$PRG:$ERR $mntpoint is more then one subdirectory deep from root of $boot"
+ if [ -n "$magicboot" -o "$nonvram" = 0 ]; then
+ if [ "$(v=`df "$mntpoint" 2> /dev/null | grep ^/dev/` ; echo ${v%%[ ]*})" != "$boot" -a -d "$mntpoint" ] ; then
+ echo 1>&2 "$PRG: $mntpoint is not located on $boot"
local CONFERR=1
- else
- OFDIR="$(v=`df "$mntpoint" 2>/dev/null | grep ^/dev/`; m=${v##*[ ]}; echo "${mntpoint##*$m/}")"
+ ## more than one subdirectory deep is not supported. no sed available on boot floppies ( / -> \ )
+ elif [ "$mntpoint" != "$(v=`df "$mntpoint" 2> /dev/null | grep ^/dev/` ; echo ${v##*[ ]})" ] ; then
+ echo "$(v=`df "$mntpoint" 2>/dev/null | grep ^/dev/`; m=${v##*[ ]}; echo "${mntpoint##*$m/}")" | grep -q /
+ if [ $? = 0 ] ; then
+ echo 1>&2 "$PRG:$ERR $mntpoint is more then one subdirectory deep from root of $boot"
+ local CONFERR=1
+ else
+ OFDIR="$(v=`df "$mntpoint" 2>/dev/null | grep ^/dev/`; m=${v##*[ ]}; echo "${mntpoint##*$m/}")"
+ fi
fi
fi

View file

@ -1,13 +0,0 @@
--- yaboot-1.3.13/ybin/ybin.dontwritehome 2006-08-10 14:33:06.000000000 -0400
+++ yaboot-1.3.13/ybin/ybin 2006-08-10 14:33:15.000000000 -0400
@@ -821,6 +821,10 @@
return 1
fi
+ ## N.B.: SELinux does not like bootloader executables writing to
+ ## root's homedir, so we lie about HOME here.
+ export HOME=/boot
+
## hmount is really more of a way to make sure we have a valid HFS
## filesystem before proceding, and hcopy requires it...
hmount "$boot" > /dev/null

View file

@ -1,15 +0,0 @@
--- yaboot-1.3.13/second/prom.c~ 2003-11-04 09:13:17.000000000 +0000
+++ yaboot-1.3.13/second/prom.c 2005-07-29 13:19:35.000000000 +0100
@@ -547,7 +547,11 @@ prom_sleep (int seconds)
void *
prom_claim (void *virt, unsigned int size, unsigned int align)
{
- return call_prom ("claim", 3, 1, virt, size, align);
+ void *ret = call_prom ("claim", 3, 1, virt, size, align);
+ /* Pegasos II SmartFirmware returns zero for failure, usefully */
+ if (virt && !ret)
+ ret = (void *)-1;
+ return ret;
}
void

View file

@ -1,82 +0,0 @@
--- yaboot-1.3.13/ybin/ybin.ext2 2005-07-29 13:22:40.000000000 +0100
+++ yaboot-1.3.13/ybin/ybin 2005-07-29 13:23:01.000000000 +0100
@@ -75,6 +75,8 @@ fi
usemount=no
if (cat /proc/cpuinfo 2> /dev/null | grep ^machine | grep -q 'CHRP IBM') ; then
fstype=raw
+elif (cat /proc/cpuinfo 2> /dev/null | grep ^machine | grep -q 'Pegasos') ; then
+ fstype=ext2
else
fstype=hfs
fi
@@ -277,13 +279,13 @@ checkconf()
fi
case "$fstype" in
- hfs|msdos|raw)
+ hfs|msdos|raw|ext2)
;;
*)
if [ "$ARGFS" = 1 ] ; then
- echo 1>&2 "$PRG: --filesystem must be either \`hfs', \`msdos', or \`raw'"
+ echo 1>&2 "$PRG: --filesystem must be either \`hfs', \`msdos', \`ext2' or \`raw'"
else
- echo 1>&2 "$PRG:$ERR \`fstype' must be either \`hfs', \`msdos', or \`raw'"
+ echo 1>&2 "$PRG:$ERR \`fstype' must be either \`hfs', \`msdos', \`ext2' or \`raw'"
fi
local CONFERR=1
;;
@@ -942,12 +944,16 @@ util_install()
## used by mnt_install so mntpoint= can be supported in a cleaner way.
mnt()
{
+ local mountopts="rw"
+
## we can even create bootstrap filesystem images directly if you
## ever wanted too.
if [ -f "$boot" ] ; then
- local loop=",loop"
+ mountopts="$mountopts,loop"
+ fi
+ if [ "$fstype" = "msdos" ] ; then
+ mountopts="$mountopts,umask=077"
fi
-
if [ -e "$TMP/bootstrap.$$" ] ; then
echo 1>&2 "$PRG: $TMP/bootstrap.$$ exists, aborting."
return 1
@@ -966,7 +972,7 @@ mnt()
fi
[ "$VERBOSE" = 1 ] && echo "$PRG: Mounting $boot..."
- mount -t "$fstype" -o rw,umask=077$loop "$boot" "$TMP/bootstrap.$$"
+ mount -t "$fstype" -o rw,$mountopts$loop "$boot" "$TMP/bootstrap.$$"
if [ $? != 0 ] ; then
echo 1>&2 "$PRG: An error occured mounting $boot"
return 1
@@ -1252,6 +1258,25 @@ mkoffs()
fi
return 0
;;
+ ext2)
+ if (command -v mkfs.ext2 > /dev/null 2>&1) ; then
+ [ -x `command -v mkfs.ext2` ] || FAIL=1 ; else FAIL=1 ; fi
+ if [ "$FAIL" = 1 ] ; then
+ echo 1>&2 "$PRG: mkfs.ext2 is not installed or cannot be found"
+ return 1
+ fi
+
+ [ "$VERBOSE" = 1 ] && echo "$PRG: Creating ext2 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
+ fi
+ mkfs.ext2 -L bootstrap "$boot" > /dev/null
+ if [ $? != 0 ] ; then
+ echo 1>&2 "$PRG: ext2 filesystem creation failed!"
+ return 1
+ fi
+ return 0
+ ;;
esac
}

View file

@ -1,14 +0,0 @@
--- yaboot-1.3.13/second/prom.c~ 2005-08-10 14:53:10.000000000 +0100
+++ yaboot-1.3.13/second/prom.c 2005-08-10 15:07:16.000000000 +0100
@@ -368,10 +368,8 @@ prom_getchar ()
char c[4];
int a;
- while ((a = (int)call_prom ("read", 3, 1, prom_stdin, c, 4)) == 0)
+ while ((a = (int)call_prom ("read", 3, 1, prom_stdin, c, 4)) <= 0)
;
- if (a == -1)
- prom_abort ("EOF on console\n");
if (a == 3 && c[0] == '\e' && c[1] == '[')
return 0x100 | c[2];
return c[0];

View file

@ -1,249 +0,0 @@
--- yaboot-1.3.13/ybin/yabootconfig.yabootconfig 2005-07-25 16:09:39.000000000 -0400
+++ yaboot-1.3.13/ybin/yabootconfig 2005-07-25 16:25:03.000000000 -0400
@@ -34,6 +34,7 @@
NOINSTALL=0
QUIET=0
DEBUG=0
+LABEL="Linux"
SIGINT="$PRG: Interrupt caught ... exiting"
export LC_COLLATE=C
@@ -319,6 +320,16 @@
exit 1
fi
;;
+ --kernel)
+ if [ -n "$2" ] ; then
+ KERNELIMAGE="$2"
+ shift 2
+ else
+ echo 1>&2 "$PRG: option requires an argument $1"
+ echo 1>&2 "Try \`$PRG --help' for more information."
+ exit 1
+ fi
+ ;;
--kernel-args)
if [ -n "$2" ] ; then
KERNARGS="$2"
@@ -347,10 +358,88 @@
NOINSTALL=1
shift 1
;;
+ --enablecdboot)
+ CDBOOT=1
+ shift 1
+ ;;
+ --enablenetboot)
+ NETBOOT=1
+ shift 1
+ ;;
--debug)
DEBUG=1
shift 1
;;
+ --delay)
+ if [ -n "$2" ] ; then
+ DELAY=$2
+ shift 2
+ else
+ echo 1>&2 "$PRG: option requires an argument $1"
+ echo 1>&2 "Try \`$PRG --help' for more information."
+ exit 1
+ fi
+ ;;
+ --label)
+ if [ -n "$2" ] ; then
+ LABEL=$2
+ shift 2
+ else
+ echo 1>&2 "$PRG: option requires an argument $1"
+ echo 1>&2 "Try \`$PRG --help' for more information."
+ exit 1
+ fi
+ ;;
+ --initrd)
+ if [ -n "$2" ] ; then
+ INITRDPATH=$2
+ shift 2
+ else
+ echo 1>&2 "$PRG: option requires an argument $1"
+ echo 1>&2 "Try \`$PRG --help' for more information."
+ exit 1
+ fi
+ ;;
+ --macosx)
+ if [ -n "$2" ] ; then
+ MACOSXDEV=$2
+ shift 2
+ else
+ echo 1>&2 "$PRG: option requires an argument $1"
+ echo 1>&2 "Try \`$PRG --help' for more information."
+ exit 1
+ fi
+ ;;
+ --macos)
+ if [ -n "$2" ] ; then
+ MACOSDEV=$2
+ shift 2
+ else
+ echo 1>&2 "$PRG: option requires an argument $1"
+ echo 1>&2 "Try \`$PRG --help' for more information."
+ exit 1
+ fi
+ ;;
+ --darwin)
+ if [ -n "$2" ] ; then
+ DARWINDEV=$2
+ shift 2
+ else
+ echo 1>&2 "$PRG: option requires an argument $1"
+ echo 1>&2 "Try \`$PRG --help' for more information."
+ exit 1
+ fi
+ ;;
+ --defaultos)
+ if [ -n "$2" ] ; then
+ DEFOS=$2
+ shift 2
+ else
+ echo 1>&2 "$PRG: option requires an argument $1"
+ echo 1>&2 "Try \`$PRG --help' for more information."
+ exit 1
+ fi
+ ;;
"")
break
;;
@@ -474,7 +563,7 @@
READLINKKV=`readlink /usr/src/linux`
## find the kernel in the usual places and (if not --quiet) ask the
## user if we cannot find one.
-for k in "vmlinux" "vmlinux-`uname -r`" "vmlinux-`uname -r`" "$READLINKKV" ; do
+for k in "${KERNELIMAGE}" "vmlinux" "vmlinux-`uname -r`" "vmlinux-`uname -r`" "$READLINKKV" ; do
if [ -f "${CHROOT}${k}" ] ; then
KERNEL="${CHROOT}${k}"
break;
@@ -721,6 +812,36 @@
HEADER="## see also: /usr/share/doc/yaboot/examples for example configurations.\n"
fi
+## find the kernel in the usual places and (if not --quiet) ask the
+## user if we cannot find one.
+if [ -f "${CHROOT}${INITRDPATH}" ] ; then
+ REALINITRD="${CHROOT}${INITRDPATH}"
+
+ ## if there is a separate /boot partition we must strip off the /boot
+ ## mountpoint or else yaboot will not find the kernel.
+ if [ "$KERNDIR" != "$CHROOT" ] ; then
+ INITRD="${REALINITRD##*$KERNDIR}"
+ else
+ INITRD="$REALINITRD"
+ fi
+
+ ## fix chrooted path
+ if [ "$CHROOT" != / ] ; then
+ INITRD="${INITRD##*$CHROOT}"
+ fi
+
+ ## fix relative path (caused by chroot path fix)
+ case "$INITRD" in
+ /*)
+ true
+ ;;
+ *)
+ INITRD="/${INITRD}"
+ ;;
+ esac
+ INITRDLINE="\tinitrd=$INITRD\n"
+fi
+
## setup append line
if [ -n "$KERNARGS" ] ; then
APPEND="\tappend=\"${KERNARGS}\"\n"
@@ -731,24 +850,64 @@
INITRDIMGS="\tinitrd=$INITRDIMG\n\tinitrd-size=8192\n"
fi
+## setup default OS bits for ybin
+if [ -n "$DEFOS" ] ; then
+ if [ "$DEFOS" = "macosx" ] ; then
+ DEFAULTOS="defaultos=${DEFOS}\n"
+ elif [ "$DEFOS" = "macos" ] ; then
+ DEFAULTOS="defaultos=${DEFOS}\n"
+ elif [ "$DEFOS" = "darwin" ] ; then
+ DEFAULTOS="defaultos=${DEFOS}\n"
+ else
+ DEFAULTOS="defaultos=linux\n"
+ fi
+else
+ DEFAULTOS="defaultos=linux\n"
+fi
+if [ -n "$DELAY" ] ; then
+ MENUDELAY="delay=${DELAY}\n"
+fi
+
+## setup enabling cd or network boot from OF
+if [ -n "$CDBOOT" ] ; then
+ ENABLECDBOOT="enablecdboot\n"
+fi
+if [ -n "$NETBOOT" ] ; then
+ ENABLENETBOOT="enablenetboot\n"
+fi
+
+MESG='"Welcome to Red Hat Linux!\\nHit <TAB> for boot options.\\n\\n"'
+
## generate global section of yaboot.conf
-GLOBAL="## yaboot.conf generated by $PRG $VERSION
-##
-## run: \"man yaboot.conf\" for details. Do not make changes until you have!!
-${HEADER}##
-## For a dual-boot menu, add one or more of:
-## bsd=/dev/hdaX, macos=/dev/hdaY, macosx=/dev/hdaZ\n
-boot=${BOOT}${DEVICE:-}
+GLOBAL="boot=${BOOT}${DEVICE:-}
+init-message=$MESG
partition=$PARTITION
-root=$ROOT
timeout=30
-install=${INSTALL}${OFBOOT:-}\n"
+install=${INSTALL}${OFBOOT:-}
+default=$LABEL
+${DEFAULTOS:-}${MENUDELAY:-}${ENABLECDBOOT:-}${ENABLENETBOOT:-}"
## generate image= section
IMAGES="
image=$IMAGE
-\tlabel=Linux
-\tread-only\n${APPEND:-}${INITRDIMGS:-}"
+\tlabel=$LABEL
+\troot=$ROOT
+\tread-only\n
+${INITRDLINE-}${APPEND:-}"
+
+if [ -n "$MACOSXDEV" ] ; then
+ MACOSX="macosx=${MACOSXDEV}\n"
+fi
+
+if [ -n "$MACOSDEV" ] ; then
+ MACOS="macos=${MACOSDEV}\n"
+fi
+
+if [ -n "$DARWINDEV" ] ; then
+ DARWIN="darwin=${DARWINDEV}\n"
+fi
+
+OTHER="${MACOSX}${MACOS}${DARWIN}${BSD}"
## safely create a tmp file then move it into place after we are sure
## it was written.
@@ -767,7 +928,9 @@
exit 1
fi
-$PRINTF "${GLOBAL}${IMAGES}" > "$TMPCONF"
+printf "${GLOBAL}
+${IMAGES}
+${OTHER}" > "$TMPCONF"
if [ $? != 0 ] ; then
echo 1>&2 "$PRG: Unable to write temporary file ${TMPCONF}, aborting..."
exit 1

View file

@ -1,99 +0,0 @@
Index: yaboot-1.3.14-30/include/prom.h
===================================================================
--- yaboot-1.3.14-30.orig/include/prom.h 2010-05-25 14:37:24.309622517 +1000
+++ yaboot-1.3.14-30/include/prom.h 2010-05-25 14:37:27.803373148 +1000
@@ -158,5 +158,6 @@
struct bootp_packet * prom_get_netinfo (void);
char * prom_get_mac (struct bootp_packet * packet);
char * prom_get_ip (struct bootp_packet * packet);
+void *prom_rma_size(void);
#endif
Index: yaboot-1.3.14-30/second/prom.c
===================================================================
--- yaboot-1.3.14-30.orig/second/prom.c 2010-05-25 14:37:24.309622517 +1000
+++ yaboot-1.3.14-30/second/prom.c 2010-05-25 14:37:27.805375106 +1000
@@ -536,7 +536,16 @@
prom_claim_chunk(void *virt, unsigned int size, unsigned int align)
{
void *found, *addr;
- for(addr=virt; addr <= (void*)PROM_CLAIM_MAX_ADDR;
+ static void *claim_max_addr = -1;
+
+ if (claim_max_addr == (void*)-1) {
+ claim_max_addr = prom_rma_size();
+ if (claim_max_addr < PROM_CLAIM_MAX_ADDR)
+ claim_max_addr = PROM_CLAIM_MAX_ADDR;
+ DEBUG_F("Setting claim_max_addr to 0x%x\n", (int)claim_max_addr);
+ }
+
+ for(addr=virt; addr <= (void*)claim_max_addr;
addr+=(0x100000/sizeof(addr))) {
found = prom_claim(addr, size, 0);
if (found != (void *)-1) {
@@ -739,6 +748,32 @@
return conf_path;
}
+void *prom_rma_size(void)
+{
+ int rc;
+ ihandle n;
+ u64 *start, *end;
+ unsigned char buf[16]; /* This will store 2 64-bit values */
+
+ DEBUG_ENTER;
+
+ n = prom_finddevice("/memory@0");
+ DEBUG_F("n = %x\n", (int)n);
+ rc = prom_getprop(n, "reg", &buf, 16);
+ DEBUG_F("rc = %d\n", rc);
+
+ /* If the getprop() failed fill the buffer with some known value */
+ if (rc == -1)
+ memset(&buf[0], 0xff, 16);
+
+ start = (u64*)&buf[0];
+ end = (u64*)&buf[8];
+ DEBUG_F("start=0x%Lx, end=0x%Lx\n", *start, *end);
+
+ DEBUG_LEAVE(0);
+ return (void*)*end;
+}
+
/*
* Local variables:
* c-file-style: "k&r"
Index: yaboot-1.3.14-30/second/yaboot.c
===================================================================
--- yaboot-1.3.14-30.orig/second/yaboot.c 2010-05-25 14:37:20.729370528 +1000
+++ yaboot-1.3.14-30/second/yaboot.c 2010-05-25 14:37:27.810374623 +1000
@@ -121,6 +121,7 @@
struct boot_fspec_t boot;
int _machine = _MACH_Pmac;
int flat_vmlinux;
+u64 rma_size = 0;
#ifdef CONFIG_COLOR_TEXT
@@ -239,6 +240,9 @@
}
}
+ rma_size = (u64)prom_rma_size();
+ prom_printf("System has %Ld Mbytes in RMA\n", rma_size >> 20);
+
DEBUG_F("Running on _machine = %d\n", _machine);
DEBUG_SLEEP;
@@ -1258,8 +1262,8 @@
(unsigned long)(initrd_size));
/* Check to see if we're near the top of the RMA */
- /* Cheat and assume the RMA == 128Mb */
- if (initrd_end > 0x7000000) {
+ /* Cheat and assume RTAS will be ~16Mb */
+ if (initrd_end > rma_size - 0x1000000) {
unsigned long new_initrd_end, free_len;
unsigned long initrd_claim_len = initrd_end - (unsigned long)initrd_base;

View file

@ -1,726 +0,0 @@
diff --git a/include/debug.h b/include/debug.h
index 47a9cce..dcac25a 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -32,8 +32,8 @@
prom_printf( fmt, ## args );\
}
# define DEBUG_OPEN DEBUG_F( "dev=%s, part=0x%p (%d), file_name=%s\n",\
- dev_name, part, part ? part->part_number : -1,\
- file_name)
+ fspec->dev, part, part ? part->part_number : -1,\
+ fspec->file)
# define DEBUG_SLEEP prom_sleep(3)
#else
#define DEBUG_ENTER
diff --git a/include/file.h b/include/file.h
index b6b9fe5..ca76a52 100644
--- a/include/file.h
+++ b/include/file.h
@@ -39,7 +39,13 @@ struct boot_file_t;
struct boot_fspec_t {
char* dev; /* OF device path */
int part; /* Partition number or -1 */
+ char* siaddr; /* Server address */
char* file; /* File path */
+ char* ciaddr; /* Client address */
+ char* giaddr; /* Gateway address */
+ char* bootp_retries; /* Bootp retries */
+ char* tftp_retries; /* TFTP retries */
+ char* addl_params; /* copy all additional parameters */
};
struct boot_file_t {
@@ -63,7 +69,7 @@ struct boot_file_t {
};
extern int
-open_file(const struct boot_fspec_t* spec,
+open_file(struct boot_fspec_t* spec,
struct boot_file_t* file);
extern int
diff --git a/include/fs.h b/include/fs.h
index d960fea..1ff7986 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -27,14 +27,14 @@
#include "file.h"
int fserrorno;
+struct boot_fspec_t;
struct fs_t {
const char* name;
int (*open)( struct boot_file_t* file,
- const char* dev_name,
struct partition_t* part,
- const char* file_name);
+ struct boot_fspec_t* fspec);
int (*read)( struct boot_file_t* file,
unsigned int size,
@@ -49,7 +49,7 @@ struct fs_t {
extern const struct fs_t *fs_of;
extern const struct fs_t *fs_of_netboot;
-const struct fs_t *fs_open(struct boot_file_t *file, const char *dev_name,
- struct partition_t *part, const char *file_name);
+const struct fs_t *fs_open(struct boot_file_t *file,
+ struct partition_t *part, struct boot_fspec_t *fspec);
#endif
diff --git a/second/file.c b/second/file.c
index 4054dd1..e429272 100644
--- a/second/file.c
+++ b/second/file.c
@@ -38,19 +38,56 @@
extern char bootdevice[];
-static char *netdev_path_to_filename(const char *path)
+/* Convert __u32 into std, dotted quad string, leaks like a sive :( */
+static char *
+ipv4_to_str(__u32 ip)
{
- char *tmp, *args, *filename;
- size_t len;
+ char *buf = malloc(sizeof("000.000.000.000"));
- DEBUG_F("path = %s\n", path);
+ sprintf(buf,"%u.%u.%u.%u",
+ (ip & 0xff000000) >> 24, (ip & 0x00ff0000) >> 16,
+ (ip & 0x0000ff00) >> 8, (ip & 0x000000ff));
- if (!path)
+ return buf;
+}
+
+/*
+ * Copy the string from source to dest till newline or comma(,) is seen
+ * in the source.
+ * Move source and dest pointers respectively.
+ * Returns pointer to the start of the string that has just been copied.
+ */
+static char *
+scopy(char **dest, char **source)
+{
+ char *ret = *dest;
+
+ if (!**source)
return NULL;
- args = strrchr(path, ':');
+ while (**source != ',' && **source != '\0')
+ *(*dest)++ = *(*source)++;
+ if (**source != '\0')
+ *(*source)++;
+ **dest = '\0';
+ *(*dest)++;
+ return ret;
+}
+
+/*
+ * Extract all the ipv4 arguments from the bootpath provided and fill result
+ * Returns 1 on success, 0 on failure.
+ */
+static int
+extract_ipv4_args(char *imagepath, struct boot_fspec_t *result)
+{
+ char *tmp, *args, *str, *start;
+
+ args = strrchr(imagepath, ':');
if (!args)
- return NULL;
+ return 1;
+
+ start = args; /* used to see if we read any optional parameters */
/* The obp-tftp device arguments should be at the end of
* the argument list. Skip over any extra arguments (promiscuous,
@@ -77,46 +114,110 @@ static char *netdev_path_to_filename(const char *path)
if (tmp && tmp > args)
args = tmp + strlen("rarp");
- args = strchr(args, ',');
+ if (args != start) /* we read some parameters, so go past the next comma(,) */
+ args = strchr(args, ',');
if (!args)
- return NULL;
+ return 1;
+
+ str = malloc(strlen(args) + 1); /*long enough to hold all strings */
+ if (!str)
+ return 0;
- tmp = args;
- tmp--;
- /* If the preceding character is ':' then there were no
- * non-obp-tftp arguments and we know we're right up to the
- * filename. Otherwise, we must advance args once more.
+ if (args[-1] != ':')
+ args++; /* If comma(,) is not immediately followed by ':' then go past the , */
+
+ /*
+ * read the arguments in order: siaddr,filename,ciaddr,giaddr,
+ * bootp-retries,tftp-retries,addl_prameters
*/
- args++;
- if (*tmp != ':') {
- args = strchr(args, ',');
- if (!args)
- return NULL;
- args++;
+ result->siaddr = scopy(&str, &args);
+ result->file = scopy(&str, &args);
+ result->ciaddr = scopy(&str, &args);
+ result->giaddr = scopy(&str, &args);
+ result->bootp_retries = scopy(&str, &args);
+ result->tftp_retries = scopy(&str, &args);
+ if (*args) {
+ result->addl_params = strdup(args);
+ if (!result->addl_params)
+ return 0;
}
+ return 1;
+}
- /* filename may be empty; e.g. enet:192.168.1.1,,192.168.1.2 */
- if (*args == ',') {
- DEBUG_F("null filename\n");
- return NULL;
+/*
+ * Check netinfo for ipv4 parameters and add them to the fspec iff the
+ * fspec has no existing value.
+ *
+ * Returns 1 on success, 0 on failure.
+ */
+static int
+extract_netinfo_args(struct boot_fspec_t *result)
+{
+ struct bootp_packet *packet;
+
+ /* Check to see if we can get the [scyg]iaddr fields from netinfo */
+ packet = prom_get_netinfo();
+ if (packet == NULL)
+ return 0;
+
+ DEBUG_F("We have a boot packet\n");
+ DEBUG_F(" siaddr = <%x>\n", packet->siaddr);
+ DEBUG_F(" ciaddr = <%x>\n", packet->ciaddr);
+ DEBUG_F(" yiaddr = <%x>\n", packet->yiaddr);
+ DEBUG_F(" giaddr = <%x>\n", packet->giaddr);
+
+ /* Try to fallback to yiaddr if ciaddr is empty. Broken? */
+ if (packet->ciaddr == 0 && packet->yiaddr != 0)
+ packet->ciaddr = packet->yiaddr;
+
+ if ((result->siaddr == NULL || *(result->siaddr) == NULL)
+ && packet->siaddr != 0)
+ result->siaddr = ipv4_to_str(packet->siaddr);
+ if ((result->ciaddr == NULL || *(result->ciaddr) == NULL)
+ && packet->ciaddr != 0)
+ result->ciaddr = ipv4_to_str(packet->ciaddr);
+ if ((result->giaddr == NULL || *(result->giaddr) == NULL)
+ && packet->giaddr != 0)
+ result->giaddr = ipv4_to_str(packet->giaddr);
+
+ /* FIXME: Yck! if we /still/ do not have a gateway then "cheat" and use
+ * the server. This will be okay if the client and server are on
+ * the same IP network, if not then lets hope the server does ICMP
+ * redirections */
+ if (result->giaddr == NULL) {
+ result->giaddr = ipv4_to_str(packet->siaddr);
+ DEBUG_F("Forcing giaddr to siaddr <%s>\n", result->giaddr);
}
- /* Now see whether there are more args following the filename. */
- tmp = strchr(args, ',');
- if (!tmp)
- len = strlen(args) + 1;
- else
- len = tmp - args + 1;
+ return 1;
+}
- filename = malloc(len);
- if (!filename)
- return NULL;
+/*
+ * Extract all the arguments provided in the imagepath and fill it in result.
+ * Returns 1 on success, 0 on failure.
+ */
+static int
+extract_netboot_args(char *imagepath, struct boot_fspec_t *result)
+{
+ int ret;
- strncpy(filename, args, len);
- filename[len - 1] = '\0';
+ DEBUG_F("imagepath = %s\n", imagepath);
- DEBUG_F("filename = %s\n", filename);
- return filename;
+ if (!imagepath)
+ return 1;
+
+ ret = extract_ipv4_args(imagepath, result);
+ ret |= extract_netinfo_args(result);
+
+ DEBUG_F("siaddr = <%s>\n", result->siaddr);
+ DEBUG_F("file = <%s>\n", result->file);
+ DEBUG_F("ciaddr = <%s>\n", result->ciaddr);
+ DEBUG_F("giaddr = <%s>\n", result->giaddr);
+ DEBUG_F("bootp_retries = <%s>\n", result->bootp_retries);
+ DEBUG_F("tftp_retries = <%s>\n", result->tftp_retries);
+ DEBUG_F("addl_params = <%s>\n", result->addl_params);
+
+ return ret;
}
static char *netdev_path_to_dev(const char *path)
@@ -163,6 +264,10 @@ static char *netdev_path_to_dev(const char *path)
- enet:,/tftpboot/vmlinux
- enet:bootp
- enet:0
+ - arguments for obp-tftp open as specified in section 4.1 of
+ http://playground.sun.com/1275/practice/obp-tftp/tftp1_0.pdf
+ [bootp,]siaddr,filename,ciaddr,giaddr,bootp-retries,tftp-retries
+ ex: enet:bootp,10.0.0.11,bootme,10.0.0.12,10.0.0.1,5,5
Supported only if defdevice == NULL
- disc
- any other device path lacking a :
@@ -179,6 +284,9 @@ parse_device_path(char *imagepath, char *defdevice, int defpart,
char *defdev = NULL;
int device_kind = -1;
+ DEBUG_F("imagepath = %s; defdevice %s; defpart %d, deffile %s\n",
+ imagepath, defdevice, defpart, deffile);
+
result->dev = NULL;
result->part = -1;
result->file = NULL;
@@ -247,10 +355,15 @@ parse_device_path(char *imagepath, char *defdevice, int defpart,
}
if (device_kind == FILE_DEVICE_NET) {
- if (strchr(ipath, ':'))
- result->file = netdev_path_to_filename(ipath);
- else
+ if (strchr(ipath, ':')) {
+ if (extract_netboot_args(ipath, result) == 0)
+ return 0;
+ } else {
+ /* If we didn't get a ':' then look only in netinfo */
+ if (extract_netinfo_args(result) == 0)
+ return 0;
result->file = strdup(ipath);
+ }
if (!defdev)
result->dev = netdev_path_to_dev(ipath);
@@ -287,15 +400,14 @@ parse_device_path(char *imagepath, char *defdevice, int defpart,
static int
file_block_open( struct boot_file_t* file,
- const char* dev_name,
- const char* file_name,
+ struct boot_fspec_t* fspec,
int partition)
{
struct partition_t* parts;
struct partition_t* p;
struct partition_t* found;
- parts = partitions_lookup(dev_name);
+ parts = partitions_lookup(fspec->dev);
found = NULL;
#if DEBUG
@@ -308,7 +420,7 @@ file_block_open( struct boot_file_t* file,
DEBUG_F("number: %02d, start: 0x%08lx, length: 0x%08lx\n",
p->part_number, p->part_start, p->part_size );
if (partition == -1) {
- file->fs = fs_open( file, dev_name, p, file_name );
+ file->fs = fs_open( file, p, fspec );
if (file->fs == NULL || fserrorno != FILE_ERR_OK)
continue;
else {
@@ -328,7 +440,7 @@ file_block_open( struct boot_file_t* file,
* cases, let OF figure out a default partition.
*/
DEBUG_F( "Using OF defaults.. (found = %p)\n", found );
- file->fs = fs_open( file, dev_name, found, file_name );
+ file->fs = fs_open( file, found, fspec );
done:
if (parts)
@@ -338,12 +450,10 @@ done:
}
static int
-file_net_open( struct boot_file_t* file,
- const char* dev_name,
- const char* file_name)
+file_net_open(struct boot_file_t* file, struct boot_fspec_t *fspec)
{
file->fs = fs_of_netboot;
- return fs_of_netboot->open(file, dev_name, NULL, file_name);
+ return fs_of_netboot->open(file, NULL, fspec);
}
static int
@@ -380,7 +490,7 @@ static struct fs_t fs_default =
};
-int open_file(const struct boot_fspec_t* spec, struct boot_file_t* file)
+int open_file(struct boot_fspec_t* spec, struct boot_file_t* file)
{
int result;
@@ -399,10 +509,10 @@ int open_file(const struct boot_fspec_t* spec, struct boot_file_t* file)
switch(file->device_kind) {
case FILE_DEVICE_BLOCK:
DEBUG_F("device is a block device\n");
- return file_block_open(file, spec->dev, spec->file, spec->part);
+ return file_block_open(file, spec, spec->part);
case FILE_DEVICE_NET:
DEBUG_F("device is a network device\n");
- return file_net_open(file, spec->dev, spec->file);
+ return file_net_open(file, spec);
}
return 0;
}
diff --git a/second/fs.c b/second/fs.c
index 2ae7066..b748bed 100644
--- a/second/fs.c
+++ b/second/fs.c
@@ -56,12 +56,12 @@ const struct fs_t *fs_of = &of_filesystem; /* needed by ISO9660 */
const struct fs_t *fs_of_netboot = &of_net_filesystem; /* needed by file.c */
const struct fs_t *
-fs_open(struct boot_file_t *file, const char *dev_name,
- struct partition_t *part, const char *file_name)
+fs_open(struct boot_file_t *file,
+ struct partition_t *part, struct boot_fspec_t *fspec)
{
const struct fs_t **fs;
for (fs = block_filesystems; *fs; fs++)
- if ((fserrorno = (*fs)->open(file, dev_name, part, file_name)) != FILE_ERR_BAD_FSYS)
+ if ((fserrorno = (*fs)->open(file, part, fspec)) != FILE_ERR_BAD_FSYS)
break;
return *fs;
diff --git a/second/fs_ext2.c b/second/fs_ext2.c
index 67571f2..d24450d 100644
--- a/second/fs_ext2.c
+++ b/second/fs_ext2.c
@@ -46,9 +46,8 @@ typedef int FILE;
#include "ext2fs/ext2fs.h"
static int ext2_open( struct boot_file_t* file,
- const char* dev_name,
struct partition_t* part,
- const char* file_name);
+ struct boot_fspec_t* fspec);
static int ext2_read( struct boot_file_t* file,
unsigned int size,
void* buffer);
@@ -123,14 +122,15 @@ void com_err (const char *a, long i, const char *fmt,...)
static int
ext2_open( struct boot_file_t* file,
- const char* dev_name,
struct partition_t* part,
- const char* file_name)
+ struct boot_fspec_t* fspec)
{
int result = 0;
int error = FILE_ERR_NOTFOUND;
static char buffer[1024];
int ofopened = 0;
+ char *dev_name = fspec->dev;
+ char *file_name = fspec->file;
DEBUG_ENTER;
DEBUG_OPEN;
diff --git a/second/fs_iso.c b/second/fs_iso.c
index 303790f..33d43b3 100644
--- a/second/fs_iso.c
+++ b/second/fs_iso.c
@@ -29,9 +29,8 @@
#include "errors.h"
static int iso_open( struct boot_file_t* file,
- const char* dev_name,
struct partition_t* part,
- const char* file_name);
+ struct boot_fspec_t* fspec);
static int iso_read( struct boot_file_t* file,
unsigned int size,
void* buffer);
@@ -50,9 +49,8 @@ struct fs_t iso_filesystem =
static int
iso_open( struct boot_file_t* file,
- const char* dev_name,
struct partition_t* part,
- const char* file_name)
+ struct boot_fspec_t* fspec)
{
return FILE_ERR_BAD_FSYS;
}
diff --git a/second/fs_of.c b/second/fs_of.c
index 95c131d..5c7dd9b 100644
--- a/second/fs_of.c
+++ b/second/fs_of.c
@@ -45,17 +45,17 @@
#include "debug.h"
#define LOAD_BUFFER_POS 0x1000000
-#define LOAD_BUFFER_SIZE 0x1000000
+#define LOAD_BUFFER_SIZE 0x2000000
-static int of_open(struct boot_file_t* file, const char* dev_name,
- struct partition_t* part, const char* file_name);
+static int of_open(struct boot_file_t* file,
+ struct partition_t* part, struct boot_fspec_t* fspec);
static int of_read(struct boot_file_t* file, unsigned int size, void* buffer);
static int of_seek(struct boot_file_t* file, unsigned int newpos);
static int of_close(struct boot_file_t* file);
-static int of_net_open(struct boot_file_t* file, const char* dev_name,
- struct partition_t* part, const char* file_name);
+static int of_net_open(struct boot_file_t* file,
+ struct partition_t* part, struct boot_fspec_t* fspec);
static int of_net_read(struct boot_file_t* file, unsigned int size, void* buffer);
static int of_net_seek(struct boot_file_t* file, unsigned int newpos);
@@ -79,8 +79,8 @@ struct fs_t of_net_filesystem =
};
static int
-of_open(struct boot_file_t* file, const char* dev_name,
- struct partition_t* part, const char* file_name)
+of_open(struct boot_file_t* file,
+ struct partition_t* part, struct boot_fspec_t* fspec)
{
static char buffer[1024];
char *filename;
@@ -89,7 +89,7 @@ of_open(struct boot_file_t* file, const char* dev_name,
DEBUG_ENTER;
DEBUG_OPEN;
- strncpy(buffer, dev_name, 768);
+ strncpy(buffer, fspec->dev, 768);
strcat(buffer, ":");
if (part) {
if (part->sys_ind == LINUX_RAID) {
@@ -101,10 +101,10 @@ of_open(struct boot_file_t* file, const char* dev_name,
sprintf(pn, "%02d", part->part_number);
strcat(buffer, pn);
}
- if (file_name && strlen(file_name)) {
+ if (fspec->file && strlen(fspec->file)) {
if (part)
strcat(buffer, ",");
- filename = strdup(file_name);
+ filename = strdup(fspec->file);
for (p = filename; *p; p++)
if (*p == '/')
*p = '\\';
@@ -131,25 +131,47 @@ of_open(struct boot_file_t* file, const char* dev_name,
}
static int
-of_net_open(struct boot_file_t* file, const char* dev_name,
- struct partition_t* part, const char* file_name)
+of_net_open(struct boot_file_t* file,
+ struct partition_t* part, struct boot_fspec_t* fspec)
{
static char buffer[1024];
- char *filename;
+ char *filename = NULL;
char *p;
DEBUG_ENTER;
DEBUG_OPEN;
- strncpy(buffer, dev_name, 768);
- if (file_name && strlen(file_name)) {
- strcat(buffer, ",");
- filename = strdup(file_name);
+ if (fspec->file && strlen(fspec->file)) {
+ filename = strdup(fspec->file);
for (p = filename; *p; p++)
if (*p == '/')
*p = '\\';
- strcat(buffer, filename);
- free(filename);
+ }
+
+ DEBUG_F("siaddr <%s>; filename <%s>; ciaddr <%s>; giaddr <%s>;\n",
+ fspec->siaddr, filename, fspec->ciaddr, fspec->giaddr);
+ strncpy(buffer, fspec->dev, 768);
+ /* If we didn't get a ':' include one */
+ if (fspec->dev[strlen(fspec->dev)-1] != ':')
+ strcat(buffer, ":");
+ strcat(buffer, fspec->siaddr);
+ strcat(buffer, ",");
+ strcat(buffer, filename);
+ strcat(buffer, ",");
+ strcat(buffer, fspec->ciaddr);
+ strcat(buffer, ",");
+ strcat(buffer, fspec->giaddr);
+
+ /* If /packages/cas exists the we have a "new skool" tftp */
+ if (prom_finddevice("/packages/cas") != PROM_INVALID_HANDLE) {
+ strcat(buffer, ",");
+ strcat(buffer, fspec->bootp_retries);
+ strcat(buffer, ",");
+ strcat(buffer, fspec->tftp_retries);
+ strcat(buffer, ",");
+ strcat(buffer, fspec->addl_params);
+ } else {
+ DEBUG_F("No \"/packages/cas\" using simple args\n")
}
DEBUG_F("Opening: \"%s\"\n", buffer);
diff --git a/second/fs_reiserfs.c b/second/fs_reiserfs.c
index 238f523..4b83a7a 100644
--- a/second/fs_reiserfs.c
+++ b/second/fs_reiserfs.c
@@ -33,8 +33,8 @@
#include "reiserfs/reiserfs.h"
/* Exported in struct fs_t */
-static int reiserfs_open( struct boot_file_t *file, const char *dev_name,
- struct partition_t *part, const char *file_name );
+static int reiserfs_open( struct boot_file_t *file, struct partition_t *part,
+ struct boot_fspec_t *fspec);
static int reiserfs_read( struct boot_file_t *file, unsigned int size,
void *buffer );
@@ -63,10 +63,12 @@ int errnum;
static int
-reiserfs_open( struct boot_file_t *file, const char *dev_name,
- struct partition_t *part, const char *file_name )
+reiserfs_open( struct boot_file_t *file, struct partition_t *part,
+ struct boot_fspec_t *fspec)
{
static char buffer[1024];
+ char *dev_name = fspec->dev;
+ char *file_name = fspec->file;
DEBUG_ENTER;
DEBUG_OPEN;
@@ -74,7 +76,7 @@ reiserfs_open( struct boot_file_t *file, const char *dev_name,
memset( INFO, 0, sizeof(struct reiserfs_state) );
INFO->file = file;
- if (part)
+ if (fspec->part)
{
DEBUG_F( "Determining offset for partition %d\n", part->part_number );
INFO->partition_offset = ((uint64_t)part->part_start) * part->blocksize;
diff --git a/second/fs_xfs.c b/second/fs_xfs.c
index 04d6cf3..e27d857 100644
--- a/second/fs_xfs.c
+++ b/second/fs_xfs.c
@@ -39,8 +39,8 @@ int xfs_read_data (char *buf, int len);
int xfs_dir (char *dirname);
/* Exported in struct fs_t */
-static int xfs_open(struct boot_file_t *file, const char *dev_name,
- struct partition_t *part, const char *file_name);
+static int xfs_open(struct boot_file_t *file,
+ struct partition_t *part, struct boot_fspec_t *fspec);
static int xfs_read(struct boot_file_t *file, unsigned int size, void *buffer);
static int xfs_seek(struct boot_file_t *file, unsigned int newpos);
static int xfs_close(struct boot_file_t *file);
@@ -59,8 +59,8 @@ uint64_t partition_offset;
int errnum;
static int
-xfs_open(struct boot_file_t *file, const char *dev_name,
- struct partition_t *part, const char *file_name)
+xfs_open(struct boot_file_t *file,
+ struct partition_t *part, struct boot_fspec_t *fspec)
{
static char buffer[1024];
@@ -78,11 +78,11 @@ xfs_open(struct boot_file_t *file, const char *dev_name,
else
partition_offset = 0;
- strncpy(buffer, dev_name, 1020);
+ strncpy(buffer, fspec->dev, 1020);
if (_machine != _MACH_bplan)
strcat(buffer, ":0"); /* 0 is full disk in (non-buggy) OF */
DEBUG_F("Trying to open dev_name=%s; filename=%s; partition offset=%Lu\n",
- buffer, file_name, partition_offset);
+ buffer, fspec->file, partition_offset);
file->of_device = prom_open(buffer);
if (file->of_device == PROM_INVALID_HANDLE || file->of_device == NULL)
@@ -105,8 +105,8 @@ xfs_open(struct boot_file_t *file, const char *dev_name,
return FILE_ERR_BAD_FSYS;
}
- DEBUG_F("Attempting to open %s\n", file_name);
- strcpy(buffer, file_name); /* xfs_dir modifies argument */
+ DEBUG_F("Attempting to open %s\n", fspec->file);
+ strcpy(buffer, fspec->file); /* xfs_dir modifies argument */
if(!xfs_dir(buffer))
{
DEBUG_F("xfs_dir() failed. errnum = %d\n", errnum);
@@ -116,7 +116,7 @@ xfs_open(struct boot_file_t *file, const char *dev_name,
return errnum;
}
- DEBUG_F("Successfully opened %s\n", file_name);
+ DEBUG_F("Successfully opened %s\n", fspec->file);
DEBUG_LEAVE(FILE_ERR_OK);
return FILE_ERR_OK;
diff --git a/second/yaboot.c b/second/yaboot.c
index 3db7b4f..8a74d7a 100644
--- a/second/yaboot.c
+++ b/second/yaboot.c
@@ -300,6 +300,7 @@ void print_message_file(char *filename)
}
strncpy(msgpath, filename, sizeof(msgpath));
+ msgfile = boot; /* Copy all the original paramters */
if (!parse_device_path(msgpath, defdev, defpart, "/etc/yaboot.msg", &msgfile)) {
prom_printf("%s: Unable to parse\n", msgpath);
goto done;
@@ -988,6 +989,7 @@ int get_params(struct boot_param_t* params)
if (!label && password)
check_password ("To boot a custom image you must enter the password.");
+ params->kernel = boot; /* Copy all the original paramters */
if (!parse_device_path(imagepath, defdevice, defpart,
"/vmlinux", &params->kernel)) {
prom_printf("%s: Unable to parse\n", imagepath);
@@ -1009,6 +1011,7 @@ int get_params(struct boot_param_t* params)
strncpy(initrdpath, p, 1024);
DEBUG_F("Parsing initrd path <%s>\n", initrdpath);
+ params->rd = boot; /* Copy all the original paramters */
if (!parse_device_path(initrdpath, defdevice, defpart,
"/root.bin", &params->rd)) {
prom_printf("%s: Unable to parse\n", imagepath);
@@ -1019,6 +1022,7 @@ int get_params(struct boot_param_t* params)
if (p && *p) {
DEBUG_F("Parsing sysmap path <%s>\n", p);
strncpy(sysmappath, p, 1024);
+ params->sysmap = boot; /* Copy all the original paramters */
if (!parse_device_path(sysmappath, defdevice, defpart,
"/boot/System.map", &params->sysmap)) {
prom_printf("%s: Unable to parse\n", imagepath);

View file

@ -1,325 +0,0 @@
diff -purN yaboot-1.3.14.orig/include/file.h yaboot-1.3.14/include/file.h
--- yaboot-1.3.14.orig/include/file.h 2009-10-15 11:39:01.112642471 +1100
+++ yaboot-1.3.14/include/file.h 2009-10-15 15:29:04.692654961 +1100
@@ -45,6 +45,7 @@ struct boot_fspec_t {
char* giaddr; /* Gateway address */
char* bootp_retries; /* Bootp retries */
char* tftp_retries; /* TFTP retries */
+ char* subnetmask; /* Subnet mask */
char* addl_params; /* copy all additional parameters */
/* Following fields are used only in ipv6 format */
diff -purN yaboot-1.3.14.orig/include/prom.h yaboot-1.3.14/include/prom.h
--- yaboot-1.3.14.orig/include/prom.h 2009-10-15 15:23:39.796944672 +1100
+++ yaboot-1.3.14/include/prom.h 2009-10-15 15:29:04.692654961 +1100
@@ -153,7 +153,7 @@ struct bootp_packet {
unsigned char chaddr[16];
unsigned char sname[64];
unsigned char file[128];
- /* vendor options go here if we need them */
+ unsigned char options[]; /* vendor options */
};
struct bootp_packet * prom_get_netinfo (void);
diff -purN yaboot-1.3.14.orig/second/cfg.c yaboot-1.3.14/second/cfg.c
--- yaboot-1.3.14.orig/second/cfg.c 2009-10-15 15:23:39.798647660 +1100
+++ yaboot-1.3.14/second/cfg.c 2009-10-15 15:29:04.693668247 +1100
@@ -597,6 +597,9 @@ int cfg_set_default_by_mac (char *mac_ad
char * label = NULL;
int haslabel = 0;
+ if (mac_addr == NULL)
+ return 0;
+
/* check if there is an image label equal to mac_addr */
for (tmp = images; tmp; tmp = tmp->next) {
label = cfg_get_strg_i (tmp->table, "label");
diff -purN yaboot-1.3.14.orig/second/file.c yaboot-1.3.14/second/file.c
--- yaboot-1.3.14.orig/second/file.c 2009-10-15 15:23:39.802647442 +1100
+++ yaboot-1.3.14/second/file.c 2009-10-15 15:29:04.694645423 +1100
@@ -51,6 +51,42 @@ ipv4_to_str(__u32 ip)
return buf;
}
+/* FIXME: COMMENT */
+static char * is_valid_ip_str(char *str)
+{
+ int i;
+ long tmp;
+ __u32 ip = 0;
+ char *ptr=str, *endptr;
+
+ if (str == NULL)
+ return NULL;
+
+ for (i=0; i<4; i++, ptr = ++endptr) {
+ tmp = strtol(ptr, &endptr, 10);
+ if ((tmp & 0xff) != tmp)
+ return NULL;
+
+ /* If we reach the end of the string but we're not in the 4th octet
+ * we have an invalid IP */
+ if (*endptr == '\x0' && i!=3)
+ return NULL;
+
+ /* If we have anything other than a NULL or '.' we have an invlaid
+ * IP */
+ if (*endptr != '\x0' && *endptr != '.')
+ return NULL;
+
+ ip += (tmp << (24-(i*8)));
+ }
+
+ if (ip == 0 || ip == ~0u)
+ return NULL;
+
+ return str;
+}
+
+
/*
* Copy the string from source to dest till newline or comma(,) is seen
* in the source.
@@ -130,12 +166,13 @@ extract_ipv4_args(char *imagepath, struc
* read the arguments in order: siaddr,filename,ciaddr,giaddr,
* bootp-retries,tftp-retries,addl_prameters
*/
- result->siaddr = scopy(&str, &args);
+ result->siaddr = is_valid_ip_str(scopy(&str, &args));
result->file = scopy(&str, &args);
- result->ciaddr = scopy(&str, &args);
- result->giaddr = scopy(&str, &args);
+ result->ciaddr = is_valid_ip_str(scopy(&str, &args));
+ result->giaddr = is_valid_ip_str(scopy(&str, &args));
result->bootp_retries = scopy(&str, &args);
result->tftp_retries = scopy(&str, &args);
+ result->subnetmask = scopy(&str, &args);
if (*args) {
result->addl_params = strdup(args);
if (!result->addl_params)
@@ -144,6 +181,82 @@ extract_ipv4_args(char *imagepath, struc
return 1;
}
+/* DHCP options */
+enum dhcp_options {
+ DHCP_PAD = 0,
+ DHCP_NETMASK = 1,
+ DHCP_ROUTERS = 3,
+ DHCP_DNS = 6,
+ DHCP_END = 255,
+};
+
+#define DHCP_COOKIE 0x63825363
+#define DHCP_COOKIE_SIZE 4
+
+/*
+ * FIXME: COMMENT
+ */
+static void
+extract_vendor_options(struct bootp_packet *packet, struct boot_fspec_t *result)
+{
+ int i = 0;
+ __u32 cookie;
+ __u8 *options = &packet->options[0];
+
+ memcpy(&cookie, &options[i], DHCP_COOKIE_SIZE);
+
+ if (cookie != DHCP_COOKIE) {
+ prom_printf("EEEK! cookie is fubar got %08x expected %08x\n",
+ cookie, DHCP_COOKIE);
+ return;
+ }
+
+ i += DHCP_COOKIE_SIZE;
+
+ /* FIXME: It may be possible to run off the end of a packet here /if/
+ * it's malformed. :( */
+ while (options[i] != DHCP_END) {
+ __u8 tag = options[i++], len;
+ __u32 value;
+
+ if (tag == DHCP_PAD)
+ continue;
+
+ len = options[i++];
+ memcpy(&value, &options[i], len);
+
+#if DEBUG
+{
+ DEBUG_F("tag=%2d, len=%2d, data=", tag, len);
+ int j;
+ for (j=0; j<len; j++)
+ prom_printf("%02x", options[i+j]);
+ prom_printf("\n");
+}
+#endif
+
+ switch (tag) {
+ case DHCP_NETMASK:
+ if ((result->subnetmask == NULL || *(result->subnetmask) == '\x0') && value != 0) {
+ result->subnetmask = ipv4_to_str(value);
+ DEBUG_F("Storing %s as subnetmask from options\n",
+ result->subnetmask);
+ }
+ /* FIXME: do we need to grok the subnet mask? */
+ break;
+ case DHCP_ROUTERS:
+ if ((result->giaddr == NULL || *(result->giaddr) == '\x0')
+ && value != 0) {
+ result->giaddr = ipv4_to_str(value);
+ DEBUG_F("Storing %s as gateway from options\n",
+ result->giaddr);
+ }
+ break;
+ }
+ i += len;
+ }
+}
+
/*
* Check netinfo for ipv4 parameters and add them to the fspec iff the
* fspec has no existing value.
@@ -170,16 +283,18 @@ extract_netinfo_args(struct boot_fspec_t
if (packet->ciaddr == 0 && packet->yiaddr != 0)
packet->ciaddr = packet->yiaddr;
- if ((result->siaddr == NULL || *(result->siaddr) == NULL)
+ if ((result->siaddr == NULL || *(result->siaddr) == '\x0')
&& packet->siaddr != 0)
result->siaddr = ipv4_to_str(packet->siaddr);
- if ((result->ciaddr == NULL || *(result->ciaddr) == NULL)
+ if ((result->ciaddr == NULL || *(result->ciaddr) == '\x0')
&& packet->ciaddr != 0)
result->ciaddr = ipv4_to_str(packet->ciaddr);
- if ((result->giaddr == NULL || *(result->giaddr) == NULL)
+ if ((result->giaddr == NULL || *(result->giaddr) == '\x0')
&& packet->giaddr != 0)
result->giaddr = ipv4_to_str(packet->giaddr);
+ extract_vendor_options(packet, result);
+
/* FIXME: Yck! if we /still/ do not have a gateway then "cheat" and use
* the server. This will be okay if the client and server are on
* the same IP network, if not then lets hope the server does ICMP
diff -purN yaboot-1.3.14.orig/second/fs_of.c yaboot-1.3.14/second/fs_of.c
--- yaboot-1.3.14.orig/second/fs_of.c 2009-10-15 15:23:39.805647069 +1100
+++ yaboot-1.3.14/second/fs_of.c 2009-10-15 15:29:04.695645439 +1100
@@ -44,7 +44,7 @@
#include "errors.h"
#include "debug.h"
-#define LOAD_BUFFER_POS 0x1000000
+#define LOAD_BUFFER_POS 0x0000000
#define LOAD_BUFFER_SIZE 0x2000000
static int of_open(struct boot_file_t* file,
@@ -137,6 +137,7 @@ of_net_open(struct boot_file_t* file,
static char buffer[1024];
char *filename = NULL;
char *p;
+ int new_tftp;
DEBUG_ENTER;
DEBUG_OPEN;
@@ -148,34 +149,47 @@ of_net_open(struct boot_file_t* file,
*p = '\\';
}
- DEBUG_F("siaddr <%s>; filename <%s>; ciaddr <%s>; giaddr <%s>; ipv6 <%d>\n",
- fspec->siaddr, filename, fspec->ciaddr, fspec->giaddr, fspec->is_ipv6);
+ DEBUG_F("siaddr <%s>; filename <%s>; ciaddr <%s>; giaddr <%s>;"
+ " ipv6 <%d>\n",
+ fspec->siaddr, filename, fspec->ciaddr, fspec->giaddr,
+ fspec->is_ipv6);
+
strncpy(buffer, fspec->dev, 768);
if (fspec->is_ipv6)
strcat(buffer, TOK_IPV6 ",");
- /* If we didn't get a ':' include one */
- if (fspec->dev[strlen(fspec->dev)-1] != ':')
+ else if (fspec->dev[strlen(fspec->dev)-1] != ':')
strcat(buffer, ":");
- strcat(buffer, fspec->siaddr);
- strcat(buffer, ",");
- if (fspec->is_ipv6 && (strstr(filename, "filename=") == NULL))
- strcat(buffer, "filename=");
- strcat(buffer, filename);
- strcat(buffer, ",");
- strcat(buffer, fspec->ciaddr);
- strcat(buffer, ",");
- strcat(buffer, fspec->giaddr);
- /* If /packages/cas exists the we have a "new skool" tftp */
- if (prom_finddevice("/packages/cas") != PROM_INVALID_HANDLE) {
+ /* If /packages/cas exists the we have a "new skool" tftp.
+ * This means that siaddr is the tftp server and that we can add
+ * {tftp,bootp}_retrys, subnet mask and tftp block size to the load
+ * method */
+ new_tftp = (prom_finddevice("/packages/cas") != PROM_INVALID_HANDLE);
+ DEBUG_F("Using %s tftp style\n", (new_tftp? "new": "old"));
+
+ if (new_tftp) {
+ strcat(buffer, fspec->siaddr);
+ strcat(buffer, ",");
+
+ if (fspec->is_ipv6 && (strstr(filename, "filename=") == NULL))
+ strcat(buffer, "filename=");
+
+ strcat(buffer, filename);
+ strcat(buffer, ",");
+ strcat(buffer, fspec->ciaddr);
strcat(buffer, ",");
+ strcat(buffer, fspec->giaddr);
+ strcat(buffer, ",");
strcat(buffer, fspec->bootp_retries);
strcat(buffer, ",");
strcat(buffer, fspec->tftp_retries);
strcat(buffer, ",");
+ strcat(buffer, fspec->subnetmask);
+ strcat(buffer, ",");
strcat(buffer, fspec->addl_params);
} else {
- DEBUG_F("No \"/packages/cas\" using simple args\n")
+ strcat(buffer, ",");
+ strcat(buffer, filename);
}
DEBUG_F("Opening: \"%s\"\n", buffer);
diff -purN yaboot-1.3.14.orig/second/prom.c yaboot-1.3.14/second/prom.c
--- yaboot-1.3.14.orig/second/prom.c 2009-10-15 15:23:39.806647224 +1100
+++ yaboot-1.3.14/second/prom.c 2009-10-15 15:29:04.696645314 +1100
@@ -685,6 +685,10 @@ struct bootp_packet * prom_get_netinfo (
void *bootp_response = NULL;
char *propname;
struct bootp_packet *packet;
+ /* struct bootp_packet contains a VLA, so sizeof won't work.
+ the VLA /must/ be the last field in the structure so use it's
+ offset as a good estimate of the packet size */
+ size_t packet_size = offsetof(struct bootp_packet, options);
int i = 0, size, offset = 0;
prom_handle chosen;
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
@@ -709,7 +713,7 @@ struct bootp_packet * prom_get_netinfo (
if (size <= 0)
return NULL;
- if (sizeof(*packet) > size - offset) {
+ if (packet_size > size - offset) {
prom_printf("Malformed %s property?\n", propname);
return NULL;
}
diff -purN yaboot-1.3.14.orig/second/yaboot.c yaboot-1.3.14/second/yaboot.c
--- yaboot-1.3.14.orig/second/yaboot.c 2009-10-15 15:23:39.809646432 +1100
+++ yaboot-1.3.14/second/yaboot.c 2009-10-15 15:29:04.697642396 +1100
@@ -471,6 +471,10 @@ static int load_my_config_file(struct bo
int minlen;
packet = prom_get_netinfo();
+ if (packet == NULL) {
+ prom_printf("Failed to get netinfo data\n");
+ return 0;
+ }
/*
* First, try to match on mac address with the hardware type

View file

@ -1,15 +0,0 @@
diff -urNp yaboot-1.3.14.orig/second/fs_of.c yaboot-1.3.14/second/fs_of.c
--- yaboot-1.3.14.orig/second/fs_of.c 2009-10-14 09:39:46.263661071 +1100
+++ yaboot-1.3.14/second/fs_of.c 2009-10-14 09:43:42.932691139 +1100
@@ -92,8 +92,8 @@ of_open(struct boot_file_t* file,
strncpy(buffer, fspec->dev, 768);
strcat(buffer, ":");
if (part) {
- if (part->sys_ind == LINUX_RAID) {
- DEBUG_F("skipping because partition is marked LINUX_RAID\n");
+ if (part->sys_ind == LINUX_RAID || part->sys_ind == LINUX_NATIVE) {
+ DEBUG_F("skipping because partition is marked %x\n", part->sys_ind);
DEBUG_LEAVE(FILE_ERR_BAD_FSYS);
return FILE_ERR_BAD_FSYS;
}
Binary files yaboot-1.3.14.orig/second/.fs_of.c.swp and yaboot-1.3.14/second/.fs_of.c.swp differ

View file

@ -1,129 +0,0 @@
diff -up yaboot-1.3.14/include/file.h.ipv6_4 yaboot-1.3.14/include/file.h
--- yaboot-1.3.14/include/file.h.ipv6_4 2009-08-14 13:48:47.000000000 +0200
+++ yaboot-1.3.14/include/file.h 2009-08-14 13:48:47.000000000 +0200
@@ -46,6 +46,11 @@ struct boot_fspec_t {
char* bootp_retries; /* Bootp retries */
char* tftp_retries; /* TFTP retries */
char* addl_params; /* copy all additional parameters */
+
+ /* Following fields are used only in ipv6 format */
+ int is_ipv6; /* is ipv6 specified ? */
+ char* dhcpv6; /* dhcpv6 string */
+ char* blksize; /* blksize string */
};
struct boot_file_t {
diff -up yaboot-1.3.14/include/prom.h.ipv6_4 yaboot-1.3.14/include/prom.h
--- yaboot-1.3.14/include/prom.h.ipv6_4 2008-04-15 15:34:48.000000000 +0200
+++ yaboot-1.3.14/include/prom.h 2009-08-14 14:37:25.000000000 +0200
@@ -37,6 +37,7 @@ typedef void *phandle;
#define PROM_INVALID_HANDLE ((prom_handle)-1UL)
#define BOOTDEVSZ (2048) /* iscsi args can be in excess of 1040 bytes */
#define TOK_ISCSI "iscsi"
+#define TOK_IPV6 "ipv6"
#define PROM_CLAIM_MAX_ADDR 0x8000000
#define BOOTLASTSZ 1024
#define FW_NBR_REBOOTSZ 4
diff -up yaboot-1.3.14/second/file.c.ipv6_4 yaboot-1.3.14/second/file.c
--- yaboot-1.3.14/second/file.c.ipv6_4 2009-08-14 13:48:47.000000000 +0200
+++ yaboot-1.3.14/second/file.c 2009-08-14 14:44:37.000000000 +0200
@@ -193,6 +193,50 @@ extract_netinfo_args(struct boot_fspec_t
}
/*
+ * Extract all the ipv6 arguments from the bootpath provided and fill result
+ * Syntax: ipv6,[dhcpv6[=diaddr,]]ciaddr=c_iaddr,giaddr=g_iaddr,siaddr=s_iaddr,
+ * filename=file_name,tftp-retries=tftp_retries,blksize=block_size
+ * Returns 1 on success, 0 on failure.
+ */
+static int
+extract_ipv6_args(char *imagepath, struct boot_fspec_t *result)
+{
+ char *str, *tmp;
+ int total_len;
+
+ result->is_ipv6 = 1;
+
+ /* Just allocate the max required size */
+ total_len = strlen(imagepath) + 1;
+ str = malloc(total_len);
+ if (!str)
+ return 0;
+
+ if ((tmp = strstr(imagepath, "dhcpv6=")) != NULL)
+ result->dhcpv6 = scopy(&str, &tmp);
+
+ if ((tmp = strstr(imagepath, "ciaddr=")) != NULL)
+ result->ciaddr = scopy(&str, &tmp);
+
+ if ((tmp = strstr(imagepath, "giaddr=")) != NULL)
+ result->giaddr = scopy(&str, &tmp);
+
+ if ((tmp = strstr(imagepath, "siaddr=")) != NULL)
+ result->siaddr = scopy(&str, &tmp);
+
+ if ((tmp = strstr(imagepath, "filename=")) != NULL)
+ result->file = scopy(&str, &tmp);
+
+ if ((tmp = strstr(imagepath, "tftp-retries=")) != NULL)
+ result->tftp_retries = scopy(&str, &tmp);
+
+ if ((tmp = strstr(imagepath, "blksize=")) != NULL)
+ result->blksize = scopy(&str, &tmp);
+
+ return 1;
+}
+
+/*
* Extract all the arguments provided in the imagepath and fill it in result.
* Returns 1 on success, 0 on failure.
*/
@@ -206,9 +250,14 @@ extract_netboot_args(char *imagepath, st
if (!imagepath)
return 1;
- ret = extract_ipv4_args(imagepath, result);
+ if (strstr(imagepath, TOK_IPV6))
+ ret = extract_ipv6_args(imagepath, result);
+ else
+ ret = extract_ipv4_args(imagepath, result);
+
ret |= extract_netinfo_args(result);
+ DEBUG_F("ipv6 = <%d>\n", result->is_ipv6);
DEBUG_F("siaddr = <%s>\n", result->siaddr);
DEBUG_F("file = <%s>\n", result->file);
DEBUG_F("ciaddr = <%s>\n", result->ciaddr);
@@ -216,6 +265,8 @@ extract_netboot_args(char *imagepath, st
DEBUG_F("bootp_retries = <%s>\n", result->bootp_retries);
DEBUG_F("tftp_retries = <%s>\n", result->tftp_retries);
DEBUG_F("addl_params = <%s>\n", result->addl_params);
+ DEBUG_F("dhcpv6 = <%s>\n", result->dhcpv6);
+ DEBUG_F("blksize = <%s>\n", result->blksize);
return ret;
}
diff -up yaboot-1.3.14/second/fs_of.c.ipv6_4 yaboot-1.3.14/second/fs_of.c
--- yaboot-1.3.14/second/fs_of.c.ipv6_4 2009-08-14 13:48:47.000000000 +0200
+++ yaboot-1.3.14/second/fs_of.c 2009-08-14 14:47:18.000000000 +0200
@@ -148,14 +148,18 @@ of_net_open(struct boot_file_t* file,
*p = '\\';
}
- DEBUG_F("siaddr <%s>; filename <%s>; ciaddr <%s>; giaddr <%s>;\n",
- fspec->siaddr, filename, fspec->ciaddr, fspec->giaddr);
+ DEBUG_F("siaddr <%s>; filename <%s>; ciaddr <%s>; giaddr <%s>; ipv6 <%d>\n",
+ fspec->siaddr, filename, fspec->ciaddr, fspec->giaddr, fspec->is_ipv6);
strncpy(buffer, fspec->dev, 768);
+ if (fspec->is_ipv6)
+ strcat(buffer, TOK_IPV6 ",");
/* If we didn't get a ':' include one */
if (fspec->dev[strlen(fspec->dev)-1] != ':')
strcat(buffer, ":");
strcat(buffer, fspec->siaddr);
strcat(buffer, ",");
+ if (fspec->is_ipv6 && (strstr(filename, "filename=") == NULL))
+ strcat(buffer, "filename=");
strcat(buffer, filename);
strcat(buffer, ",");
strcat(buffer, fspec->ciaddr);

View file

@ -1,55 +0,0 @@
Index: b/second/file.c
===================================================================
--- a/second/file.c
+++ b/second/file.c
@@ -671,6 +671,9 @@
case FILE_DEVICE_BLOCK:
DEBUG_F("device is a block device\n");
return file_block_open(file, spec, spec->part);
+ case FILE_DEVICE_ISCSI:
+ DEBUG_F("device is a iSCSI device\n");
+ return file_block_open(file, spec, spec->part);
case FILE_DEVICE_NET:
DEBUG_F("device is a network device\n");
return file_net_open(file, spec);
Index: b/second/partition.c
===================================================================
--- a/second/partition.c
+++ b/second/partition.c
@@ -400,7 +400,8 @@
struct partition_t* found;
char *type = NULL;
- if (prom_get_devtype(device) != FILE_DEVICE_BLOCK)
+ int device_kind = prom_get_devtype(device);
+ if (device_kind != FILE_DEVICE_BLOCK && device_kind != FILE_DEVICE_ISCSI)
return NULL;
parts = partitions_lookup(device);
Index: b/second/prom.c
===================================================================
--- a/second/prom.c
+++ b/second/prom.c
@@ -196,7 +196,7 @@
char tmp[64];
if (strstr(device, TOK_ISCSI))
- device = strcpy(tmp, "/vdevice/gscsi/disk");
+ return FILE_DEVICE_ISCSI;
/* Find OF device phandle */
dev = prom_finddevice(device);
Index: b/second/fs_ext2.c
===================================================================
--- a/second/fs_ext2.c
+++ b/second/fs_ext2.c
@@ -139,7 +139,8 @@
DEBUG_LEAVE(FILE_ERR_FSBUSY);
return FILE_ERR_FSBUSY;
}
- if (file->device_kind != FILE_DEVICE_BLOCK) {
+ if (file->device_kind != FILE_DEVICE_BLOCK
+ && file->device_kind != FILE_DEVICE_ISCSI) {
DEBUG_LEAVE(FILE_ERR_BADDEV);
return FILE_ERR_BADDEV;
}

View file

@ -1,118 +0,0 @@
diff --git a/Makefile b/Makefile
index 8f2b1c4..3603c7d 100644
--- a/Makefile
+++ b/Makefile
@@ -121,6 +121,9 @@ mkofboot:
false; \
fi
+%.i: %.c
+ $(CC) $(YBCFLAGS) -E -o $@ $<
+
%.o: %.c
$(CC) $(YBCFLAGS) -c -o $@ $<
diff --git a/include/file.h b/include/file.h
index b2d9c63..9990f4b 100644
--- a/include/file.h
+++ b/include/file.h
@@ -68,6 +68,7 @@ struct boot_file_t {
ino_t inode;
__u64 pos;
unsigned char* buffer;
+ __u64 buffer_sz;
__u64 len;
// unsigned int dev_blk_size;
// unsigned int part_start;
diff --git a/second/fs_of.c b/second/fs_of.c
index 1f48f4f..d2e7434 100644
--- a/second/fs_of.c
+++ b/second/fs_of.c
@@ -214,6 +214,7 @@ of_net_open(struct boot_file_t* file,
DEBUG_LEAVE(FILE_IOERR);
return FILE_IOERR;
}
+ file->buffer_sz = LOAD_BUFFER_SIZE;
memset(file->buffer, 0, LOAD_BUFFER_SIZE);
DEBUG_F("TFP...\n");
diff --git a/second/yaboot.c b/second/yaboot.c
index 0ccfed5..1241eec 100644
--- a/second/yaboot.c
+++ b/second/yaboot.c
@@ -1052,6 +1052,7 @@ yaboot_text_ui(void)
static struct boot_param_t params;
void *initrd_base;
unsigned long initrd_size;
+ unsigned long initrd_end;
void *sysmap_base;
unsigned long sysmap_size;
kernel_entry_t kernel_entry;
@@ -1227,8 +1228,67 @@ yaboot_text_ui(void)
initrd_read = file.fs->read(&file, INITRD_CHUNKSIZE, initrd_more);
DEBUG_F(" block at %p rc=%lu\n",initrd_more,initrd_read);
initrd_size += initrd_read;
+ initrd_end = initrd_more+INITRD_CHUNKSIZE;
}
}
+ /* If we netbooted and got this far, we may have filled the
+ * RMA. We're about the free the TFTP load buffer to we
+ * can "shuffle" things around so that the booted kernel
+ * has some memory to run with */
+ if (!is_elf64(&loadinfo)) {
+ DEBUG_F("Not running a 64-kernel\n");
+ /* Is this check enough? */
+ } else if (loadinfo.base == file.buffer + file.buffer_sz) {
+ DEBUG_F("file->buffer %lx -> %lx (%lx)\n",
+ (unsigned long)(file.buffer),
+ (unsigned long)(file.buffer+file.buffer_sz),
+ (unsigned long)(file.buffer_sz));
+ DEBUG_F("vmlinux %lx -> %lx (%lx)\n",
+ (unsigned long)(loadinfo.base),
+ (unsigned long)(loadinfo.base+loadinfo.memsize),
+ (unsigned long)(loadinfo.memsize));
+ DEBUG_F("initrd %lx -> %lx (%lx)\n",
+ (unsigned long)(initrd_base),
+ (unsigned long)(initrd_base+initrd_size),
+ (unsigned long)(initrd_size));
+
+ /* Check to see if we're near the top of the RMA */
+ /* Cheat and assume the RMA == 128Mb */
+ if (initrd_end > 0x7000000) {
+ unsigned long new_initrd_end, free_len;
+ unsigned long initrd_claim_len = initrd_end - (unsigned long)initrd_base;
+
+ memmove(file.buffer, loadinfo.base,
+ loadinfo.memsize+initrd_size);
+ loadinfo.base = file.buffer;
+ initrd_base = loadinfo.base+loadinfo.memsize;
+
+ new_initrd_end = (unsigned long)initrd_base+initrd_claim_len;
+ free_len = initrd_end - (unsigned long)new_initrd_end;
+ file.buffer = NULL;
+ file.buffer_sz = 0;
+ memset((void*)new_initrd_end, 0x0, free_len);
+ prom_release((void*)new_initrd_end, free_len);
+
+ DEBUG_F("Releaseing from 0x%08lx -> 0x%08lx\n",
+ new_initrd_end, free_len);
+
+ DEBUG_F("file->buffer %lx -> %lx (%lx)\n",
+ (unsigned long)(file.buffer),
+ (unsigned long)(file.buffer+file.buffer_sz),
+ (unsigned long)(file.buffer_sz));
+ DEBUG_F("vmlinux %lx -> %lx (%lx)\n",
+ (unsigned long)(loadinfo.base),
+ (unsigned long)(loadinfo.base+loadinfo.memsize),
+ (unsigned long)(loadinfo.memsize));
+ DEBUG_F("initrd %lx -> %lx (%lx)\n",
+ (unsigned long)(initrd_base),
+ (unsigned long)(initrd_base+initrd_size),
+ (unsigned long)(initrd_size));
+ } else {
+ DEBUG_F("Looks like we do not need to move the kernel\n");
+ }
+ }
file.fs->close(&file);
memset(&file, 0, sizeof(file));
}

View file

@ -1,66 +0,0 @@
extract_netinfo_args() should be a void function.
If there is no "netinfo" packet, extract_netinfo_args() will fail and cause
parse_device_path() to abort. This basically meant that yaboot will fail to
load any kernel/initrd under those circumstances.
This fix changes extract_netinfo_args() to be a void function.
Signed-off-by: Tony Breeds <tonyb@au1.ibm.com>
---
I'll talk to FW about /why/ there is no netinfo data, but even if that is a FW bug we need to work around it.
second/file.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
--- yaboot-1.3.14.orig/second/file.c 2010-03-06 09:23:12.174204856 +0800
+++ yaboot-1.3.14/second/file.c 2010-03-06 11:59:04.045205260 +0800
@@ -260,10 +260,8 @@ extract_vendor_options(struct bootp_pack
/*
* Check netinfo for ipv4 parameters and add them to the fspec iff the
* fspec has no existing value.
- *
- * Returns 1 on success, 0 on failure.
*/
-static int
+static void
extract_netinfo_args(struct boot_fspec_t *result)
{
struct bootp_packet *packet;
@@ -271,7 +269,7 @@ extract_netinfo_args(struct boot_fspec_t
/* Check to see if we can get the [scyg]iaddr fields from netinfo */
packet = prom_get_netinfo();
if (packet == NULL)
- return 0;
+ return;
DEBUG_F("We have a boot packet\n");
DEBUG_F(" siaddr = <%x>\n", packet->siaddr);
@@ -303,8 +301,6 @@ extract_netinfo_args(struct boot_fspec_t
result->giaddr = ipv4_to_str(packet->siaddr);
DEBUG_F("Forcing giaddr to siaddr <%s>\n", result->giaddr);
}
-
- return 1;
}
/*
@@ -370,7 +366,7 @@ extract_netboot_args(char *imagepath, st
else
ret = extract_ipv4_args(imagepath, result);
- ret |= extract_netinfo_args(result);
+ extract_netinfo_args(result);
DEBUG_F("ipv6 = <%d>\n", result->is_ipv6);
DEBUG_F("siaddr = <%s>\n", result->siaddr);
@@ -526,8 +522,7 @@ parse_device_path(char *imagepath, char
return 0;
} else {
/* If we didn't get a ':' then look only in netinfo */
- if (extract_netinfo_args(result) == 0)
- return 0;
+ extract_netinfo_args(result);
result->file = strdup(ipath);
}

View file

@ -1,95 +0,0 @@
Date: Sun, 11 Apr 2010 14:05:59 +1000
From: Anton Blanchard <anton@samba.org>
Subject: prom_getchar eats characters
This bug has been annoying me for a long time. If you copy and paste a
string into the yaboot prompt, or even type too fast, characters get
dropped.
It turns out we were asking OF for 4 characters, but only using the first one.
There is strange logic to look for \e[, and then oring the third character with
0x100. I haven't been able to find anyone that knows why that was there in the
first place, so just remove it and fix this bug once and for all.
Automated test infrastructures the world over will thank us for fixing this
bug!
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
diff -purN yaboot-1.3.14.orig/include/prom.h yaboot-1.3.14/include/prom.h
--- yaboot-1.3.14.orig/include/prom.h 2010-05-13 22:32:41.363286396 -0500
+++ yaboot-1.3.14/include/prom.h 2010-05-15 22:45:20.057035750 -0500
@@ -84,7 +84,6 @@ void prom_printf (char *fmt, ...);
#endif
void prom_perror (int error, char *filename);
-void prom_readline (char *prompt, char *line, int len);
int prom_set_color(prom_handle device, int color, int r, int g, int b);
/* memory */
diff -purN yaboot-1.3.14.orig/second/prom.c yaboot-1.3.14/second/prom.c
--- yaboot-1.3.14.orig/second/prom.c 2010-05-13 22:32:41.383286111 -0500
+++ yaboot-1.3.14/second/prom.c 2010-05-15 22:45:43.615473125 -0500
@@ -389,14 +389,12 @@ prom_readblocks (prom_handle dev, int bl
int
prom_getchar ()
{
- char c[4];
+ char c;
int a;
- while ((a = (int)call_prom ("read", 3, 1, prom_stdin, c, 4)) <= 0)
- ;
- if (a == 3 && c[0] == '\e' && c[1] == '[')
- return 0x100 | c[2];
- return c[0];
+ while ((a = (int)call_prom ("read", 3, 1, prom_stdin, &c, 1)) <= 0)
+ continue;
+ return c;
}
int
@@ -500,41 +498,6 @@ prom_perror (int error, char *filename)
prom_printf("%s: Unknown error\n", filename);
}
-void
-prom_readline (char *prompt, char *buf, int len)
-{
- int i = 0;
- int c;
-
- if (prompt)
- prom_puts (prom_stdout, prompt);
-
- while (i < len-1 && (c = prom_getchar ()) != '\r')
- {
- if (c >= 0x100)
- continue;
- if (c == 8)
- {
- if (i > 0)
- {
- prom_puts (prom_stdout, "\b \b");
- i--;
- }
- else
- prom_putchar ('\a');
- }
- else if (isprint (c))
- {
- prom_putchar (c);
- buf[i++] = c;
- }
- else
- prom_putchar ('\a');
- }
- prom_putchar ('\n');
- buf[i] = 0;
-}
-
#ifdef CONFIG_SET_COLORMAP
int prom_set_color(prom_handle device, int color, int r, int g, int b)
{

View file

@ -1,65 +0,0 @@
diff --git a/lib/malloc.c b/lib/malloc.c
index 81d7717..0121112 100644
--- a/lib/malloc.c
+++ b/lib/malloc.c
@@ -23,6 +23,10 @@
#include "stddef.h"
#include "string.h"
+/* Copied from asm-generic/errno-base.h */
+#define ENOMEM 12 /* Out of memory */
+#define EINVAL 22 /* Invalid argument */
+
/* Imported functions */
extern void prom_printf (char *fmt, ...);
@@ -60,6 +64,49 @@ void *malloc (unsigned int size)
return caddr;
}
+/* Do not fall back to the malloc above as posix_memalign is needed by
+ * external libraries not yaboot */
+int posix_memalign(void **memptr, size_t alignment, size_t size)
+{
+ char *caddr;
+ /* size of allocation including the alignment */
+ size_t alloc_size;
+
+ if (!malloc_ptr)
+ return EINVAL;
+
+ /* Minimal aligment is sizeof(void *) */
+ if (alignment < sizeof(void*))
+ alignment = sizeof(void*);
+
+ /* Check for valid alignment and power of 2 */
+ if ((alignment % sizeof(void*) != 0) || ((alignment-1)&alignment))
+ return EINVAL;
+
+ if (size == 0) {
+ *memptr=NULL;
+ return 0;
+ }
+
+ caddr = (char*)(
+ (size_t)((malloc_ptr + sizeof(int))+(alignment-1)) &
+ (~(alignment-1))
+ );
+
+ alloc_size = size + (caddr - (malloc_ptr+sizeof(int)));
+
+ if ((malloc_ptr + alloc_size + sizeof(int)) > malloc_top)
+ return ENOMEM;
+
+ *(int *)(caddr - sizeof(int)) = size;
+ malloc_ptr += alloc_size + sizeof(int);
+ last_alloc = caddr;
+ malloc_ptr = (char *) ((((unsigned int) malloc_ptr) + 3) & (~3));
+ *memptr=(void*)caddr;
+
+ return 0;
+}
+
void *realloc(void *ptr, unsigned int size)
{
char *caddr, *oaddr = ptr;

View file

@ -1,132 +0,0 @@
diff -urN -X CVS man/mkofboot.8 man.deb/mkofboot.8
--- man/mkofboot.8 Thu May 24 04:32:54 2001
+++ man.deb/mkofboot.8 Tue Sep 25 05:38:42 2001
@@ -94,7 +94,7 @@
.TP
.BR \-i ,\ \-\-install\ \fIboot-file
Use \fIboot-file\fR as the primary boot loader executable, instead of
-the default\fI/usr/local/lib/yaboot/yaboot\fR(8).
+the default\fI/usr/lib/yaboot/yaboot\fR(8).
.TP
.BR \-C ,\ \-\-config\ \fIconfig-file
Use \fIconfig-file\fR as the \fBmkofboot\fR/\fByaboot\fR(8) configuration
@@ -200,8 +200,8 @@
Print out the version number and exit.
.SH FILES
.nf
-/usr/local/lib/yaboot/yaboot \- boot loader executable
-/usr/local/lib/yaboot/ofboot \- OpenFirmware boot script
+/usr/lib/yaboot/yaboot \- boot loader executable
+/usr/lib/yaboot/ofboot \- OpenFirmware boot script
/etc/yaboot.conf \- boot loader/mkofboot configuration file
.fi
.SH ENVIRONMENT
@@ -218,7 +218,7 @@
program otherwise \fBmkofboot\fR will be vulnerable to race conditions.
The Debian mktemp is derived from OpenBSD and thus should be secure.
-\fI/usr/local/lib/yaboot/ofboot\fR now contains code executed by /bin/sh (by
+\fI/usr/lib/yaboot/ofboot\fR now contains code executed by /bin/sh (by
\fBmkofboot\fR) it is thus critical that it not be writable by anyone
but root. It is also critical that \fI/etc/yaboot.conf\fR not be
writable by anyone but root since a different \fIofboot\fR script could be
diff -urN -X CVS man/yaboot.conf.5 man.deb/yaboot.conf.5
--- man/yaboot.conf.5 Tue Sep 25 05:20:03 2001
+++ man.deb/yaboot.conf.5 Tue Sep 25 05:38:42 2001
@@ -136,7 +136,7 @@
boot=/dev/hda2
device=hd:
partition=3
- magicboot=/usr/local/lib/yaboot/ofboot
+ magicboot=/usr/lib/yaboot/ofboot
timeout=50
root=/dev/hda3
read-only
@@ -228,7 +228,7 @@
magicboot script will be executed by OF automatically at boot (instead
of the \fBinstall\fR file.) See man \fBbootstrap\fR(8) for more
information on this. As of ybin 0.22 you should set this to
-/usr/local/lib/yaboot/ofboot which is a autoconfiguring first stage
+/usr/lib/yaboot/ofboot which is a autoconfiguring first stage
loader for yaboot. It is capable of presenting a dual boot menu for
GNU/Linux, MacOS and MacOSX. If dual booting is not required or
configured it will simply load yaboot directly. You must specify this
@@ -301,7 +301,7 @@
When you define this option you will be presented with a simple menu at
bootup allowing you to hit L to boot GNU/Linux or B to boot BSD (along
with other choices if configured). This will only work if you are
-using the new \fI/usr/local/lib/yaboot/ofboot\fR script. When this is
+using the new \fI/usr/lib/yaboot/ofboot\fR script. When this is
set to a unix device node (ie \fI/dev/hda11\fR) then ybin will use the
\fBofpath\fR(8) utility to determine the OpenFirmware device path.
.TP
@@ -310,7 +310,7 @@
partition. When you define this option you will be presented with a
simple menu at bootup allowing you to hit L to boot GNU/Linux or M to
boot MacOS (along with other choices if configured). This will only
-work if you are using the new \fI/usr/local/lib/yaboot/ofboot\fR
+work if you are using the new \fI/usr/lib/yaboot/ofboot\fR
script. When this is set to a unix device node (ie \fI/dev/hda11\fR)
then ybin will use the \fBofpath\fR(8) utility to determine the
OpenFirmware device path.
@@ -320,7 +320,7 @@
When you define this option you will be presented with a simple menu
at bootup allowing you to hit L to boot GNU/Linux or X to boot MacOSX
(along with other choices if configured). This will only work if you
-are using the new \fI/usr/local/lib/yaboot/ofboot\fR script. When
+are using the new \fI/usr/lib/yaboot/ofboot\fR script. When
this is set to a unix device node (ie \fI/dev/hda11\fR) then ybin will
use the \fBofpath\fR(8) utility to determine the OpenFirmware device
path.
@@ -341,7 +341,7 @@
When you define this option you will be presented with a simple menu
at bootup allowing you to hit L to boot GNU/Linux or D to boot Darwin
(along with other choices if configured). This will only work if you
-are using the new \fI/usr/local/lib/yaboot/ofboot\fR script. When
+are using the new \fI/usr/lib/yaboot/ofboot\fR script. When
this is set to a unix device node (ie \fI/dev/hda11\fR) then ybin will
use the \fBofpath\fR(8) utility to determine the OpenFirmware device
path.
@@ -589,8 +589,8 @@
root=/dev/hda3
partition=3
timeout=20
-install=/usr/local/lib/yaboot/yaboot
-magicboot=/usr/local/lib/yaboot/ofboot
+install=/usr/lib/yaboot/yaboot
+magicboot=/usr/lib/yaboot/ofboot
fgcolor=black
bgcolor=green
default=Linux
diff -urN -X CVS man/ybin.8 man.deb/ybin.8
--- man/ybin.8 Thu May 24 04:33:16 2001
+++ man.deb/ybin.8 Tue Sep 25 05:38:42 2001
@@ -109,7 +109,7 @@
.TP
.BR \-i ,\ \-\-install\ \fIboot-file
Use \fIboot-file\fR as the primary boot loader executable, instead of
-the default \fI/usr/local/lib/yaboot/yaboot\fR.
+the default \fI/usr/lib/yaboot/yaboot\fR.
.TP
.BR \-C ,\ \-\-config\ \fIconfig-file
Use \fIconfig-file\fR as the \fBybin\fR/\fByaboot\fR(8) configuration
@@ -214,8 +214,8 @@
Print out the version number and exit.
.SH FILES
.nf
-/usr/local/lib/yaboot/yaboot \- boot loader executable
-/usr/local/lib/yaboot/ofboot \- OpenFirmware boot script
+/usr/lib/yaboot/yaboot \- boot loader executable
+/usr/lib/yaboot/ofboot \- OpenFirmware boot script
/etc/yaboot.conf \- boot loader/ybin configuration file
.fi
.SH ENVIRONMENT
@@ -232,7 +232,7 @@
program, otherwise \fBybin\fR will be vulnerable to race conditions.
The Debian mktemp is derived from OpenBSD and thus should be secure.
-\fI/usr/local/lib/yaboot/ofboot\fR now contains code executed by /bin/sh (by
+\fI/usr/lib/yaboot/ofboot\fR now contains code executed by /bin/sh (by
\fBybin\fR). It is thus critical that it not be writable by anyone but
root. It is also critical that \fI/etc/yaboot.conf\fR not be writable
by anyone but root since a different \fIofboot\fR script could be

View file

@ -1,29 +0,0 @@
--- yaboot-1.3.6/first/ofboot.orig Thu Mar 7 04:19:09 2002
+++ yaboot-1.3.6/first/ofboot Thu Mar 7 04:21:49 2002
@@ -102,7 +102,7 @@
[ "$DEBUG" = 1 ] && $PRINTF 1>&2 "$PRG: DEBUG: file1: $5\n"
[ "$COUNT" = "$OSNUM" ] && c="."
BTYA=": boot$1 \" Loading second stage bootstrap...\" .printf 100 ms load-base release-load-area \" ${4}${5}\" \$boot ;"
- MENUYA="\" Press $3 for GNU/Linux${c-,}\"(0d 0a)\" .printf"
+ MENUYA="\" Press $3 for Red Hat Linux${c-,}\"(0d 0a)\" .printf"
GETYA=" ascii $3 of \" $3 \"(0d 0a)\" .printf boot$1 endof"
shift 5
COUNT="$(($COUNT + 1))"
@@ -315,7 +315,7 @@
MacRISC MacRISC3 MacRISC4
</COMPATIBLE>
<DESCRIPTION>
-PowerPC GNU/Linux First Stage Bootstrap
+Red Hat Linux First Stage Bootstrap
</DESCRIPTION>
<BOOT-SCRIPT>
: .printf fb8-write drop ;
@@ -336,7 +336,7 @@
$BGCOLOR to background-color
\" \"(0C)\" .printf
-\" First Stage GNU/Linux Bootstrap\"(0d 0a)\" .printf
+\" First Stage Red Hat Linux Bootstrap\"(0d 0a)\" .printf
\" \"(0d 0a)\" .printf
$MENUOPTS
\" \"(0d 0a)\" .printf

View file

@ -1,94 +0,0 @@
--- yaboot-1.3.6/Makefile.rh Fri May 17 15:08:25 2002
+++ yaboot-1.3.6/Makefile Fri May 17 15:09:32 2002
@@ -178,32 +178,32 @@
strip --remove-section=.comment --remove-section=.note util/addnote
install: all strip
- install -d -o root -g root -m 0755 ${ROOT}/etc/
- install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/sbin/
- install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/lib
- install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/lib/yaboot
- install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/${MANDIR}/man5/
- install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/${MANDIR}/man8/
- install -o root -g root -m 0644 second/yaboot ${ROOT}/$(PREFIX)/lib/yaboot
- install -o root -g root -m 0755 util/addnote ${ROOT}/${PREFIX}/lib/yaboot/addnote
- install -o root -g root -m 0644 first/ofboot ${ROOT}/${PREFIX}/lib/yaboot/ofboot
- install -o root -g root -m 0755 ybin/ofpath ${ROOT}/${PREFIX}/sbin/ofpath
- install -o root -g root -m 0755 ybin/ybin ${ROOT}/${PREFIX}/sbin/ybin
- install -o root -g root -m 0755 ybin/yabootconfig ${ROOT}/${PREFIX}/sbin/yabootconfig
+ install -d -m 0755 ${ROOT}/etc/
+ install -d -m 0755 ${ROOT}/${PREFIX}/sbin/
+ install -d -m 0755 ${ROOT}/${PREFIX}/lib
+ install -d -m 0755 ${ROOT}/${PREFIX}/lib/yaboot
+ install -d -m 0755 ${ROOT}/${PREFIX}/${MANDIR}/man5/
+ install -d -m 0755 ${ROOT}/${PREFIX}/${MANDIR}/man8/
+ install -m 0644 second/yaboot ${ROOT}/$(PREFIX)/lib/yaboot
+ install -m 0755 util/addnote ${ROOT}/${PREFIX}/lib/yaboot/addnote
+ install -m 0644 first/ofboot ${ROOT}/${PREFIX}/lib/yaboot/ofboot
+ install -m 0755 ybin/ofpath ${ROOT}/${PREFIX}/sbin/ofpath
+ install -m 0755 ybin/ybin ${ROOT}/${PREFIX}/sbin/ybin
+ install -m 0755 ybin/yabootconfig ${ROOT}/${PREFIX}/sbin/yabootconfig
rm -f ${ROOT}/${PREFIX}/sbin/mkofboot
ln -s ybin ${ROOT}/${PREFIX}/sbin/mkofboot
@gzip -9 man/*.[58]
- install -o root -g root -m 0644 man/bootstrap.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/bootstrap.8.gz
- install -o root -g root -m 0644 man/mkofboot.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/mkofboot.8.gz
- install -o root -g root -m 0644 man/ofpath.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/ofpath.8.gz
- install -o root -g root -m 0644 man/yaboot.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/yaboot.8.gz
- install -o root -g root -m 0644 man/yabootconfig.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/yabootconfig.8.gz
- install -o root -g root -m 0644 man/ybin.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/ybin.8.gz
- install -o root -g root -m 0644 man/yaboot.conf.5.gz ${ROOT}/${PREFIX}/${MANDIR}/man5/yaboot.conf.5.gz
+ install -m 0644 man/bootstrap.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/bootstrap.8.gz
+ install -m 0644 man/mkofboot.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/mkofboot.8.gz
+ install -m 0644 man/ofpath.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/ofpath.8.gz
+ install -m 0644 man/yaboot.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/yaboot.8.gz
+ install -m 0644 man/yabootconfig.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/yabootconfig.8.gz
+ install -m 0644 man/ybin.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/ybin.8.gz
+ install -m 0644 man/yaboot.conf.5.gz ${ROOT}/${PREFIX}/${MANDIR}/man5/yaboot.conf.5.gz
@gunzip man/*.gz
@if [ ! -e ${ROOT}/etc/yaboot.conf ] ; then \
- echo "install -o root -g root -m 0644 etc/yaboot.conf ${ROOT}/etc/yaboot.conf"; \
- install -o root -g root -m 0644 etc/yaboot.conf ${ROOT}/etc/yaboot.conf; \
+ echo "install -m 0644 etc/yaboot.conf ${ROOT}/etc/yaboot.conf"; \
+ install -m 0644 etc/yaboot.conf ${ROOT}/etc/yaboot.conf; \
else \
echo "/etc/yaboot.conf already exists, leaving it alone"; \
fi
--- yaboot-1.3.6/etc/yaboot.conf.fhs Thu May 23 15:56:11 2002
+++ yaboot-1.3.6/etc/yaboot.conf Thu May 23 15:57:29 2002
@@ -10,7 +10,7 @@
## specify a partition number for this! On IBM hardware you can
## generally comment this out.
-device=hd:
+## device=hd:
## partition is the partition number where the kernel images are
## located. The kernel images should be on your root filesystem, so
@@ -20,7 +20,7 @@
## option can be either set globally as shown here, or per image in
## the image= sections
-partition=3
+partition=2
## delay is the amount of time in seconds the dual boot menu (if one
## is configured, by the presense of macos, macosx, etc options here)
@@ -35,13 +35,13 @@
## section in this config file or the value of default=).
timeout=40
-install=/usr/local/lib/yaboot/yaboot
-magicboot=/usr/local/lib/yaboot/ofboot
+install=/usr/lib/yaboot/yaboot
+magicboot=/usr/lib/yaboot/ofboot
## Change the default colors, fgcolor is the text color, bgcolor is
## the screen background color. (default: fgcolor=white, bgcolor=black)
-#fgcolor=black
-#bgcolor=green
+fgcolor=white
+bgcolor=black
## Password supplied in plaintext, required for yaboot to boot, unless
## restricted is also present (see below). Be sure to

View file

@ -1,22 +0,0 @@
--- yaboot-1.3.13/Makefile.ppc64 2005-09-14 20:01:12.920430616 -0400
+++ yaboot-1.3.13/Makefile 2005-09-14 20:01:21.090385992 -0400
@@ -36,8 +36,8 @@
# The flags for the yaboot binary.
#
-YBCFLAGS = -Os $(CFLAGS) -nostdinc -Wall -isystem `$(CC) -m32 -print-file-name=include` -fsigned-char
-YBCFLAGS += -DVERSION=\"${VERSION}${VERSIONEXTRA}\" #"
+YBCFLAGS = -Os $(CFLAGS) -m32 -nostdinc -Wall -isystem `$(CC) -m32 -print-file-name=include` -fsigned-char
+YBCFLAGS += -DVERSION="\"${VERSION}${VERSIONEXTRA}\"" #"
YBCFLAGS += -DTEXTADDR=$(TEXTADDR) -DDEBUG=$(DEBUG)
YBCFLAGS += -DMALLOCADDR=$(MALLOCADDR) -DMALLOCSIZE=$(MALLOCSIZE)
YBCFLAGS += -DKERNELADDR=$(KERNELADDR)
@@ -66,7 +66,7 @@
# Link flags
#
-LFLAGS = -Ttext $(TEXTADDR) -Bstatic -melf32ppclinux
+LFLAGS = -Ttext $(TEXTADDR) -Bstatic
# Libraries
#

File diff suppressed because it is too large Load diff

View file

@ -1,462 +0,0 @@
Summary: Linux bootloader for Power Macintosh "New World" computers.
Name: yaboot
Version: 1.3.16
Release: 3%{?dist}
License: GPLv2+
Group: System Environment/Base
Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz
Source1: efika.forth
Patch1: yaboot-1.3.3-man.patch
Patch2: yaboot-1.3.6-ofboot.patch
Patch3: yaboot-1.3.6-rh.patch
Patch4: yaboot-1.3.13-yabootconfig.patch
Patch6: yaboot-1.3.10-proddiscover.patch
Patch7: yaboot-1.3.10-ext3.patch
Patch8: yaboot-1.3.10-sbindir.patch
Patch9: yaboot-1.3.10-configfile.patch
Patch10: yaboot-1.3.10-parted.patch
Patch17: yaboot-1.3.13-pegasos-claim.patch
Patch18: yaboot-1.3.13-pegasos-ext2.patch
Patch21: yaboot-1.3.13-pegasos-serial.patch
Patch22: yaboot-1.3.13-allow-deep-mntpoint.patch
Patch27: yaboot-ppc64.patch
Patch28: yaboot-1.3.13-dontwritehome.patch
Patch33: yaboot-1.3.14-better_netboot.patch
# ipv6 support
Patch36: yaboot-1.3.14-ipv6.patch
# Do not open LINUX_NATIVE parttions with OF, as badness happens
Patch37: yaboot-1.3.14-dont_of_open_native_partitions.patch
# Try #2 at better netboot now with DHCP parseing
Patch38: yaboot-1.3.14-better_netboot2.patch
# When netbooting, move the kernel onto the load buffer, sure it's a hack
Patch39: yaboot-1.3.14-move_kernel.patch
# Don't use insecure MD5, use SHA-2
Patch40: yaboot-sha2.patch
# Solves the situation, when there is no netinfo packet
Patch41: yaboot-1.3.14-netinfo.patch
# Better ISCSI boot
Patch42: yaboot-1.3.14-iscsi.patch
# prom_getchar eats characters
Patch43: yaboot-1.3.14-prom_getchars.patch
# Allows yaboot to allocate up to 256MB of memory
Patch44: yaboot-1.3.14-256-RMA.patch
# Create dummy instance of posix_memalign for e3fsprogs
Patch45: yaboot-1.3.16-memalign.patch
URL: http://yaboot.ozlabs.org/
BuildRoot: %{_tmppath}/%{name}-root
Obsoletes: ybin
ExclusiveArch: ppc
# hfsutils will not be in RHEL6.
# hfsutils is needed only for non-IBM ppc machines
%if 0%{?fedora} || 0%{?rhel} < 6
Requires: hfsutils
%endif
BuildRequires: e2fsprogs-static
# yaboot is bootloader. It contains ELF object, but it is not Linux or MacOS
# executable file. Yaboot is meant to be executed only by OpenFirmware.
# So debuginfo rpm is nonsense
%global debug_package %{nil}
%description
yaboot is a bootloader for PowerPC machines which works on New World ROM
machines (Rev. A iMac and newer) and runs directly from Open Firmware,
eliminating the need for Mac OS.
yaboot can also bootload IBM pSeries machines.
%prep
%setup -q
%patch1 -p0 -b .man
%patch2 -p1 -b .ofboot
%patch3 -p1 -b .rh
%patch4 -p1 -b .yabootconfig
%patch6 -p1 -b .proddisc
%patch7 -p1 -b .ext3
%patch8 -p1 -b .sbin
%patch9 -p1 -b .config
%patch10 -p1 -b .parted
%patch17 -p1 -b .pegasos
%patch18 -p1 -b .ext2
%patch21 -p1 -b .pegasos-serial
%patch22 -p1 -b .deepmnt
%patch27 -p1 -b .ppc64
%patch28 -p1 -b .bootwrite
%patch33 -p1 -b .netboot
%patch36 -p1 -b .ipv6
%patch37 -p1 -b .partitions
%patch38 -p1 -b .netboot2
%patch39 -p1 -b .movekernel
%patch40 -p1 -b .sha2
%patch41 -p1 -b .netinfo
%patch42 -p1 -b .iscsi
%patch43 -p1 -b .prom_getchars
%patch44 -p1 -b .256-RMA
%patch45 -p1 -b .posix
%build
make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1
cp -a second/yaboot{,.debug}
make clean
make VERSIONEXTRA='\ (Red Hat %version-%release)'
%install
%makeinstall ROOT=$RPM_BUILD_ROOT PREFIX=%{_prefix} MANDIR=share/man SBINDIR=/sbin
rm -f $RPM_BUILD_ROOT/etc/yaboot.conf
touch $RPM_BUILD_ROOT/etc/yaboot.conf
mkdir -p $RPM_BUILD_ROOT/boot
install -m0644 %{SOURCE1} $RPM_BUILD_ROOT/boot/efika.forth
install -m0644 second/yaboot.debug $RPM_BUILD_ROOT/usr/lib/yaboot/
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc COPYING README* doc/*
/boot/efika.forth
/sbin/ofpath
/sbin/ybin
/sbin/yabootconfig
/sbin/mkofboot
/usr/lib/yaboot/addnote
/usr/lib/yaboot/ofboot
/usr/lib/yaboot/yaboot
/usr/lib/yaboot/yaboot.debug
%{_mandir}/man8/bootstrap.8.gz
%{_mandir}/man8/mkofboot.8.gz
%{_mandir}/man8/ofpath.8.gz
%{_mandir}/man8/yaboot.8.gz
%{_mandir}/man8/yabootconfig.8.gz
%{_mandir}/man8/ybin.8.gz
%{_mandir}/man5/yaboot.conf.5.gz
%ghost %config(noreplace) %{_sysconfdir}/yaboot.conf
%changelog
* Tue Apr 12 2011 Tony Breeds <tony@bakeyournoodle.com> - 1.3.16-3
- Add fix for failing to link against posix_memalign() (closes 689415)
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.16-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Mon Jul 19 2010 Roman Rakus <rrakus@redhat.com> - 1.3.16-1
- Update to 1.3.16 version
* Thu Jun 03 2010 Roman Rakus <rrakus@redhat.com> - 1.3.14-34
- added dependency on e2fsprogs-static package
* Wed May 26 2010 Roman Rakus <rrakus@redhat.com> - 1.3.14-33
- Allow yaboot to allocate up to 256MB of memory
* Wed May 26 2010 Roman Rakus <rrakus@redhat.com> - 1.3.14-32
- Added missing yaboot-1.3.14-netinfo.patch
Resolves: #553061
- Better iSCSI booting
Resolves: #553748
- Allow copy&paste
Resolves: #593377
- Bump release to 32 (as in RHEL6)
* Fri Jan 22 2010 Roman Rakus <rrasku@redhat.com> 1.3.14-22
- SHA2 support
* Thu Oct 29 2009 Roman Rakus <rrakus@redhat.com> - 1.3.14-21
- When netbooting "clobber" the LOAD_BUFFER and move the kernel into it to make
room for RTAS (#530330)
- Adding better netboot support more work on (#458438)
* Mon Oct 19 2009 Roman Rakus <rrakus@redhat.com> - 1.3.13-20
- Only require hfsutils on fedora and rhel <= 5
- Explicitly build a DEBUG=1 version of yaboot to aid in debugging
- Calling of_open() on a LINUX_NATIVE parttions seesm to work but end up with a
garbage file. Add check to of_open to skip these parttions (#526021).
* Thu Sep 10 2009 Roman Rakus <rrakus@redhat.com> - 1.3.14-19
- Increase TFTP buffer to 32MB
* Wed Sep 09 2009 Roman Rakus <rrakus@redhat.com> - 1.3.14-18
- Do not require hfsutils on RHEL 6
* Fri Aug 14 2009 Roman Rakus <rrakus@redhat.com> - 1.3.14-17
- ipv6 support
- don't build debuginfo package
* Fri Aug 07 2009 Bill Nottingham <notting@redhat.com> - 1.3.14-16
- fix patch file for (#515555)
* Fri Aug 07 2009 Roman Rakus <rrakus@redhat.com> - 1.3.14-15
- Fix bad return code in verbose mode (#515555)
* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.14-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Sun Jun 07 2009 David Woodhouse <David.Woodhouse@intel.com> - 1.3.14-13
- Don't set up bi_recs. Especially not in the middle of the kernel text.
* Mon Apr 06 2009 tony@bakeyournoodle.com - 1.3.14-12
- Increase the TFTP load buffer from 20MiB to 25MiB. (#483051)
* Fri Mar 13 2009 tony@bakeyournoodle.com - 1.3.14-11
- Adding better netboot support (#458438)
- Allocate more buffer space for larger kernels and initrds (#472225)
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.14-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Thu Jan 22 2009 Josh Boyer <jwboyer@gmail.com> - 1.3.14-9
- Add patch to handle relocatable kernels
* Thu Nov 27 2008 Roman Rakus <rrakus@redhat.com> - 1.3.14-8
- Bumped release, so preupgrade is now silent and go through
* Fri Nov 21 2008 David Woodhouse <David.Woodhouse@intel.com> - 1.3.14-7
- Fix 'ybin --bootonce' (#471425)
- Fix maximum token length, to fix preupgrade (#471321)
* Wed Nov 05 2008 Roman Rakus <rrakus@redhat.com> - 1.3.14-6
- Changed kernel load base address
Resolves: #468492
* Mon Aug 11 2008 Roman Rakus <rrakus@redhat.com> - 1.3.14-5
- Clearing in specfile
- Fixed patches for --fuzz=0
* Wed May 28 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 1.3.14-4
- fix license tag
* Wed Apr 16 2008 Roman Rakus <rrakus@redhat.com> - 1.3.14-3
- Upstream 1.3.14
* Thu Mar 27 2008 David Woodhouse <dwmw2@redhat.com> - 1.3.13-11
- Correct off-by-one error in Amiga partition numbers
* Thu Mar 27 2008 David Woodhouse <dwmw2@redhat.com> - 1.3.13-10
- Don't increment partition number to work around bplan firmware
brokenness when the config file was specified on the command line
* Fri Feb 08 2008 David Cantrell <dcantrell@redhat.com> - 1.3.13-9
- Rebuild for gcc-4.3
* Wed Nov 28 2007 David Woodhouse <dwmw2@redhat.com> - 1.3.13-8
- Correct default config file location on Efika
- Disable new USB bindings in efika.forth for now
* Tue Nov 27 2007 David Woodhouse <dwmw2@redhat.com> - 1.3.13-7
- Add efika.forth for fixing up Efika device-tree
* Tue Nov 27 2007 David Woodhouse <dwmw2@redhat.com> - 1.3.13-6
- Detect broken bplan firmware and don't add ":0" to block device names
* Tue Aug 21 2007 David Cantrell <dcantrell@redhat.com> - 1.3.13-5
- Rebuild
* Thu Nov 16 2006 Paul Nasrat <pnasrat@redhat.com> - 1.3.13-4
- Add support for usb/firewire from Alex Kanavin (#208768)
* Thu Nov 09 2006 Paul Nasrat <pnasrat@redhat.com> - 1.3.13-3
- Apply addnote patch (#184714)
* Wed Aug 23 2006 Paul Nasrat <pnasrat@redhat.com> - 1.3.13-2
- Fix ybin with SELinux (#201414)
* Mon Aug 21 2006 Paul Nasrat <pnasrat@redhat.com> - 1.3.13-1
- Fix multi disk G5 patch for all cases
* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 1.3.13-0.18.1
- rebuild
* Tue Feb 21 2006 Paul Nasrat <pnasrat@redhat.com> - 1.3.13-0.18
- Drop telnet console patch for now (#182180)
* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 1.3.13-0.17.1
- bump again for double-long bug on ppc(64)
* Thu Feb 09 2006 Paul Nasrat <pnasrat@redhat.com> - 1.3.13-0.17
- Fix ofpath for multi-disk G5 (#180182)
* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 1.3.13-0.16.2
- rebuilt for new gcc4.1 snapshot and glibc changes
* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt
* Wed Sep 14 2005 Jeremy Katz <katzj@redhat.com> - 1.3.13-0.16
- fix paths
* Wed Sep 14 2005 Jeremy Katz <katzj@redhat.com> - 1.3.13-0.15
- fix build on ppc64
* Wed Sep 14 2005 Paul Nasrat <pnasrat@redhat.com> - 1.3.13-0.14
- New netboot patch handling device=alias: for non network case
* Tue Sep 13 2005 David Woodhouse <dwmw2@redhat.com> - 1.3.13-0.13
- Print version-release of yaboot
* Mon Sep 12 2005 Paul Nasrat <pnasrat@redhat.com> - 1.3.13-0.12
- reworking of netboot patch (Nathan Lynch)
* Sat Aug 20 2005 Paul Nasrat <pnasrat@redhat.com> - 1.3.13-0.11
- drop netboot patch as mac cds fail to load yaboot.conf
* Wed Aug 17 2005 Paul Nasrat <pnasrat@redhat.com> - 1.3.13-0.10
- No colours on unsupported consoles (eg telnet)
- Improved pSeries netbooting (Nathan Lynch)
* Sun Aug 14 2005 David Woodhouse <dwmw2@redhat.com> - 1.3.13-0.9
- Try harder to allocate malloc region
* Thu Aug 11 2005 David Woodhouse <dwmw2@redhat.com> - 1.3.13-0.8
- Allow mntpoint to be more than one directory into the partition
as long as magicboot and nvram are not being used.
* Thu Aug 11 2005 David Woodhouse <dwmw2@redhat.com> - 1.3.13-0.7
- Fix error in swraid2 patch -- don't dereference NULL pointer.
* Tue Aug 9 2005 David Woodhouse <dwmw2@redhat.com> - 1.3.13-0.6
- Fix handling of prom 'read' method, to make Pegasos serial work
* Tue Aug 9 2005 David Woodhouse <dwmw2@redhat.com> - 1.3.13-0.5
- Fix Pegasos partition hack
* Tue Aug 9 2005 David Woodhouse <dwmw2@redhat.com> - 1.3.13-0.4
- Make default boot after timeout work again
- Pegasos disagrees about partition numbering
* Sat Jul 30 2005 David Woodhouse <dwmw2@redhat.com> - 1.3.13-0.3
- Accept config file path on command line
- Make ofpath work on Pegasos
* Fri Jul 29 2005 David Woodhouse <dwmw2@redhat.com> - 1.3.13-0.2
- Workaround claim bug in Pegasos SmartFirmware
- Handle ext2 boot partition
* Fri Jul 22 2005 Paul Nasrat <pnasrat@redhat.com> - 1.3.13-0.1
- Upstream 1.3.13
- Add patches on yaboot-1.3.x tree
- Try dropping ppc64 initrd patch
* Tue Mar 15 2005 Paul Nasrat <pnasrat@redhat.com> - 1.3.12-9
- GCC 4 rebuild
* Wed Feb 02 2005 Paul Nasrat <pnasrat@redhat.com> - 1.3.12-8
- addnote support for IBM,RPA-Client-Config note (#145739)
- Patch to recognise l-lan as a network device
* Wed Jul 28 2004 Paul Nasrat <pnasrat@redhat.com> - 1.3.12-7
- Add yaboot.conf as ghost
* Sat Jul 10 2004 Paul Nasrat <pnasrat@redhat.com> - 1.3.12-6
- Rebuild
* Sat Jul 10 2004 Paul Nasrat <pnasrat@redhat.com> - 1.3.12-5
- Added hfsutils requires for pmac
* Wed Jun 23 2004 David Woodhouse <dwmw2@redhat.com> - 1.3.12-4
- Increase TFTP load buffer size to 8MiB.
* Fri Jun 18 2004 Jeremy Katz <katzj@redhat.com> - 1.3.12-3
- s/Copyright/License/
- fix build with gcc 3.4
* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Mon May 24 2004 Paul Nasrat <pnasrat@redhat.com> 1.3.12-1
- update to 1.3.12
* Tue Apr 20 2004 David Woodhouse <dwmw2@redhat.com> 1.3.10-10
- make yabootconfig use parted if available
* Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Fri Aug 22 2003 Elliot Lee <sopwith@redhat.com> 1.3.10-8
- Build for rawhide
* Fri Jun 20 2003 Jeremy Katz <katzj@redhat.com> 1.3.10-7
- allow passing configfile name to yabootconfig with -C
* Wed Jun 18 2003 Jeremy Katz <katzj@redhat.com> 1.3.10-6
- don't ship (invalid) default yaboot.conf
- update to newer version of ppc64 initrd patch
* Mon Apr 28 2003 Jeremy Katz <katzj@redhat.com> 1.3.10-5
- clean up how yabootconfig adds stuff, do some rediff'ing
- install ybin, etc in /sbin instead of /usr/sbin (#83229)
* Wed Apr 23 2003 Jeremy Katz <katzj@redhat.com> 1.3.10-4
- make sure there's a newline at the end of yaboot.conf generated by
yabootconfig
* Wed Apr 9 2003 Jeremy Katz <katzj@redhat.com> 1.3.10-3
- try to read product name from /etc/redhat-release instead of hard coding
- add patch (from silo) to allow mounting dirty fs's instead of mounting
read-write
* Thu Apr 3 2003 Jeremy Katz <katzj@redhat.com> 1.3.10-2
- add patch from Peter Bergner <bergner@vnet.ibm.com> to add support for
ppc64 initrds (warning: breaks ppc32 initrds)
* Thu Mar 20 2003 Jeremy Katz <katzj@redhat.com> 1.3.10-1
- update to 1.3.10
- fix ofboot patch to use Red Hat Linux instead of Yellow Dog Linux
- include patch from Dan Burcaw for yabootconfig so that it can be used
from the installer
* Tue Jan 21 2003 Elliot Lee <sopwith@redhat.com> 1.3.8-1
- Update to new version
* Wed Dec 11 2002 Tim Powers <timp@redhat.com> 1.3.6-1b.2rh
- rebuild
- added ExclusiveArch
* Wed Mar 06 2002 Dan Burcaw <dburcaw@terrasoftsolutions.com>
- modify for YDL 2.2
* Fri Dec 07 2001 Dan Burcaw <dburcaw@terrasoftsolutions.com>
- update to 1.3.6
* Sat Oct 06 2001 Dan Burcaw <dburcaw@terrasoftsolutions.com>
- update to 1.3.4
* Sun Sep 30 2001 Dan Burcaw <dburcaw@terrasoftsolutions.com>
- updated to yaboot 1.3.3
* Tue Sep 25 2001 Dan Burcaw <dburcaw@terrasoftsolutions.com>
- add makefile patch
* Sun Sep 23 2001 Dan Burcaw <dburcaw@terrasoftsolutions.com>
- update to 1.3.1
- obsoletes ybin
* Thu Aug 08 2001 Dan Burcaw <dburcaw@terrasoftsolutions.com>
- updated to 1.2.3 per Ben H's urgent announcement
- removed obsoleted patches
* Tue Jan 16 2001 Hollis Blanchard <hollis@terrasoftsolutions.com>
- hacked out bug preventing manual boot from yaboot prompt (may break CHRP)
- removed ybin's man pages
- moved to /usr/lib/yaboot for ybin, FHS compliance
- changed permissions to 644 (can't run yaboot under Linux)
* Sat Nov 18 2000 Hollis Blanchard <hollis@terrasoftsolutions.com>
- updated to yaboot 0.9
- added man pages from ybin
- added sample yaboot.conf and bootscript (and README's)
* Sun Feb 27 2000 Dan Burcaw <dburcaw@terrasoftsolutions.com>
- modified for YDL
* Wed Jan 18 2000 Tom Rini <trini@kernel.crashing.org>
- created