From 24e1dbcf5fe710aa110f76473c5b82d274a06e1c Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 27 Nov 2007 18:02:51 +0000 Subject: [PATCH 01/55] fix partition numbering handling with bplan firmware --- yaboot-1.3.13-bplan.patch | 125 ++++++++++++++++++++++++++++++++++++++ yaboot.spec | 8 ++- 2 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 yaboot-1.3.13-bplan.patch diff --git a/yaboot-1.3.13-bplan.patch b/yaboot-1.3.13-bplan.patch new file mode 100644 index 0000000..21d46df --- /dev/null +++ b/yaboot-1.3.13-bplan.patch @@ -0,0 +1,125 @@ +--- yaboot-1.3.13/include/bootinfo.h.nocolonzero 2001-12-01 09:58:10.000000000 +0000 ++++ yaboot-1.3.13/include/bootinfo.h 2007-11-27 17:17:28.000000000 +0000 +@@ -34,6 +34,7 @@ + #define _MACH_classic 0x00000400 /* RPCG RPX-Classic 8xx board */ + #define _MACH_oak 0x00000800 /* IBM "Oak" 403 eval. board */ + #define _MACH_walnut 0x00001000 /* IBM "Walnut" 405GP eval. board */ ++#define _MACH_bplan 0x00002000 /* Pegasos/Efika, broken partition #s */ + + struct bi_record { + unsigned long tag; /* tag ID */ +@@ -51,6 +52,8 @@ struct bi_record { + + #endif /* _PPC_BOOTINFO_H */ + ++extern int _machine; ++ + /* + * Local variables: + * c-file-style: "k&r" +--- yaboot-1.3.13/second/fs_ext2.c.nocolonzero 2007-11-27 17:16:21.000000000 +0000 ++++ yaboot-1.3.13/second/fs_ext2.c 2007-11-27 17:17:43.000000000 +0000 +@@ -35,6 +35,7 @@ + #include "fs.h" + #include "errors.h" + #include "debug.h" ++#include "bootinfo.h" + + #define FAST_VERSION + #define MAX_READ_RANGE 256 +@@ -159,7 +160,8 @@ ext2_open( struct boot_file_t* file, + + /* Open the OF device for the entire disk */ + strncpy(buffer, dev_name, 1020); +- strcat(buffer, ":0"); ++ if (_machine != _MACH_bplan) ++ strcat(buffer, ":0"); + + DEBUG_F("<%s>\n", buffer); + +--- yaboot-1.3.13/second/fs_reiserfs.c.nocolonzero 2001-12-01 09:58:10.000000000 +0000 ++++ yaboot-1.3.13/second/fs_reiserfs.c 2007-11-27 17:18:14.000000000 +0000 +@@ -29,6 +29,7 @@ + #include "fs.h" + #include "errors.h" + #include "debug.h" ++#include "bootinfo.h" + #include "reiserfs/reiserfs.h" + + /* Exported in struct fs_t */ +@@ -84,7 +85,10 @@ reiserfs_open( struct boot_file_t *file, + else + INFO->partition_offset = 0; + +- sprintf( buffer, "%s:%d", dev_name, 0 ); /* 0 is full disk in OF */ ++ strncpy(buffer, dev_name, 1020); ++ if (_machine != _MACH_bplan) ++ strcat(buffer, ":0"); /* 0 is full disk in (non-buggy) OF */ ++ + file->of_device = prom_open( buffer ); + DEBUG_F( "Trying to open dev_name=%s; filename=%s; partition offset=%Lu\n", + buffer, file_name, INFO->partition_offset ); +--- yaboot-1.3.13/second/fs_xfs.c.nocolonzero 2002-09-15 04:12:21.000000000 +0100 ++++ yaboot-1.3.13/second/fs_xfs.c 2007-11-27 17:17:57.000000000 +0000 +@@ -30,6 +30,7 @@ + #include "xfs/xfs.h" + #include "errors.h" + #include "debug.h" ++#include "bootinfo.h" + + #define SECTOR_BITS 9 + +@@ -77,7 +78,9 @@ xfs_open(struct boot_file_t *file, const + else + partition_offset = 0; + +- sprintf(buffer, "%s:%d", dev_name, 0); /* 0 is full disk in OF */ ++ strncpy(buffer, dev_name, 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); + file->of_device = prom_open(buffer); +--- yaboot-1.3.13/second/partition.c.nocolonzero 2007-11-27 17:16:21.000000000 +0000 ++++ yaboot-1.3.13/second/partition.c 2007-11-27 17:17:16.000000000 +0000 +@@ -40,6 +40,7 @@ + #include "linux/iso_fs.h" + #include "debug.h" + #include "errors.h" ++#include "bootinfo.h" + + /* We currently don't check the partition type, some users + * are putting crap there and still expect it to work... +@@ -337,7 +338,8 @@ partitions_lookup(const char *device) + unsigned int prom_blksize, iso_root_block; + + strncpy(block_buffer, device, 2040); +- strcat(block_buffer, ":0"); ++ if (_machine != _MACH_bplan) ++ strcat(block_buffer, ":0"); + + /* Open device */ + disk = prom_open(block_buffer); +--- yaboot-1.3.13/second/yaboot.c.nocolonzero 2007-11-27 17:16:21.000000000 +0000 ++++ yaboot-1.3.13/second/yaboot.c 2007-11-27 17:16:21.000000000 +0000 +@@ -222,7 +222,10 @@ yaboot_start (unsigned long r3, unsigned + root = prom_finddevice("/"); + if (root != 0) { + static char model[256]; +- if (prom_getprop(root, "device_type", model, 256 ) > 0 && ++ if (prom_getprop(root, "CODEGEN,vendor", model, 256) > 0 && ++ !strncmp("bplan", model, 5)) ++ _machine = _MACH_bplan; ++ else if (prom_getprop(root, "device_type", model, 256 ) > 0 && + !strncmp("chrp", model, 4)) + _machine = _MACH_chrp; + else { +@@ -1490,7 +1493,7 @@ yaboot_main(void) + boot.dev, boot.part, boot.file); + + if (!conf_given) { +- if (_machine == _MACH_chrp) ++ if (_machine == _MACH_chrp || _machine == _MACH_bplan) + boot.file = "/etc/"; + else if (strlen(boot.file)) { + if (!strncmp(boot.file, "\\\\", 2)) diff --git a/yaboot.spec b/yaboot.spec index a457d13..a7dca4b 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.13 -Release: 5%{?dist} +Release: 6%{?dist} License: GPL Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -36,6 +36,8 @@ Patch28: yaboot-1.3.13-multisata.patch Patch29: yaboot-1.3.13-dontwritehome.patch Patch30: yaboot-1.3.12-addnote.patch Patch31: yaboot-1.3.13-ofpath-firewire-usb.patch +Patch32: yaboot-1.3.13-bplan.patch + URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root Obsoletes: ybin @@ -81,6 +83,7 @@ yaboot can also bootload IBM pSeries machines. %patch29 -p1 -b .bootwrite %patch30 -p1 -b .addnote %patch31 -p1 -b .firewire +%patch32 -p1 -b .bplan %build make VERSIONEXTRA='\ (Red Hat %version-%release)' @@ -114,6 +117,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Tue Nov 27 2007 David Woodhouse - 1.3.13-6 +- Detect broken bplan firmware and don't add ":0" to block device names + * Tue Aug 21 2007 David Cantrell - 1.3.13-5 - Rebuild From 9c9f0459aef6c2d81661b3393b37d27264939372 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 27 Nov 2007 20:13:22 +0000 Subject: [PATCH 02/55] add efika.forth --- efika.forth | 336 ++++++++++++++++++++++++++++++++++++++++++++++++++++ yaboot.spec | 10 +- 2 files changed, 344 insertions(+), 2 deletions(-) create mode 100644 efika.forth diff --git a/efika.forth b/efika.forth new file mode 100644 index 0000000..e701d4b --- /dev/null +++ b/efika.forth @@ -0,0 +1,336 @@ +\ 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 +1 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 \ No newline at end of file diff --git a/yaboot.spec b/yaboot.spec index a7dca4b..a042cf2 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,10 +1,11 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.13 -Release: 6%{?dist} +Release: 7%{?dist} License: GPL 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 @@ -92,7 +93,8 @@ make VERSIONEXTRA='\ (Red Hat %version-%release)' %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 %clean rm -rf $RPM_BUILD_ROOT @@ -100,6 +102,7 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %doc COPYING README* doc/* +/boot/efika.forth /sbin/ofpath /sbin/ybin /sbin/yabootconfig @@ -117,6 +120,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Tue Nov 27 2007 David Woodhouse - 1.3.13-7 +- Add efika.forth for fixing up Efika device-tree + * Tue Nov 27 2007 David Woodhouse - 1.3.13-6 - Detect broken bplan firmware and don't add ":0" to block device names From 669d68438a17de74eabf72af46ccef30d052c3d8 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 28 Nov 2007 13:20:47 +0000 Subject: [PATCH 03/55] more efika fixes --- efika.forth | 4 ++-- yaboot-1.3.13-bplan.patch | 8 +++++++- yaboot.spec | 6 +++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/efika.forth b/efika.forth index e701d4b..786212e 100644 --- a/efika.forth +++ b/efika.forth @@ -96,7 +96,7 @@ device-end \ New USB binding - change one of the numbers here to disable it for older kernels \ as this is a destructive change -1 1 = if +0 1 = if s" /builtin/usb" find-device s" usb-ohci" device-type s" " encode-string s" big-endian" property @@ -333,4 +333,4 @@ new-device finish-device \ Optionally uncomment and boot your Linux -\ s" hd:0 vmlinuz console= blah=" $boot \ No newline at end of file +\ s" hd:0 vmlinuz console= blah=" $boot diff --git a/yaboot-1.3.13-bplan.patch b/yaboot-1.3.13-bplan.patch index 21d46df..445757d 100644 --- a/yaboot-1.3.13-bplan.patch +++ b/yaboot-1.3.13-bplan.patch @@ -114,7 +114,13 @@ !strncmp("chrp", model, 4)) _machine = _MACH_chrp; else { -@@ -1490,7 +1493,7 @@ yaboot_main(void) +@@ -1486,11 +1489,13 @@ yaboot_main(void) + prom_printf("%s: Unable to parse\n", bootdevice); + return -1; + } ++ if (_machine == _MACH_bplan) ++ boot.part++; + DEBUG_F("After parse_device_path: dev=%s, part=%d, file=%s\n", boot.dev, boot.part, boot.file); if (!conf_given) { diff --git a/yaboot.spec b/yaboot.spec index a042cf2..132b6e5 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.13 -Release: 7%{?dist} +Release: 8%{?dist} License: GPL Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -120,6 +120,10 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Wed Nov 28 2007 David Woodhouse - 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 - 1.3.13-7 - Add efika.forth for fixing up Efika device-tree From 2da635ceb9af8c4b2ae9df6e930e5dd18769d70d Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Fri, 8 Feb 2008 21:59:29 +0000 Subject: [PATCH 04/55] - Rebuild for gcc-4.3 --- yaboot.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yaboot.spec b/yaboot.spec index 132b6e5..445e205 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.13 -Release: 8%{?dist} +Release: 9%{?dist} License: GPL Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -120,6 +120,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Fri Feb 08 2008 David Cantrell - 1.3.13-9 +- Rebuild for gcc-4.3 + * Wed Nov 28 2007 David Woodhouse - 1.3.13-8 - Correct default config file location on Efika - Disable new USB bindings in efika.forth for now From c083412369d72a71e41b6f9fff41c4387a372127 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 27 Mar 2008 23:09:10 +0000 Subject: [PATCH 05/55] Don't fuck with the partition number when the user gave conf= on the command line. --- yaboot-1.3.13-bplan.patch | 2 +- yaboot.spec | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/yaboot-1.3.13-bplan.patch b/yaboot-1.3.13-bplan.patch index 445757d..2a9b642 100644 --- a/yaboot-1.3.13-bplan.patch +++ b/yaboot-1.3.13-bplan.patch @@ -118,7 +118,7 @@ prom_printf("%s: Unable to parse\n", bootdevice); return -1; } -+ if (_machine == _MACH_bplan) ++ if (_machine == _MACH_bplan && !conf_given) + boot.part++; DEBUG_F("After parse_device_path: dev=%s, part=%d, file=%s\n", boot.dev, boot.part, boot.file); diff --git a/yaboot.spec b/yaboot.spec index 445e205..43eb8b2 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.13 -Release: 9%{?dist} +Release: 10%{?dist} License: GPL Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -120,6 +120,10 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Thu Mar 27 2008 David Woodhouse - 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 - 1.3.13-9 - Rebuild for gcc-4.3 From 78836e00810ae3881a94dfef5acad33852399299 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 7 Apr 2008 14:48:14 +0000 Subject: [PATCH 06/55] Correct off-by-one in Amiga partitioning --- yaboot-1.3.13-amigaparts.patch | 2 +- yaboot.spec | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/yaboot-1.3.13-amigaparts.patch b/yaboot-1.3.13-amigaparts.patch index ac07876..7d1744d 100644 --- a/yaboot-1.3.13-amigaparts.patch +++ b/yaboot-1.3.13-amigaparts.patch @@ -90,7 +90,7 @@ + for (i=0; i < possible; i++) used[i] = 0; + + -+ for (part = amiga_block[AMIGA_PARTITIONS], partition = 0; ++ for (part = amiga_block[AMIGA_PARTITIONS], partition = 1; + part != AMIGA_END; + part = amiga_block[AMIGA_PART_NEXT], partition++) + { diff --git a/yaboot.spec b/yaboot.spec index 43eb8b2..b3abd4f 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.13 -Release: 10%{?dist} +Release: 11%{?dist} License: GPL Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -120,6 +120,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Thu Mar 27 2008 David Woodhouse - 1.3.13-11 +- Correct off-by-one error in Amiga partition numbers + * Thu Mar 27 2008 David Woodhouse - 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 From eb3a1ec169b6776da638a651cfdd40554223cec1 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Wed, 16 Apr 2008 11:21:11 +0000 Subject: [PATCH 07/55] Upstream 1.3.14 --- .cvsignore | 1 + sources | 1 + yaboot-1.3.13-yabootconfig.patch | 19 +++++++--------- yaboot-ppc64.patch | 25 ++++----------------- yaboot.spec | 38 ++++++++++++++++++-------------- 5 files changed, 35 insertions(+), 49 deletions(-) diff --git a/.cvsignore b/.cvsignore index cd2576c..1961ae2 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,2 +1,3 @@ yaboot-1.3.12.tar.gz yaboot-1.3.13.tar.gz +yaboot-1.3.14.tar.gz diff --git a/sources b/sources index 1f56f93..8c34882 100644 --- a/sources +++ b/sources @@ -1,2 +1,3 @@ 85cf685c1dc5873c2a5124ba4524b2d2 yaboot-1.3.12.tar.gz f12798d1b2063f21d07e0ae7f602ccaf yaboot-1.3.13.tar.gz +dd346812667ab3818248c9784fe8e38e yaboot-1.3.14.tar.gz diff --git a/yaboot-1.3.13-yabootconfig.patch b/yaboot-1.3.13-yabootconfig.patch index 953d1f8..a6f6967 100644 --- a/yaboot-1.3.13-yabootconfig.patch +++ b/yaboot-1.3.13-yabootconfig.patch @@ -114,17 +114,14 @@ "") break ;; -@@ -474,7 +563,9 @@ - +@@ -474,6 +563,6 @@ + READLINKKV=`readlink /usr/src/linux` ## find the kernel in the usual places and (if not --quiet) ask the ## user if we cannot find one. --if [ -f "${CHROOT}vmlinux" ] ; then -+if [ -f "${CHROOT}${KERNELIMAGE}" ] ; then -+ KERNEL="${CHROOT}${KERNELIMAGE}" -+elif [ -f "${CHROOT}vmlinux" ] ; then - KERNEL="${CHROOT}vmlinux" - if [ -f "${CHROOT}initrd" ] ; then - INITRD="${CHROOT}initrd" +-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}" @@ -721,6 +812,36 @@ HEADER="## see also: /usr/share/doc/yaboot/examples for example configurations.\n" fi @@ -162,7 +159,7 @@ ## setup append line if [ -n "$KERNARGS" ] ; then APPEND="\tappend=\"${KERNARGS}\"\n" -@@ -740,24 +861,64 @@ +@@ -731,24 +850,64 @@ INITRDIMGS="\tinitrd=$INITRDIMG\n\tinitrd-size=8192\n" fi @@ -199,7 +196,7 @@ -## -## run: \"man yaboot.conf\" for details. Do not make changes until you have!! -${HEADER}## --## For a dual-boot menu, add one or more of: +-## For a dual-boot menu, add one or more of: -## bsd=/dev/hdaX, macos=/dev/hdaY, macosx=/dev/hdaZ\n -boot=${BOOT}${DEVICE:-} +GLOBAL="boot=${BOOT}${DEVICE:-} diff --git a/yaboot-ppc64.patch b/yaboot-ppc64.patch index 18d1302..c2cd9c6 100644 --- a/yaboot-ppc64.patch +++ b/yaboot-ppc64.patch @@ -1,29 +1,12 @@ --- 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 -@@ -31,7 +31,7 @@ +@@ -36,7 +36,7 @@ # The flags for the yaboot binary. # --YBCFLAGS = -Os $(CFLAGS) -nostdinc -Wall -isystem `gcc -print-file-name=include` -fsigned-char +-YBCFLAGS = -Os $(CFLAGS) -nostdinc -Wall -isystem `$(CC) -m32 -print-file-name=include` -fsigned-char +-YBCFLAGS += -DVERSION=\"${VERSION}${VERSIONEXTRA}\" #" +YBCFLAGS = -Os -m32 $(CFLAGS) -nostdinc -Wall -isystem `$(CC) -m32 -print-file-name=include` -fsigned-char - YBCFLAGS += -DVERSION="\"${VERSION}${VERSIONEXTRA}\"" #" ++YBCFLAGS += -DVERSION="\"${VERSION}${VERSIONEXTRA}\"" #" YBCFLAGS += -DTEXTADDR=$(TEXTADDR) -DDEBUG=$(DEBUG) YBCFLAGS += -DMALLOCADDR=$(MALLOCADDR) -DMALLOCSIZE=$(MALLOCSIZE) -@@ -60,7 +60,7 @@ - - # Link flags - # --LFLAGS = -Ttext $(TEXTADDR) -Bstatic -+LFLAGS = -Ttext $(TEXTADDR) -Bstatic -melf32ppclinux - - # Libraries - # -@@ -100,7 +100,7 @@ - AS := $(CROSS)as - OBJCOPY := $(CROSS)objcopy - --lgcc = `$(CC) -print-libgcc-file-name` -+lgcc = `$(CC) -m32 -print-libgcc-file-name` - - all: yaboot addnote mkofboot - diff --git a/yaboot.spec b/yaboot.spec index b3abd4f..2750b08 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot -Version: 1.3.13 -Release: 11%{?dist} +Version: 1.3.14 +Release: 0%{?dist} License: GPL Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -44,6 +44,7 @@ BuildRoot: %{_tmppath}/%{name}-root Obsoletes: ybin ExclusiveArch: ppc ppc64 Requires: hfsutils +BuildRequires: e2fsprogs-devel %description yaboot is a bootloader for PowerPC machines which works on New World ROM @@ -63,28 +64,28 @@ yaboot can also bootload IBM pSeries machines. %patch8 -p1 -b .sbin %patch9 -p1 -b .config %patch10 -p1 -b .parted -%patch11 -p1 -b .manpage -%patch12 -p1 -b .gcc34 -%patch13 -p1 -b .amigaparts -%patch14 -p1 -b .swraid1 -%patch15 -p1 -b .nobootx -%patch16 -p1 -b .swraid2 +#%patch11 -p1 -b .manpage +#%patch12 -p1 -b .gcc34 +#%patch13 -p1 -b .amigaparts +#%patch14 -p1 -b .swraid1 +#%patch15 -p1 -b .nobootx +#%patch16 -p1 -b .swraid2 %patch17 -p1 -b .pegasos %patch18 -p1 -b .ext2 -%patch19 -p1 -b .confarg -%patch20 -p1 -b .ofpath +#%patch19 -p1 -b .confarg +#%patch20 -p1 -b .ofpath %patch21 -p1 -b .pegasos-serial %patch22 -p1 -b .deepmnt -%patch23 -p1 -b .malloc +#%patch23 -p1 -b .malloc #patch24 -p1 -b .telnet -%patch25 -p1 -b .netboot -%patch26 -p1 -b .printversion +#%patch25 -p1 -b .netboot +#%patch26 -p1 -b .printversion %patch27 -p1 -b .ppc64 -%patch28 -p1 -b .multisata +#%patch28 -p1 -b .multisata %patch29 -p1 -b .bootwrite -%patch30 -p1 -b .addnote -%patch31 -p1 -b .firewire -%patch32 -p1 -b .bplan +#%patch30 -p1 -b .addnote +#%patch31 -p1 -b .firewire +#%patch32 -p1 -b .bplan %build make VERSIONEXTRA='\ (Red Hat %version-%release)' @@ -120,6 +121,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Wed Apr 16 2008 Roman Rakus +- Upstram 1.3.14 + * Thu Mar 27 2008 David Woodhouse - 1.3.13-11 - Correct off-by-one error in Amiga partition numbers From 5efd759909a98b13a76682cf374e0adddd92a993 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Wed, 16 Apr 2008 13:21:29 +0000 Subject: [PATCH 08/55] Clean for PPC64 --- yaboot-ppc64.patch | 2 +- yaboot.spec | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/yaboot-ppc64.patch b/yaboot-ppc64.patch index c2cd9c6..b8ab642 100644 --- a/yaboot-ppc64.patch +++ b/yaboot-ppc64.patch @@ -6,7 +6,7 @@ # -YBCFLAGS = -Os $(CFLAGS) -nostdinc -Wall -isystem `$(CC) -m32 -print-file-name=include` -fsigned-char -YBCFLAGS += -DVERSION=\"${VERSION}${VERSIONEXTRA}\" #" -+YBCFLAGS = -Os -m32 $(CFLAGS) -nostdinc -Wall -isystem `$(CC) -m32 -print-file-name=include` -fsigned-char ++YBCFLAGS = -Os $(CFLAGS) -nostdinc -Wall -isystem `$(CC) -print-file-name=include` -fsigned-char +YBCFLAGS += -DVERSION="\"${VERSION}${VERSIONEXTRA}\"" #" YBCFLAGS += -DTEXTADDR=$(TEXTADDR) -DDEBUG=$(DEBUG) YBCFLAGS += -DMALLOCADDR=$(MALLOCADDR) -DMALLOCSIZE=$(MALLOCSIZE) diff --git a/yaboot.spec b/yaboot.spec index 2750b08..fda3b9d 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 0%{?dist} +Release: 1%{?dist} License: GPL Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -121,8 +121,8 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog -* Wed Apr 16 2008 Roman Rakus -- Upstram 1.3.14 +* Wed Apr 16 2008 Roman Rakus - 1.3.14-1 +- Upstream 1.3.14 * Thu Mar 27 2008 David Woodhouse - 1.3.13-11 - Correct off-by-one error in Amiga partition numbers From 81396601fe7f02e26c6a8dbbd290eb9ff7a80431 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Thu, 17 Apr 2008 10:22:37 +0000 Subject: [PATCH 09/55] PPC64 compiling/linking --- yaboot-ppc64.patch | 11 ++++++++++- yaboot.spec | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/yaboot-ppc64.patch b/yaboot-ppc64.patch index b8ab642..3c9c644 100644 --- a/yaboot-ppc64.patch +++ b/yaboot-ppc64.patch @@ -6,7 +6,16 @@ # -YBCFLAGS = -Os $(CFLAGS) -nostdinc -Wall -isystem `$(CC) -m32 -print-file-name=include` -fsigned-char -YBCFLAGS += -DVERSION=\"${VERSION}${VERSIONEXTRA}\" #" -+YBCFLAGS = -Os $(CFLAGS) -nostdinc -Wall -isystem `$(CC) -print-file-name=include` -fsigned-char ++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) +@@ -65,7 +65,7 + # Link flags + # +-LFLAGS = -Ttext $(TEXTADDR) -Bstatic -melf32ppclinux ++LFLAGS = -Ttext $(TEXTADDR) -Bstatic + + # Libraries + # + LLIBS = -lext2fs diff --git a/yaboot.spec b/yaboot.spec index fda3b9d..8f8a5df 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -121,7 +121,7 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog -* Wed Apr 16 2008 Roman Rakus - 1.3.14-1 +* Wed Apr 16 2008 Roman Rakus - 1.3.14-2 - Upstream 1.3.14 * Thu Mar 27 2008 David Woodhouse - 1.3.13-11 From 62e5b4b7cbd5a3c2f0722785ad42096d16eeff3f Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Thu, 17 Apr 2008 10:36:46 +0000 Subject: [PATCH 10/55] PPC64 compiling/linking --- yaboot-ppc64.patch | 2 +- yaboot.spec | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/yaboot-ppc64.patch b/yaboot-ppc64.patch index 3c9c644..8f9dd3e 100644 --- a/yaboot-ppc64.patch +++ b/yaboot-ppc64.patch @@ -10,7 +10,7 @@ +YBCFLAGS += -DVERSION="\"${VERSION}${VERSIONEXTRA}\"" #" YBCFLAGS += -DTEXTADDR=$(TEXTADDR) -DDEBUG=$(DEBUG) YBCFLAGS += -DMALLOCADDR=$(MALLOCADDR) -DMALLOCSIZE=$(MALLOCSIZE) -@@ -65,7 +65,7 +@@ -65,7 +65,7 @@ # Link flags # -LFLAGS = -Ttext $(TEXTADDR) -Bstatic -melf32ppclinux diff --git a/yaboot.spec b/yaboot.spec index 8f8a5df..4a19b5b 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 2%{?dist} +Release: 3%{?dist} License: GPL Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -121,7 +121,7 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog -* Wed Apr 16 2008 Roman Rakus - 1.3.14-2 +* Wed Apr 16 2008 Roman Rakus - 1.3.14-3 - Upstream 1.3.14 * Thu Mar 27 2008 David Woodhouse - 1.3.13-11 From 08882edc9fd6917c970c5a597121ab9d481ad72c Mon Sep 17 00:00:00 2001 From: Tom Callaway Date: Wed, 28 May 2008 21:24:20 +0000 Subject: [PATCH 11/55] fix license tag --- yaboot.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/yaboot.spec b/yaboot.spec index 4a19b5b..f8973d0 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,8 +1,8 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 3%{?dist} -License: GPL +Release: 4%{?dist} +License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz Source1: efika.forth @@ -121,6 +121,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Wed May 28 2008 Tom "spot" Callaway - 1.3.14-4 +- fix license tag + * Wed Apr 16 2008 Roman Rakus - 1.3.14-3 - Upstream 1.3.14 From 8b3a6c5f35bf9e2b6c72ea3a6a17c1aa8c85b980 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Mon, 11 Aug 2008 08:56:27 +0000 Subject: [PATCH 12/55] Cleared specfile cvs of unsused patches. Patches fixed for fuzz=0 --- yaboot-1.3.10-yabootconfig.patch | 251 --------------- yaboot-1.3.12-addnote.patch | 113 ------- yaboot-1.3.12-gcc34.patch | 22 -- yaboot-1.3.12-swraid.patch | 21 -- yaboot-1.3.13-amigaparts.patch | 189 ------------ yaboot-1.3.13-bplan.patch | 131 -------- yaboot-1.3.13-confarg.patch | 166 ---------- yaboot-1.3.13-gcc34.patch | 12 - yaboot-1.3.13-malloc.patch | 22 -- yaboot-1.3.13-manpage.patch | 95 ------ yaboot-1.3.13-multisata.patch | 30 -- yaboot-1.3.13-netboot.patch | 179 ----------- yaboot-1.3.13-nobootx.patch | 17 - yaboot-1.3.13-ofpath-firewire-usb.patch | 41 --- yaboot-1.3.13-ofpath-pegasos.patch | 83 ----- yaboot-1.3.13-printversion.patch | 11 - yaboot-1.3.13-swraid1.patch | 179 ----------- yaboot-1.3.13-swraid2.patch | 111 ------- yaboot-1.3.13-telnet.patch | 11 - yaboot-1.3.8-ppc64-initrd.patch | 393 ------------------------ yaboot.spec | 50 +-- 21 files changed, 10 insertions(+), 2117 deletions(-) delete mode 100644 yaboot-1.3.10-yabootconfig.patch delete mode 100644 yaboot-1.3.12-addnote.patch delete mode 100644 yaboot-1.3.12-gcc34.patch delete mode 100644 yaboot-1.3.12-swraid.patch delete mode 100644 yaboot-1.3.13-amigaparts.patch delete mode 100644 yaboot-1.3.13-bplan.patch delete mode 100644 yaboot-1.3.13-confarg.patch delete mode 100644 yaboot-1.3.13-gcc34.patch delete mode 100644 yaboot-1.3.13-malloc.patch delete mode 100644 yaboot-1.3.13-manpage.patch delete mode 100644 yaboot-1.3.13-multisata.patch delete mode 100644 yaboot-1.3.13-netboot.patch delete mode 100644 yaboot-1.3.13-nobootx.patch delete mode 100644 yaboot-1.3.13-ofpath-firewire-usb.patch delete mode 100644 yaboot-1.3.13-ofpath-pegasos.patch delete mode 100644 yaboot-1.3.13-printversion.patch delete mode 100644 yaboot-1.3.13-swraid1.patch delete mode 100644 yaboot-1.3.13-swraid2.patch delete mode 100644 yaboot-1.3.13-telnet.patch delete mode 100644 yaboot-1.3.8-ppc64-initrd.patch diff --git a/yaboot-1.3.10-yabootconfig.patch b/yaboot-1.3.10-yabootconfig.patch deleted file mode 100644 index 5f80b76..0000000 --- a/yaboot-1.3.10-yabootconfig.patch +++ /dev/null @@ -1,251 +0,0 @@ ---- yaboot-1.3.10/ybin/yabootconfig.yabootconfig 2003-02-08 23:53:46.000000000 -0500 -+++ yaboot-1.3.10/ybin/yabootconfig 2003-04-28 18:13:16.000000000 -0400 -@@ -34,6 +34,7 @@ - NOINSTALL=0 - QUIET=0 - DEBUG=0 -+LABEL="Linux" - SIGINT="$PRG: Interrupt caught ... exiting" - export LC_COLLATE=C - -@@ -309,6 +310,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" -@@ -327,10 +338,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 - ;; -@@ -439,7 +528,9 @@ - - ## find the kernel in the usual places and (if not --quiet) ask the - ## user if we cannot find one. --if [ -f "${CHROOT}vmlinux" ] ; then -+if [ -f "${CHROOT}${KERNELIMAGE}" ] ; then -+ KERNEL="${CHROOT}${KERNELIMAGE}" -+elif [ -f "${CHROOT}vmlinux" ] ; then - KERNEL="${CHROOT}vmlinux" - elif [ -f "${CHROOT}boot/vmlinux" ] ; then - KERNEL="${CHROOT}boot/vmlinux" -@@ -565,6 +656,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" -@@ -579,24 +700,64 @@ - fi - 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 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:-}" -+\tlabel=$LABEL -+\troot=$ROOT -+\tread-only -+${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. -@@ -606,7 +767,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 diff --git a/yaboot-1.3.12-addnote.patch b/yaboot-1.3.12-addnote.patch deleted file mode 100644 index 00e09b9..0000000 --- a/yaboot-1.3.12-addnote.patch +++ /dev/null @@ -1,113 +0,0 @@ ---- yaboot-1.3.12/util/addnote.c.addnote 2001-12-01 04:58:11.000000000 -0500 -+++ yaboot-1.3.12/util/addnote.c 2005-02-02 09:47:02.321140000 -0500 -@@ -28,6 +28,7 @@ - #include - #include - -+/* CHRP note section */ - char arch[] = "PowerPC"; - - #define N_DESCR 6 -@@ -40,6 +41,29 @@ - 0x4000, /* load-base */ - }; - -+/* RPA note section */ -+char rpaname[] = "IBM,RPA-Client-Config"; -+ -+/* -+ * Note: setting ignore_my_client_config *should* mean that OF ignores -+ * all the other fields, but there is a firmware bug which means that -+ * it looks at the splpar field at least. So these values need to be -+ * reasonable. -+ */ -+#define N_RPA_DESCR 8 -+unsigned int rpanote[N_RPA_DESCR] = { -+ 0, /* lparaffinity */ -+ 64, /* min_rmo_size */ -+ 0, /* min_rmo_percent */ -+ 40, /* max_pft_size */ -+ 1, /* splpar */ -+ -1, /* min_load */ -+ 0, /* new_mem_def */ -+ 1, /* ignore_my_client_config */ -+}; -+ -+#define ROUNDUP(len) (((len) + 3) & ~3) -+ - unsigned char buf[512]; - - #define GET_16BE(off) ((buf[off] << 8) + (buf[(off)+1])) -@@ -77,7 +101,7 @@ - { - int fd, n, i; - int ph, ps, np; -- int nnote, ns; -+ int nnote, nnote2, ns; - - if (ac != 2) { - fprintf(stderr, "Usage: %s elf-file\n", av[0]); -@@ -89,7 +113,8 @@ - exit(1); - } - -- nnote = strlen(arch) + 1 + (N_DESCR + 3) * 4; -+ nnote = 12 + ROUNDUP(strlen(arch) + 1) + sizeof(descr); -+ nnote2 = 12 + ROUNDUP(strlen(rpaname) + 1) + sizeof(rpanote); - - n = read(fd, buf, sizeof(buf)); - if (n < 0) { -@@ -112,7 +137,7 @@ - np = GET_16BE(E_PHNUM); - if (ph < E_HSIZE || ps < PH_HSIZE || np < 1) - goto notelf; -- if (ph + (np + 1) * ps + nnote > n) -+ if (ph + (np + 2) * ps + nnote + nnote2 > n) - goto nospace; - - for (i = 0; i < np; ++i) { -@@ -125,12 +150,12 @@ - } - - /* XXX check that the area we want to use is all zeroes */ -- for (i = 0; i < ps + nnote; ++i) -+ for (i = 0; i < 2 * ps + nnote + nnote2; ++i) - if (buf[ph + i] != 0) - goto nospace; - - /* fill in the program header entry */ -- ns = ph + ps; -+ ns = ph + 2 * ps; - PUT_32BE(ph + PH_TYPE, PT_NOTE); - PUT_32BE(ph + PH_OFFSET, ns); - PUT_32BE(ph + PH_FILESZ, nnote); -@@ -142,11 +167,26 @@ - PUT_32BE(ns + 8, 0x1275); - strcpy(&buf[ns + 12], arch); - ns += 12 + strlen(arch) + 1; -- for (i = 0; i < N_DESCR; ++i) -- PUT_32BE(ns + i * 4, descr[i]); -+ for (i = 0; i < N_DESCR; ++i, ns += 4) -+ PUT_32BE(ns, descr[i]); -+ -+ /* fill in the second program header entry and the RPA note area */ -+ ph += ps; -+ PUT_32BE(ph + PH_TYPE, PT_NOTE); -+ PUT_32BE(ph + PH_OFFSET, ns); -+ PUT_32BE(ph + PH_FILESZ, nnote2); -+ -+ /* fill in the note area we point to */ -+ PUT_32BE(ns, strlen(rpaname) + 1); -+ PUT_32BE(ns + 4, sizeof(rpanote)); -+ PUT_32BE(ns + 8, 0x12759999); -+ strcpy(&buf[ns + 12], rpaname); -+ ns += 12 + ROUNDUP(strlen(rpaname) + 1); -+ for (i = 0; i < N_RPA_DESCR; ++i, ns += 4) -+ PUT_32BE(ns, rpanote[i]); - - /* Update the number of program headers */ -- PUT_16BE(E_PHNUM, np + 1); -+ PUT_16BE(E_PHNUM, np + 2); - - /* write back */ - lseek(fd, (long) 0, SEEK_SET); diff --git a/yaboot-1.3.12-gcc34.patch b/yaboot-1.3.12-gcc34.patch deleted file mode 100644 index e34277d..0000000 --- a/yaboot-1.3.12-gcc34.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- yaboot-1.3.12/lib/strstr.c.gcc34 2004-06-18 16:47:43.669136744 -0400 -+++ yaboot-1.3.12/lib/strstr.c 2004-06-18 16:48:05.700787424 -0400 -@@ -76,7 +76,8 @@ - a = *++haystack; - if (a == '\0') - goto ret0; --shloop: } -+shloop: ; -+ } - while (a != b); - - jin: a = *++haystack; ---- yaboot-1.3.12/lib/malloc.c.gcc34 2004-06-18 16:46:29.718378968 -0400 -+++ yaboot-1.3.12/lib/malloc.c 2004-06-18 16:48:41.972273320 -0400 -@@ -21,6 +21,7 @@ - - #include "types.h" - #include "stddef.h" -+#include - - /* Imported functions */ - extern void prom_printf (char *fmt, ...); diff --git a/yaboot-1.3.12-swraid.patch b/yaboot-1.3.12-swraid.patch deleted file mode 100644 index 64bcf50..0000000 --- a/yaboot-1.3.12-swraid.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- yaboot-1.3.12/include/fdisk-part.h.raid 2001-12-01 09:58:10.000000000 +0000 -+++ yaboot-1.3.12/include/fdisk-part.h 2005-04-27 08:01:33.000000000 +0100 -@@ -27,6 +27,7 @@ - #define LINUX_SWAP 0x82 - #define LINUX_NATIVE 0x83 - #define LINUX_EXTENDED 0x85 -+#define LINUX_RAID 0xfd - - struct fdisk_partition { - unsigned char boot_ind; /* 0x80 - active */ ---- yaboot-1.3.12/second/partition.c.raid 2005-04-27 08:01:45.000000000 +0100 -+++ yaboot-1.3.12/second/partition.c 2005-04-27 08:02:07.000000000 +0100 -@@ -167,7 +167,7 @@ - (struct fdisk_partition *) (block_buffer + 0x1be); - - for (partition=1; partition <= 4 ;partition++, part++) { -- if (part->sys_ind == LINUX_NATIVE) { -+ if (part->sys_ind == LINUX_NATIVE || part->sys_ind == LINUX_RAID) { - add_new_partition( list, - partition, - "Linux", /* type */ diff --git a/yaboot-1.3.13-amigaparts.patch b/yaboot-1.3.13-amigaparts.patch deleted file mode 100644 index 7d1744d..0000000 --- a/yaboot-1.3.13-amigaparts.patch +++ /dev/null @@ -1,189 +0,0 @@ ---- yaboot-1.3.13/second/partition.c.amigaparts 2002-09-14 23:12:05.000000000 -0400 -+++ yaboot-1.3.13/second/partition.c 2005-07-25 16:54:22.000000000 -0400 -@@ -1,6 +1,8 @@ - /* - * partition.c - partition table support - * -+ * Copyright (C) 2004 Sven Luther -+ * - * Copyright (C) 2001, 2002 Ethan Benson - * - * Copyright (C) 1999 Benjamin Herrenschmidt -@@ -31,6 +33,7 @@ - #include "stdlib.h" - #include "mac-part.h" - #include "fdisk-part.h" -+#include "amiga-part.h" - #include "partition.h" - #include "prom.h" - #include "string.h" -@@ -213,6 +216,114 @@ - return 0; - } - -+/* -+ * Detects and read amiga partition tables. -+ */ -+ -+static int -+_amiga_checksum (unsigned int blk_size) -+{ -+ unsigned int sum; -+ int i, end; -+ unsigned int *amiga_block = (unsigned int *) block_buffer; -+ -+ sum = amiga_block[0]; -+ end = amiga_block[AMIGA_LENGTH]; -+ -+ if (end > blk_size) end = blk_size; -+ -+ for (i = 1; i < end; i++) sum += amiga_block[i]; -+ -+ return sum; -+} -+ -+static int -+_amiga_find_rdb (const char *dev_name, prom_handle disk, unsigned int prom_blksize) -+{ -+ int i; -+ unsigned int *amiga_block = (unsigned int *) block_buffer; -+ -+ for (i = 0; i -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ */ -+ -+#define AMIGA_RDB_MAX 16 -+#define AMIGA_ID_RDB 0x5244534B /* 'RDSK' */ -+#define AMIGA_ID_PART 0x50415254 /* 'PART' */ -+#define AMIGA_END 0xffffffff -+ -+#define AMIGA_ID 0 -+#define AMIGA_LENGTH 1 -+#define AMIGA_PARTITIONS 7 -+#define AMIGA_CYL 16 -+#define AMIGA_SECT 17 -+#define AMIGA_HEADS 18 -+#define AMIGA_RDBLIMIT 33 -+ -+ -+#define AMIGA_PART_NEXT 4 -+#define AMIGA_PART_FLAGS 8 -+#define AMIGA_PART_LOWCYL 41 -+#define AMIGA_PART_HIGHCYL 42 -+#define AMIGA_PART_DOSTYPE 48 -+ -+#define AMIGA_PART_BOOTABLE 0x1 -+#define AMIGA_PART_NOMOUNT 0x2 diff --git a/yaboot-1.3.13-bplan.patch b/yaboot-1.3.13-bplan.patch deleted file mode 100644 index 2a9b642..0000000 --- a/yaboot-1.3.13-bplan.patch +++ /dev/null @@ -1,131 +0,0 @@ ---- yaboot-1.3.13/include/bootinfo.h.nocolonzero 2001-12-01 09:58:10.000000000 +0000 -+++ yaboot-1.3.13/include/bootinfo.h 2007-11-27 17:17:28.000000000 +0000 -@@ -34,6 +34,7 @@ - #define _MACH_classic 0x00000400 /* RPCG RPX-Classic 8xx board */ - #define _MACH_oak 0x00000800 /* IBM "Oak" 403 eval. board */ - #define _MACH_walnut 0x00001000 /* IBM "Walnut" 405GP eval. board */ -+#define _MACH_bplan 0x00002000 /* Pegasos/Efika, broken partition #s */ - - struct bi_record { - unsigned long tag; /* tag ID */ -@@ -51,6 +52,8 @@ struct bi_record { - - #endif /* _PPC_BOOTINFO_H */ - -+extern int _machine; -+ - /* - * Local variables: - * c-file-style: "k&r" ---- yaboot-1.3.13/second/fs_ext2.c.nocolonzero 2007-11-27 17:16:21.000000000 +0000 -+++ yaboot-1.3.13/second/fs_ext2.c 2007-11-27 17:17:43.000000000 +0000 -@@ -35,6 +35,7 @@ - #include "fs.h" - #include "errors.h" - #include "debug.h" -+#include "bootinfo.h" - - #define FAST_VERSION - #define MAX_READ_RANGE 256 -@@ -159,7 +160,8 @@ ext2_open( struct boot_file_t* file, - - /* Open the OF device for the entire disk */ - strncpy(buffer, dev_name, 1020); -- strcat(buffer, ":0"); -+ if (_machine != _MACH_bplan) -+ strcat(buffer, ":0"); - - DEBUG_F("<%s>\n", buffer); - ---- yaboot-1.3.13/second/fs_reiserfs.c.nocolonzero 2001-12-01 09:58:10.000000000 +0000 -+++ yaboot-1.3.13/second/fs_reiserfs.c 2007-11-27 17:18:14.000000000 +0000 -@@ -29,6 +29,7 @@ - #include "fs.h" - #include "errors.h" - #include "debug.h" -+#include "bootinfo.h" - #include "reiserfs/reiserfs.h" - - /* Exported in struct fs_t */ -@@ -84,7 +85,10 @@ reiserfs_open( struct boot_file_t *file, - else - INFO->partition_offset = 0; - -- sprintf( buffer, "%s:%d", dev_name, 0 ); /* 0 is full disk in OF */ -+ strncpy(buffer, dev_name, 1020); -+ if (_machine != _MACH_bplan) -+ strcat(buffer, ":0"); /* 0 is full disk in (non-buggy) OF */ -+ - file->of_device = prom_open( buffer ); - DEBUG_F( "Trying to open dev_name=%s; filename=%s; partition offset=%Lu\n", - buffer, file_name, INFO->partition_offset ); ---- yaboot-1.3.13/second/fs_xfs.c.nocolonzero 2002-09-15 04:12:21.000000000 +0100 -+++ yaboot-1.3.13/second/fs_xfs.c 2007-11-27 17:17:57.000000000 +0000 -@@ -30,6 +30,7 @@ - #include "xfs/xfs.h" - #include "errors.h" - #include "debug.h" -+#include "bootinfo.h" - - #define SECTOR_BITS 9 - -@@ -77,7 +78,9 @@ xfs_open(struct boot_file_t *file, const - else - partition_offset = 0; - -- sprintf(buffer, "%s:%d", dev_name, 0); /* 0 is full disk in OF */ -+ strncpy(buffer, dev_name, 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); - file->of_device = prom_open(buffer); ---- yaboot-1.3.13/second/partition.c.nocolonzero 2007-11-27 17:16:21.000000000 +0000 -+++ yaboot-1.3.13/second/partition.c 2007-11-27 17:17:16.000000000 +0000 -@@ -40,6 +40,7 @@ - #include "linux/iso_fs.h" - #include "debug.h" - #include "errors.h" -+#include "bootinfo.h" - - /* We currently don't check the partition type, some users - * are putting crap there and still expect it to work... -@@ -337,7 +338,8 @@ partitions_lookup(const char *device) - unsigned int prom_blksize, iso_root_block; - - strncpy(block_buffer, device, 2040); -- strcat(block_buffer, ":0"); -+ if (_machine != _MACH_bplan) -+ strcat(block_buffer, ":0"); - - /* Open device */ - disk = prom_open(block_buffer); ---- yaboot-1.3.13/second/yaboot.c.nocolonzero 2007-11-27 17:16:21.000000000 +0000 -+++ yaboot-1.3.13/second/yaboot.c 2007-11-27 17:16:21.000000000 +0000 -@@ -222,7 +222,10 @@ yaboot_start (unsigned long r3, unsigned - root = prom_finddevice("/"); - if (root != 0) { - static char model[256]; -- if (prom_getprop(root, "device_type", model, 256 ) > 0 && -+ if (prom_getprop(root, "CODEGEN,vendor", model, 256) > 0 && -+ !strncmp("bplan", model, 5)) -+ _machine = _MACH_bplan; -+ else if (prom_getprop(root, "device_type", model, 256 ) > 0 && - !strncmp("chrp", model, 4)) - _machine = _MACH_chrp; - else { -@@ -1486,11 +1489,13 @@ yaboot_main(void) - prom_printf("%s: Unable to parse\n", bootdevice); - return -1; - } -+ if (_machine == _MACH_bplan && !conf_given) -+ boot.part++; - DEBUG_F("After parse_device_path: dev=%s, part=%d, file=%s\n", - boot.dev, boot.part, boot.file); - - if (!conf_given) { -- if (_machine == _MACH_chrp) -+ if (_machine == _MACH_chrp || _machine == _MACH_bplan) - boot.file = "/etc/"; - else if (strlen(boot.file)) { - if (!strncmp(boot.file, "\\\\", 2)) diff --git a/yaboot-1.3.13-confarg.patch b/yaboot-1.3.13-confarg.patch deleted file mode 100644 index 77a14f6..0000000 --- a/yaboot-1.3.13-confarg.patch +++ /dev/null @@ -1,166 +0,0 @@ ---- yaboot-1.3.13/second/yaboot.c.cnf 2005-08-09 16:00:12.000000000 +0100 -+++ yaboot-1.3.13/second/yaboot.c 2005-08-09 16:01:45.000000000 +0100 -@@ -112,6 +112,7 @@ static void setup_display(void); - - int useconf = 0; - char bootdevice[1024]; -+char bootargs[1024]; - char *password = NULL; - struct boot_fspec_t boot; - int _machine = _MACH_Pmac; -@@ -324,13 +325,11 @@ done: - * config file. Handle the "\\" (blessed system folder) - */ - static int --load_config_file(char *device, char* path, int partition) -+load_config_file(struct boot_fspec_t *fspec) - { - char *conf_file = NULL, *p; - struct boot_file_t file; - int sz, opened = 0, result = 0; -- char conf_path[512]; -- struct boot_fspec_t fspec; - - /* Allocate a buffer for the config file */ - conf_file = malloc(CONFIG_FILE_MAX); -@@ -339,23 +338,11 @@ load_config_file(char *device, char* pat - goto bail; - } - -- /* Build the path to the file */ -- if (_machine == _MACH_chrp) -- strcpy(conf_path, "/etc/"); -- else if (path && *path) -- strcpy(conf_path, path); -- else -- conf_path[0] = 0; -- strcat(conf_path, CONFIG_FILE_NAME); -- - /* Open it */ -- fspec.dev = device; -- fspec.file = conf_path; -- fspec.part = partition; -- result = open_file(&fspec, &file); -+ result = open_file(fspec, &file); - if (result != FILE_ERR_OK) { -- prom_printf("%s:%d,", fspec.dev, fspec.part); -- prom_perror(result, fspec.file); -+ prom_printf("%s:%d,", fspec->dev, fspec->part); -+ prom_perror(result, fspec->file); - prom_printf("Can't open config file\n"); - goto bail; - } -@@ -375,7 +362,7 @@ load_config_file(char *device, char* pat - opened = 0; - - /* Call the parsing code in cfg.c */ -- if (cfg_parse(conf_path, conf_file, sz) < 0) { -+ if (cfg_parse(fspec->file, conf_file, sz) < 0) { - prom_printf ("Syntax error or read error config\n"); - goto bail; - } -@@ -590,7 +577,6 @@ int get_params(struct boot_param_t* para - int singlekey = 0; - int restricted = 0; - static int first = 1; -- static char bootargs[1024]; - static char imagepath[1024]; - static char initrdpath[1024]; - static char sysmappath[1024]; -@@ -607,7 +593,6 @@ int get_params(struct boot_param_t* para - - if (first) { - first = 0; -- prom_get_chosen("bootargs", bootargs, sizeof(bootargs)); - imagename = bootargs; - word_split(&imagename, ¶ms->args); - timeout = DEFAULT_TIMEOUT; -@@ -1458,12 +1443,32 @@ int - yaboot_main(void) - { - char *ptype; -+ int conf_given = 0; -+ char conf_path[1024]; - - if (_machine == _MACH_Pmac) - setup_display(); - -+ prom_get_chosen("bootargs", bootargs, sizeof(bootargs)); -+ DEBUG_F("/chosen/bootargs = %s\n", bootargs); - prom_get_chosen("bootpath", bootdevice, sizeof(bootdevice)); - DEBUG_F("/chosen/bootpath = %s\n", bootdevice); -+ -+ /* If conf= specified on command line, it overrides */ -+ if (!strncmp(bootargs, "conf=", 5)) { -+ char *end = strchr(bootargs,' '); -+ if (end) -+ *end = 0; -+ -+ strcpy(bootdevice, bootargs + 5); -+ conf_given = 1; -+ -+ /* Remove conf=xxx from bootargs */ -+ if (end) -+ memmove(bootargs, end+1, strlen(end+1)+1); -+ else -+ bootargs[0] = 0; -+ } - if (bootdevice[0] == 0) { - prom_get_options("boot-device", bootdevice, sizeof(bootdevice)); - DEBUG_F("boot-device = %s\n", bootdevice); -@@ -1480,29 +1485,36 @@ yaboot_main(void) - DEBUG_F("After parse_device_path: dev=%s, part=%d, file=%s\n", - boot.dev, boot.part, boot.file); - -- if (strlen(boot.file)) { -- if (!strncmp(boot.file, "\\\\", 2)) -- boot.file = "\\\\"; -- else { -- char *p, *last; -- p = last = boot.file; -- while(*p) { -- if (*p == '\\') -- last = p; -- p++; -+ if (!conf_given) { -+ if (_machine == _MACH_chrp) -+ boot.file = "/etc/"; -+ else if (strlen(boot.file)) { -+ if (!strncmp(boot.file, "\\\\", 2)) -+ boot.file = "\\\\"; -+ else { -+ char *p, *last; -+ p = last = boot.file; -+ while(*p) { -+ if (*p == '\\') -+ last = p; -+ p++; -+ } -+ if (p) -+ *(last) = 0; -+ else -+ boot.file = ""; -+ if (strlen(boot.file)) -+ strcat(boot.file, "\\"); - } -- if (p) -- *(last) = 0; -- else -- boot.file = ""; -- if (strlen(boot.file)) -- strcat(boot.file, "\\"); - } -+ strcpy(conf_path, boot.file); -+ strcat(conf_path, CONFIG_FILE_NAME); -+ boot.file = conf_path; -+ DEBUG_F("After path kludgeup: dev=%s, part=%d, file=%s\n", -+ boot.dev, boot.part, boot.file); - } -- DEBUG_F("After pmac path kludgeup: dev=%s, part=%d, file=%s\n", -- boot.dev, boot.part, boot.file); - -- useconf = load_config_file(boot.dev, boot.file, boot.part); -+ useconf = load_config_file(&boot); - - prom_printf("Welcome to yaboot version " VERSION "\n"); - prom_printf("Enter \"help\" to get some basic usage information\n"); diff --git a/yaboot-1.3.13-gcc34.patch b/yaboot-1.3.13-gcc34.patch deleted file mode 100644 index cba7312..0000000 --- a/yaboot-1.3.13-gcc34.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- yaboot-1.3.13/lib/strstr.c.gcc34 2001-09-20 09:15:31.000000000 -0400 -+++ yaboot-1.3.13/lib/strstr.c 2005-07-25 16:02:23.000000000 -0400 -@@ -76,7 +76,8 @@ - a = *++haystack; - if (a == '\0') - goto ret0; --shloop: } -+shloop: ; -+ } - while (a != b); - - jin: a = *++haystack; diff --git a/yaboot-1.3.13-malloc.patch b/yaboot-1.3.13-malloc.patch deleted file mode 100644 index 1d9bdf8..0000000 --- a/yaboot-1.3.13-malloc.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- yaboot-1.3.13/second/yaboot.c~ 2005-08-11 16:16:46.000000000 +0100 -+++ yaboot-1.3.13/second/yaboot.c 2005-08-14 14:22:52.000000000 +0100 -@@ -177,6 +177,7 @@ yaboot_start (unsigned long r3, unsigned - { - int result; - void* malloc_base = NULL; -+ unsigned long addr; - prom_handle root; - - /* OF seems to do it, but I'm not very confident */ -@@ -195,7 +196,10 @@ yaboot_start (unsigned long r3, unsigned - prom_init ((prom_entry) r5); - - /* Allocate some memory for malloc'ator */ -- malloc_base = prom_claim((void *)MALLOCADDR, MALLOCSIZE, 0); -+ for (addr = MALLOCADDR; addr <= MALLOCADDR * 16 ;addr+=0x100000) { -+ malloc_base = prom_claim((void *)addr, MALLOCSIZE, 0); -+ if (malloc_base != (void *)-1) break; -+ } - if (malloc_base == (void *)-1) { - prom_printf("Can't claim malloc buffer (%d bytes at 0x%08x)\n", - MALLOCSIZE, MALLOCADDR); diff --git a/yaboot-1.3.13-manpage.patch b/yaboot-1.3.13-manpage.patch deleted file mode 100644 index 738da90..0000000 --- a/yaboot-1.3.13-manpage.patch +++ /dev/null @@ -1,95 +0,0 @@ -* added files - - {arch}/yaboot/yaboot--devel/yaboot--devel--1.3/erbenson@alaska.net--public/patch-log/patch-76 - -* modified files - - - ---- orig/ChangeLog -+++ mod/ChangeLog -@@ -2,6 +2,19 @@ - # arch-tag: automatic-ChangeLog--erbenson@alaska.net--public/yaboot--devel--1.3 - # - -+2004-07-24 20:07:25 GMT Ethan Benson patch-76 -+ -+ Summary: -+ Fix typos in yaboot man page -+ Revision: -+ yaboot--devel--1.3--patch-76 -+ -+ man/yaboot.8: Fix various typos (thanks Helge Kreutzman). -+ -+ modified files: -+ 0arch-timestamps0 ChangeLog man/yaboot.8 -+ -+ - 2004-07-11 20:14:40 GMT Ethan Benson patch-75 - - Summary: - - ---- orig/man/yaboot.8 -+++ mod/man/yaboot.8 -@@ -16,12 +16,12 @@ - Fault. \fByaboot\fR is meant to be executed only by OpenFirmware. - - .B yaboot --is executed from OpenFirmare in the following manner: -+is executed from OpenFirmware in the following manner: - .I boot hd:2,yaboot - where \fIhd:\fR is the OpenFirmware path for the hard disk, and the - \fI2\fR is the partition number \fByaboot\fR is located on. In this - example, the hard disk path is actually an OpenFirmware alias which is --present on all NewWorld powermacs. It usually points to the internal -+present on all NewWorld PowerMacs. It usually points to the internal - ATA hard disk. If you have a SCSI disk, then you might execute - \fByaboot\fR with this command: - .I boot /pci@80000000/pci-bridge@d/ADPT,2930CU@2/@1:2,yaboot -@@ -29,7 +29,7 @@ - have. For a more detailed explanation of OpenFirmware's [disgusting] - paths, see man \fBbootstrap\fR(8). On IBM hardware \fByaboot\fR is - directly copied to the \fBbootstrap\fR(8) partition raw, without any --filesystem. OpenFirmare will boot from a type 0x41 PReP Boot parition -+filesystem. OpenFirmware will boot from a type 0x41 PReP Boot parition - marked bootable, this must contain \fByaboot\fR. On IBM hardware the - config file is read directly from the root filesystem. On PowerMac - hardware it must be present on the \fBbootstrap\fR(8) partition but -@@ -60,7 +60,7 @@ - should preferably be installed on a dedicated \fBbootstrap\fR(8) - partition (type Apple_Bootstrap for PowerMacs, type 0x41 PReP Boot for - IBM hardware). This allows the partition to be modified in such a way --that OpenFirmare will load \fByaboot\fR or a boot menu automatically -+that OpenFirmware will load \fByaboot\fR or a boot menu automatically - with a default OF configuration. If \fByaboot\fR cannot be installed - on a \fBbootstrap\fR(8) partition it can be installed on the root of a - MacOS boot partition instead. \fByaboot\fR however should not be -@@ -70,7 +70,7 @@ - (\fBybin\fR(8) is a utility for installing \fByaboot\fR with minimal - difficulty). - --The \fByaboot.conf\fR(5) file must be next to the yaboot executable on -+The \fByaboot.conf\fR(5) file must be next to the \fByaboot\fR executable on - the \fBbootstrap\fR(8) partition. \fBybin\fR(8) will take care of this. - - OpenFirmware may be accessed by holding down the \fIcommand, option, -@@ -81,13 +81,13 @@ - - If you have G4 hardware then your OpenFirmware may already have a - graphical boot selector built in. This selector can be accessed by --holding down the option key when booting the machine. You should see -+holding down the \fIoption\fR key when booting the machine. You should see - a screen with buttons for each bootable partition. The current - version (included with \fBybin\fR(8) 0.13) of ofboot includes a - badge icon, the button with a penguin icon is your \fBbootstrap\fR(8) - partition. Thanks to Nicholas Humfrey for creating the Badge icon. - --The \fBbootstrap\fR(8) need not and -+The \fBbootstrap\fR(8) partition need not and - .B should not - be mounted anywhere on your filesystem, especially not on top of /boot. \fBYaboot\fR is able - to load the kernels from the ext2fs root partition so that is where - - - diff --git a/yaboot-1.3.13-multisata.patch b/yaboot-1.3.13-multisata.patch deleted file mode 100644 index 159251e..0000000 --- a/yaboot-1.3.13-multisata.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- yaboot-1.3.13/ybin/ofpath.multisata 2006-08-21 14:30:50.000000000 -0400 -+++ yaboot-1.3.13/ybin/ofpath 2006-08-21 14:41:28.000000000 -0400 -@@ -298,10 +298,24 @@ - echo "${DEVICE_PATH##*device-tree}/@$DEVICE_ID:$PARTITION" - ;; - ata_k2|sata_svw) -- HOST_LIST="$(for i in `find /proc/device-tree -name compatible` ; do -- lgrep "$i" "k2-s-ata" ; done)" -+ #Not all G5 device trees have a compatible "k2-sata" node -+ #per channel use parent -+ HOST_LIST="$(for i in `find /proc/device-tree -name compatible ` ; do -+ lgrep "$i" "k2-s-ata" ; done | sort)" - DEVICE_PATH="$(printhost $SCSI_HOSTNUMBER $HOST_LIST)" -- echo "${DEVICE_PATH##*device-tree}/k2-sata@$DEVICE_ID/disk@0:$PARTITION" -+ K2_DEVICE_ID=0 -+ while [ "$DEVICE_PATH" = "" ] ; do -+ SCSI_HOSTNUMBER=`expr $SCSI_HOSTNUMBER - 1` -+ let "K2_DEVICE_ID += 1" -+ DEVICE_PATH="$(printhost $SCSI_HOSTNUMBER $HOST_LIST)" -+ done -+ echo "${DEVICE_PATH##*device-tree}/k2-sata@$K2_DEVICE_ID/disk@0:$PARTITION" -+ ;; -+ sbp2) -+ HOST_LIST="$(for i in `find /proc/device-tree -name name` ; do -+ lgrep "$i" "sbp-2" ; done)" -+ DEVICE_PATH="$(printhost $SCSI_HOSTNUMBER $HOST_LIST)" -+ echo "${DEVICE_PATH##*device-tree}/disk@0:$PARTITION" - ;; - *) - echo 1>&2 "$PRG: Driver: $SCSI_DRIVER is not supported" diff --git a/yaboot-1.3.13-netboot.patch b/yaboot-1.3.13-netboot.patch deleted file mode 100644 index fd39e19..0000000 --- a/yaboot-1.3.13-netboot.patch +++ /dev/null @@ -1,179 +0,0 @@ ---- yaboot-1.3.13/second/file.c.netboot 2003-02-10 04:18:13.000000000 -0500 -+++ yaboot-1.3.13/second/file.c 2005-09-14 16:57:02.000000000 -0400 -@@ -38,6 +38,112 @@ - - extern char bootdevice[1024]; - -+static char *netdev_path_to_filename(const char *path) -+{ -+ char *tmp, *args, *filename; -+ size_t len; -+ -+ DEBUG_F("path = %s\n", path); -+ -+ if (!path) -+ return NULL; -+ -+ args = strrchr(path, ':'); -+ if (!args) -+ return NULL; -+ -+ /* The obp-tftp device arguments should be at the end of -+ * the argument list. Skip over any extra arguments (promiscuous, -+ * speed, duplex, bootp, rarp). -+ */ -+ -+ tmp = strstr(args, "promiscuous"); -+ if (tmp && tmp > args) -+ args = tmp + strlen("promiscuous"); -+ -+ tmp = strstr(args, "speed="); -+ if (tmp && tmp > args) -+ args = tmp + strlen("speed="); -+ -+ tmp = strstr(args, "duplex="); -+ if (tmp && tmp > args) -+ args = tmp + strlen("duplex="); -+ -+ tmp = strstr(args, "bootp"); -+ if (tmp && tmp > args) -+ args = tmp + strlen("bootp"); -+ -+ tmp = strstr(args, "rarp"); -+ if (tmp && tmp > args) -+ args = tmp + strlen("rarp"); -+ -+ args = strchr(args, ','); -+ if (!args) -+ return NULL; -+ -+ 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. -+ */ -+ args++; -+ if (*tmp != ':') { -+ args = strchr(args, ','); -+ if (!args) -+ return NULL; -+ args++; -+ } -+ -+ /* filename may be empty; e.g. enet:192.168.1.1,,192.168.1.2 */ -+ if (*args == ',') { -+ DEBUG_F("null filename\n"); -+ return NULL; -+ } -+ -+ /* Now see whether there are more args following the filename. */ -+ tmp = strchr(args, ','); -+ if (!tmp) -+ len = strlen(args) + 1; -+ else -+ len = tmp - args + 1; -+ -+ filename = malloc(len); -+ if (!filename) -+ return NULL; -+ -+ strncpy(filename, args, len); -+ filename[len - 1] = '\0'; -+ -+ DEBUG_F("filename = %s\n", filename); -+ return filename; -+} -+ -+static char *netdev_path_to_dev(const char *path) -+{ -+ char *dev, *tmp; -+ size_t len; -+ -+ DEBUG_F("path = %s\n", path); -+ -+ if (!path) -+ return NULL; -+ -+ tmp = strchr(path, ':'); -+ if (!tmp) -+ return strdup(path); -+ tmp++; -+ -+ len = tmp - path + 1; -+ -+ dev = malloc(len); -+ if (dev) { -+ strncpy(dev, path, len); -+ dev[len - 1] = '\0'; -+ } -+ return dev; -+} -+ - /* This function follows the device path in the devtree and separates - the device name, partition number, and other datas (mostly file name) - the string passed in parameters is changed since 0 are put in place -@@ -71,6 +177,7 @@ - char *ptr; - char *ipath = NULL; - char *defdev = NULL; -+ int device_kind; - - result->dev = NULL; - result->part = -1; -@@ -81,20 +188,21 @@ - else - ipath = strdup(imagepath); - -- if (defdevice) -+ if (defdevice) { - defdev = strdup(defdevice); -- -- if (defdev) { -- if (!strstr(defdev, "ethernet") && !strstr(defdev, "enet")) { -- if ((ptr = strrchr(defdev, ':')) != NULL) -- *ptr = 0; /* remove trailing : from defdevice if necessary */ -- } -+ device_kind = prom_get_devtype(defdev); -+ } else -+ device_kind = prom_get_devtype(ipath); -+ -+ if (device_kind != FILE_DEVICE_NET && strchr(defdev, ':') != NULL) { -+ if ((ptr = strrchr(defdev, ':')) != NULL) -+ *ptr = 0; /* remove trailing : from defdevice if necessary */ - } - -- /* if there is no : then there is no filename or partition. must -- use strrchr() since enet:,10.0.0.1,file is legal */ -- -- if (strchr(ipath, ':') != NULL) { -+ /* This will not properly handle an obp-tftp argument list -+ * with elements after the filename; that is handled below. -+ */ -+ if (device_kind != FILE_DEVICE_NET && strchr(ipath, ':') != NULL) { - if ((ptr = strrchr(ipath, ',')) != NULL) { - char *colon = strrchr(ipath, ':'); - /* If a ':' occurs *after* a ',', then we assume that there is -@@ -107,13 +215,15 @@ - } - } - -- if (strstr(ipath, "ethernet") || strstr(ipath, "enet")) -- if ((ptr = strstr(ipath, "bootp")) != NULL) { /* `n' key booting boots enet:bootp */ -- *ptr = 0; -- result->dev = strdup(ipath); -- } else -- result->dev = strdup(ipath); -- else if ((ptr = strchr(ipath, ':')) != NULL) { -+ if (device_kind == FILE_DEVICE_NET) { -+ if (strchr(ipath, ':')) -+ result->file = netdev_path_to_filename(ipath); -+ else -+ result->file = strdup(ipath); -+ -+ if (!defdev) -+ result->dev = netdev_path_to_dev(ipath); -+ } else if ((ptr = strchr(ipath, ':')) != NULL) { - *ptr = 0; - result->dev = strdup(ipath); - if (*(ptr+1)) diff --git a/yaboot-1.3.13-nobootx.patch b/yaboot-1.3.13-nobootx.patch deleted file mode 100644 index 0df4a55..0000000 --- a/yaboot-1.3.13-nobootx.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- yaboot-1.3.13/ybin/ofpath.nobootx 2004-07-11 16:12:42.000000000 -0400 -+++ yaboot-1.3.13/ybin/ofpath 2005-07-25 16:05:57.000000000 -0400 -@@ -425,14 +425,6 @@ - { - case "$DEVNODE" in - sd*) -- if ls -l /proc/device-tree | grep -q ^lr ; then -- true -- else -- echo 1>&2 "$PRG: /proc/device-tree is broken. Do not use BootX to boot, use yaboot." -- echo 1>&2 "$PRG: The yaboot HOWTO can be found here: http://www.alaska.net/~erbenson/doc" -- return 1 -- fi -- - ## use common scsiinfo function to get info we need. - scsiinfo || return 1 - diff --git a/yaboot-1.3.13-ofpath-firewire-usb.patch b/yaboot-1.3.13-ofpath-firewire-usb.patch deleted file mode 100644 index 6cdb78e..0000000 --- a/yaboot-1.3.13-ofpath-firewire-usb.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- yaboot-1.3.13/ybin/ofpath.firewire 2006-11-16 12:58:15.000000000 +0000 -+++ yaboot-1.3.13/ybin/ofpath 2006-11-16 13:03:03.000000000 +0000 -@@ -250,7 +250,7 @@ - DEVHOST="$(v=$(echo ${DEVINFO##*Host: scsi}) ; echo ${v%% *})" - [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: DEVHOST=$DEVHOST" - -- if [ "$DEVTYPE" = "Direct-Access" ] ; then -+ if [ "$DEVTYPE" = "Direct-Access" ] || [ "$DEVTYPE" = "Direct-Access-RBC" ] ; then - DEVCOUNT="$(($DEVCOUNT + 1))" - [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: DEVCOUNT=$DEVCOUNT" - if [ "$SUBDEV" = "$DEVCOUNT" ] ; then -@@ -311,9 +311,19 @@ - done - echo "${DEVICE_PATH##*device-tree}/k2-sata@$K2_DEVICE_ID/disk@0:$PARTITION" - ;; -- sbp2) -+ usb-storage) -+ HOST_LIST="$(for i in `find /proc/device-tree -name name | grep usb` ; do -+ lgrep "$i" "disk" ; done)" -+ DEVICE_PATH="$(printhost $SCSI_HOSTNUMBER $HOST_LIST)" -+ echo "${DEVICE_PATH##*device-tree}:$PARTITION" -+ ;; -+ sbp2|"") -+ # sbp-2 driver may not have a dir in /proc/scsi - HOST_LIST="$(for i in `find /proc/device-tree -name name` ; do - lgrep "$i" "sbp-2" ; done)" -+ if [ "$SCSI_HOSTNUMBER" = "" ] ; then -+ SCSI_HOSTNUMBER=1 -+ fi - DEVICE_PATH="$(printhost $SCSI_HOSTNUMBER $HOST_LIST)" - echo "${DEVICE_PATH##*device-tree}/disk@0:$PARTITION" - ;; -@@ -821,7 +831,7 @@ - local DEVTYPE="$(v=$(echo ${DEVINFO##*Type: }) ; echo ${v%% *})" - [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: fixdevfs: DEVTYPE=$DEVTYPE" - -- if [ "$DEVTYPE" = "Direct-Access" ] ; then -+ if [ "$DEVTYPE" = "Direct-Access" ] || [ "$DEVTYPE" = "Direct-Access-RBC" ] ; then - ## Lets find out some more information - ## get the device id. - local DEVID="$(v=$(echo ${DEVINFO##*Id: }) ; n=$(echo ${v%% *}) ; echo ${n#*0})" diff --git a/yaboot-1.3.13-ofpath-pegasos.patch b/yaboot-1.3.13-ofpath-pegasos.patch deleted file mode 100644 index 4140a3e..0000000 --- a/yaboot-1.3.13-ofpath-pegasos.patch +++ /dev/null @@ -1,83 +0,0 @@ ---- yaboot-1.3.13/ybin/ofpath.ofpath 2005-07-30 23:28:00.000000000 +0100 -+++ yaboot-1.3.13/ybin/ofpath 2005-07-30 23:34:52.000000000 +0100 -@@ -382,12 +382,19 @@ ide_ofpath() - echo 1>&2 "$PRG: KERNEL BUG: /proc/ide/${IDEBUS}/channel does not exist" - return 1 - fi -- - case "$(cat /proc/device-tree${DEVSPEC}/device_type 2> /dev/null)" in - ide|ata) - local MASTER="/disk@0" - local SLAVE="/disk@1" - ;; -+ spi) -+ local DEVTYPE="disk$DEVTYPE" -+ if grep -q ide-cdrom /proc/ide/$DEVNODE/driver; then -+ DEVTYPE="cdrom" -+ fi -+ local MASTER="/$DEVTYPE@$(cat /proc/ide/${IDEBUS}/channel),0" -+ local SLAVE="/$DEVTYPE@$(cat /proc/ide/${IDEBUS}/channel),1" -+ ;; - pci-ide|pci-ata) - local MASTER="/@$(cat /proc/ide/${IDEBUS}/channel)/disk@0" - local SLAVE="/@$(cat /proc/ide/${IDEBUS}/channel)/disk@1" -@@ -681,6 +688,40 @@ chrp() - return 0 - } - -+## find OpenFirmware device path for Genesi Pegasos hardware (ide only) -+pegasos() -+{ -+ # SmartFirmware disagrees with the rest of the world about whether -+ # partition numbers should start at zero or one. -+ [ -n $PARTITION ] && PARTITION=$(($PARTITION - 1)) -+ -+ case "$DEVNODE" in -+ sd*) -+ if ls -l /proc/device-tree | grep -q ^lr ; then -+ true -+ else -+ echo 1>&2 "$PRG: /proc/device-tree is broken." -+ return 1 -+ fi -+ -+ ## use common scsiinfo function to get info we need. -+ scsiinfo || return 1 -+ -+ ## now we have the data for /@$DEVID:$PARTITION -+ ## find the actual OF path. -+ scsi_ofpath || return 1 -+ ;; -+ hd*) -+ ide_ofpath || return 1 -+ ;; -+ *) -+ echo 1>&2 "$PRG: Device: /dev/$DEVNODE is not supported" -+ return 1 -+ ;; -+ esac -+ return 0 -+} -+ - ## If we get lame devfs name, we need to make it foad - ckdevfs() - { -@@ -906,6 +947,8 @@ elif (cat /proc/cpuinfo 2>/dev/null | gr - SUBARCH=OldWorld - elif (cat /proc/cpuinfo 2> /dev/null | grep ^machine | grep -q 'CHRP IBM') ; then - SUBARCH=CHRP -+elif (cat /proc/cpuinfo 2> /dev/null | grep ^machine | grep -q 'CHRP Pegasos') ; then -+ SUBARCH=Pegasos - else - echo 1>&2 "$PRG: This machine is not yet supported" - exit 1 -@@ -937,6 +980,9 @@ case "$SUBARCH" in - CHRP) - chrp || exit 1 - ;; -+ Pegasos) -+ pegasos || exit 1 -+ ;; - esac - - exit 0 diff --git a/yaboot-1.3.13-printversion.patch b/yaboot-1.3.13-printversion.patch deleted file mode 100644 index 9efb047..0000000 --- a/yaboot-1.3.13-printversion.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- yaboot-1.3.13/Makefile.orig 2005-09-13 13:12:44.000000000 +0000 -+++ yaboot-1.3.13/Makefile 2005-09-13 13:12:01.000000000 +0000 -@@ -32,7 +32,7 @@ CROSS = - # The flags for the yaboot binary. - # - YBCFLAGS = -Os $(CFLAGS) -nostdinc -Wall -isystem `gcc -print-file-name=include` -fsigned-char --YBCFLAGS += -DVERSION=\"${VERSION}\" #" -+YBCFLAGS += -DVERSION="\"${VERSION}${VERSIONEXTRA}\"" #" - YBCFLAGS += -DTEXTADDR=$(TEXTADDR) -DDEBUG=$(DEBUG) - YBCFLAGS += -DMALLOCADDR=$(MALLOCADDR) -DMALLOCSIZE=$(MALLOCSIZE) - YBCFLAGS += -DKERNELADDR=$(KERNELADDR) diff --git a/yaboot-1.3.13-swraid1.patch b/yaboot-1.3.13-swraid1.patch deleted file mode 100644 index ae612b1..0000000 --- a/yaboot-1.3.13-swraid1.patch +++ /dev/null @@ -1,179 +0,0 @@ ---- yaboot-1.3.13/ybin/ybin.swraid1 2004-07-11 16:12:12.000000000 -0400 -+++ yaboot-1.3.13/ybin/ybin 2005-07-25 16:05:01.000000000 -0400 -@@ -27,6 +27,7 @@ - PATH="${PATH}:${PATH_PREFIX}/sbin:${PATH_PREFIX}/bin:${PATH_PREFIX}/usr/sbin:${PATH_PREFIX}/usr/bin:${PATH_PREFIX}/usr/local/sbin:${PATH_PREFIX}/usr/local/bin" - fi - PRG="${0##*/}" -+ABSPRG="$0" - SIGINT="$PRG: Interrupt caught ... exiting" - VERSION=1.3.13 - DEBUG=0 -@@ -1336,19 +1337,26 @@ - ;; - --debug) - DEBUG=1 -+ ARGS="$ARGS $1" - shift - ;; - -v|--verbose) - VERBOSE=1 -+ ARGS="$ARGS $1" - shift - ;; - -f|--force) - FORCE=yes -+ ARGS="$ARGS $1" - shift - ;; - -b|--boot) - if [ -n "$2" ] ; then -- boot="$2" -+ if [ "$boot" = "unconfigured" ]; then -+ boot="$2" -+ else -+ boot="$boot $2" -+ fi - ARGBT=1 - shift 2 - else -@@ -1361,6 +1369,7 @@ - if [ -n "$2" ] ; then - ofboot="$2" - ARGOB=1 -+ ARGS="$ARGS $1 $2" - shift 2 - else - echo 1>&2 "$PRG: option requires an argument $1" -@@ -1372,6 +1381,7 @@ - if [ -n "$2" ] ; then - install="$2" - ARGBF=1 -+ ARGS="$ARGS $1 $2" - shift 2 - else - echo 1>&2 "$PRG: option requires an argument $1" -@@ -1384,6 +1394,7 @@ - CONF="$2" - bootconf="$2" - ERR=" Error in $CONF:" -+ ARGS="$ARGS $1 $2" - shift 2 - else - echo 1>&2 "$PRG: option requires an argument $1" -@@ -1395,6 +1406,7 @@ - if [ -n "$2" ] ; then - magicboot="$2" - ARGWP=1 -+ ARGS="$ARGS $1 $2" - shift 2 - else - echo 1>&2 "$PRG: option requires an argument $1" -@@ -1406,6 +1418,7 @@ - if [ -n "$2" ] ; then - fstype="$2" - ARGFS=1 -+ ARGS="$ARGS $1 $2" - shift 2 - else - echo 1>&2 "$PRG: option requires an argument $1" -@@ -1416,26 +1429,31 @@ - --nobless) - bless=no - ARGBS=1 -+ ARGS="$ARGS $1" - shift - ;; - -M|--mount) - usemount=yes - ARGMT=1 -+ ARGS="$ARGS $1" - shift - ;; - --protect) - protect=yes - ARGPT=1 -+ ARGS="$ARGS $1" - shift - ;; - --hide) - hide=yes - ARGHD=1 -+ ARGS="$ARGS $1" - shift - ;; - --nonvram) - nonvram=1 - ARGNV=1 -+ ARGS="$ARGS $1" - shift - ;; - --device) -@@ -1443,6 +1461,7 @@ - device="$2" - bootconf=auto - echo 1>&2 "$PRG: WARNING: Deprecated option --device" -+ ARGS="$ARGS $1 $2" - shift 2 - else - echo 1>&2 "$PRG: option requires an argument $1" -@@ -1455,6 +1474,7 @@ - timeout="$2" - bootconf=auto - echo 1>&2 "$PRG: WARNING: Deprecated option --device" -+ ARGS="$ARGS $1 $2" - shift 2 - else - echo 1>&2 "$PRG: option requires an argument $1" -@@ -1467,6 +1487,7 @@ - image="$2" - bootconf=auto - echo 1>&2 "$PRG: WARNING: Deprecated option --device" -+ ARGS="$ARGS $1 $2" - shift 2 - else - echo 1>&2 "$PRG: option requires an argument $1" -@@ -1479,6 +1500,7 @@ - label="$2" - bootconf=auto - echo 1>&2 "$PRG: WARNING: Deprecated option --device" -+ ARGS="$ARGS $1 $2" - shift 2 - else - echo 1>&2 "$PRG: option requires an argument $1" -@@ -1491,6 +1513,7 @@ - partition="$2" - bootconf=auto - echo 1>&2 "$PRG: WARNING: Deprecated option --device" -+ ARGS="$ARGS $1 $2" - shift 2 - else - echo 1>&2 "$PRG: option requires an argument $1" -@@ -1503,6 +1526,7 @@ - root="$2" - bootconf=auto - echo 1>&2 "$PRG: WARNING: Deprecated option --device" -+ ARGS="$ARGS $1 $2" - shift 2 - else - echo 1>&2 "$PRG: option requires an argument $1" -@@ -1582,6 +1606,20 @@ - [ $(parseconf flag enableofboot) = 0 ] && of=yes - [ $(parseconf flag brokenosx) = 0 ] && brokenosx=yes - -+bootparts=0 -+for i in $boot; do -+ bootparts=$(($bootparts + 1)) -+done -+if [ "$bootparts" -gt 1 ]; then -+ [ "$VERBOSE" = 1 ] && echo "$PRG: Iterating through list of boot partitions..." -+ rc=0 -+ for i in $boot; do -+ [ "$VERBOSE" = 1 ] && echo "$ABSPRG $ARGS -b $i" -+ $ABSPRG $ARGS -b $i || rc=$? -+ done -+ exit $rc -+fi -+ - ## ffs!! rtfm! foad! - if [ "$boot" = unconfigured ] ; then - echo 1>&2 "$PRG: You must specify the device for the bootstrap partition. (ie: boot=/dev/hdaX)" diff --git a/yaboot-1.3.13-swraid2.patch b/yaboot-1.3.13-swraid2.patch deleted file mode 100644 index 7b5d088..0000000 --- a/yaboot-1.3.13-swraid2.patch +++ /dev/null @@ -1,111 +0,0 @@ ---- yaboot-1.3.13/second/partition.c.swraid2 2005-07-25 16:09:39.000000000 -0400 -+++ yaboot-1.3.13/second/partition.c 2005-07-25 16:09:39.000000000 -0400 -@@ -67,7 +67,7 @@ - static void - add_new_partition(struct partition_t** list, int part_number, const char *part_type, - const char *part_name, unsigned long part_start, unsigned long part_size, -- unsigned short part_blocksize) -+ unsigned short part_blocksize, int sys_ind) - { - struct partition_t* part; - part = (struct partition_t*)malloc(sizeof(struct partition_t)); -@@ -78,6 +78,7 @@ - part->part_start = part_start; - part->part_size = part_size; - part->blocksize = part_blocksize; -+ part->sys_ind = sys_ind; - - /* Tack this entry onto the list */ - part->next = *list; -@@ -149,7 +150,8 @@ - part->name, /* name */ - part->start_block + part->data_start, /* start */ - part->data_count, /* size */ -- ptable_block_size ); -+ ptable_block_size, -+ 0); - } - } - -@@ -170,14 +172,15 @@ - (struct fdisk_partition *) (block_buffer + 0x1be); - - for (partition=1; partition <= 4 ;partition++, part++) { -- if (part->sys_ind == LINUX_NATIVE) { -+ if (part->sys_ind == LINUX_NATIVE || part->sys_ind == LINUX_RAID) { - add_new_partition( list, - partition, - "Linux", /* type */ - '\0', /* name */ - swab32(*(unsigned int *)(part->start4)), - swab32(*(unsigned int *)(part->size4)), -- 512 /*blksize*/ ); -+ 512 /*blksize*/, -+ part->sys_ind /* partition type */ ); - } - } - } -@@ -316,7 +319,8 @@ - '\0', /* name */ - blockspercyl * amiga_block[AMIGA_PART_LOWCYL], /* start */ - blockspercyl * (amiga_block[AMIGA_PART_HIGHCYL] - amiga_block[AMIGA_PART_LOWCYL] + 1), /* size */ -- prom_blksize ); -+ prom_blksize, -+ 0 ); - } - } - -@@ -365,7 +369,8 @@ - '\0', - iso_root_block, - 0, -- prom_blksize); -+ prom_blksize, -+ 0); - prom_printf("ISO9660 disk\n"); - } else if (_amiga_find_rdb(device, disk, prom_blksize) != -1) { - /* amiga partition format */ ---- yaboot-1.3.13/second/fs_of.c.swraid2 2004-07-11 15:54:53.000000000 -0400 -+++ yaboot-1.3.13/second/fs_of.c 2005-07-25 16:09:39.000000000 -0400 -@@ -39,6 +39,7 @@ - #include "prom.h" - #include "string.h" - #include "partition.h" -+#include "fdisk-part.h" - #include "fs.h" - #include "errors.h" - #include "debug.h" -@@ -89,6 +90,13 @@ - DEBUG_ENTER; - DEBUG_OPEN; - -+ if (part && part->sys_ind == LINUX_RAID) -+ { -+ DEBUG_F("skipping because partition is marked LINUX_RAID\n"); -+ DEBUG_LEAVE(FILE_ERR_BAD_FSYS); -+ return FILE_ERR_BAD_FSYS; -+ } -+ - strncpy(buffer, dev_name, 768); - strcat(buffer, ":"); - if (part) { ---- yaboot-1.3.13/include/partition.h.swraid2 2001-12-01 04:58:10.000000000 -0500 -+++ yaboot-1.3.13/include/partition.h 2005-07-25 16:09:39.000000000 -0400 -@@ -40,6 +40,7 @@ - unsigned long part_start; /* In blocks */ - unsigned long part_size; /* In blocks */ - unsigned short blocksize; -+ int sys_ind; /* fs type */ - }; - - extern struct partition_t* partitions_lookup(const char *device); ---- yaboot-1.3.13/include/fdisk-part.h.swraid2 2001-12-01 04:58:10.000000000 -0500 -+++ yaboot-1.3.13/include/fdisk-part.h 2005-07-25 16:09:39.000000000 -0400 -@@ -27,6 +27,7 @@ - #define LINUX_SWAP 0x82 - #define LINUX_NATIVE 0x83 - #define LINUX_EXTENDED 0x85 -+#define LINUX_RAID 0xfd - - struct fdisk_partition { - unsigned char boot_ind; /* 0x80 - active */ diff --git a/yaboot-1.3.13-telnet.patch b/yaboot-1.3.13-telnet.patch deleted file mode 100644 index f5865e4..0000000 --- a/yaboot-1.3.13-telnet.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- yaboot-1.3.13/second/yaboot.c.telnet 2005-08-17 17:53:35.000000000 -0400 -+++ yaboot-1.3.13/second/yaboot.c 2005-08-17 17:54:24.000000000 -0400 -@@ -1450,7 +1450,7 @@ - int conf_given = 0; - char conf_path[1024]; - -- if (_machine == _MACH_Pmac) -+ if (prom_getprop(call_prom("instance-to-package", 1, 1, prom_stdout), "iso6429-1983-colors", NULL, 0) >= 0) - setup_display(); - - prom_get_chosen("bootargs", bootargs, sizeof(bootargs)); diff --git a/yaboot-1.3.8-ppc64-initrd.patch b/yaboot-1.3.8-ppc64-initrd.patch deleted file mode 100644 index dd70b11..0000000 --- a/yaboot-1.3.8-ppc64-initrd.patch +++ /dev/null @@ -1,393 +0,0 @@ -diff -urpN -X /cvs/dontdiff yaboot-1.3.8-orig/include/bootinfo.h yaboot-1.3.8-redhat/include/bootinfo.h ---- yaboot-1.3.8-orig/include/bootinfo.h 2001-12-01 03:58:10.000000000 -0600 -+++ yaboot-1.3.8-redhat/include/bootinfo.h 2003-05-02 14:17:59.000000000 -0500 -@@ -21,6 +21,8 @@ - #ifndef _PPC_BOOTINFO_H - #define _PPC_BOOTINFO_H - -+#include "debug.h" -+ - #define _MACH_prep 0x00000001 - #define _MACH_Pmac 0x00000002 /* pmac or pmac clone (non-chrp) */ - #define _MACH_chrp 0x00000004 /* chrp machine */ -@@ -41,6 +43,13 @@ struct bi_record { - unsigned long data[0]; /* data */ - }; - -+struct birecs { -+ struct bi_record *first; /* first record pointer */ -+ struct bi_record *last; /* last record pointer */ -+ int initialized; -+}; -+extern struct birecs birecs; -+ - #define BI_FIRST 0x1010 /* first record - marker */ - #define BI_LAST 0x1011 /* last record - marker */ - #define BI_CMD_LINE 0x1012 -@@ -49,6 +58,79 @@ struct bi_record { - #define BI_SYSMAP 0x1015 - #define BI_MACHTYPE 0x1016 - -+/* align addr on a size boundry - adjust address up if needed -- Cort */ -+#define _ALIGN(addr,size) ((((ulong)(addr))+((ulong)(size))-1)&(~(((ulong)(size))-1))) -+ -+static __inline__ struct bi_record * birec_next(struct bi_record *birec) -+{ -+ return (struct bi_record *)((ulong)birec + birec->size); -+} -+ -+static __inline__ void birecs_init(ulong addr) -+{ -+ /* Since the birec may be inside the malloc pool, we'll wait -+ * to finish the birec initialization until just before we -+ * are ready to allocate the birec entries when we no longer -+ * need the malloc pool. -+ */ -+ birecs.first = (struct bi_record *)addr; -+ birecs.initialized = 0; -+} -+ -+static __inline__ struct bi_record * birec_alloc(ulong tag, ulong args); -+ -+static __inline__ void birecs_lazy_init(void) -+{ -+ /* -+ * We make sure it's mapped. We map only 64k for now, it's -+ * plenty enough we don't claim since this precise memory -+ * range may already be claimed by the malloc pool. -+ */ -+ prom_map (birecs.first, birecs.first, 0x10000); -+ DEBUG_F("birec at %p\n", birecs.first); -+ DEBUG_SLEEP; -+ -+ birecs.last = birecs.first; -+ birecs.last->size = 0; -+ birecs.initialized = 1; -+ -+ /* Create the BI_FIRST entry. The BI_LAST entry is created as a side effect. */ -+ birecs.first = birec_alloc(BI_FIRST, 2); -+} -+ -+static __inline__ struct bi_record * birec_alloc_bytes(ulong tag, ulong bytes) -+{ -+ struct bi_record *birec; -+ -+ if (!birecs.initialized) -+ birecs_lazy_init(); -+ -+ /* Allocate and initialize the new birec. */ -+ birec = birecs.last; -+ birec->tag = tag; -+ birec->size = _ALIGN(sizeof(struct bi_record) + bytes, sizeof(ulong)); -+ birec->data[0] = 0; /* Clear out the old birecs.last->date[0] entry */ -+ -+ /* -+ * Create a new BI_LAST entry and link the BI_FIRST and -+ * BI_LAST entries together as required by the PPC64 kernel. -+ */ -+ birecs.last = birec_next(birec); -+ birecs.last->tag = BI_LAST; -+ birecs.last->size = sizeof(struct bi_record) + sizeof(ulong); -+ birecs.last->data[0] = (ulong)birecs.first; -+ -+ birecs.first->data[0] = (ulong)birecs.last; -+ birecs.first->data[1] = (ulong)birecs.last + birecs.last->size - (ulong)birecs.first; -+ -+ return birec; -+} -+ -+static __inline__ struct bi_record * birec_alloc(ulong tag, ulong args) -+{ -+ return birec_alloc_bytes(tag, args * sizeof(ulong)); -+} -+ - #endif /* _PPC_BOOTINFO_H */ - - /* -diff -urpN -X /cvs/dontdiff yaboot-1.3.8-orig/lib/vsprintf.c yaboot-1.3.8-redhat/lib/vsprintf.c ---- yaboot-1.3.8-orig/lib/vsprintf.c 2001-09-20 08:15:31.000000000 -0500 -+++ yaboot-1.3.8-redhat/lib/vsprintf.c 2003-04-02 13:00:41.000000000 -0600 -@@ -158,9 +158,9 @@ static char * number(char * str, long lo - tmp[i++]='0'; - else while (num != 0) - { -- int t = ((long long) num) % (unsigned int) base; -+ int t = ((unsigned long long) num) % (unsigned int) base; - tmp[i++] = digits[t]; -- num = ((long long) num) / (unsigned int) base; -+ num = ((unsigned long long) num) / (unsigned int) base; - } - if (i > precision) - precision = i; -diff -urpN -X /cvs/dontdiff yaboot-1.3.8-orig/second/yaboot.c yaboot-1.3.8-redhat/second/yaboot.c ---- yaboot-1.3.8-orig/second/yaboot.c 2002-09-14 22:11:44.000000000 -0500 -+++ yaboot-1.3.8-redhat/second/yaboot.c 2003-05-02 12:09:03.000000000 -0500 -@@ -62,9 +62,6 @@ - #include "md5.h" - #endif /* USE_MD5_PASSWORDS */ - --/* align addr on a size boundry - adjust address up if needed -- Cort */ --#define _ALIGN(addr,size) (((addr)+size-1)&(~(size-1))) -- - /* Addresses where the PPC32 and PPC64 vmlinux kernels are linked at. - * These are used to determine whether we are booting a vmlinux, in - * which case, it will be loaded at KERNELADDR. Otherwise (eg zImage), -@@ -81,16 +78,19 @@ typedef struct { - } elf; - void* base; - unsigned long memsize; -+ unsigned long totalsize; - unsigned long filesize; - unsigned long offset; -- unsigned long load_loc; -- unsigned long entry; -+ unsigned long long load_loc; -+ unsigned long long entry; - } loadinfo_t; - -+struct birecs birecs; -+ - typedef void (*kernel_entry_t)( void *, - unsigned long, - prom_entry, -- unsigned long, -+ struct bi_record *, - unsigned long ); - - /* Imported functions */ -@@ -913,7 +913,7 @@ yaboot_text_ui(void) - prom_perror(result, params.sysmap.file); - } - else { -- sysmap_base = prom_claim(loadinfo.base+loadinfo.memsize, 0x100000, 0); -+ sysmap_base = prom_claim(loadinfo.base+loadinfo.totalsize, 0x100000, 0); - if (sysmap_base == (void *)-1) { - prom_printf("Claim failed for sysmap memory\n"); - sysmap_base = 0; -@@ -930,7 +930,7 @@ yaboot_text_ui(void) - if (sysmap_base) { - prom_printf("System.map loaded at %p, size: %lu Kbytes\n", - sysmap_base, sysmap_size >> 10); -- loadinfo.memsize += _ALIGN(0x100000, 0x1000); -+ loadinfo.totalsize += _ALIGN(0x100000, 0x1000); - } else { - prom_printf("System.map load failed !\n"); - prom_pause(); -@@ -964,7 +964,7 @@ yaboot_text_ui(void) - } - else { - #define INITRD_CHUNKSIZE 0x400000 -- initrd_base = prom_claim(loadinfo.base+loadinfo.memsize, INITRD_CHUNKSIZE, 0); -+ initrd_base = prom_claim(loadinfo.base+loadinfo.totalsize, INITRD_CHUNKSIZE, 0); - if (initrd_base == (void *)-1) { - prom_printf("Claim failed for initrd memory\n"); - initrd_base = 0; -@@ -989,10 +989,11 @@ yaboot_text_ui(void) - file.fs->close(&file); - memset(&file, 0, sizeof(file)); - } -- if (initrd_base) -+ if (initrd_base) { - prom_printf("ramdisk loaded at %p, size: %lu Kbytes\n", - initrd_base, initrd_size >> 10); -- else { -+ loadinfo.totalsize += _ALIGN(initrd_size, 0x1000); -+ } else { - prom_printf("ramdisk load failed !\n"); - prom_pause(); - } -@@ -1001,7 +1002,7 @@ yaboot_text_ui(void) - DEBUG_F("setting kernel args to: %s\n", params.args); - prom_setargs(params.args); - DEBUG_F("flushing icache..."); -- flush_icache_range ((long)loadinfo.base, (long)loadinfo.base+loadinfo.memsize); -+ flush_icache_range ((long)loadinfo.base, (long)loadinfo.base+loadinfo.totalsize); - DEBUG_F(" done\n"); - - if (flat_vmlinux) { -@@ -1012,40 +1013,24 @@ yaboot_text_ui(void) - * so we don't write it earlier. At this point, we should not - * use anything coming from the malloc pool. - */ -- birec = (struct bi_record *)_ALIGN(loadinfo.filesize+(1<<20)-1,(1<<20)); - -- /* We make sure it's mapped. We map only 64k for now, it's -- * plenty enough we don't claim since this precise memory -- * range may already be claimed by the malloc pool. -- */ -- prom_map (birec, birec, 0x10000); -- DEBUG_F("birec at %p\n", birec); -- DEBUG_SLEEP; -- -- birec->tag = BI_FIRST; -- birec->size = sizeof(struct bi_record); -- birec = (struct bi_record *)((ulong)birec + birec->size); -+ birec = birec_alloc_bytes(BI_BOOTLOADER_ID, strlen("yaboot")+1); -+ sprintf((char *)birec->data, "yaboot"); - -- birec->tag = BI_BOOTLOADER_ID; -- sprintf( (char *)birec->data, "yaboot"); -- birec->size = sizeof(struct bi_record) + strlen("yaboot") + 1; -- birec = (struct bi_record *)((ulong)birec + birec->size); -- -- birec->tag = BI_MACHTYPE; -+ birec = birec_alloc(BI_MACHTYPE, 1); - birec->data[0] = _machine; -- birec->size = sizeof(struct bi_record) + sizeof(ulong); -- birec = (struct bi_record *)((ulong)birec + birec->size); - - if (sysmap_base) { -- birec->tag = BI_SYSMAP; -+ birec = birec_alloc(BI_SYSMAP, 2); - birec->data[0] = (ulong)sysmap_base; - birec->data[1] = sysmap_size; -- birec->size = sizeof(struct bi_record) + sizeof(ulong)*2; -- birec = (struct bi_record *)((ulong)birec + birec->size); - } -- birec->tag = BI_LAST; -- birec->size = sizeof(struct bi_record); -- birec = (struct bi_record *)((ulong)birec + birec->size); -+ -+ if (initrd_base) { -+ birec = birec_alloc(BI_INITRD, 2); -+ birec->data[0] = (ulong)initrd_base; -+ birec->data[1] = initrd_size; -+ } - } - - /* compute the kernel's entry point. */ -@@ -1055,14 +1040,13 @@ yaboot_text_ui(void) - DEBUG_F("kernel: arg1 = %p,\n" - " arg2 = 0x%08lx,\n" - " prom = %p,\n" -- " arg4 = %d,\n" -+ " birecs = %p,\n" - " arg5 = %d\n\n", -- initrd_base + loadinfo.load_loc, initrd_size, prom, 0, 0); -- -+ initrd_base + loadinfo.load_loc, initrd_size, prom, birecs.first, 0); - DEBUG_F("Entering kernel...\n"); - - /* call the kernel with our stack. */ -- kernel_entry(initrd_base + loadinfo.load_loc, initrd_size, prom, 0, 0); -+ kernel_entry(initrd_base + loadinfo.load_loc, initrd_size, prom, birecs.first, 0); - continue; - next: - ; /* do nothing */ -@@ -1148,9 +1132,9 @@ load_elf32(struct boot_file_t *file, loa - } - - /* leave some room (1Mb) for boot infos */ -- loadinfo->memsize = _ALIGN(loadinfo->memsize,(1<<20)) + 0x100000; -+ loadinfo->totalsize = _ALIGN(loadinfo->memsize,(1<<20)) + 0x100000; - /* Claim OF memory */ -- DEBUG_F("Before prom_claim, mem_sz: 0x%08lx\n", loadinfo->memsize); -+ DEBUG_F("Before prom_claim, mem_sz: 0x%08lx\n", loadinfo->totalsize); - - /* Determine whether we are trying to boot a vmlinux or some - * other binary image (eg, zImage). We load vmlinux's at -@@ -1168,7 +1152,7 @@ load_elf32(struct boot_file_t *file, loa - * other nearby addresses before giving up. - */ - for(addr=loadaddr; addr <= loadaddr * 8 ;addr+=0x100000) { -- loadinfo->base = prom_claim((void *)addr, loadinfo->memsize, 0); -+ loadinfo->base = prom_claim((void *)addr, loadinfo->totalsize, 0); - if (loadinfo->base != (void *)-1) break; - } - if (loadinfo->base == (void *)-1) { -@@ -1177,9 +1161,12 @@ load_elf32(struct boot_file_t *file, loa - } - - DEBUG_F("After ELF parsing, load base: %p, mem_sz: 0x%08lx\n", -- loadinfo->base, loadinfo->memsize); -+ loadinfo->base, loadinfo->totalsize); - DEBUG_F(" wanted load base: 0x%08lx, mem_sz: 0x%08lx\n", -- loadaddr, loadinfo->memsize); -+ loadaddr, loadinfo->totalsize); -+ -+ if (flat_vmlinux) -+ birecs_init(_ALIGN(loadinfo->filesize+(1<<20)-1,1<<20)); - - /* Load the program segments... */ - p = ph; -@@ -1191,13 +1178,13 @@ load_elf32(struct boot_file_t *file, loa - /* Now, we skip to the image itself */ - if ((*(file->fs->seek))(file, p->p_offset) != FILE_ERR_OK) { - prom_printf ("Seek error\n"); -- prom_release(loadinfo->base, loadinfo->memsize); -+ prom_release(loadinfo->base, loadinfo->totalsize); - return 0; - } - offset = p->p_vaddr - loadinfo->load_loc; - if ((*(file->fs->read))(file, p->p_filesz, loadinfo->base+offset) != p->p_filesz) { - prom_printf ("Read failed\n"); -- prom_release(loadinfo->base, loadinfo->memsize); -+ prom_release(loadinfo->base, loadinfo->totalsize); - return 0; - } - } -@@ -1227,9 +1214,9 @@ load_elf64(struct boot_file_t *file, loa - DEBUG_F(" e.e_type = %d\n", (int)e->e_type); - DEBUG_F(" e.e_machine = %d\n", (int)e->e_machine); - DEBUG_F(" e.e_version = %d\n", (int)e->e_version); -- DEBUG_F(" e.e_entry = 0x%016lx\n", (long)e->e_entry); -- DEBUG_F(" e.e_phoff = 0x%016lx\n", (long)e->e_phoff); -- DEBUG_F(" e.e_shoff = 0x%016lx\n", (long)e->e_shoff); -+ DEBUG_F(" e.e_entry = 0x%016Lx\n", (long long)e->e_entry); -+ DEBUG_F(" e.e_phoff = 0x%016Lx\n", (long long)e->e_phoff); -+ DEBUG_F(" e.e_shoff = 0x%016Lx\n", (long long)e->e_shoff); - DEBUG_F(" e.e_flags = %d\n", (int)e->e_flags); - DEBUG_F(" e.e_ehsize = 0x%08x\n", (int)e->e_ehsize); - DEBUG_F(" e.e_phentsize = 0x%08x\n", (int)e->e_phentsize); -@@ -1287,9 +1274,9 @@ load_elf64(struct boot_file_t *file, loa - } - - /* leave some room (1Mb) for boot infos */ -- loadinfo->memsize = _ALIGN(loadinfo->memsize,(1<<20)) + 0x100000; -+ loadinfo->totalsize = _ALIGN(loadinfo->memsize,(1<<20)) + 0x100000; - /* Claim OF memory */ -- DEBUG_F("Before prom_claim, mem_sz: 0x%08lx\n", loadinfo->memsize); -+ DEBUG_F("Before prom_claim, mem_sz: 0x%08lx\n", loadinfo->totalsize); - - /* Determine whether we are trying to boot a vmlinux or some - * other binary image (eg, zImage). We load vmlinux's at -@@ -1307,7 +1294,7 @@ load_elf64(struct boot_file_t *file, loa - * other nearby addresses before giving up. - */ - for(addr=loadaddr; addr <= loadaddr * 8 ;addr+=0x100000) { -- loadinfo->base = prom_claim((void *)addr, loadinfo->memsize, 0); -+ loadinfo->base = prom_claim((void *)addr, loadinfo->totalsize, 0); - if (loadinfo->base != (void *)-1) break; - } - if (loadinfo->base == (void *)-1) { -@@ -1316,9 +1303,12 @@ load_elf64(struct boot_file_t *file, loa - } - - DEBUG_F("After ELF parsing, load base: %p, mem_sz: 0x%08lx\n", -- loadinfo->base, loadinfo->memsize); -+ loadinfo->base, loadinfo->totalsize); - DEBUG_F(" wanted load base: 0x%08lx, mem_sz: 0x%08lx\n", -- loadaddr, loadinfo->memsize); -+ loadaddr, loadinfo->totalsize); -+ -+ if (flat_vmlinux) -+ birecs_init(_ALIGN((unsigned long)loadinfo->base+loadinfo->memsize,0x1000)); - - /* Load the program segments... */ - p = ph; -@@ -1330,13 +1320,13 @@ load_elf64(struct boot_file_t *file, loa - /* Now, we skip to the image itself */ - if ((*(file->fs->seek))(file, p->p_offset) != FILE_ERR_OK) { - prom_printf ("Seek error\n"); -- prom_release(loadinfo->base, loadinfo->memsize); -+ prom_release(loadinfo->base, loadinfo->totalsize); - return 0; - } - offset = p->p_vaddr - loadinfo->load_loc; - if ((*(file->fs->read))(file, p->p_filesz, loadinfo->base+offset) != p->p_filesz) { - prom_printf ("Read failed\n"); -- prom_release(loadinfo->base, loadinfo->memsize); -+ prom_release(loadinfo->base, loadinfo->totalsize); - return 0; - } - } diff --git a/yaboot.spec b/yaboot.spec index f8973d0..8ef4be4 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -10,39 +10,22 @@ 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 -Patch5: yaboot-1.3.8-ppc64-initrd.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 -Patch11: yaboot-1.3.13-manpage.patch -Patch12: yaboot-1.3.13-gcc34.patch -Patch13: yaboot-1.3.13-amigaparts.patch -Patch14: yaboot-1.3.13-swraid1.patch -Patch15: yaboot-1.3.13-nobootx.patch -Patch16: yaboot-1.3.13-swraid2.patch Patch17: yaboot-1.3.13-pegasos-claim.patch Patch18: yaboot-1.3.13-pegasos-ext2.patch -Patch19: yaboot-1.3.13-confarg.patch -Patch20: yaboot-1.3.13-ofpath-pegasos.patch Patch21: yaboot-1.3.13-pegasos-serial.patch Patch22: yaboot-1.3.13-allow-deep-mntpoint.patch -Patch23: yaboot-1.3.13-malloc.patch -Patch24: yaboot-1.3.13-telnet.patch -Patch25: yaboot-1.3.13-netboot.patch -Patch26: yaboot-1.3.13-printversion.patch Patch27: yaboot-ppc64.patch -Patch28: yaboot-1.3.13-multisata.patch Patch29: yaboot-1.3.13-dontwritehome.patch -Patch30: yaboot-1.3.12-addnote.patch -Patch31: yaboot-1.3.13-ofpath-firewire-usb.patch -Patch32: yaboot-1.3.13-bplan.patch URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root Obsoletes: ybin -ExclusiveArch: ppc ppc64 +ExclusiveArch: ppc Requires: hfsutils BuildRequires: e2fsprogs-devel @@ -54,38 +37,21 @@ yaboot can also bootload IBM pSeries machines. %prep %setup -q -%patch1 -p0 -%patch2 -p1 -%patch3 -p1 +%patch1 -p0 -b .man +%patch2 -p1 -b .ofboot +%patch3 -p1 -b .rh %patch4 -p1 -b .yabootconfig -#patch5 -p1 -b .ppc64initrd %patch6 -p1 -b .proddisc %patch7 -p1 -b .ext3 %patch8 -p1 -b .sbin %patch9 -p1 -b .config %patch10 -p1 -b .parted -#%patch11 -p1 -b .manpage -#%patch12 -p1 -b .gcc34 -#%patch13 -p1 -b .amigaparts -#%patch14 -p1 -b .swraid1 -#%patch15 -p1 -b .nobootx -#%patch16 -p1 -b .swraid2 %patch17 -p1 -b .pegasos %patch18 -p1 -b .ext2 -#%patch19 -p1 -b .confarg -#%patch20 -p1 -b .ofpath %patch21 -p1 -b .pegasos-serial %patch22 -p1 -b .deepmnt -#%patch23 -p1 -b .malloc -#patch24 -p1 -b .telnet -#%patch25 -p1 -b .netboot -#%patch26 -p1 -b .printversion %patch27 -p1 -b .ppc64 -#%patch28 -p1 -b .multisata %patch29 -p1 -b .bootwrite -#%patch30 -p1 -b .addnote -#%patch31 -p1 -b .firewire -#%patch32 -p1 -b .bplan %build make VERSIONEXTRA='\ (Red Hat %version-%release)' @@ -121,10 +87,14 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Mon Aug 11 2008 Roman Rakus - 1.3.14-5 +- Clearing in specfile +- Fixed patches for --fuzz=0 + * Wed May 28 2008 Tom "spot" Callaway - 1.3.14-4 - fix license tag -* Wed Apr 16 2008 Roman Rakus - 1.3.14-3 +* Wed Apr 16 2008 Roman Rakus - 1.3.14-3 - Upstream 1.3.14 * Thu Mar 27 2008 David Woodhouse - 1.3.13-11 From 013cdb15fea597e9427f1b02058dc1c2e3c50346 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Mon, 11 Aug 2008 09:45:29 +0000 Subject: [PATCH 13/55] Commiting fixed patches. --- yaboot-1.3.10-ext3.patch | 4 ++-- yaboot-1.3.10-proddiscover.patch | 4 ++-- yaboot-1.3.13-yabootconfig.patch | 3 ++- yaboot-1.3.6-ofboot.patch | 2 +- yaboot-1.3.6-rh.patch | 4 ++-- yaboot-ppc64.patch | 7 ++++--- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/yaboot-1.3.10-ext3.patch b/yaboot-1.3.10-ext3.patch index c4bbc23..af6fc15 100644 --- a/yaboot-1.3.10-ext3.patch +++ b/yaboot-1.3.10-ext3.patch @@ -1,8 +1,8 @@ --- 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 -@@ -176,7 +176,7 @@ +@@ -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); diff --git a/yaboot-1.3.10-proddiscover.patch b/yaboot-1.3.10-proddiscover.patch index 34615fb..a28e57e 100644 --- a/yaboot-1.3.10-proddiscover.patch +++ b/yaboot-1.3.10-proddiscover.patch @@ -24,7 +24,7 @@ shift 5 COUNT="$(($COUNT + 1))" @@ -315,7 +322,7 @@ - MacRISC MacRISC3 + MacRISC MacRISC3 MacRISC4 -Red Hat Linux First Stage Bootstrap @@ -44,7 +44,7 @@ --- 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 @@ - fi + ENABLENETBOOT="enablenetboot\n" fi -MESG='"Welcome to Red Hat Linux!\\nHit for boot options.\\n\\n"' diff --git a/yaboot-1.3.13-yabootconfig.patch b/yaboot-1.3.13-yabootconfig.patch index a6f6967..7360cd1 100644 --- a/yaboot-1.3.13-yabootconfig.patch +++ b/yaboot-1.3.13-yabootconfig.patch @@ -114,7 +114,7 @@ "") break ;; -@@ -474,6 +563,6 @@ +@@ -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. @@ -122,6 +122,7 @@ +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 diff --git a/yaboot-1.3.6-ofboot.patch b/yaboot-1.3.6-ofboot.patch index 47a846f..cd35657 100644 --- a/yaboot-1.3.6-ofboot.patch +++ b/yaboot-1.3.6-ofboot.patch @@ -10,7 +10,7 @@ shift 5 COUNT="$(($COUNT + 1))" @@ -315,7 +315,7 @@ - MacRISC + MacRISC MacRISC3 MacRISC4 -PowerPC GNU/Linux First Stage Bootstrap diff --git a/yaboot-1.3.6-rh.patch b/yaboot-1.3.6-rh.patch index 4b63c85..f701474 100644 --- a/yaboot-1.3.6-rh.patch +++ b/yaboot-1.3.6-rh.patch @@ -1,6 +1,6 @@ --- 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 -@@ -172,32 +172,32 @@ +@@ -178,32 +178,32 @@ strip --remove-section=.comment --remove-section=.note util/addnote install: all strip @@ -75,7 +75,7 @@ ## 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=). + ## section in this config file or the value of default=). timeout=40 -install=/usr/local/lib/yaboot/yaboot diff --git a/yaboot-ppc64.patch b/yaboot-ppc64.patch index 8f9dd3e..a86d18b 100644 --- a/yaboot-ppc64.patch +++ b/yaboot-ppc64.patch @@ -1,6 +1,6 @@ --- 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,7 +36,7 @@ +@@ -36,8 +36,8 @@ # The flags for the yaboot binary. # @@ -10,7 +10,9 @@ +YBCFLAGS += -DVERSION="\"${VERSION}${VERSIONEXTRA}\"" #" YBCFLAGS += -DTEXTADDR=$(TEXTADDR) -DDEBUG=$(DEBUG) YBCFLAGS += -DMALLOCADDR=$(MALLOCADDR) -DMALLOCSIZE=$(MALLOCSIZE) -@@ -65,7 +65,7 @@ + YBCFLAGS += -DKERNELADDR=$(KERNELADDR) +@@ -66,7 +66,7 @@ + # Link flags # -LFLAGS = -Ttext $(TEXTADDR) -Bstatic -melf32ppclinux @@ -18,4 +20,3 @@ # Libraries # - LLIBS = -lext2fs From 1887cffab2f3b1d6f8807e9ec0740d62b87f7fa1 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Wed, 5 Nov 2008 12:46:07 +0000 Subject: [PATCH 14/55] Changed kernel load base address. Resolves: #468492 --- yaboot-1.3.14-baseaddr.patch | 28 ++++++++++++++++++++++++++++ yaboot.spec | 12 +++++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 yaboot-1.3.14-baseaddr.patch diff --git a/yaboot-1.3.14-baseaddr.patch b/yaboot-1.3.14-baseaddr.patch new file mode 100644 index 0000000..f36814c --- /dev/null +++ b/yaboot-1.3.14-baseaddr.patch @@ -0,0 +1,28 @@ +diff --git a/Makefile b/Makefile +index 5457dc9..ce0dc06 100644 +--- a/Makefile ++++ b/Makefile +@@ -21,7 +21,7 @@ TEXTADDR = 0x200000 + MALLOCADDR = 0x300000 + MALLOCSIZE = 0x100000 + # Load kernel and ramdisk at real-base. If there is overlap, will retry until find open space +-KERNELADDR = 0x00000000 ++KERNELADDR = 0x00C00000 + + # Set this to the prefix of your cross-compiler, if you have one. + # Else leave it empty. +diff --git a/second/fs_of.c b/second/fs_of.c +index 0d554c5..95c131d 100644 +--- a/second/fs_of.c ++++ b/second/fs_of.c +@@ -44,8 +44,8 @@ + #include "errors.h" + #include "debug.h" + +-#define LOAD_BUFFER_POS 0x00000000 +-#define LOAD_BUFFER_SIZE 0x01000000 ++#define LOAD_BUFFER_POS 0x1000000 ++#define LOAD_BUFFER_SIZE 0x1000000 + + static int of_open(struct boot_file_t* file, const char* dev_name, + struct partition_t* part, const char* file_name); diff --git a/yaboot.spec b/yaboot.spec index 8ef4be4..f022427 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -20,7 +20,8 @@ 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 -Patch29: yaboot-1.3.13-dontwritehome.patch +Patch28: yaboot-1.3.13-dontwritehome.patch +Patch29: yaboot-1.3.14-baseaddr.patch URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root @@ -51,7 +52,8 @@ yaboot can also bootload IBM pSeries machines. %patch21 -p1 -b .pegasos-serial %patch22 -p1 -b .deepmnt %patch27 -p1 -b .ppc64 -%patch29 -p1 -b .bootwrite +%patch28 -p1 -b .bootwrite +%patch29 -p1 -b .baseaddr %build make VERSIONEXTRA='\ (Red Hat %version-%release)' @@ -87,6 +89,10 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Wed Nov 05 2008 Roman Rakus - 1.3.14-6 +- Changed kernel load base address + Resolves: #468492 + * Mon Aug 11 2008 Roman Rakus - 1.3.14-5 - Clearing in specfile - Fixed patches for --fuzz=0 From 02cc5413a7c34d9b69c4b001cae480344726b249 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 21 Nov 2008 17:08:23 +0000 Subject: [PATCH 15/55] fix bootonce, MAX_TOKEN --- yaboot-1.3.14-bigger-max-token.patch | 12 ++++++++++++ yaboot-1.3.14-fix-bootonce-nvram.patch | 21 +++++++++++++++++++++ yaboot.spec | 10 +++++++++- 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 yaboot-1.3.14-bigger-max-token.patch create mode 100644 yaboot-1.3.14-fix-bootonce-nvram.patch diff --git a/yaboot-1.3.14-bigger-max-token.patch b/yaboot-1.3.14-bigger-max-token.patch new file mode 100644 index 0000000..b1a7d32 --- /dev/null +++ b/yaboot-1.3.14-bigger-max-token.patch @@ -0,0 +1,12 @@ +diff -up yaboot-1.3.14/second/cfg.c.bigger-max-token yaboot-1.3.14/second/cfg.c +--- yaboot-1.3.14/second/cfg.c.bigger-max-token 2008-11-12 14:39:11.000000000 -0500 ++++ yaboot-1.3.14/second/cfg.c 2008-11-12 14:39:17.000000000 -0500 +@@ -41,7 +41,7 @@ typedef struct { + void *data; + } CONFIG; + +-#define MAX_TOKEN 200 ++#define MAX_TOKEN 511 + #define MAX_VAR_NAME MAX_TOKEN + #define EOF -1 + diff --git a/yaboot-1.3.14-fix-bootonce-nvram.patch b/yaboot-1.3.14-fix-bootonce-nvram.patch new file mode 100644 index 0000000..c7d20ba --- /dev/null +++ b/yaboot-1.3.14-fix-bootonce-nvram.patch @@ -0,0 +1,21 @@ +diff -up yaboot-1.3.14/ybin/ybin.fix-bootonce-nvram yaboot-1.3.14/ybin/ybin +--- yaboot-1.3.14/ybin/ybin.fix-bootonce-nvram 2008-11-12 14:51:28.000000000 -0500 ++++ yaboot-1.3.14/ybin/ybin 2008-11-13 12:15:21.000000000 -0500 +@@ -1689,14 +1689,15 @@ checkconf || exit 1 + + if [ "x$bootonce" != "x" ]; then + foundlabel=`sed s/\#.*// $bootconf | grep "label=$bootonce$" | wc -l` +- if [ "$nonvram" = 0 ]; then ++ if [ "$nonvram" = 1 ]; then + echo 1>&2 "$PRG: --bootonce specified, but nvsetenv not available." + exit 1 + fi + if [ "$foundlabel" = 1 ]; then + nvsetenv boot-once "$bootonce" + foundlabel=`nvsetenv boot-once` +- if [ "$foundlabel" != "boot-once=$bootonce" ]; then ++ if [ "$foundlabel" != "boot-once=$bootonce" -a \ ++ "$foundlabel" != "$bootonce" ]; then + echo 1>&2 "$PRG: Could not nvsetenv boot-once $bootonce" + exit 1 + fi diff --git a/yaboot.spec b/yaboot.spec index f022427..83a66b2 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -22,6 +22,8 @@ Patch22: yaboot-1.3.13-allow-deep-mntpoint.patch Patch27: yaboot-ppc64.patch Patch28: yaboot-1.3.13-dontwritehome.patch Patch29: yaboot-1.3.14-baseaddr.patch +Patch30: yaboot-1.3.14-fix-bootonce-nvram.patch +Patch31: yaboot-1.3.14-bigger-max-token.patch URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root @@ -54,6 +56,8 @@ yaboot can also bootload IBM pSeries machines. %patch27 -p1 -b .ppc64 %patch28 -p1 -b .bootwrite %patch29 -p1 -b .baseaddr +%patch30 -p1 -b .bootonce +%patch31 -p1 -b .maxtoken %build make VERSIONEXTRA='\ (Red Hat %version-%release)' @@ -89,6 +93,10 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Fri Nov 21 2008 David Woodhouse - 1.3.14-7 +- Fix 'ybin --bootonce' (#471425) +- Fix maximum token length, to fix preupgrade (#471321) + * Wed Nov 05 2008 Roman Rakus - 1.3.14-6 - Changed kernel load base address Resolves: #468492 From 1113166e055f4ae15f38ee030ed2373246ac493e Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Thu, 27 Nov 2008 15:38:18 +0000 Subject: [PATCH 16/55] Release bump because of preupgrade. --- yaboot.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yaboot.spec b/yaboot.spec index 83a66b2..84fd9f1 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -93,6 +93,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Thu Nov 27 2008 Roman Rakus - 1.3.14-8 +- Bumped release, so preupgrade is now silent and go through + * Fri Nov 21 2008 David Woodhouse - 1.3.14-7 - Fix 'ybin --bootonce' (#471425) - Fix maximum token length, to fix preupgrade (#471321) From 5b9fcec782ca9768774c7e6d6cc9bf74a8532a91 Mon Sep 17 00:00:00 2001 From: jwboyer Date: Thu, 22 Jan 2009 18:33:36 +0000 Subject: [PATCH 17/55] - Add patch to handle relocatable kernels --- yaboot-relocatable-kernel.patch | 21 +++++++++++++++++++++ yaboot.spec | 7 ++++++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 yaboot-relocatable-kernel.patch diff --git a/yaboot-relocatable-kernel.patch b/yaboot-relocatable-kernel.patch new file mode 100644 index 0000000..10e08ea --- /dev/null +++ b/yaboot-relocatable-kernel.patch @@ -0,0 +1,21 @@ +PPC64 relocatable kernels (built with CONFIG_RELOCATABLE=y) have the type of +ET_DYN. But yaboot code won't load the kernel if the ELF type is not +ET_EXEC. Attached patch adds support to yaboot to load relocatable kernels +also (ie load ET_DYN type also) + +Signed-off-by: M. Mohan Kumar +--- + second/yaboot.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- yaboot-1.3.14.orig/second/yaboot.c ++++ yaboot-1.3.14/second/yaboot.c +@@ -1606,7 +1606,7 @@ is_elf64(loadinfo_t *loadinfo) + e->e_ident[EI_MAG3] == ELFMAG3 && + e->e_ident[EI_CLASS] == ELFCLASS64 && + e->e_ident[EI_DATA] == ELFDATA2MSB && +- e->e_type == ET_EXEC && ++ (e->e_type == ET_EXEC || e->e_type == ET_DYN) && + e->e_machine == EM_PPC64); + } + diff --git a/yaboot.spec b/yaboot.spec index 84fd9f1..c77712c 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 8%{?dist} +Release: 9%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -24,6 +24,7 @@ Patch28: yaboot-1.3.13-dontwritehome.patch Patch29: yaboot-1.3.14-baseaddr.patch Patch30: yaboot-1.3.14-fix-bootonce-nvram.patch Patch31: yaboot-1.3.14-bigger-max-token.patch +Patch32: yaboot-relocatable-kernel.patch URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root @@ -58,6 +59,7 @@ yaboot can also bootload IBM pSeries machines. %patch29 -p1 -b .baseaddr %patch30 -p1 -b .bootonce %patch31 -p1 -b .maxtoken +%patch32 -p1 -b .relocatable %build make VERSIONEXTRA='\ (Red Hat %version-%release)' @@ -93,6 +95,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Thu Jan 22 2009 Josh Boyer - 1.3.14-9 +- Add patch to handle relocatable kernels + * Thu Nov 27 2008 Roman Rakus - 1.3.14-8 - Bumped release, so preupgrade is now silent and go through From d1ea1773fac47594abe61204ab93808873969fac Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Wed, 25 Feb 2009 18:00:01 +0000 Subject: [PATCH 18/55] - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild --- yaboot.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yaboot.spec b/yaboot.spec index c77712c..633d305 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -95,6 +95,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Wed Feb 25 2009 Fedora Release Engineering - 1.3.14-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + * Thu Jan 22 2009 Josh Boyer - 1.3.14-9 - Add patch to handle relocatable kernels From da55ca6aecb57c6e5e1824298ddae344b15991cb Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Fri, 13 Mar 2009 00:32:03 +0000 Subject: [PATCH 19/55] - Adding better netboot support (#458438) - Allocate more buffer space for larger kernels and initrds (#472225) --- yaboot-1.3.14-better_netboot.patch | 726 +++++++++++++++++++++++++++++ yaboot.spec | 8 +- 2 files changed, 733 insertions(+), 1 deletion(-) create mode 100644 yaboot-1.3.14-better_netboot.patch diff --git a/yaboot-1.3.14-better_netboot.patch b/yaboot-1.3.14-better_netboot.patch new file mode 100644 index 0000000..31f2173 --- /dev/null +++ b/yaboot-1.3.14-better_netboot.patch @@ -0,0 +1,726 @@ +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 0x1400000 + +-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", ¶ms->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", ¶ms->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", ¶ms->sysmap)) { + prom_printf("%s: Unable to parse\n", imagepath); diff --git a/yaboot.spec b/yaboot.spec index 633d305..f442d03 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 10%{?dist} +Release: 11%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -25,6 +25,7 @@ Patch29: yaboot-1.3.14-baseaddr.patch Patch30: yaboot-1.3.14-fix-bootonce-nvram.patch Patch31: yaboot-1.3.14-bigger-max-token.patch Patch32: yaboot-relocatable-kernel.patch +Patch33: yaboot-1.3.14-better_netboot.patch URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root @@ -60,6 +61,7 @@ yaboot can also bootload IBM pSeries machines. %patch30 -p1 -b .bootonce %patch31 -p1 -b .maxtoken %patch32 -p1 -b .relocatable +%patch33 -p1 -b .netboot %build make VERSIONEXTRA='\ (Red Hat %version-%release)' @@ -95,6 +97,10 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* 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 - 1.3.14-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild From a0628ea14c180ebe0b9dee2613e192165dfadd6f Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Mon, 6 Apr 2009 05:51:50 +0000 Subject: [PATCH 20/55] Increase the LOAD_BUFFER size from 20MiB to 25MiB. This allows the F-11-Beta to boot. --- yaboot-1.3.14-better_netboot.patch | 2 +- yaboot.spec | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/yaboot-1.3.14-better_netboot.patch b/yaboot-1.3.14-better_netboot.patch index 31f2173..4b2e05a 100644 --- a/yaboot-1.3.14-better_netboot.patch +++ b/yaboot-1.3.14-better_netboot.patch @@ -481,7 +481,7 @@ index 95c131d..5c7dd9b 100644 #define LOAD_BUFFER_POS 0x1000000 -#define LOAD_BUFFER_SIZE 0x1000000 -+#define LOAD_BUFFER_SIZE 0x1400000 ++#define LOAD_BUFFER_SIZE 0x1800000 -static int of_open(struct boot_file_t* file, const char* dev_name, - struct partition_t* part, const char* file_name); diff --git a/yaboot.spec b/yaboot.spec index f442d03..2b63c03 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 11%{?dist} +Release: 12%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -97,6 +97,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* 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) From 6c9e5ac4bcc4396b1517cd4a3a7987aa79d875c4 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 7 Jun 2009 08:04:45 +0000 Subject: [PATCH 21/55] remove birecs --- yaboot-1.3.14-no-birecs.patch | 11 +++++++++++ yaboot.spec | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 yaboot-1.3.14-no-birecs.patch diff --git a/yaboot-1.3.14-no-birecs.patch b/yaboot-1.3.14-no-birecs.patch new file mode 100644 index 0000000..96748c7 --- /dev/null +++ b/yaboot-1.3.14-no-birecs.patch @@ -0,0 +1,11 @@ +--- yaboot-1.3.14/second/yaboot.c~ 2009-06-07 08:57:58.000000000 +0100 ++++ yaboot-1.3.14/second/yaboot.c 2009-06-07 09:02:03.000000000 +0100 +@@ -1243,7 +1243,7 @@ yaboot_text_ui(void) + flush_icache_range ((long)loadinfo.base, (long)loadinfo.base+loadinfo.memsize); + DEBUG_F(" done\n"); + +- if (flat_vmlinux) { ++ if (0 && flat_vmlinux) { + /* + * Fill new boot infos (only if booting a vmlinux). + * diff --git a/yaboot.spec b/yaboot.spec index 2b63c03..c7d88ed 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 12%{?dist} +Release: 13%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -26,6 +26,7 @@ Patch30: yaboot-1.3.14-fix-bootonce-nvram.patch Patch31: yaboot-1.3.14-bigger-max-token.patch Patch32: yaboot-relocatable-kernel.patch Patch33: yaboot-1.3.14-better_netboot.patch +Patch34: yaboot-1.3.14-no-birecs.patch URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root @@ -62,6 +63,7 @@ yaboot can also bootload IBM pSeries machines. %patch31 -p1 -b .maxtoken %patch32 -p1 -b .relocatable %patch33 -p1 -b .netboot +%patch34 -p1 -b .birecs %build make VERSIONEXTRA='\ (Red Hat %version-%release)' @@ -97,6 +99,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Sun Jun 07 2009 David Woodhouse - 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) From 828ada572e353c113df2cb655df5eb5196795f07 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 27 Jul 2009 08:50:50 +0000 Subject: [PATCH 22/55] - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild --- yaboot.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yaboot.spec b/yaboot.spec index c7d88ed..24428bb 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 13%{?dist} +Release: 14%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -99,6 +99,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Mon Jul 27 2009 Fedora Release Engineering - 1.3.14-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + * Sun Jun 07 2009 David Woodhouse - 1.3.14-13 - Don't set up bi_recs. Especially not in the middle of the kernel text. From 7ee6e263abaef374894820f627acc716911298ca Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Fri, 7 Aug 2009 16:31:28 +0000 Subject: [PATCH 23/55] Fix bad return code in verbose mode (#515555) --- yaboot-1.3.14-returns.patch | 11 +++++++++++ yaboot.spec | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 yaboot-1.3.14-returns.patch diff --git a/yaboot-1.3.14-returns.patch b/yaboot-1.3.14-returns.patch new file mode 100644 index 0000000..6692e89 --- /dev/null +++ b/yaboot-1.3.14-returns.patch @@ -0,0 +1,11 @@ +--- yaboot-1.3.14/ybin/mkofboot.orig 2009-08-07 11:08:04.000000000 +1000 ++++ yaboot-1.3.14/ybin/mkofboot 2009-08-07 11:08:09.000000000 +1000 +@@ -1164,6 +1164,8 @@ + fi + sync ; sync + [ "$VERBOSE" = 1 ] && echo "$PRG: Installation successful" ++ ++ return 0 + } + + ## make sure the first stage ofboot generator is compatible. diff --git a/yaboot.spec b/yaboot.spec index 24428bb..780c4d4 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 14%{?dist} +Release: 15%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -28,6 +28,9 @@ Patch32: yaboot-relocatable-kernel.patch Patch33: yaboot-1.3.14-better_netboot.patch Patch34: yaboot-1.3.14-no-birecs.patch +# mkofboot in verbose mode returns bad value +Patch35: yaboot-1.3.14-returns.patch + URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root Obsoletes: ybin @@ -64,6 +67,7 @@ yaboot can also bootload IBM pSeries machines. %patch32 -p1 -b .relocatable %patch33 -p1 -b .netboot %patch34 -p1 -b .birecs +%patch35 -p1 -b .returns %build make VERSIONEXTRA='\ (Red Hat %version-%release)' @@ -99,6 +103,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Fri Aug 07 2009 Roman Rakus - 1.3.14-15 +- Fix bad return code in verbose mode (#515555) + * Mon Jul 27 2009 Fedora Release Engineering - 1.3.14-14 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild From 46025e69e3e92a1368ec54c1d6099d6fc759ce70 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 7 Aug 2009 20:27:51 +0000 Subject: [PATCH 24/55] mkofboot is a symlink in the source tree. patching it does not do what we want. --- yaboot-1.3.14-returns.patch | 4 ++-- yaboot.spec | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/yaboot-1.3.14-returns.patch b/yaboot-1.3.14-returns.patch index 6692e89..b3d66da 100644 --- a/yaboot-1.3.14-returns.patch +++ b/yaboot-1.3.14-returns.patch @@ -1,5 +1,5 @@ ---- yaboot-1.3.14/ybin/mkofboot.orig 2009-08-07 11:08:04.000000000 +1000 -+++ yaboot-1.3.14/ybin/mkofboot 2009-08-07 11:08:09.000000000 +1000 +--- yaboot-1.3.14/ybin/ybin.orig 2009-08-07 11:08:04.000000000 +1000 ++++ yaboot-1.3.14/ybin/ybin 2009-08-07 11:08:09.000000000 +1000 @@ -1164,6 +1164,8 @@ fi sync ; sync diff --git a/yaboot.spec b/yaboot.spec index 780c4d4..084a35c 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 15%{?dist} +Release: 16%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -103,6 +103,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Fri Aug 07 2009 Bill Nottingham - 1.3.14-16 +- fix patch file for (#515555) + * Fri Aug 07 2009 Roman Rakus - 1.3.14-15 - Fix bad return code in verbose mode (#515555) From f1b0f3ab061a7f413b17943f5f310a789fa53a5a Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Fri, 14 Aug 2009 13:55:37 +0000 Subject: [PATCH 25/55] ipv6 support, don't do debuginfo rpm --- yaboot-1.3.14-ipv6.patch | 129 +++++++++++++++++++++++++++++++++++++++ yaboot.spec | 15 ++++- 2 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 yaboot-1.3.14-ipv6.patch diff --git a/yaboot-1.3.14-ipv6.patch b/yaboot-1.3.14-ipv6.patch new file mode 100644 index 0000000..0ec08be --- /dev/null +++ b/yaboot-1.3.14-ipv6.patch @@ -0,0 +1,129 @@ +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); diff --git a/yaboot.spec b/yaboot.spec index 084a35c..d25e3b3 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 16%{?dist} +Release: 17%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -31,6 +31,9 @@ Patch34: yaboot-1.3.14-no-birecs.patch # mkofboot in verbose mode returns bad value Patch35: yaboot-1.3.14-returns.patch +# ipv6 support +Patch36: yaboot-1.3.14-ipv6.patch + URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root Obsoletes: ybin @@ -38,6 +41,11 @@ ExclusiveArch: ppc Requires: hfsutils BuildRequires: e2fsprogs-devel +# 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, @@ -68,6 +76,7 @@ yaboot can also bootload IBM pSeries machines. %patch33 -p1 -b .netboot %patch34 -p1 -b .birecs %patch35 -p1 -b .returns +%patch36 -p1 -b .ipv6 %build make VERSIONEXTRA='\ (Red Hat %version-%release)' @@ -103,6 +112,10 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Fri Aug 14 2009 Roman Rakus - 1.3.14-17 +- ipv6 support +- don't build debuginfo package + * Fri Aug 07 2009 Bill Nottingham - 1.3.14-16 - fix patch file for (#515555) From 33c2ea3b3e947f2aba515c92c4094cdbf8cd6f69 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Fri, 14 Aug 2009 14:07:35 +0000 Subject: [PATCH 26/55] Use only yaboot-1.3.14 source tarball --- .cvsignore | 2 -- sources | 2 -- 2 files changed, 4 deletions(-) diff --git a/.cvsignore b/.cvsignore index 1961ae2..ee86d42 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,3 +1 @@ -yaboot-1.3.12.tar.gz -yaboot-1.3.13.tar.gz yaboot-1.3.14.tar.gz diff --git a/sources b/sources index 8c34882..de9d08c 100644 --- a/sources +++ b/sources @@ -1,3 +1 @@ -85cf685c1dc5873c2a5124ba4524b2d2 yaboot-1.3.12.tar.gz -f12798d1b2063f21d07e0ae7f602ccaf yaboot-1.3.13.tar.gz dd346812667ab3818248c9784fe8e38e yaboot-1.3.14.tar.gz From 5197e942ff79800b2ba4fb40b65be4b33364938d Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Wed, 9 Sep 2009 15:55:37 +0000 Subject: [PATCH 27/55] Do not require hfsutils on RHEL 6 --- yaboot.spec | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/yaboot.spec b/yaboot.spec index d25e3b3..587a2b9 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 17%{?dist} +Release: 18%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -34,11 +34,17 @@ Patch35: yaboot-1.3.14-returns.patch # ipv6 support Patch36: yaboot-1.3.14-ipv6.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%{?rhel} < 6 Requires: hfsutils +%endif BuildRequires: e2fsprogs-devel # yaboot is bootloader. It contains ELF object, but it is not Linux or MacOS @@ -112,6 +118,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Wed Sep 09 2009 Roman Rakus - 1.3.14-18 +- Do not require hfsutils on RHEL 6 + * Fri Aug 14 2009 Roman Rakus - 1.3.14-17 - ipv6 support - don't build debuginfo package From 43721b6e6a005fc29105e8ee6e78abf9c12b1727 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Wed, 9 Sep 2009 17:45:06 +0000 Subject: [PATCH 28/55] Fixed check for RHEL6 --- yaboot.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yaboot.spec b/yaboot.spec index 587a2b9..5986fef 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -42,7 +42,7 @@ ExclusiveArch: ppc # hfsutils will not be in RHEL6. # hfsutils is needed only for non-IBM ppc machines -%if ! 0%{?rhel} < 6 +%if ! 0%{?rhel} >= 6 Requires: hfsutils %endif BuildRequires: e2fsprogs-devel From 8e34c7d231e9f9eca08b37864b1651b4745db195 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Thu, 24 Sep 2009 12:16:42 +0000 Subject: [PATCH 29/55] Increase TFTP buffer to 32MB --- yaboot-1.3.14-better_netboot.patch | 2 +- yaboot.spec | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/yaboot-1.3.14-better_netboot.patch b/yaboot-1.3.14-better_netboot.patch index 4b2e05a..f06fce5 100644 --- a/yaboot-1.3.14-better_netboot.patch +++ b/yaboot-1.3.14-better_netboot.patch @@ -481,7 +481,7 @@ index 95c131d..5c7dd9b 100644 #define LOAD_BUFFER_POS 0x1000000 -#define LOAD_BUFFER_SIZE 0x1000000 -+#define LOAD_BUFFER_SIZE 0x1800000 ++#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); diff --git a/yaboot.spec b/yaboot.spec index 5986fef..92f7c50 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 18%{?dist} +Release: 19%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -118,6 +118,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Thu Sep 09 2009 Roman Rakus - 1.3.14-19 +- Increase TFTP buffer to 32MB + * Wed Sep 09 2009 Roman Rakus - 1.3.14-18 - Do not require hfsutils on RHEL 6 From 87e5af631bbec387eb50c53d800d1de3d001309a Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Mon, 19 Oct 2009 12:44:27 +0000 Subject: [PATCH 30/55] 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). --- ....3.14-dont_of_open_native_partitions.patch | 15 ++++++++++++++ yaboot.spec | 20 ++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 yaboot-1.3.14-dont_of_open_native_partitions.patch diff --git a/yaboot-1.3.14-dont_of_open_native_partitions.patch b/yaboot-1.3.14-dont_of_open_native_partitions.patch new file mode 100644 index 0000000..048349b --- /dev/null +++ b/yaboot-1.3.14-dont_of_open_native_partitions.patch @@ -0,0 +1,15 @@ +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 diff --git a/yaboot.spec b/yaboot.spec index 92f7c50..149675a 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 19%{?dist} +Release: 20%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -34,6 +34,8 @@ Patch35: yaboot-1.3.14-returns.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 URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root @@ -42,7 +44,7 @@ ExclusiveArch: ppc # hfsutils will not be in RHEL6. # hfsutils is needed only for non-IBM ppc machines -%if ! 0%{?rhel} >= 6 +%if 0%{?fedora} || 0%{?rhel} < 6 Requires: hfsutils %endif BuildRequires: e2fsprogs-devel @@ -83,8 +85,12 @@ yaboot can also bootload IBM pSeries machines. %patch34 -p1 -b .birecs %patch35 -p1 -b .returns %patch36 -p1 -b .ipv6 +%patch37 -p1 -b .partitions %build +make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1 +cp -a second/yaboot{,.debug} +make clean make VERSIONEXTRA='\ (Red Hat %version-%release)' %install @@ -93,6 +99,7 @@ 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 @@ -108,6 +115,7 @@ rm -rf $RPM_BUILD_ROOT /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 @@ -118,7 +126,13 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog -* Thu Sep 09 2009 Roman Rakus - 1.3.14-19 +* Mon Oct 19 2009 Roman Rakus - 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 - 1.3.14-19 - Increase TFTP buffer to 32MB * Wed Sep 09 2009 Roman Rakus - 1.3.14-18 From 09042cce687396cb7ebc97de59d6cebeb03f58ef Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Thu, 29 Oct 2009 12:20:12 +0000 Subject: [PATCH 31/55] 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) --- yaboot-1.3.14-better_netboot2.patch | 325 ++++++++++++++++++++++++++++ yaboot-1.3.14-move_kernel.patch | 118 ++++++++++ yaboot.spec | 15 +- 3 files changed, 457 insertions(+), 1 deletion(-) create mode 100644 yaboot-1.3.14-better_netboot2.patch create mode 100644 yaboot-1.3.14-move_kernel.patch diff --git a/yaboot-1.3.14-better_netboot2.patch b/yaboot-1.3.14-better_netboot2.patch new file mode 100644 index 0000000..1561e88 --- /dev/null +++ b/yaboot-1.3.14-better_netboot2.patch @@ -0,0 +1,325 @@ +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; jsubnetmask == 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 diff --git a/yaboot-1.3.14-move_kernel.patch b/yaboot-1.3.14-move_kernel.patch new file mode 100644 index 0000000..8142646 --- /dev/null +++ b/yaboot-1.3.14-move_kernel.patch @@ -0,0 +1,118 @@ +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)); + } diff --git a/yaboot.spec b/yaboot.spec index 149675a..5dbd83c 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 20%{?dist} +Release: 21%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -37,6 +37,12 @@ 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 + URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root Obsoletes: ybin @@ -86,6 +92,8 @@ yaboot can also bootload IBM pSeries machines. %patch35 -p1 -b .returns %patch36 -p1 -b .ipv6 %patch37 -p1 -b .partitions +%patch38 -p1 -b .netboot2 +%patch39 -p1 -b .movekernel %build make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1 @@ -126,6 +134,11 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Thu Oct 29 2009 Roman Rakus - 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 - 1.3.13-20 - Only require hfsutils on fedora and rhel <= 5 - Explicitly build a DEBUG=1 version of yaboot to aid in debugging From 76bc8b3f41ae79b624d3b01c828c4c8fcb99e04f Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 25 Nov 2009 22:39:34 +0000 Subject: [PATCH 32/55] Fix typo that causes a failure to update the common directory. (releng #2781) --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c014f1e..4234502 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ # Makefile for source rpm: yaboot -# $Id: Makefile,v 1.2 2004/09/18 08:21:27 pnasrat Exp $ +# $Id: Makefile,v 1.3 2007/10/15 19:38:27 notting Exp $ NAME := yaboot SPECFILE = $(firstword $(wildcard *.spec)) UPSTREAM_CHECKS = sig define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done +for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done endef MAKEFILE_COMMON := $(shell $(find-makefile-common)) From faf5395bdb35f1951506e30187e618f70839d0d9 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Fri, 22 Jan 2010 15:48:28 +0000 Subject: [PATCH 33/55] SHA2 support --- yaboot-sha2.patch | 1687 +++++++++++++++++++++++++++++++++++++++++++++ yaboot.spec | 9 +- 2 files changed, 1695 insertions(+), 1 deletion(-) create mode 100644 yaboot-sha2.patch diff --git a/yaboot-sha2.patch b/yaboot-sha2.patch new file mode 100644 index 0000000..b70c4ad --- /dev/null +++ b/yaboot-sha2.patch @@ -0,0 +1,1687 @@ +diff -urN --exclude '*~' yaboot/doc/yaboot-howto.sgml yaboot-1.3.14/doc/yaboot-howto.sgml +--- yaboot/doc/yaboot-howto.sgml 2008-04-15 15:34:48.000000000 +0200 ++++ yaboot-1.3.14/doc/yaboot-howto.sgml 2010-01-13 17:12:26.046808859 +0100 +@@ -487,17 +487,17 @@ + +

+ +-The password= line may either be a plaintext password or an MD5 +-hash (the same format as the Linux /etc/shadow file). To make an +-md5 hash use the following perl snippet: ++The password= line may either be a plaintext password or a ++hash (the same format as the Linux /etc/shadow file, using MD5, ++SHA-256 or SHA-512). To make a SHA-512 hash use the following perl snippet: + + +- $ perl -e 'printf("%s\n", crypt("secret", "\$1\$saltstrg"))' ++ $ perl -e 'printf("%s\n", crypt("secret", "\$6\$saltstrg"))' + + The saltstrg should be a random string, for example one generated by + + +- makepasswd --chars=8 ++ makepasswd --chars=16 + + + +diff -urN --exclude '*~' yaboot/etc/yaboot.conf yaboot-1.3.14/etc/yaboot.conf +--- yaboot/etc/yaboot.conf 2010-01-12 22:39:21.593765245 +0100 ++++ yaboot-1.3.14/etc/yaboot.conf 2010-01-13 17:09:25.957808951 +0100 +@@ -53,6 +53,10 @@ + + #password=$1$saltstrg$HnJ/gcM3oKhNbnzUPgXTD/ + ++## Password supplied as a SHA-2 hash, see above ++ ++#password=6$saltstrg$RtV84gQMyM4d9gENIlyHmaGKQXckHJBjhU4aBOpbyzcvDMSxK/dJI7e/sYJtRwl4sR9WTFCfKJLVaDY.5VdjU1 ++ + ## A password is only required to boot an image specified here if + ## parameters are specified on the command line or if the user enters + ## an image is not specified in the configuration file at all (ie. +diff -urN --exclude '*~' yaboot/include/string.h yaboot-1.3.14/include/string.h +--- yaboot/include/string.h 2008-04-15 15:34:48.000000000 +0200 ++++ yaboot-1.3.14/include/string.h 2010-01-13 14:18:51.293809297 +0100 +@@ -7,6 +7,7 @@ + extern char * ___strtok; + extern char * strcpy(char *,const char *); + extern char * strncpy(char *,const char *, size_t); ++extern char * stpncpy(char *,const char *, size_t); + extern char * strcat(char *, const char *); + extern char * strncat(char *, const char *, size_t); + extern char * strchr(const char *,int); +diff -urN --exclude '*~' yaboot/include/yaboot.h yaboot-1.3.14/include/yaboot.h +--- yaboot/include/yaboot.h 2008-04-15 15:34:48.000000000 +0200 ++++ yaboot-1.3.14/include/yaboot.h 2010-01-12 22:43:37.092766857 +0100 +@@ -59,4 +59,7 @@ + extern char *bootpath; + extern int bootpartition; + ++extern char *sha256_crypt (const char *key, const char *salt); ++extern char *sha512_crypt (const char *key, const char *salt); ++ + #endif +diff -urN --exclude '*~' yaboot/lib/stpncpy.c yaboot-1.3.14/lib/stpncpy.c +--- yaboot/lib/stpncpy.c 1970-01-01 01:00:00.000000000 +0100 ++++ yaboot-1.3.14/lib/stpncpy.c 2010-01-13 14:55:22.663809519 +0100 +@@ -0,0 +1,21 @@ ++#include "string.h" ++ ++char * ++stpncpy (char *dest, const char *src, size_t n) ++{ ++ char *res; ++ ++ res = NULL; ++ while (n != 0) { ++ *dest = *src; ++ if (*src != 0) ++ src++; ++ else if (res == NULL) ++ res = dest; ++ dest++; ++ n--; ++ } ++ if (res == NULL) ++ res = dest; ++ return res; ++} +diff -urN --exclude '*~' yaboot/Makefile yaboot-1.3.14/Makefile +--- yaboot/Makefile 2010-01-12 22:39:21.669786352 +0100 ++++ yaboot-1.3.14/Makefile 2010-01-13 14:20:28.214809232 +0100 +@@ -85,7 +85,8 @@ + OBJS = second/crt0.o second/yaboot.o second/cache.o second/prom.o second/file.o \ + second/partition.o second/fs.o second/cfg.o second/setjmp.o second/cmdline.o \ + second/fs_of.o second/fs_ext2.o second/fs_iso.o second/iso_util.o \ +- lib/nosys.o lib/string.o lib/strtol.o lib/vsprintf.o lib/ctype.o lib/malloc.o lib/strstr.o ++ second/sha256crypt.o second/sha512crypt.o \ ++ lib/nosys.o lib/string.o lib/strtol.o lib/vsprintf.o lib/ctype.o lib/malloc.o lib/stpncpy.o lib/strstr.o + + ifeq ($(USE_MD5_PASSWORDS),y) + OBJS += second/md5.o +diff -urN --exclude '*~' yaboot/man/yaboot.conf.5 yaboot-1.3.14/man/yaboot.conf.5 +--- yaboot/man/yaboot.conf.5 2010-01-12 22:39:21.565767002 +0100 ++++ yaboot-1.3.14/man/yaboot.conf.5 2010-01-13 17:10:00.334808308 +0100 +@@ -258,8 +258,9 @@ + .TP + .BI "password=" password + Protect booting by a password. The password is given in either +-cleartext or an md5 hash (of the same format as used in GNU/Linux +-passwd files)in the configuration file. Because of that, the ++cleartext or an hash (of the same format as used in GNU/Linux ++passwd files, using MD5, SHA-256 or SHA-512) in the configuration file. ++Because of that, the + configuration file should be only readable by the superuser and the + password should differ if possible from other passwords on the system. + See +diff -urN --exclude '*~' yaboot/second/sha256crypt.c yaboot-1.3.14/second/sha256crypt.c +--- yaboot/second/sha256crypt.c 1970-01-01 01:00:00.000000000 +0100 ++++ yaboot-1.3.14/second/sha256crypt.c 2010-01-13 16:56:46.453807903 +0100 +@@ -0,0 +1,735 @@ ++/* SHA256-based Unix crypt implementation. ++ Released into the Public Domain by Ulrich Drepper . ++ Adapted for yaboot by Miloslav Trmac . */ ++ ++#include ++#include "prom.h" ++#include "stdlib.h" ++#include "string.h" ++#include "types.h" ++ ++#define TEST ++typedef size_t uintptr_t; ++#define alloca(SIZE) (__builtin_alloca (SIZE)) ++#define MIN(a, b) ((a) < (b) ? (a) : (b)) ++#define MAX(a, b) ((a) > (b) ? (a) : (b)) ++ ++/* Structure to save state of computation between the single steps. */ ++struct sha256_ctx ++{ ++ uint32_t H[8]; ++ ++ uint32_t total[2]; ++ uint32_t buflen; ++ char buffer[128]; /* NB: always correctly aligned for uint32_t. */ ++}; ++ ++ ++#if 0 /* __BYTE_ORDER == __LITTLE_ENDIAN */ ++# define SWAP(n) \ ++ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) ++#else ++# define SWAP(n) (n) ++#endif ++ ++ ++/* This array contains the bytes used to pad the buffer to the next ++ 64-byte boundary. (FIPS 180-2:5.1.1) */ ++static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; ++ ++ ++/* Constants for SHA256 from FIPS 180-2:4.2.2. */ ++static const uint32_t K[64] = ++ { ++ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, ++ 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, ++ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, ++ 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, ++ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, ++ 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, ++ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, ++ 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, ++ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, ++ 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, ++ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, ++ 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, ++ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, ++ 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, ++ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, ++ 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 ++ }; ++ ++ ++/* Process LEN bytes of BUFFER, accumulating context into CTX. ++ It is assumed that LEN % 64 == 0. */ ++static void ++sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx) ++{ ++ const uint32_t *words = buffer; ++ size_t nwords = len / sizeof (uint32_t); ++ uint32_t a = ctx->H[0]; ++ uint32_t b = ctx->H[1]; ++ uint32_t c = ctx->H[2]; ++ uint32_t d = ctx->H[3]; ++ uint32_t e = ctx->H[4]; ++ uint32_t f = ctx->H[5]; ++ uint32_t g = ctx->H[6]; ++ uint32_t h = ctx->H[7]; ++ ++ /* First increment the byte count. FIPS 180-2 specifies the possible ++ length of the file up to 2^64 bits. Here we only compute the ++ number of bytes. Do a double word increment. */ ++ ctx->total[0] += len; ++ if (ctx->total[0] < len) ++ ++ctx->total[1]; ++ ++ /* Process all bytes in the buffer with 64 bytes in each round of ++ the loop. */ ++ while (nwords > 0) ++ { ++ uint32_t W[64]; ++ uint32_t a_save = a; ++ uint32_t b_save = b; ++ uint32_t c_save = c; ++ uint32_t d_save = d; ++ uint32_t e_save = e; ++ uint32_t f_save = f; ++ uint32_t g_save = g; ++ uint32_t h_save = h; ++ unsigned int t; ++ ++ /* Operators defined in FIPS 180-2:4.1.2. */ ++#define Ch(x, y, z) ((x & y) ^ (~x & z)) ++#define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z)) ++#define S0(x) (CYCLIC (x, 2) ^ CYCLIC (x, 13) ^ CYCLIC (x, 22)) ++#define S1(x) (CYCLIC (x, 6) ^ CYCLIC (x, 11) ^ CYCLIC (x, 25)) ++#define R0(x) (CYCLIC (x, 7) ^ CYCLIC (x, 18) ^ (x >> 3)) ++#define R1(x) (CYCLIC (x, 17) ^ CYCLIC (x, 19) ^ (x >> 10)) ++ ++ /* It is unfortunate that C does not provide an operator for ++ cyclic rotation. Hope the C compiler is smart enough. */ ++#define CYCLIC(w, s) ((w >> s) | (w << (32 - s))) ++ ++ /* Compute the message schedule according to FIPS 180-2:6.2.2 step 2. */ ++ for (t = 0; t < 16; ++t) ++ { ++ W[t] = SWAP (*words); ++ ++words; ++ } ++ for (t = 16; t < 64; ++t) ++ W[t] = R1 (W[t - 2]) + W[t - 7] + R0 (W[t - 15]) + W[t - 16]; ++ ++ /* The actual computation according to FIPS 180-2:6.2.2 step 3. */ ++ for (t = 0; t < 64; ++t) ++ { ++ uint32_t T1 = h + S1 (e) + Ch (e, f, g) + K[t] + W[t]; ++ uint32_t T2 = S0 (a) + Maj (a, b, c); ++ h = g; ++ g = f; ++ f = e; ++ e = d + T1; ++ d = c; ++ c = b; ++ b = a; ++ a = T1 + T2; ++ } ++ ++ /* Add the starting values of the context according to FIPS 180-2:6.2.2 ++ step 4. */ ++ a += a_save; ++ b += b_save; ++ c += c_save; ++ d += d_save; ++ e += e_save; ++ f += f_save; ++ g += g_save; ++ h += h_save; ++ ++ /* Prepare for the next round. */ ++ nwords -= 16; ++ } ++ ++ /* Put checksum in context given as argument. */ ++ ctx->H[0] = a; ++ ctx->H[1] = b; ++ ctx->H[2] = c; ++ ctx->H[3] = d; ++ ctx->H[4] = e; ++ ctx->H[5] = f; ++ ctx->H[6] = g; ++ ctx->H[7] = h; ++} ++ ++ ++/* Initialize structure containing state of computation. ++ (FIPS 180-2:5.3.2) */ ++static void ++sha256_init_ctx (struct sha256_ctx *ctx) ++{ ++ ctx->H[0] = 0x6a09e667; ++ ctx->H[1] = 0xbb67ae85; ++ ctx->H[2] = 0x3c6ef372; ++ ctx->H[3] = 0xa54ff53a; ++ ctx->H[4] = 0x510e527f; ++ ctx->H[5] = 0x9b05688c; ++ ctx->H[6] = 0x1f83d9ab; ++ ctx->H[7] = 0x5be0cd19; ++ ++ ctx->total[0] = ctx->total[1] = 0; ++ ctx->buflen = 0; ++} ++ ++ ++/* Process the remaining bytes in the internal buffer and the usual ++ prolog according to the standard and write the result to RESBUF. ++ ++ IMPORTANT: On some systems it is required that RESBUF is correctly ++ aligned for a 32 bits value. */ ++static void * ++sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf) ++{ ++ /* Take yet unprocessed bytes into account. */ ++ uint32_t bytes = ctx->buflen; ++ size_t pad; ++ unsigned int i; ++ ++ /* Now count remaining bytes. */ ++ ctx->total[0] += bytes; ++ if (ctx->total[0] < bytes) ++ ++ctx->total[1]; ++ ++ pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; ++ memcpy (&ctx->buffer[bytes], fillbuf, pad); ++ ++ /* Put the 64-bit file length in *bits* at the end of the buffer. */ ++ *(uint32_t *) &ctx->buffer[bytes + pad + 4] = SWAP (ctx->total[0] << 3); ++ *(uint32_t *) &ctx->buffer[bytes + pad] = SWAP ((ctx->total[1] << 3) | ++ (ctx->total[0] >> 29)); ++ ++ /* Process last bytes. */ ++ sha256_process_block (ctx->buffer, bytes + pad + 8, ctx); ++ ++ /* Put result from CTX in first 32 bytes following RESBUF. */ ++ for (i = 0; i < 8; ++i) ++ ((uint32_t *) resbuf)[i] = SWAP (ctx->H[i]); ++ ++ return resbuf; ++} ++ ++ ++static void ++sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx) ++{ ++ /* When we already have some bits in our internal buffer concatenate ++ both inputs first. */ ++ if (ctx->buflen != 0) ++ { ++ size_t left_over = ctx->buflen; ++ size_t add = 128 - left_over > len ? len : 128 - left_over; ++ ++ memcpy (&ctx->buffer[left_over], buffer, add); ++ ctx->buflen += add; ++ ++ if (ctx->buflen > 64) ++ { ++ sha256_process_block (ctx->buffer, ctx->buflen & ~63, ctx); ++ ++ ctx->buflen &= 63; ++ /* The regions in the following copy operation cannot overlap. */ ++ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], ++ ctx->buflen); ++ } ++ ++ buffer = (const char *) buffer + add; ++ len -= add; ++ } ++ ++ /* Process available complete blocks. */ ++ if (len >= 64) ++ { ++/* To check alignment gcc has an appropriate operator. Other ++ compilers don't. */ ++#if __GNUC__ >= 2 ++# define UNALIGNED_P(p) (((uintptr_t) p) % __alignof__ (uint32_t) != 0) ++#else ++# define UNALIGNED_P(p) (((uintptr_t) p) % sizeof (uint32_t) != 0) ++#endif ++ if (UNALIGNED_P (buffer)) ++ while (len > 64) ++ { ++ sha256_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); ++ buffer = (const char *) buffer + 64; ++ len -= 64; ++ } ++ else ++ { ++ sha256_process_block (buffer, len & ~63, ctx); ++ buffer = (const char *) buffer + (len & ~63); ++ len &= 63; ++ } ++ } ++ ++ /* Move remaining bytes into internal buffer. */ ++ if (len > 0) ++ { ++ size_t left_over = ctx->buflen; ++ ++ memcpy (&ctx->buffer[left_over], buffer, len); ++ left_over += len; ++ if (left_over >= 64) ++ { ++ sha256_process_block (ctx->buffer, 64, ctx); ++ left_over -= 64; ++ memcpy (ctx->buffer, &ctx->buffer[64], left_over); ++ } ++ ctx->buflen = left_over; ++ } ++} ++ ++ ++/* Define our magic string to mark salt for SHA256 "encryption" ++ replacement. */ ++static const char sha256_salt_prefix[] = "$5$"; ++ ++/* Prefix for optional rounds specification. */ ++static const char sha256_rounds_prefix[] = "rounds="; ++ ++/* Maximum salt string length. */ ++#define SALT_LEN_MAX 16 ++/* Default number of rounds if not explicitly specified. */ ++#define ROUNDS_DEFAULT 5000 ++/* Minimum number of rounds. */ ++#define ROUNDS_MIN 1000 ++/* Maximum number of rounds. */ ++#define ROUNDS_MAX 999999999 ++ ++/* Table with characters for base64 transformation. */ ++static const char b64t[64] = ++"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; ++ ++ ++static char * ++sha256_crypt_r (const char *key, const char *salt, char *buffer, int buflen) ++{ ++ unsigned char alt_result[32] ++ __attribute__ ((__aligned__ (__alignof__ (uint32_t)))); ++ unsigned char temp_result[32] ++ __attribute__ ((__aligned__ (__alignof__ (uint32_t)))); ++ struct sha256_ctx ctx; ++ struct sha256_ctx alt_ctx; ++ size_t salt_len; ++ size_t key_len; ++ size_t cnt; ++ char *cp; ++ char *copied_key = NULL; ++ char *copied_salt = NULL; ++ char *p_bytes; ++ char *s_bytes; ++ /* Default number of rounds. */ ++ size_t rounds = ROUNDS_DEFAULT; ++ bool rounds_custom = false; ++ ++ /* Find beginning of salt string. The prefix should normally always ++ be present. Just in case it is not. */ ++ if (strncmp (sha256_salt_prefix, salt, sizeof (sha256_salt_prefix) - 1) == 0) ++ /* Skip salt prefix. */ ++ salt += sizeof (sha256_salt_prefix) - 1; ++ ++ if (strncmp (salt, sha256_rounds_prefix, sizeof (sha256_rounds_prefix) - 1) ++ == 0) ++ { ++ const char *num = salt + sizeof (sha256_rounds_prefix) - 1; ++ char *endp; ++ unsigned long int srounds = (unsigned long)strtol (num, &endp, 10); ++ if (*endp == '$') ++ { ++ salt = endp + 1; ++ rounds = MAX (ROUNDS_MIN, MIN (srounds, ROUNDS_MAX)); ++ rounds_custom = true; ++ } ++ } ++ ++ { ++ char *salt_end; ++ ++ salt_end = strchr (salt, '$'); ++ if (salt_end == NULL) ++ salt_end = strchr (salt, '\0'); ++ salt_len = salt_end - salt; ++ } ++ salt_len = MIN (salt_len, SALT_LEN_MAX); ++ key_len = strlen (key); ++ ++ if ((key - (char *) 0) % __alignof__ (uint32_t) != 0) ++ { ++ char *tmp = (char *) alloca (key_len + __alignof__ (uint32_t)); ++ key = copied_key = ++ memcpy (tmp + __alignof__ (uint32_t) ++ - (tmp - (char *) 0) % __alignof__ (uint32_t), ++ key, key_len); ++ } ++ ++ if ((salt - (char *) 0) % __alignof__ (uint32_t) != 0) ++ { ++ char *tmp = (char *) alloca (salt_len + __alignof__ (uint32_t)); ++ salt = copied_salt = ++ memcpy (tmp + __alignof__ (uint32_t) ++ - (tmp - (char *) 0) % __alignof__ (uint32_t), ++ salt, salt_len); ++ } ++ ++ /* Prepare for the real work. */ ++ sha256_init_ctx (&ctx); ++ ++ /* Add the key string. */ ++ sha256_process_bytes (key, key_len, &ctx); ++ ++ /* The last part is the salt string. This must be at most 16 ++ characters and it ends at the first `$' character (for ++ compatibility with existing implementations). */ ++ sha256_process_bytes (salt, salt_len, &ctx); ++ ++ ++ /* Compute alternate SHA256 sum with input KEY, SALT, and KEY. The ++ final result will be added to the first context. */ ++ sha256_init_ctx (&alt_ctx); ++ ++ /* Add key. */ ++ sha256_process_bytes (key, key_len, &alt_ctx); ++ ++ /* Add salt. */ ++ sha256_process_bytes (salt, salt_len, &alt_ctx); ++ ++ /* Add key again. */ ++ sha256_process_bytes (key, key_len, &alt_ctx); ++ ++ /* Now get result of this (32 bytes) and add it to the other ++ context. */ ++ sha256_finish_ctx (&alt_ctx, alt_result); ++ ++ /* Add for any character in the key one byte of the alternate sum. */ ++ for (cnt = key_len; cnt > 32; cnt -= 32) ++ sha256_process_bytes (alt_result, 32, &ctx); ++ sha256_process_bytes (alt_result, cnt, &ctx); ++ ++ /* Take the binary representation of the length of the key and for every ++ 1 add the alternate sum, for every 0 the key. */ ++ for (cnt = key_len; cnt > 0; cnt >>= 1) ++ if ((cnt & 1) != 0) ++ sha256_process_bytes (alt_result, 32, &ctx); ++ else ++ sha256_process_bytes (key, key_len, &ctx); ++ ++ /* Create intermediate result. */ ++ sha256_finish_ctx (&ctx, alt_result); ++ ++ /* Start computation of P byte sequence. */ ++ sha256_init_ctx (&alt_ctx); ++ ++ /* For every character in the password add the entire password. */ ++ for (cnt = 0; cnt < key_len; ++cnt) ++ sha256_process_bytes (key, key_len, &alt_ctx); ++ ++ /* Finish the digest. */ ++ sha256_finish_ctx (&alt_ctx, temp_result); ++ ++ /* Create byte sequence P. */ ++ cp = p_bytes = alloca (key_len); ++ for (cnt = key_len; cnt >= 32; cnt -= 32) ++ { ++ memcpy (cp, temp_result, 32); ++ cp += 32; ++ } ++ memcpy (cp, temp_result, cnt); ++ ++ /* Start computation of S byte sequence. */ ++ sha256_init_ctx (&alt_ctx); ++ ++ /* For every character in the password add the entire password. */ ++ for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt) ++ sha256_process_bytes (salt, salt_len, &alt_ctx); ++ ++ /* Finish the digest. */ ++ sha256_finish_ctx (&alt_ctx, temp_result); ++ ++ /* Create byte sequence S. */ ++ cp = s_bytes = alloca (salt_len); ++ for (cnt = salt_len; cnt >= 32; cnt -= 32) ++ { ++ memcpy (cp, temp_result, 32); ++ cp += 32; ++ } ++ memcpy (cp, temp_result, cnt); ++ ++ /* Repeatedly run the collected hash value through SHA256 to burn ++ CPU cycles. */ ++ for (cnt = 0; cnt < rounds; ++cnt) ++ { ++ /* New context. */ ++ sha256_init_ctx (&ctx); ++ ++ /* Add key or last result. */ ++ if ((cnt & 1) != 0) ++ sha256_process_bytes (p_bytes, key_len, &ctx); ++ else ++ sha256_process_bytes (alt_result, 32, &ctx); ++ ++ /* Add salt for numbers not divisible by 3. */ ++ if (cnt % 3 != 0) ++ sha256_process_bytes (s_bytes, salt_len, &ctx); ++ ++ /* Add key for numbers not divisible by 7. */ ++ if (cnt % 7 != 0) ++ sha256_process_bytes (p_bytes, key_len, &ctx); ++ ++ /* Add key or last result. */ ++ if ((cnt & 1) != 0) ++ sha256_process_bytes (alt_result, 32, &ctx); ++ else ++ sha256_process_bytes (p_bytes, key_len, &ctx); ++ ++ /* Create intermediate result. */ ++ sha256_finish_ctx (&ctx, alt_result); ++ } ++ ++ /* Now we can construct the result string. It consists of three ++ parts. */ ++ cp = stpncpy (buffer, sha256_salt_prefix, MAX (0, buflen)); ++ buflen -= sizeof (sha256_salt_prefix) - 1; ++ ++ if (rounds_custom) ++ { ++ char sbuf[64]; ++ sprintf (sbuf, "%s%Lu$", sha256_rounds_prefix, ++ (unsigned long long)rounds); ++ size_t n = strlen (sbuf); ++ memcpy (cp, sbuf, MIN (MAX (0, buflen), n)); ++ cp += n; ++ buflen -= n; ++ } ++ ++ cp = stpncpy (cp, salt, MIN ((size_t) MAX (0, buflen), salt_len)); ++ buflen -= MIN ((size_t) MAX (0, buflen), salt_len); ++ ++ if (buflen > 0) ++ { ++ *cp++ = '$'; ++ --buflen; ++ } ++ ++#define b64_from_24bit(B2, B1, B0, N) \ ++ do { \ ++ unsigned int w = ((B2) << 16) | ((B1) << 8) | (B0); \ ++ int n = (N); \ ++ while (n-- > 0 && buflen > 0) \ ++ { \ ++ *cp++ = b64t[w & 0x3f]; \ ++ --buflen; \ ++ w >>= 6; \ ++ } \ ++ } while (0) ++ ++ b64_from_24bit (alt_result[0], alt_result[10], alt_result[20], 4); ++ b64_from_24bit (alt_result[21], alt_result[1], alt_result[11], 4); ++ b64_from_24bit (alt_result[12], alt_result[22], alt_result[2], 4); ++ b64_from_24bit (alt_result[3], alt_result[13], alt_result[23], 4); ++ b64_from_24bit (alt_result[24], alt_result[4], alt_result[14], 4); ++ b64_from_24bit (alt_result[15], alt_result[25], alt_result[5], 4); ++ b64_from_24bit (alt_result[6], alt_result[16], alt_result[26], 4); ++ b64_from_24bit (alt_result[27], alt_result[7], alt_result[17], 4); ++ b64_from_24bit (alt_result[18], alt_result[28], alt_result[8], 4); ++ b64_from_24bit (alt_result[9], alt_result[19], alt_result[29], 4); ++ b64_from_24bit (0, alt_result[31], alt_result[30], 3); ++ if (buflen <= 0) ++ buffer = NULL; ++ else ++ *cp = '\0'; /* Terminate the string. */ ++ ++ /* Clear the buffer for the intermediate result so that people ++ attaching to processes or reading core dumps cannot get any ++ information. We do it in this way to clear correct_words[] ++ inside the SHA256 implementation as well. */ ++ sha256_init_ctx (&ctx); ++ sha256_finish_ctx (&ctx, alt_result); ++ memset (temp_result, '\0', sizeof (temp_result)); ++ memset (p_bytes, '\0', key_len); ++ memset (s_bytes, '\0', salt_len); ++ memset (&ctx, '\0', sizeof (ctx)); ++ memset (&alt_ctx, '\0', sizeof (alt_ctx)); ++ if (copied_key != NULL) ++ memset (copied_key, '\0', key_len); ++ if (copied_salt != NULL) ++ memset (copied_salt, '\0', salt_len); ++ ++ return buffer; ++} ++ ++ ++/* This entry point is equivalent to the `crypt' function in Unix ++ libcs. */ ++char * ++sha256_crypt (const char *key, const char *salt) ++{ ++ /* We don't want to have an arbitrary limit in the size of the ++ password. We can compute an upper bound for the size of the ++ result in advance and so we can prepare the buffer we pass to ++ `sha256_crypt_r'. */ ++ static char *buffer; ++ static int buflen; ++ int needed = (sizeof (sha256_salt_prefix) - 1 ++ + sizeof (sha256_rounds_prefix) + 9 + 1 ++ + strlen (salt) + 1 + 43 + 1); ++ ++ if (buflen < needed) ++ { ++ char *new_buffer = (char *) realloc (buffer, needed); ++ if (new_buffer == NULL) ++ return NULL; ++ ++ buffer = new_buffer; ++ buflen = needed; ++ } ++ ++ return sha256_crypt_r (key, salt, buffer, buflen); ++} ++ ++ ++#ifdef TEST ++static const struct ++{ ++ const char *input; ++ const char result[32]; ++} tests[] = ++ { ++ /* Test vectors from FIPS 180-2: appendix B.1. */ ++ { "abc", ++ "\xba\x78\x16\xbf\x8f\x01\xcf\xea\x41\x41\x40\xde\x5d\xae\x22\x23" ++ "\xb0\x03\x61\xa3\x96\x17\x7a\x9c\xb4\x10\xff\x61\xf2\x00\x15\xad" }, ++ /* Test vectors from FIPS 180-2: appendix B.2. */ ++ { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", ++ "\x24\x8d\x6a\x61\xd2\x06\x38\xb8\xe5\xc0\x26\x93\x0c\x3e\x60\x39" ++ "\xa3\x3c\xe4\x59\x64\xff\x21\x67\xf6\xec\xed\xd4\x19\xdb\x06\xc1" }, ++ /* Test vectors from the NESSIE project. */ ++ { "", ++ "\xe3\xb0\xc4\x42\x98\xfc\x1c\x14\x9a\xfb\xf4\xc8\x99\x6f\xb9\x24" ++ "\x27\xae\x41\xe4\x64\x9b\x93\x4c\xa4\x95\x99\x1b\x78\x52\xb8\x55" }, ++ { "a", ++ "\xca\x97\x81\x12\xca\x1b\xbd\xca\xfa\xc2\x31\xb3\x9a\x23\xdc\x4d" ++ "\xa7\x86\xef\xf8\x14\x7c\x4e\x72\xb9\x80\x77\x85\xaf\xee\x48\xbb" }, ++ { "message digest", ++ "\xf7\x84\x6f\x55\xcf\x23\xe1\x4e\xeb\xea\xb5\xb4\xe1\x55\x0c\xad" ++ "\x5b\x50\x9e\x33\x48\xfb\xc4\xef\xa3\xa1\x41\x3d\x39\x3c\xb6\x50" }, ++ { "abcdefghijklmnopqrstuvwxyz", ++ "\x71\xc4\x80\xdf\x93\xd6\xae\x2f\x1e\xfa\xd1\x44\x7c\x66\xc9\x52" ++ "\x5e\x31\x62\x18\xcf\x51\xfc\x8d\x9e\xd8\x32\xf2\xda\xf1\x8b\x73" }, ++ { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", ++ "\x24\x8d\x6a\x61\xd2\x06\x38\xb8\xe5\xc0\x26\x93\x0c\x3e\x60\x39" ++ "\xa3\x3c\xe4\x59\x64\xff\x21\x67\xf6\xec\xed\xd4\x19\xdb\x06\xc1" }, ++ { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", ++ "\xdb\x4b\xfc\xbd\x4d\xa0\xcd\x85\xa6\x0c\x3c\x37\xd3\xfb\xd8\x80" ++ "\x5c\x77\xf1\x5f\xc6\xb1\xfd\xfe\x61\x4e\xe0\xa7\xc8\xfd\xb4\xc0" }, ++ { "123456789012345678901234567890123456789012345678901234567890" ++ "12345678901234567890", ++ "\xf3\x71\xbc\x4a\x31\x1f\x2b\x00\x9e\xef\x95\x2d\xd8\x3c\xa8\x0e" ++ "\x2b\x60\x02\x6c\x8e\x93\x55\x92\xd0\xf9\xc3\x08\x45\x3c\x81\x3e" } ++ }; ++#define ntests (sizeof (tests) / sizeof (tests[0])) ++ ++ ++static const struct ++{ ++ const char *salt; ++ const char *input; ++ const char *expected; ++} tests2[] = ++{ ++ { "$5$saltstring", "Hello world!", ++ "$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5" }, ++ { "$5$rounds=10000$saltstringsaltstring", "Hello world!", ++ "$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2." ++ "opqey6IcA" }, ++ { "$5$rounds=5000$toolongsaltstring", "This is just a test", ++ "$5$rounds=5000$toolongsaltstrin$Un/5jzAHMgOGZ5.mWJpuVolil07guHPvOW8" ++ "mGRcvxa5" }, ++ { "$5$rounds=1400$anotherlongsaltstring", ++ "a very much longer text to encrypt. This one even stretches over more" ++ "than one line.", ++ "$5$rounds=1400$anotherlongsalts$Rx.j8H.h8HjEDGomFU8bDkXm3XIUnzyxf12" ++ "oP84Bnq1" }, ++ { "$5$rounds=77777$short", ++ "we have a short salt string but not a short password", ++ "$5$rounds=77777$short$JiO1O3ZpDAxGJeaDIuqCoEFysAe1mZNJRs3pw0KQRd/" }, ++ { "$5$rounds=123456$asaltof16chars..", "a short string", ++ "$5$rounds=123456$asaltof16chars..$gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/" ++ "cZKmF/wJvD" }, ++ { "$5$rounds=10$roundstoolow", "the minimum number is still observed", ++ "$5$rounds=1000$roundstoolow$yfvwcWrQ8l/K0DAWyuPMDNHpIVlTQebY9l/gL97" ++ "2bIC" }, ++}; ++#define ntests2 (sizeof (tests2) / sizeof (tests2[0])) ++ ++ ++int ++sha256_test (void) ++{ ++ struct sha256_ctx ctx; ++ char sum[32]; ++ int result = 0; ++ int cnt, i; ++ ++ for (cnt = 0; cnt < (int) ntests; ++cnt) ++ { ++ sha256_init_ctx (&ctx); ++ sha256_process_bytes (tests[cnt].input, strlen (tests[cnt].input), &ctx); ++ sha256_finish_ctx (&ctx, sum); ++ if (memcmp (tests[cnt].result, sum, 32) != 0) ++ { ++ prom_printf ("test %d run %d failed\n", cnt, 1); ++ result = 1; ++ } ++ ++ sha256_init_ctx (&ctx); ++ for (i = 0; tests[cnt].input[i] != '\0'; ++i) ++ sha256_process_bytes (&tests[cnt].input[i], 1, &ctx); ++ sha256_finish_ctx (&ctx, sum); ++ if (memcmp (tests[cnt].result, sum, 32) != 0) ++ { ++ prom_printf ("test %d run %d failed\n", cnt, 2); ++ result = 1; ++ } ++ } ++ ++ /* Test vector from FIPS 180-2: appendix B.3. */ ++ char buf[1000]; ++ memset (buf, 'a', sizeof (buf)); ++ sha256_init_ctx (&ctx); ++ for (i = 0; i < 1000; ++i) ++ sha256_process_bytes (buf, sizeof (buf), &ctx); ++ sha256_finish_ctx (&ctx, sum); ++ static const char expected[32] = ++ "\xcd\xc7\x6e\x5c\x99\x14\xfb\x92\x81\xa1\xc7\xe2\x84\xd7\x3e\x67" ++ "\xf1\x80\x9a\x48\xa4\x97\x20\x0e\x04\x6d\x39\xcc\xc7\x11\x2c\xd0"; ++ if (memcmp (expected, sum, 32) != 0) ++ { ++ prom_printf ("test %d failed\n", cnt); ++ result = 1; ++ } ++ ++ for (cnt = 0; cnt < ntests2; ++cnt) ++ { ++ char *cp = sha256_crypt (tests2[cnt].input, tests2[cnt].salt); ++ ++ if (strcmp (cp, tests2[cnt].expected) != 0) ++ { ++ prom_printf ("test %d: expected \"%s\", got \"%s\"\n", ++ cnt, tests2[cnt].expected, cp); ++ result = 1; ++ } ++ } ++ ++ if (result == 0) ++ prom_printf ("all tests OK\n"); ++ ++ return result; ++} ++#endif +diff -urN --exclude '*~' yaboot/second/sha512crypt.c yaboot-1.3.14/second/sha512crypt.c +--- yaboot/second/sha512crypt.c 1970-01-01 01:00:00.000000000 +0100 ++++ yaboot-1.3.14/second/sha512crypt.c 2010-01-13 16:56:43.390807820 +0100 +@@ -0,0 +1,804 @@ ++/* SHA512-based Unix crypt implementation. ++ Released into the Public Domain by Ulrich Drepper . ++ Adapted for yaboot by Miloslav Trmac . */ ++ ++#include ++#include "prom.h" ++#include "stdlib.h" ++#include "string.h" ++#include "types.h" ++ ++#define TEST ++typedef size_t uintptr_t; ++#define UINT64_C(X) X ## ULL ++#define alloca(SIZE) (__builtin_alloca (SIZE)) ++#define MIN(a, b) ((a) < (b) ? (a) : (b)) ++#define MAX(a, b) ((a) > (b) ? (a) : (b)) ++ ++/* Structure to save state of computation between the single steps. */ ++struct sha512_ctx ++{ ++ uint64_t H[8]; ++ ++ uint64_t total[2]; ++ uint64_t buflen; ++ char buffer[256]; /* NB: always correctly aligned for uint64_t. */ ++}; ++ ++ ++#if 0 /* __BYTE_ORDER == __LITTLE_ENDIAN */ ++# define SWAP(n) \ ++ (((n) << 56) \ ++ | (((n) & 0xff00) << 40) \ ++ | (((n) & 0xff0000) << 24) \ ++ | (((n) & 0xff000000) << 8) \ ++ | (((n) >> 8) & 0xff000000) \ ++ | (((n) >> 24) & 0xff0000) \ ++ | (((n) >> 40) & 0xff00) \ ++ | ((n) >> 56)) ++#else ++# define SWAP(n) (n) ++#endif ++ ++ ++/* This array contains the bytes used to pad the buffer to the next ++ 64-byte boundary. (FIPS 180-2:5.1.2) */ ++static const unsigned char fillbuf[128] = { 0x80, 0 /* , 0, 0, ... */ }; ++ ++ ++/* Constants for SHA512 from FIPS 180-2:4.2.3. */ ++static const uint64_t K[80] = ++ { ++ UINT64_C (0x428a2f98d728ae22), UINT64_C (0x7137449123ef65cd), ++ UINT64_C (0xb5c0fbcfec4d3b2f), UINT64_C (0xe9b5dba58189dbbc), ++ UINT64_C (0x3956c25bf348b538), UINT64_C (0x59f111f1b605d019), ++ UINT64_C (0x923f82a4af194f9b), UINT64_C (0xab1c5ed5da6d8118), ++ UINT64_C (0xd807aa98a3030242), UINT64_C (0x12835b0145706fbe), ++ UINT64_C (0x243185be4ee4b28c), UINT64_C (0x550c7dc3d5ffb4e2), ++ UINT64_C (0x72be5d74f27b896f), UINT64_C (0x80deb1fe3b1696b1), ++ UINT64_C (0x9bdc06a725c71235), UINT64_C (0xc19bf174cf692694), ++ UINT64_C (0xe49b69c19ef14ad2), UINT64_C (0xefbe4786384f25e3), ++ UINT64_C (0x0fc19dc68b8cd5b5), UINT64_C (0x240ca1cc77ac9c65), ++ UINT64_C (0x2de92c6f592b0275), UINT64_C (0x4a7484aa6ea6e483), ++ UINT64_C (0x5cb0a9dcbd41fbd4), UINT64_C (0x76f988da831153b5), ++ UINT64_C (0x983e5152ee66dfab), UINT64_C (0xa831c66d2db43210), ++ UINT64_C (0xb00327c898fb213f), UINT64_C (0xbf597fc7beef0ee4), ++ UINT64_C (0xc6e00bf33da88fc2), UINT64_C (0xd5a79147930aa725), ++ UINT64_C (0x06ca6351e003826f), UINT64_C (0x142929670a0e6e70), ++ UINT64_C (0x27b70a8546d22ffc), UINT64_C (0x2e1b21385c26c926), ++ UINT64_C (0x4d2c6dfc5ac42aed), UINT64_C (0x53380d139d95b3df), ++ UINT64_C (0x650a73548baf63de), UINT64_C (0x766a0abb3c77b2a8), ++ UINT64_C (0x81c2c92e47edaee6), UINT64_C (0x92722c851482353b), ++ UINT64_C (0xa2bfe8a14cf10364), UINT64_C (0xa81a664bbc423001), ++ UINT64_C (0xc24b8b70d0f89791), UINT64_C (0xc76c51a30654be30), ++ UINT64_C (0xd192e819d6ef5218), UINT64_C (0xd69906245565a910), ++ UINT64_C (0xf40e35855771202a), UINT64_C (0x106aa07032bbd1b8), ++ UINT64_C (0x19a4c116b8d2d0c8), UINT64_C (0x1e376c085141ab53), ++ UINT64_C (0x2748774cdf8eeb99), UINT64_C (0x34b0bcb5e19b48a8), ++ UINT64_C (0x391c0cb3c5c95a63), UINT64_C (0x4ed8aa4ae3418acb), ++ UINT64_C (0x5b9cca4f7763e373), UINT64_C (0x682e6ff3d6b2b8a3), ++ UINT64_C (0x748f82ee5defb2fc), UINT64_C (0x78a5636f43172f60), ++ UINT64_C (0x84c87814a1f0ab72), UINT64_C (0x8cc702081a6439ec), ++ UINT64_C (0x90befffa23631e28), UINT64_C (0xa4506cebde82bde9), ++ UINT64_C (0xbef9a3f7b2c67915), UINT64_C (0xc67178f2e372532b), ++ UINT64_C (0xca273eceea26619c), UINT64_C (0xd186b8c721c0c207), ++ UINT64_C (0xeada7dd6cde0eb1e), UINT64_C (0xf57d4f7fee6ed178), ++ UINT64_C (0x06f067aa72176fba), UINT64_C (0x0a637dc5a2c898a6), ++ UINT64_C (0x113f9804bef90dae), UINT64_C (0x1b710b35131c471b), ++ UINT64_C (0x28db77f523047d84), UINT64_C (0x32caab7b40c72493), ++ UINT64_C (0x3c9ebe0a15c9bebc), UINT64_C (0x431d67c49c100d4c), ++ UINT64_C (0x4cc5d4becb3e42b6), UINT64_C (0x597f299cfc657e2a), ++ UINT64_C (0x5fcb6fab3ad6faec), UINT64_C (0x6c44198c4a475817) ++ }; ++ ++ ++/* Process LEN bytes of BUFFER, accumulating context into CTX. ++ It is assumed that LEN % 128 == 0. */ ++static void ++sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx) ++{ ++ const uint64_t *words = buffer; ++ size_t nwords = len / sizeof (uint64_t); ++ uint64_t a = ctx->H[0]; ++ uint64_t b = ctx->H[1]; ++ uint64_t c = ctx->H[2]; ++ uint64_t d = ctx->H[3]; ++ uint64_t e = ctx->H[4]; ++ uint64_t f = ctx->H[5]; ++ uint64_t g = ctx->H[6]; ++ uint64_t h = ctx->H[7]; ++ ++ /* First increment the byte count. FIPS 180-2 specifies the possible ++ length of the file up to 2^128 bits. Here we only compute the ++ number of bytes. Do a double word increment. */ ++ ctx->total[0] += len; ++ if (ctx->total[0] < len) ++ ++ctx->total[1]; ++ ++ /* Process all bytes in the buffer with 128 bytes in each round of ++ the loop. */ ++ while (nwords > 0) ++ { ++ uint64_t W[80]; ++ uint64_t a_save = a; ++ uint64_t b_save = b; ++ uint64_t c_save = c; ++ uint64_t d_save = d; ++ uint64_t e_save = e; ++ uint64_t f_save = f; ++ uint64_t g_save = g; ++ uint64_t h_save = h; ++ unsigned int t; ++ ++ /* Operators defined in FIPS 180-2:4.1.2. */ ++#define Ch(x, y, z) ((x & y) ^ (~x & z)) ++#define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z)) ++#define S0(x) (CYCLIC (x, 28) ^ CYCLIC (x, 34) ^ CYCLIC (x, 39)) ++#define S1(x) (CYCLIC (x, 14) ^ CYCLIC (x, 18) ^ CYCLIC (x, 41)) ++#define R0(x) (CYCLIC (x, 1) ^ CYCLIC (x, 8) ^ (x >> 7)) ++#define R1(x) (CYCLIC (x, 19) ^ CYCLIC (x, 61) ^ (x >> 6)) ++ ++ /* It is unfortunate that C does not provide an operator for ++ cyclic rotation. Hope the C compiler is smart enough. */ ++#define CYCLIC(w, s) ((w >> s) | (w << (64 - s))) ++ ++ /* Compute the message schedule according to FIPS 180-2:6.3.2 step 2. */ ++ for (t = 0; t < 16; ++t) ++ { ++ W[t] = SWAP (*words); ++ ++words; ++ } ++ for (t = 16; t < 80; ++t) ++ W[t] = R1 (W[t - 2]) + W[t - 7] + R0 (W[t - 15]) + W[t - 16]; ++ ++ /* The actual computation according to FIPS 180-2:6.3.2 step 3. */ ++ for (t = 0; t < 80; ++t) ++ { ++ uint64_t T1 = h + S1 (e) + Ch (e, f, g) + K[t] + W[t]; ++ uint64_t T2 = S0 (a) + Maj (a, b, c); ++ h = g; ++ g = f; ++ f = e; ++ e = d + T1; ++ d = c; ++ c = b; ++ b = a; ++ a = T1 + T2; ++ } ++ ++ /* Add the starting values of the context according to FIPS 180-2:6.3.2 ++ step 4. */ ++ a += a_save; ++ b += b_save; ++ c += c_save; ++ d += d_save; ++ e += e_save; ++ f += f_save; ++ g += g_save; ++ h += h_save; ++ ++ /* Prepare for the next round. */ ++ nwords -= 16; ++ } ++ ++ /* Put checksum in context given as argument. */ ++ ctx->H[0] = a; ++ ctx->H[1] = b; ++ ctx->H[2] = c; ++ ctx->H[3] = d; ++ ctx->H[4] = e; ++ ctx->H[5] = f; ++ ctx->H[6] = g; ++ ctx->H[7] = h; ++} ++ ++ ++/* Initialize structure containing state of computation. ++ (FIPS 180-2:5.3.3) */ ++static void ++sha512_init_ctx (struct sha512_ctx *ctx) ++{ ++ ctx->H[0] = UINT64_C (0x6a09e667f3bcc908); ++ ctx->H[1] = UINT64_C (0xbb67ae8584caa73b); ++ ctx->H[2] = UINT64_C (0x3c6ef372fe94f82b); ++ ctx->H[3] = UINT64_C (0xa54ff53a5f1d36f1); ++ ctx->H[4] = UINT64_C (0x510e527fade682d1); ++ ctx->H[5] = UINT64_C (0x9b05688c2b3e6c1f); ++ ctx->H[6] = UINT64_C (0x1f83d9abfb41bd6b); ++ ctx->H[7] = UINT64_C (0x5be0cd19137e2179); ++ ++ ctx->total[0] = ctx->total[1] = 0; ++ ctx->buflen = 0; ++} ++ ++ ++/* Process the remaining bytes in the internal buffer and the usual ++ prolog according to the standard and write the result to RESBUF. ++ ++ IMPORTANT: On some systems it is required that RESBUF is correctly ++ aligned for a 32 bits value. */ ++static void * ++sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf) ++{ ++ /* Take yet unprocessed bytes into account. */ ++ uint64_t bytes = ctx->buflen; ++ size_t pad; ++ unsigned int i; ++ ++ /* Now count remaining bytes. */ ++ ctx->total[0] += bytes; ++ if (ctx->total[0] < bytes) ++ ++ctx->total[1]; ++ ++ pad = bytes >= 112 ? 128 + 112 - bytes : 112 - bytes; ++ memcpy (&ctx->buffer[bytes], fillbuf, pad); ++ ++ /* Put the 128-bit file length in *bits* at the end of the buffer. */ ++ *(uint64_t *) &ctx->buffer[bytes + pad + 8] = SWAP (ctx->total[0] << 3); ++ *(uint64_t *) &ctx->buffer[bytes + pad] = SWAP ((ctx->total[1] << 3) | ++ (ctx->total[0] >> 61)); ++ ++ /* Process last bytes. */ ++ sha512_process_block (ctx->buffer, bytes + pad + 16, ctx); ++ ++ /* Put result from CTX in first 64 bytes following RESBUF. */ ++ for (i = 0; i < 8; ++i) ++ ((uint64_t *) resbuf)[i] = SWAP (ctx->H[i]); ++ ++ return resbuf; ++} ++ ++ ++static void ++sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx) ++{ ++ /* When we already have some bits in our internal buffer concatenate ++ both inputs first. */ ++ if (ctx->buflen != 0) ++ { ++ size_t left_over = ctx->buflen; ++ size_t add = 256 - left_over > len ? len : 256 - left_over; ++ ++ memcpy (&ctx->buffer[left_over], buffer, add); ++ ctx->buflen += add; ++ ++ if (ctx->buflen > 128) ++ { ++ sha512_process_block (ctx->buffer, ctx->buflen & ~127, ctx); ++ ++ ctx->buflen &= 127; ++ /* The regions in the following copy operation cannot overlap. */ ++ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~127], ++ ctx->buflen); ++ } ++ ++ buffer = (const char *) buffer + add; ++ len -= add; ++ } ++ ++ /* Process available complete blocks. */ ++ if (len >= 128) ++ { ++#if !_STRING_ARCH_unaligned ++/* To check alignment gcc has an appropriate operator. Other ++ compilers don't. */ ++# if __GNUC__ >= 2 ++# define UNALIGNED_P(p) (((uintptr_t) p) % __alignof__ (uint64_t) != 0) ++# else ++# define UNALIGNED_P(p) (((uintptr_t) p) % sizeof (uint64_t) != 0) ++# endif ++ if (UNALIGNED_P (buffer)) ++ while (len > 128) ++ { ++ sha512_process_block (memcpy (ctx->buffer, buffer, 128), 128, ++ ctx); ++ buffer = (const char *) buffer + 128; ++ len -= 128; ++ } ++ else ++#endif ++ { ++ sha512_process_block (buffer, len & ~127, ctx); ++ buffer = (const char *) buffer + (len & ~127); ++ len &= 127; ++ } ++ } ++ ++ /* Move remaining bytes into internal buffer. */ ++ if (len > 0) ++ { ++ size_t left_over = ctx->buflen; ++ ++ memcpy (&ctx->buffer[left_over], buffer, len); ++ left_over += len; ++ if (left_over >= 128) ++ { ++ sha512_process_block (ctx->buffer, 128, ctx); ++ left_over -= 128; ++ memcpy (ctx->buffer, &ctx->buffer[128], left_over); ++ } ++ ctx->buflen = left_over; ++ } ++} ++ ++ ++/* Define our magic string to mark salt for SHA512 "encryption" ++ replacement. */ ++static const char sha512_salt_prefix[] = "$6$"; ++ ++/* Prefix for optional rounds specification. */ ++static const char sha512_rounds_prefix[] = "rounds="; ++ ++/* Maximum salt string length. */ ++#define SALT_LEN_MAX 16 ++/* Default number of rounds if not explicitly specified. */ ++#define ROUNDS_DEFAULT 5000 ++/* Minimum number of rounds. */ ++#define ROUNDS_MIN 1000 ++/* Maximum number of rounds. */ ++#define ROUNDS_MAX 999999999 ++ ++/* Table with characters for base64 transformation. */ ++static const char b64t[64] = ++"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; ++ ++ ++static char * ++sha512_crypt_r (const char *key, const char *salt, char *buffer, int buflen) ++{ ++ unsigned char alt_result[64] ++ __attribute__ ((__aligned__ (__alignof__ (uint64_t)))); ++ unsigned char temp_result[64] ++ __attribute__ ((__aligned__ (__alignof__ (uint64_t)))); ++ struct sha512_ctx ctx; ++ struct sha512_ctx alt_ctx; ++ size_t salt_len; ++ size_t key_len; ++ size_t cnt; ++ char *cp; ++ char *copied_key = NULL; ++ char *copied_salt = NULL; ++ char *p_bytes; ++ char *s_bytes; ++ /* Default number of rounds. */ ++ size_t rounds = ROUNDS_DEFAULT; ++ bool rounds_custom = false; ++ ++ /* Find beginning of salt string. The prefix should normally always ++ be present. Just in case it is not. */ ++ if (strncmp (sha512_salt_prefix, salt, sizeof (sha512_salt_prefix) - 1) == 0) ++ /* Skip salt prefix. */ ++ salt += sizeof (sha512_salt_prefix) - 1; ++ ++ if (strncmp (salt, sha512_rounds_prefix, sizeof (sha512_rounds_prefix) - 1) ++ == 0) ++ { ++ const char *num = salt + sizeof (sha512_rounds_prefix) - 1; ++ char *endp; ++ unsigned long int srounds = (unsigned long)strtol (num, &endp, 10); ++ if (*endp == '$') ++ { ++ salt = endp + 1; ++ rounds = MAX (ROUNDS_MIN, MIN (srounds, ROUNDS_MAX)); ++ rounds_custom = true; ++ } ++ } ++ ++ { ++ char *salt_end; ++ ++ salt_end = strchr (salt, '$'); ++ if (salt_end == NULL) ++ salt_end = strchr (salt, '\0'); ++ salt_len = salt_end - salt; ++ } ++ key_len = strlen (key); ++ ++ if ((key - (char *) 0) % __alignof__ (uint64_t) != 0) ++ { ++ char *tmp = (char *) alloca (key_len + __alignof__ (uint64_t)); ++ key = copied_key = ++ memcpy (tmp + __alignof__ (uint64_t) ++ - (tmp - (char *) 0) % __alignof__ (uint64_t), ++ key, key_len); ++ } ++ ++ if ((salt - (char *) 0) % __alignof__ (uint64_t) != 0) ++ { ++ char *tmp = (char *) alloca (salt_len + __alignof__ (uint64_t)); ++ salt = copied_salt = ++ memcpy (tmp + __alignof__ (uint64_t) ++ - (tmp - (char *) 0) % __alignof__ (uint64_t), ++ salt, salt_len); ++ } ++ ++ /* Prepare for the real work. */ ++ sha512_init_ctx (&ctx); ++ ++ /* Add the key string. */ ++ sha512_process_bytes (key, key_len, &ctx); ++ ++ /* The last part is the salt string. This must be at most 16 ++ characters and it ends at the first `$' character (for ++ compatibility with existing implementations). */ ++ sha512_process_bytes (salt, salt_len, &ctx); ++ ++ ++ /* Compute alternate SHA512 sum with input KEY, SALT, and KEY. The ++ final result will be added to the first context. */ ++ sha512_init_ctx (&alt_ctx); ++ ++ /* Add key. */ ++ sha512_process_bytes (key, key_len, &alt_ctx); ++ ++ /* Add salt. */ ++ sha512_process_bytes (salt, salt_len, &alt_ctx); ++ ++ /* Add key again. */ ++ sha512_process_bytes (key, key_len, &alt_ctx); ++ ++ /* Now get result of this (64 bytes) and add it to the other ++ context. */ ++ sha512_finish_ctx (&alt_ctx, alt_result); ++ ++ /* Add for any character in the key one byte of the alternate sum. */ ++ for (cnt = key_len; cnt > 64; cnt -= 64) ++ sha512_process_bytes (alt_result, 64, &ctx); ++ sha512_process_bytes (alt_result, cnt, &ctx); ++ ++ /* Take the binary representation of the length of the key and for every ++ 1 add the alternate sum, for every 0 the key. */ ++ for (cnt = key_len; cnt > 0; cnt >>= 1) ++ if ((cnt & 1) != 0) ++ sha512_process_bytes (alt_result, 64, &ctx); ++ else ++ sha512_process_bytes (key, key_len, &ctx); ++ ++ /* Create intermediate result. */ ++ sha512_finish_ctx (&ctx, alt_result); ++ ++ /* Start computation of P byte sequence. */ ++ sha512_init_ctx (&alt_ctx); ++ ++ /* For every character in the password add the entire password. */ ++ for (cnt = 0; cnt < key_len; ++cnt) ++ sha512_process_bytes (key, key_len, &alt_ctx); ++ ++ /* Finish the digest. */ ++ sha512_finish_ctx (&alt_ctx, temp_result); ++ ++ /* Create byte sequence P. */ ++ cp = p_bytes = alloca (key_len); ++ for (cnt = key_len; cnt >= 64; cnt -= 64) ++ { ++ memcpy (cp, temp_result, 64); ++ cp += 64; ++ } ++ memcpy (cp, temp_result, cnt); ++ ++ /* Start computation of S byte sequence. */ ++ sha512_init_ctx (&alt_ctx); ++ ++ /* For every character in the password add the entire password. */ ++ for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt) ++ sha512_process_bytes (salt, salt_len, &alt_ctx); ++ ++ /* Finish the digest. */ ++ sha512_finish_ctx (&alt_ctx, temp_result); ++ ++ /* Create byte sequence S. */ ++ cp = s_bytes = alloca (salt_len); ++ for (cnt = salt_len; cnt >= 64; cnt -= 64) ++ { ++ memcpy (cp, temp_result, 64); ++ cp += 64; ++ } ++ memcpy (cp, temp_result, cnt); ++ ++ /* Repeatedly run the collected hash value through SHA512 to burn ++ CPU cycles. */ ++ for (cnt = 0; cnt < rounds; ++cnt) ++ { ++ /* New context. */ ++ sha512_init_ctx (&ctx); ++ ++ /* Add key or last result. */ ++ if ((cnt & 1) != 0) ++ sha512_process_bytes (p_bytes, key_len, &ctx); ++ else ++ sha512_process_bytes (alt_result, 64, &ctx); ++ ++ /* Add salt for numbers not divisible by 3. */ ++ if (cnt % 3 != 0) ++ sha512_process_bytes (s_bytes, salt_len, &ctx); ++ ++ /* Add key for numbers not divisible by 7. */ ++ if (cnt % 7 != 0) ++ sha512_process_bytes (p_bytes, key_len, &ctx); ++ ++ /* Add key or last result. */ ++ if ((cnt & 1) != 0) ++ sha512_process_bytes (alt_result, 64, &ctx); ++ else ++ sha512_process_bytes (p_bytes, key_len, &ctx); ++ ++ /* Create intermediate result. */ ++ sha512_finish_ctx (&ctx, alt_result); ++ } ++ ++ /* Now we can construct the result string. It consists of three ++ parts. */ ++ cp = stpncpy (buffer, sha512_salt_prefix, MAX (0, buflen)); ++ buflen -= sizeof (sha512_salt_prefix) - 1; ++ ++ if (rounds_custom) ++ { ++ char sbuf[64]; ++ sprintf (sbuf, "%s%Lu$", sha512_rounds_prefix, ++ (unsigned long long)rounds); ++ size_t n = strlen (sbuf); ++ memcpy (cp, sbuf, MIN (MAX (0, buflen), n)); ++ cp += n; ++ buflen -= n; ++ } ++ ++ cp = stpncpy (cp, salt, MIN ((size_t) MAX (0, buflen), salt_len)); ++ buflen -= MIN ((size_t) MAX (0, buflen), salt_len); ++ ++ if (buflen > 0) ++ { ++ *cp++ = '$'; ++ --buflen; ++ } ++ ++#define b64_from_24bit(B2, B1, B0, N) \ ++ do { \ ++ unsigned int w = ((B2) << 16) | ((B1) << 8) | (B0); \ ++ int n = (N); \ ++ while (n-- > 0 && buflen > 0) \ ++ { \ ++ *cp++ = b64t[w & 0x3f]; \ ++ --buflen; \ ++ w >>= 6; \ ++ } \ ++ } while (0) ++ ++ b64_from_24bit (alt_result[0], alt_result[21], alt_result[42], 4); ++ b64_from_24bit (alt_result[22], alt_result[43], alt_result[1], 4); ++ b64_from_24bit (alt_result[44], alt_result[2], alt_result[23], 4); ++ b64_from_24bit (alt_result[3], alt_result[24], alt_result[45], 4); ++ b64_from_24bit (alt_result[25], alt_result[46], alt_result[4], 4); ++ b64_from_24bit (alt_result[47], alt_result[5], alt_result[26], 4); ++ b64_from_24bit (alt_result[6], alt_result[27], alt_result[48], 4); ++ b64_from_24bit (alt_result[28], alt_result[49], alt_result[7], 4); ++ b64_from_24bit (alt_result[50], alt_result[8], alt_result[29], 4); ++ b64_from_24bit (alt_result[9], alt_result[30], alt_result[51], 4); ++ b64_from_24bit (alt_result[31], alt_result[52], alt_result[10], 4); ++ b64_from_24bit (alt_result[53], alt_result[11], alt_result[32], 4); ++ b64_from_24bit (alt_result[12], alt_result[33], alt_result[54], 4); ++ b64_from_24bit (alt_result[34], alt_result[55], alt_result[13], 4); ++ b64_from_24bit (alt_result[56], alt_result[14], alt_result[35], 4); ++ b64_from_24bit (alt_result[15], alt_result[36], alt_result[57], 4); ++ b64_from_24bit (alt_result[37], alt_result[58], alt_result[16], 4); ++ b64_from_24bit (alt_result[59], alt_result[17], alt_result[38], 4); ++ b64_from_24bit (alt_result[18], alt_result[39], alt_result[60], 4); ++ b64_from_24bit (alt_result[40], alt_result[61], alt_result[19], 4); ++ b64_from_24bit (alt_result[62], alt_result[20], alt_result[41], 4); ++ b64_from_24bit (0, 0, alt_result[63], 2); ++ ++ if (buflen <= 0) ++ buffer = NULL; ++ else ++ *cp = '\0'; /* Terminate the string. */ ++ ++ /* Clear the buffer for the intermediate result so that people ++ attaching to processes or reading core dumps cannot get any ++ information. We do it in this way to clear correct_words[] ++ inside the SHA512 implementation as well. */ ++ sha512_init_ctx (&ctx); ++ sha512_finish_ctx (&ctx, alt_result); ++ memset (temp_result, '\0', sizeof (temp_result)); ++ memset (p_bytes, '\0', key_len); ++ memset (s_bytes, '\0', salt_len); ++ memset (&ctx, '\0', sizeof (ctx)); ++ memset (&alt_ctx, '\0', sizeof (alt_ctx)); ++ if (copied_key != NULL) ++ memset (copied_key, '\0', key_len); ++ if (copied_salt != NULL) ++ memset (copied_salt, '\0', salt_len); ++ ++ return buffer; ++} ++ ++ ++/* This entry point is equivalent to the `crypt' function in Unix ++ libcs. */ ++char * ++sha512_crypt (const char *key, const char *salt) ++{ ++ /* We don't want to have an arbitrary limit in the size of the ++ password. We can compute an upper bound for the size of the ++ result in advance and so we can prepare the buffer we pass to ++ `sha512_crypt_r'. */ ++ static char *buffer; ++ static int buflen; ++ int needed = (sizeof (sha512_salt_prefix) - 1 ++ + sizeof (sha512_rounds_prefix) + 9 + 1 ++ + strlen (salt) + 1 + 86 + 1); ++ ++ if (buflen < needed) ++ { ++ char *new_buffer = (char *) realloc (buffer, needed); ++ if (new_buffer == NULL) ++ return NULL; ++ ++ buffer = new_buffer; ++ buflen = needed; ++ } ++ ++ return sha512_crypt_r (key, salt, buffer, buflen); ++} ++ ++ ++#ifdef TEST ++static const struct ++{ ++ const char *input; ++ const char result[64]; ++} tests[] = ++ { ++ /* Test vectors from FIPS 180-2: appendix C.1. */ ++ { "abc", ++ "\xdd\xaf\x35\xa1\x93\x61\x7a\xba\xcc\x41\x73\x49\xae\x20\x41\x31" ++ "\x12\xe6\xfa\x4e\x89\xa9\x7e\xa2\x0a\x9e\xee\xe6\x4b\x55\xd3\x9a" ++ "\x21\x92\x99\x2a\x27\x4f\xc1\xa8\x36\xba\x3c\x23\xa3\xfe\xeb\xbd" ++ "\x45\x4d\x44\x23\x64\x3c\xe8\x0e\x2a\x9a\xc9\x4f\xa5\x4c\xa4\x9f" }, ++ /* Test vectors from FIPS 180-2: appendix C.2. */ ++ { "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn" ++ "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", ++ "\x8e\x95\x9b\x75\xda\xe3\x13\xda\x8c\xf4\xf7\x28\x14\xfc\x14\x3f" ++ "\x8f\x77\x79\xc6\xeb\x9f\x7f\xa1\x72\x99\xae\xad\xb6\x88\x90\x18" ++ "\x50\x1d\x28\x9e\x49\x00\xf7\xe4\x33\x1b\x99\xde\xc4\xb5\x43\x3a" ++ "\xc7\xd3\x29\xee\xb6\xdd\x26\x54\x5e\x96\xe5\x5b\x87\x4b\xe9\x09" }, ++ /* Test vectors from the NESSIE project. */ ++ { "", ++ "\xcf\x83\xe1\x35\x7e\xef\xb8\xbd\xf1\x54\x28\x50\xd6\x6d\x80\x07" ++ "\xd6\x20\xe4\x05\x0b\x57\x15\xdc\x83\xf4\xa9\x21\xd3\x6c\xe9\xce" ++ "\x47\xd0\xd1\x3c\x5d\x85\xf2\xb0\xff\x83\x18\xd2\x87\x7e\xec\x2f" ++ "\x63\xb9\x31\xbd\x47\x41\x7a\x81\xa5\x38\x32\x7a\xf9\x27\xda\x3e" }, ++ { "a", ++ "\x1f\x40\xfc\x92\xda\x24\x16\x94\x75\x09\x79\xee\x6c\xf5\x82\xf2" ++ "\xd5\xd7\xd2\x8e\x18\x33\x5d\xe0\x5a\xbc\x54\xd0\x56\x0e\x0f\x53" ++ "\x02\x86\x0c\x65\x2b\xf0\x8d\x56\x02\x52\xaa\x5e\x74\x21\x05\x46" ++ "\xf3\x69\xfb\xbb\xce\x8c\x12\xcf\xc7\x95\x7b\x26\x52\xfe\x9a\x75" }, ++ { "message digest", ++ "\x10\x7d\xbf\x38\x9d\x9e\x9f\x71\xa3\xa9\x5f\x6c\x05\x5b\x92\x51" ++ "\xbc\x52\x68\xc2\xbe\x16\xd6\xc1\x34\x92\xea\x45\xb0\x19\x9f\x33" ++ "\x09\xe1\x64\x55\xab\x1e\x96\x11\x8e\x8a\x90\x5d\x55\x97\xb7\x20" ++ "\x38\xdd\xb3\x72\xa8\x98\x26\x04\x6d\xe6\x66\x87\xbb\x42\x0e\x7c" }, ++ { "abcdefghijklmnopqrstuvwxyz", ++ "\x4d\xbf\xf8\x6c\xc2\xca\x1b\xae\x1e\x16\x46\x8a\x05\xcb\x98\x81" ++ "\xc9\x7f\x17\x53\xbc\xe3\x61\x90\x34\x89\x8f\xaa\x1a\xab\xe4\x29" ++ "\x95\x5a\x1b\xf8\xec\x48\x3d\x74\x21\xfe\x3c\x16\x46\x61\x3a\x59" ++ "\xed\x54\x41\xfb\x0f\x32\x13\x89\xf7\x7f\x48\xa8\x79\xc7\xb1\xf1" }, ++ { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", ++ "\x20\x4a\x8f\xc6\xdd\xa8\x2f\x0a\x0c\xed\x7b\xeb\x8e\x08\xa4\x16" ++ "\x57\xc1\x6e\xf4\x68\xb2\x28\xa8\x27\x9b\xe3\x31\xa7\x03\xc3\x35" ++ "\x96\xfd\x15\xc1\x3b\x1b\x07\xf9\xaa\x1d\x3b\xea\x57\x78\x9c\xa0" ++ "\x31\xad\x85\xc7\xa7\x1d\xd7\x03\x54\xec\x63\x12\x38\xca\x34\x45" }, ++ { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", ++ "\x1e\x07\xbe\x23\xc2\x6a\x86\xea\x37\xea\x81\x0c\x8e\xc7\x80\x93" ++ "\x52\x51\x5a\x97\x0e\x92\x53\xc2\x6f\x53\x6c\xfc\x7a\x99\x96\xc4" ++ "\x5c\x83\x70\x58\x3e\x0a\x78\xfa\x4a\x90\x04\x1d\x71\xa4\xce\xab" ++ "\x74\x23\xf1\x9c\x71\xb9\xd5\xa3\xe0\x12\x49\xf0\xbe\xbd\x58\x94" }, ++ { "123456789012345678901234567890123456789012345678901234567890" ++ "12345678901234567890", ++ "\x72\xec\x1e\xf1\x12\x4a\x45\xb0\x47\xe8\xb7\xc7\x5a\x93\x21\x95" ++ "\x13\x5b\xb6\x1d\xe2\x4e\xc0\xd1\x91\x40\x42\x24\x6e\x0a\xec\x3a" ++ "\x23\x54\xe0\x93\xd7\x6f\x30\x48\xb4\x56\x76\x43\x46\x90\x0c\xb1" ++ "\x30\xd2\xa4\xfd\x5d\xd1\x6a\xbb\x5e\x30\xbc\xb8\x50\xde\xe8\x43" } ++ }; ++#define ntests (sizeof (tests) / sizeof (tests[0])) ++ ++ ++static const struct ++{ ++ const char *salt; ++ const char *input; ++ const char *expected; ++} tests2[] = ++{ ++ { "$6$saltstring", "Hello world!", ++ "$6$saltstring$svn8UoSVapNtMuq1ukKS4tPQd8iKwSMHWjl/O817G3uBnIFNjnQJu" ++ "esI68u4OTLiBFdcbYEdFCoEOfaS35inz1" }, ++ { "$6$rounds=10000$saltstringsaltstring", "Hello world!", ++ "$6$rounds=10000$saltstringsaltst$OW1/O6BYHV6BcXZu8QVeXbDWra3Oeqh0sb" ++ "HbbMCVNSnCM/UrjmM0Dp8vOuZeHBy/YTBmSK6H9qs/y3RnOaw5v." }, ++ { "$6$rounds=5000$toolongsaltstring", "This is just a test", ++ "$6$rounds=5000$toolongsaltstrin$lQ8jolhgVRVhY4b5pZKaysCLi0QBxGoNeKQ" ++ "zQ3glMhwllF7oGDZxUhx1yxdYcz/e1JSbq3y6JMxxl8audkUEm0" }, ++ { "$6$rounds=1400$anotherlongsaltstring", ++ "a very much longer text to encrypt. This one even stretches over more" ++ "than one line.", ++ "$6$rounds=1400$anotherlongsalts$POfYwTEok97VWcjxIiSOjiykti.o/pQs.wP" ++ "vMxQ6Fm7I6IoYN3CmLs66x9t0oSwbtEW7o7UmJEiDwGqd8p4ur1" }, ++ { "$6$rounds=77777$short", ++ "we have a short salt string but not a short password", ++ "$6$rounds=77777$short$WuQyW2YR.hBNpjjRhpYD/ifIw05xdfeEyQoMxIXbkvr0g" ++ "ge1a1x3yRULJ5CCaUeOxFmtlcGZelFl5CxtgfiAc0" }, ++ { "$6$rounds=123456$asaltof16chars..", "a short string", ++ "$6$rounds=123456$asaltof16chars..$BtCwjqMJGx5hrJhZywWvt0RLE8uZ4oPwc" ++ "elCjmw2kSYu.Ec6ycULevoBK25fs2xXgMNrCzIMVcgEJAstJeonj1" }, ++ { "$6$rounds=10$roundstoolow", "the minimum number is still observed", ++ "$6$rounds=1000$roundstoolow$kUMsbe306n21p9R.FRkW3IGn.S9NPN0x50YhH1x" ++ "hLsPuWGsUSklZt58jaTfF4ZEQpyUNGc0dqbpBYYBaHHrsX." }, ++}; ++#define ntests2 (sizeof (tests2) / sizeof (tests2[0])) ++ ++ ++int ++sha512_test (void) ++{ ++ struct sha512_ctx ctx; ++ char sum[64]; ++ int result = 0; ++ int cnt, i; ++ ++ for (cnt = 0; cnt < (int) ntests; ++cnt) ++ { ++ sha512_init_ctx (&ctx); ++ sha512_process_bytes (tests[cnt].input, strlen (tests[cnt].input), &ctx); ++ sha512_finish_ctx (&ctx, sum); ++ if (memcmp (tests[cnt].result, sum, 64) != 0) ++ { ++ prom_printf ("test %d run %d failed\n", cnt, 1); ++ result = 1; ++ } ++ ++ sha512_init_ctx (&ctx); ++ for (i = 0; tests[cnt].input[i] != '\0'; ++i) ++ sha512_process_bytes (&tests[cnt].input[i], 1, &ctx); ++ sha512_finish_ctx (&ctx, sum); ++ if (memcmp (tests[cnt].result, sum, 64) != 0) ++ { ++ prom_printf ("test %d run %d failed\n", cnt, 2); ++ result = 1; ++ } ++ } ++ ++ /* Test vector from FIPS 180-2: appendix C.3. */ ++ char buf[1000]; ++ memset (buf, 'a', sizeof (buf)); ++ sha512_init_ctx (&ctx); ++ for (i = 0; i < 1000; ++i) ++ sha512_process_bytes (buf, sizeof (buf), &ctx); ++ sha512_finish_ctx (&ctx, sum); ++ static const char expected[64] = ++ "\xe7\x18\x48\x3d\x0c\xe7\x69\x64\x4e\x2e\x42\xc7\xbc\x15\xb4\x63" ++ "\x8e\x1f\x98\xb1\x3b\x20\x44\x28\x56\x32\xa8\x03\xaf\xa9\x73\xeb" ++ "\xde\x0f\xf2\x44\x87\x7e\xa6\x0a\x4c\xb0\x43\x2c\xe5\x77\xc3\x1b" ++ "\xeb\x00\x9c\x5c\x2c\x49\xaa\x2e\x4e\xad\xb2\x17\xad\x8c\xc0\x9b"; ++ if (memcmp (expected, sum, 64) != 0) ++ { ++ prom_printf ("test %d failed\n", cnt); ++ result = 1; ++ } ++ ++ for (cnt = 0; cnt < ntests2; ++cnt) ++ { ++ char *cp = sha512_crypt (tests2[cnt].input, tests2[cnt].salt); ++ ++ if (strcmp (cp, tests2[cnt].expected) != 0) ++ { ++ prom_printf ("test %d: expected \"%s\", got \"%s\"\n", ++ cnt, tests2[cnt].expected, cp); ++ result = 1; ++ } ++ } ++ ++ if (result == 0) ++ prom_printf ("all tests OK\n"); ++ ++ return result; ++} ++#endif +diff -urN --exclude '*~' yaboot/second/yaboot.c yaboot-1.3.14/second/yaboot.c +--- yaboot/second/yaboot.c 2010-01-12 22:39:21.670784810 +0100 ++++ yaboot-1.3.14/second/yaboot.c 2010-01-13 17:07:06.972808719 +0100 +@@ -634,13 +634,17 @@ + if (!strncmp (password, "$1$", 3)) { + if (!check_md5_password(passwdbuff, password)) + return; ++ } else ++#endif /* USE_MD5_PASSWORDS */ ++ if (!strncmp (password, "$5$", 3)) { ++ if (!strcmp (password, sha256_crypt (passwdbuff, password))) ++ return; ++ } else if (!strncmp (password, "$6$", 3)) { ++ if (!strcmp (password, sha512_crypt (passwdbuff, password))) ++ return; + } + else if (!strcmp (password, passwdbuff)) + return; +-#else /* !MD5 */ +- if (!strcmp (password, passwdbuff)) +- return; +-#endif /* USE_MD5_PASSWORDS */ + if (i < 2) { + prom_sleep(1); + prom_printf ("Incorrect password. Try again."); diff --git a/yaboot.spec b/yaboot.spec index 5dbd83c..bcee7fa 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 21%{?dist} +Release: 22%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -43,6 +43,9 @@ 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 + URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root Obsoletes: ybin @@ -94,6 +97,7 @@ yaboot can also bootload IBM pSeries machines. %patch37 -p1 -b .partitions %patch38 -p1 -b .netboot2 %patch39 -p1 -b .movekernel +%patch40 -p1 -b .sha2 %build make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1 @@ -134,6 +138,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Fri Jan 22 2010 Roman Rakus 1.3.14-22 +- SHA2 support + * Thu Oct 29 2009 Roman Rakus - 1.3.14-21 - When netbooting "clobber" the LOAD_BUFFER and move the kernel into it to make room for RTAS (#530330) From be1a5059a90140c697c6c82304d1dd90f77f2281 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Wed, 26 May 2010 15:31:33 +0000 Subject: [PATCH 34/55] Include missing pacthes --- yaboot-1.3.14-iscsi.patch | 55 ++++++++++++++++++ yaboot-1.3.14-netinfo.patch | 66 +++++++++++++++++++++ yaboot-1.3.14-prom_getchars.patch | 95 +++++++++++++++++++++++++++++++ yaboot.spec | 24 +++++++- 4 files changed, 239 insertions(+), 1 deletion(-) create mode 100644 yaboot-1.3.14-iscsi.patch create mode 100644 yaboot-1.3.14-netinfo.patch create mode 100644 yaboot-1.3.14-prom_getchars.patch diff --git a/yaboot-1.3.14-iscsi.patch b/yaboot-1.3.14-iscsi.patch new file mode 100644 index 0000000..816bae7 --- /dev/null +++ b/yaboot-1.3.14-iscsi.patch @@ -0,0 +1,55 @@ +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; + } diff --git a/yaboot-1.3.14-netinfo.patch b/yaboot-1.3.14-netinfo.patch new file mode 100644 index 0000000..b366956 --- /dev/null +++ b/yaboot-1.3.14-netinfo.patch @@ -0,0 +1,66 @@ +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 +--- +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); + } + diff --git a/yaboot-1.3.14-prom_getchars.patch b/yaboot-1.3.14-prom_getchars.patch new file mode 100644 index 0000000..bf4e048 --- /dev/null +++ b/yaboot-1.3.14-prom_getchars.patch @@ -0,0 +1,95 @@ +Date: Sun, 11 Apr 2010 14:05:59 +1000 +From: Anton Blanchard +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 +Signed-off-by: Tony Breeds + +--- +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) + { diff --git a/yaboot.spec b/yaboot.spec index bcee7fa..ea2b6ee 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 22%{?dist} +Release: 32%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -46,6 +46,16 @@ 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 + + URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root Obsoletes: ybin @@ -98,6 +108,9 @@ yaboot can also bootload IBM pSeries machines. %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 %build make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1 @@ -138,6 +151,15 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Wed May 26 2010 Roman Rakus - 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 1.3.14-22 - SHA2 support From fbe565583d5b0500c386d861498e024cb804dd82 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Wed, 26 May 2010 15:37:47 +0000 Subject: [PATCH 35/55] Allow yaboot to allocate up to 256MB of memory --- yaboot-1.3.14-256-RMA.patch | 99 +++++++++++++++++++++++++++++++++++++ yaboot.spec | 8 ++- 2 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 yaboot-1.3.14-256-RMA.patch diff --git a/yaboot-1.3.14-256-RMA.patch b/yaboot-1.3.14-256-RMA.patch new file mode 100644 index 0000000..285c10a --- /dev/null +++ b/yaboot-1.3.14-256-RMA.patch @@ -0,0 +1,99 @@ +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; + diff --git a/yaboot.spec b/yaboot.spec index ea2b6ee..57163a9 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 32%{?dist} +Release: 33%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -55,6 +55,8 @@ 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 URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root @@ -111,6 +113,7 @@ yaboot can also bootload IBM pSeries machines. %patch41 -p1 -b .netinfo %patch42 -p1 -b .iscsi %patch43 -p1 -b .prom_getchars +%patch44 -p1 -b .256-RMA %build make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1 @@ -151,6 +154,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Wed May 26 2010 Roman Rakus - 1.3.14-33 +- Allow yaboot to allocate up to 256MB of memory + * Wed May 26 2010 Roman Rakus - 1.3.14-32 - Added missing yaboot-1.3.14-netinfo.patch Resolves: #553061 From 5388f83ed2ebd7c4aa8c318accab057f6873deb6 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Thu, 3 Jun 2010 15:14:05 +0000 Subject: [PATCH 36/55] added dependency on e2fsprogs-static package --- yaboot.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/yaboot.spec b/yaboot.spec index 57163a9..c344598 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.14 -Release: 33%{?dist} +Release: 34%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -68,7 +68,7 @@ ExclusiveArch: ppc %if 0%{?fedora} || 0%{?rhel} < 6 Requires: hfsutils %endif -BuildRequires: e2fsprogs-devel +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. @@ -154,6 +154,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Thu Jun 03 2010 Roman Rakus - 1.3.14-34 +- added dependency on e2fsprogs-static package + * Wed May 26 2010 Roman Rakus - 1.3.14-33 - Allow yaboot to allocate up to 256MB of memory From 3fefbde3e35602c0bf7b448b8219ca7caae01525 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Mon, 19 Jul 2010 11:57:07 +0000 Subject: [PATCH 37/55] Update to 1.3.16 version --- yaboot-1.3.14-baseaddr.patch | 28 -------------------------- yaboot-1.3.14-bigger-max-token.patch | 12 ----------- yaboot-1.3.14-fix-bootonce-nvram.patch | 21 ------------------- yaboot-1.3.14-no-birecs.patch | 11 ---------- yaboot-1.3.14-returns.patch | 11 ---------- yaboot-relocatable-kernel.patch | 21 ------------------- yaboot.spec | 21 +++++-------------- 7 files changed, 5 insertions(+), 120 deletions(-) delete mode 100644 yaboot-1.3.14-baseaddr.patch delete mode 100644 yaboot-1.3.14-bigger-max-token.patch delete mode 100644 yaboot-1.3.14-fix-bootonce-nvram.patch delete mode 100644 yaboot-1.3.14-no-birecs.patch delete mode 100644 yaboot-1.3.14-returns.patch delete mode 100644 yaboot-relocatable-kernel.patch diff --git a/yaboot-1.3.14-baseaddr.patch b/yaboot-1.3.14-baseaddr.patch deleted file mode 100644 index f36814c..0000000 --- a/yaboot-1.3.14-baseaddr.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/Makefile b/Makefile -index 5457dc9..ce0dc06 100644 ---- a/Makefile -+++ b/Makefile -@@ -21,7 +21,7 @@ TEXTADDR = 0x200000 - MALLOCADDR = 0x300000 - MALLOCSIZE = 0x100000 - # Load kernel and ramdisk at real-base. If there is overlap, will retry until find open space --KERNELADDR = 0x00000000 -+KERNELADDR = 0x00C00000 - - # Set this to the prefix of your cross-compiler, if you have one. - # Else leave it empty. -diff --git a/second/fs_of.c b/second/fs_of.c -index 0d554c5..95c131d 100644 ---- a/second/fs_of.c -+++ b/second/fs_of.c -@@ -44,8 +44,8 @@ - #include "errors.h" - #include "debug.h" - --#define LOAD_BUFFER_POS 0x00000000 --#define LOAD_BUFFER_SIZE 0x01000000 -+#define LOAD_BUFFER_POS 0x1000000 -+#define LOAD_BUFFER_SIZE 0x1000000 - - static int of_open(struct boot_file_t* file, const char* dev_name, - struct partition_t* part, const char* file_name); diff --git a/yaboot-1.3.14-bigger-max-token.patch b/yaboot-1.3.14-bigger-max-token.patch deleted file mode 100644 index b1a7d32..0000000 --- a/yaboot-1.3.14-bigger-max-token.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up yaboot-1.3.14/second/cfg.c.bigger-max-token yaboot-1.3.14/second/cfg.c ---- yaboot-1.3.14/second/cfg.c.bigger-max-token 2008-11-12 14:39:11.000000000 -0500 -+++ yaboot-1.3.14/second/cfg.c 2008-11-12 14:39:17.000000000 -0500 -@@ -41,7 +41,7 @@ typedef struct { - void *data; - } CONFIG; - --#define MAX_TOKEN 200 -+#define MAX_TOKEN 511 - #define MAX_VAR_NAME MAX_TOKEN - #define EOF -1 - diff --git a/yaboot-1.3.14-fix-bootonce-nvram.patch b/yaboot-1.3.14-fix-bootonce-nvram.patch deleted file mode 100644 index c7d20ba..0000000 --- a/yaboot-1.3.14-fix-bootonce-nvram.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -up yaboot-1.3.14/ybin/ybin.fix-bootonce-nvram yaboot-1.3.14/ybin/ybin ---- yaboot-1.3.14/ybin/ybin.fix-bootonce-nvram 2008-11-12 14:51:28.000000000 -0500 -+++ yaboot-1.3.14/ybin/ybin 2008-11-13 12:15:21.000000000 -0500 -@@ -1689,14 +1689,15 @@ checkconf || exit 1 - - if [ "x$bootonce" != "x" ]; then - foundlabel=`sed s/\#.*// $bootconf | grep "label=$bootonce$" | wc -l` -- if [ "$nonvram" = 0 ]; then -+ if [ "$nonvram" = 1 ]; then - echo 1>&2 "$PRG: --bootonce specified, but nvsetenv not available." - exit 1 - fi - if [ "$foundlabel" = 1 ]; then - nvsetenv boot-once "$bootonce" - foundlabel=`nvsetenv boot-once` -- if [ "$foundlabel" != "boot-once=$bootonce" ]; then -+ if [ "$foundlabel" != "boot-once=$bootonce" -a \ -+ "$foundlabel" != "$bootonce" ]; then - echo 1>&2 "$PRG: Could not nvsetenv boot-once $bootonce" - exit 1 - fi diff --git a/yaboot-1.3.14-no-birecs.patch b/yaboot-1.3.14-no-birecs.patch deleted file mode 100644 index 96748c7..0000000 --- a/yaboot-1.3.14-no-birecs.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- yaboot-1.3.14/second/yaboot.c~ 2009-06-07 08:57:58.000000000 +0100 -+++ yaboot-1.3.14/second/yaboot.c 2009-06-07 09:02:03.000000000 +0100 -@@ -1243,7 +1243,7 @@ yaboot_text_ui(void) - flush_icache_range ((long)loadinfo.base, (long)loadinfo.base+loadinfo.memsize); - DEBUG_F(" done\n"); - -- if (flat_vmlinux) { -+ if (0 && flat_vmlinux) { - /* - * Fill new boot infos (only if booting a vmlinux). - * diff --git a/yaboot-1.3.14-returns.patch b/yaboot-1.3.14-returns.patch deleted file mode 100644 index b3d66da..0000000 --- a/yaboot-1.3.14-returns.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- yaboot-1.3.14/ybin/ybin.orig 2009-08-07 11:08:04.000000000 +1000 -+++ yaboot-1.3.14/ybin/ybin 2009-08-07 11:08:09.000000000 +1000 -@@ -1164,6 +1164,8 @@ - fi - sync ; sync - [ "$VERBOSE" = 1 ] && echo "$PRG: Installation successful" -+ -+ return 0 - } - - ## make sure the first stage ofboot generator is compatible. diff --git a/yaboot-relocatable-kernel.patch b/yaboot-relocatable-kernel.patch deleted file mode 100644 index 10e08ea..0000000 --- a/yaboot-relocatable-kernel.patch +++ /dev/null @@ -1,21 +0,0 @@ -PPC64 relocatable kernels (built with CONFIG_RELOCATABLE=y) have the type of -ET_DYN. But yaboot code won't load the kernel if the ELF type is not -ET_EXEC. Attached patch adds support to yaboot to load relocatable kernels -also (ie load ET_DYN type also) - -Signed-off-by: M. Mohan Kumar ---- - second/yaboot.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- yaboot-1.3.14.orig/second/yaboot.c -+++ yaboot-1.3.14/second/yaboot.c -@@ -1606,7 +1606,7 @@ is_elf64(loadinfo_t *loadinfo) - e->e_ident[EI_MAG3] == ELFMAG3 && - e->e_ident[EI_CLASS] == ELFCLASS64 && - e->e_ident[EI_DATA] == ELFDATA2MSB && -- e->e_type == ET_EXEC && -+ (e->e_type == ET_EXEC || e->e_type == ET_DYN) && - e->e_machine == EM_PPC64); - } - diff --git a/yaboot.spec b/yaboot.spec index c344598..53d9e35 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot -Version: 1.3.14 -Release: 34%{?dist} +Version: 1.3.16 +Release: 1%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -21,15 +21,7 @@ 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 -Patch29: yaboot-1.3.14-baseaddr.patch -Patch30: yaboot-1.3.14-fix-bootonce-nvram.patch -Patch31: yaboot-1.3.14-bigger-max-token.patch -Patch32: yaboot-relocatable-kernel.patch Patch33: yaboot-1.3.14-better_netboot.patch -Patch34: yaboot-1.3.14-no-birecs.patch - -# mkofboot in verbose mode returns bad value -Patch35: yaboot-1.3.14-returns.patch # ipv6 support Patch36: yaboot-1.3.14-ipv6.patch @@ -98,13 +90,7 @@ yaboot can also bootload IBM pSeries machines. %patch22 -p1 -b .deepmnt %patch27 -p1 -b .ppc64 %patch28 -p1 -b .bootwrite -%patch29 -p1 -b .baseaddr -%patch30 -p1 -b .bootonce -%patch31 -p1 -b .maxtoken -%patch32 -p1 -b .relocatable %patch33 -p1 -b .netboot -%patch34 -p1 -b .birecs -%patch35 -p1 -b .returns %patch36 -p1 -b .ipv6 %patch37 -p1 -b .partitions %patch38 -p1 -b .netboot2 @@ -154,6 +140,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Mon Jul 19 2010 Roman Rakus - 1.3.16-1 +- Update to 1.3.16 version + * Thu Jun 03 2010 Roman Rakus - 1.3.14-34 - added dependency on e2fsprogs-static package From c416dbbf7f4117139ceaa11adcbbb086bcf2f033 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 29 Jul 2010 16:18:05 +0000 Subject: [PATCH 38/55] dist-git conversion --- .cvsignore => .gitignore | 0 Makefile | 22 ---------------------- 2 files changed, 22 deletions(-) rename .cvsignore => .gitignore (100%) delete mode 100644 Makefile diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/Makefile b/Makefile deleted file mode 100644 index 4234502..0000000 --- a/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# Makefile for source rpm: yaboot -# $Id: Makefile,v 1.3 2007/10/15 19:38:27 notting Exp $ -NAME := yaboot -SPECFILE = $(firstword $(wildcard *.spec)) -UPSTREAM_CHECKS = sig - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attempt a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) From 3bae39f0bd7a2a350f138ab931b6531fd9d6d6bb Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Mon, 2 Aug 2010 11:01:09 +1000 Subject: [PATCH 39/55] Add yaboot-1.3.16.tar.gz Signed-off-by: Tony Breeds --- sources | 1 + 1 file changed, 1 insertion(+) diff --git a/sources b/sources index de9d08c..2f23db7 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ dd346812667ab3818248c9784fe8e38e yaboot-1.3.14.tar.gz +dd8f436cf23d562c8a9f6ff513e1f435 yaboot-1.3.16.tar.gz From 7c557ad7352e5e52f0992174c5a9ea96c22fda68 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Tue, 8 Feb 2011 01:15:01 -0600 Subject: [PATCH 40/55] - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild --- yaboot.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yaboot.spec b/yaboot.spec index 53d9e35..f042315 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.16 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -140,6 +140,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Tue Feb 08 2011 Fedora Release Engineering - 1.3.16-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + * Mon Jul 19 2010 Roman Rakus - 1.3.16-1 - Update to 1.3.16 version From f9545f5c3c13de34f0c55363b0cc7021d17cb453 Mon Sep 17 00:00:00 2001 From: Karsten Hopp Date: Tue, 12 Apr 2011 16:46:13 +0200 Subject: [PATCH 41/55] Add fix from Tony Breeds for failing to link against posix_memalign() (closes 689415) --- yaboot-1.3.16-memalign.patch | 65 ++++++++++++++++++++++++++++++++++++ yaboot.spec | 9 ++++- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 yaboot-1.3.16-memalign.patch diff --git a/yaboot-1.3.16-memalign.patch b/yaboot-1.3.16-memalign.patch new file mode 100644 index 0000000..43e97af --- /dev/null +++ b/yaboot-1.3.16-memalign.patch @@ -0,0 +1,65 @@ +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; diff --git a/yaboot.spec b/yaboot.spec index f042315..f39fd03 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.16 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -50,6 +50,9 @@ 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 @@ -100,6 +103,7 @@ yaboot can also bootload IBM pSeries machines. %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 @@ -140,6 +144,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Tue Apr 12 2011 Tony Breeds - 1.3.16-3 +- Add fix for failing to link against posix_memalign() (closes 689415) + * Tue Feb 08 2011 Fedora Release Engineering - 1.3.16-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild From fe26fbee331b59ac551f29491ed8ae07bc46d449 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Thu, 11 Aug 2011 10:48:02 +1000 Subject: [PATCH 42/55] Truncate memcpy() in extract_vendor_options() Backport patch from 1.3.17-rc1 which will stop stack smash. Signed-off-by: Tony Breeds --- yaboot-1.3.14-dhcp_truncate.patch | 17 +++++++++++++++++ yaboot.spec | 10 +++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 yaboot-1.3.14-dhcp_truncate.patch diff --git a/yaboot-1.3.14-dhcp_truncate.patch b/yaboot-1.3.14-dhcp_truncate.patch new file mode 100644 index 0000000..749408a --- /dev/null +++ b/yaboot-1.3.14-dhcp_truncate.patch @@ -0,0 +1,17 @@ +diff -ru yaboot-1.3.16.orig/second/file.c yaboot-1.3.16/second/file.c +--- yaboot-1.3.16.orig/second/file.c 2011-08-11 10:32:58.654006637 +1000 ++++ yaboot-1.3.16/second/file.c 2011-08-11 10:34:04.877846737 +1000 +@@ -223,7 +223,12 @@ + continue; + + len = options[i++]; +- memcpy(&value, &options[i], len); ++ /* Clamp the maxium length of the memcpy() to the right size for ++ * value. */ ++ if (len > sizeof(value)) ++ memcpy(&value, &options[i], sizeof(value)); ++ else ++ memcpy(&value, &options[i], len); + + #if DEBUG + { diff --git a/yaboot.spec b/yaboot.spec index f39fd03..865ede0 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.16 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -53,6 +53,10 @@ Patch44: yaboot-1.3.14-256-RMA.patch # Create dummy instance of posix_memalign for e3fsprogs Patch45: yaboot-1.3.16-memalign.patch +# Truncate memcpy() in extract_vendor_options() +# https://bugzilla.redhat.com/show_bug.cgi?id=729684 +Patch46: yaboot-1.3.14-dhcp_truncate.patch + URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root Obsoletes: ybin @@ -104,6 +108,7 @@ yaboot can also bootload IBM pSeries machines. %patch43 -p1 -b .prom_getchars %patch44 -p1 -b .256-RMA %patch45 -p1 -b .posix +%patch46 -p1 -b .dhcppad %build make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1 @@ -144,6 +149,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Thu Aug 11 2011 Tony Breeds - 1.3.16-4 +- truncate memcpy() extract_vendor_options() to avoid clobbering the stack. (closes 729684) + * Tue Apr 12 2011 Tony Breeds - 1.3.16-3 - Add fix for failing to link against posix_memalign() (closes 689415) From 934bf6ca3d00e3183a504c6b3d61527323e1df2d Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Wed, 31 Aug 2011 15:28:36 +1000 Subject: [PATCH 43/55] Force the linker to use elf32 Signed-off-by: Tony Breeds --- yaboot-ppc64.patch | 8 -------- yaboot.spec | 5 ++++- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/yaboot-ppc64.patch b/yaboot-ppc64.patch index a86d18b..1ed2d54 100644 --- a/yaboot-ppc64.patch +++ b/yaboot-ppc64.patch @@ -11,12 +11,4 @@ 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 - # diff --git a/yaboot.spec b/yaboot.spec index 865ede0..13dec83 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.16 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -149,6 +149,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Wed Aug 31 2011 Tony Breeds - 1.3.16-5 +- yaboot-ppc64.patch incorrectly removed the -melfppc32linux from LDFLAGS. DOn't know why this hasn't been a problem 'til now. + * Thu Aug 11 2011 Tony Breeds - 1.3.16-4 - truncate memcpy() extract_vendor_options() to avoid clobbering the stack. (closes 729684) From 56d90079a4107d8a25c9d441e193ebe582791c4b Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Mon, 26 Sep 2011 15:16:04 +1000 Subject: [PATCH 44/55] Add support for PowerVM and add no-strict-aliasing to YBCFLAGS Signed-off-by: Tony Breeds --- yaboot-1.3.16-no-strict-aliasing.patch | 11 +++++++ yaboot-1.3.16-powervm.patch | 40 ++++++++++++++++++++++++++ yaboot.spec | 10 ++++++- 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 yaboot-1.3.16-no-strict-aliasing.patch create mode 100644 yaboot-1.3.16-powervm.patch diff --git a/yaboot-1.3.16-no-strict-aliasing.patch b/yaboot-1.3.16-no-strict-aliasing.patch new file mode 100644 index 0000000..7895bd6 --- /dev/null +++ b/yaboot-1.3.16-no-strict-aliasing.patch @@ -0,0 +1,11 @@ +diff -uNr yaboot-1.3.16.orig/Makefile yaboot-1.3.16/Makefile +--- yaboot-1.3.16.orig/Makefile 2011-08-31 15:24:40.920001343 +1000 ++++ yaboot-1.3.16/Makefile 2011-08-31 15:38:22.050001354 +1000 +@@ -42,6 +42,7 @@ + YBCFLAGS += -DMALLOCADDR=$(MALLOCADDR) -DMALLOCSIZE=$(MALLOCSIZE) + YBCFLAGS += -DKERNELADDR=$(KERNELADDR) + YBCFLAGS += -I ./include ++YBCFLAGS += -fno-strict-aliasing + + ifeq ($(CONFIG_COLOR_TEXT),y) + YBCFLAGS += -DCONFIG_COLOR_TEXT diff --git a/yaboot-1.3.16-powervm.patch b/yaboot-1.3.16-powervm.patch new file mode 100644 index 0000000..ebdd970 --- /dev/null +++ b/yaboot-1.3.16-powervm.patch @@ -0,0 +1,40 @@ +diff -uNr yaboot-1.3.16.orig/second/yaboot.c yaboot-1.3.16/second/yaboot.c +--- yaboot-1.3.16.orig/second/yaboot.c 2011-08-31 15:24:40.940001350 +1000 ++++ yaboot-1.3.16/second/yaboot.c 2011-08-31 15:30:43.890002019 +1000 +@@ -233,6 +233,9 @@ + else if (prom_getprop(root, "device_type", model, 256 ) > 0 && + !strncmp("chrp", model, 4)) + _machine = _MACH_chrp; ++ else if (prom_getprop(root, "compatible", model, 256 ) > 0 && ++ strstr(model, "ibm,powernv")) ++ _machine = _MACH_chrp; + else { + if (prom_getprop(root, "model", model, 256 ) > 0 && + !strncmp(model, "IBM", 3)) +diff -uNr yaboot-1.3.16.orig/ybin/ybin yaboot-1.3.16/ybin/ybin +--- yaboot-1.3.16.orig/ybin/ybin 2011-08-31 15:24:40.910001339 +1000 ++++ yaboot-1.3.16/ybin/ybin 2011-08-31 15:34:58.630001563 +1000 +@@ -73,7 +73,9 @@ + + ## defaults + usemount=no +-if (cat /proc/cpuinfo 2> /dev/null | grep ^machine | grep -q 'CHRP IBM') ; then ++if (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'pSeries') ; then ++ fstype=raw ++elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'PowerNV') ; then + fstype=raw + elif (cat /proc/cpuinfo 2> /dev/null | grep ^machine | grep -q 'Pegasos') ; then + fstype=ext2 +@@ -508,7 +510,11 @@ + echo 1>&2 + [ "$nonvram" = 0 ] && echo 1>&2 "$PRG: OldWorld PowerMac, nvram will not be updated" + nonvram=1 +- elif (cat /proc/cpuinfo 2> /dev/null | grep ^machine | grep -q 'CHRP IBM') ; then ++ elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'pSeries') ; then ++ ## IBM hardware does not need nvram update AFAICT ++ nonvram=1 ++ ADDNOTE=yes ++ elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'PowerNV') ; then + ## IBM hardware does not need nvram update AFAICT + nonvram=1 + ADDNOTE=yes diff --git a/yaboot.spec b/yaboot.spec index 13dec83..d2b6ee5 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.16 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -56,6 +56,8 @@ Patch45: yaboot-1.3.16-memalign.patch # Truncate memcpy() in extract_vendor_options() # https://bugzilla.redhat.com/show_bug.cgi?id=729684 Patch46: yaboot-1.3.14-dhcp_truncate.patch +Patch47: yaboot-1.3.16-no-strict-aliasing.patch +Patch48: yaboot-1.3.16-powervm.patch URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root @@ -109,6 +111,8 @@ yaboot can also bootload IBM pSeries machines. %patch44 -p1 -b .256-RMA %patch45 -p1 -b .posix %patch46 -p1 -b .dhcppad +%patch47 -p1 -b .aliasing +%patch48 -p1 -b .powervm %build make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1 @@ -149,6 +153,10 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Mon Sep 26 2011 Tony Breeds - 1.3.16-6 +- Add no-strict-aliasing to YBCFLAGS +- Add detection for PowerVM Firmware. + * Wed Aug 31 2011 Tony Breeds - 1.3.16-5 - yaboot-ppc64.patch incorrectly removed the -melfppc32linux from LDFLAGS. DOn't know why this hasn't been a problem 'til now. From 75645bf8d22bd921a293464ece7a236c6bc766a8 Mon Sep 17 00:00:00 2001 From: Jiri Skala Date: Mon, 17 Oct 2011 22:41:24 +0200 Subject: [PATCH 45/55] fixes #746408 - yaboot discards parameters after CAS reboot --- yaboot-1.3.16-args-cas.patch | 32 ++++++++++++++++++++++++++++++++ yaboot.spec | 9 ++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 yaboot-1.3.16-args-cas.patch diff --git a/yaboot-1.3.16-args-cas.patch b/yaboot-1.3.16-args-cas.patch new file mode 100644 index 0000000..28ff872 --- /dev/null +++ b/yaboot-1.3.16-args-cas.patch @@ -0,0 +1,32 @@ +diff -up yaboot-1.3.16/second/yaboot.c.args-cas yaboot-1.3.16/second/yaboot.c +--- yaboot-1.3.16/second/yaboot.c.args-cas 2011-10-17 21:56:53.728000031 +0200 ++++ yaboot-1.3.16/second/yaboot.c 2011-10-17 21:56:53.731000031 +0200 +@@ -751,9 +751,10 @@ int get_params(struct boot_param_t* para + if (!imagename) { + if (bootoncelabel[0] != 0) + imagename = bootoncelabel; +- else if (bootlastlabel[0] != 0) +- imagename = bootlastlabel; +- else ++ else if (bootlastlabel[0] != 0) { ++ imagename = bootlastlabel; ++ word_split(&imagename, ¶ms->args); ++ } else + imagename = cfg_get_default(); + } + if (imagename) +@@ -815,7 +816,13 @@ int get_params(struct boot_param_t* para + imagename = cfg_get_default(); + + /* write the imagename out so it can be reused on reboot if necessary */ +- prom_set_options("boot-last-label", imagename, strlen(imagename)); ++ strcpy(bootlastlabel, imagename); ++ if (params->args && params->args[0]) { ++ strcat(bootlastlabel, " "); ++ strcat(bootlastlabel, params->args); ++ } ++ prom_set_options("boot-last-label", bootlastlabel, ++ strlen(bootlastlabel) + 1); + + label = 0; + defdevice = boot.dev; diff --git a/yaboot.spec b/yaboot.spec index d2b6ee5..d9315c2 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.16 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -59,6 +59,9 @@ Patch46: yaboot-1.3.14-dhcp_truncate.patch Patch47: yaboot-1.3.16-no-strict-aliasing.patch Patch48: yaboot-1.3.16-powervm.patch +# Yaboot discards parameters after CAS reboot +Patch49: yaboot-1.3.16-args-cas.patch + URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root Obsoletes: ybin @@ -113,6 +116,7 @@ yaboot can also bootload IBM pSeries machines. %patch46 -p1 -b .dhcppad %patch47 -p1 -b .aliasing %patch48 -p1 -b .powervm +%patch49 -p1 -b .args-cas %build make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1 @@ -153,6 +157,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Mon Oct 17 2011 Jiri Skala - 1.3.16-7 +- fixes #746408 - yaboot discards parameters after CAS reboot + * Mon Sep 26 2011 Tony Breeds - 1.3.16-6 - Add no-strict-aliasing to YBCFLAGS - Add detection for PowerVM Firmware. From a55381a68365b6547961508b774d9e01ada47b0f Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Tue, 18 Oct 2011 16:19:58 +1100 Subject: [PATCH 46/55] Update to new upstream release yaboot-1.3.17 Signed-off-by: Tony Breeds --- .gitignore | 3 +- sources | 3 +- yaboot-1.3.13-pegasos-claim.patch | 25 +- yaboot-1.3.13-pegasos-ext2.patch | 18 +- yaboot-1.3.13-pegasos-serial.patch | 18 +- yaboot-1.3.14-256-RMA.patch | 99 --- yaboot-1.3.14-better_netboot.patch | 726 ------------------ yaboot-1.3.14-better_netboot2.patch | 325 -------- yaboot-1.3.14-dhcp_truncate.patch | 17 - ....3.14-dont_of_open_native_partitions.patch | 15 - yaboot-1.3.14-ipv6.patch | 129 ---- yaboot-1.3.14-iscsi.patch | 55 -- yaboot-1.3.14-move_kernel.patch | 118 --- yaboot-1.3.14-netinfo.patch | 66 -- yaboot-1.3.14-prom_getchars.patch | 95 --- yaboot-1.3.16-args-cas.patch | 32 - yaboot-1.3.16-memalign.patch | 65 -- yaboot-1.3.16-no-strict-aliasing.patch | 11 - yaboot-1.3.16-powervm.patch | 40 - yaboot-1.3.3-man.patch | 44 +- yaboot-ppc64.patch | 14 - yaboot-sha2.patch | 86 +-- yaboot.spec | 90 +-- 23 files changed, 117 insertions(+), 1977 deletions(-) delete mode 100644 yaboot-1.3.14-256-RMA.patch delete mode 100644 yaboot-1.3.14-better_netboot.patch delete mode 100644 yaboot-1.3.14-better_netboot2.patch delete mode 100644 yaboot-1.3.14-dhcp_truncate.patch delete mode 100644 yaboot-1.3.14-dont_of_open_native_partitions.patch delete mode 100644 yaboot-1.3.14-ipv6.patch delete mode 100644 yaboot-1.3.14-iscsi.patch delete mode 100644 yaboot-1.3.14-move_kernel.patch delete mode 100644 yaboot-1.3.14-netinfo.patch delete mode 100644 yaboot-1.3.14-prom_getchars.patch delete mode 100644 yaboot-1.3.16-args-cas.patch delete mode 100644 yaboot-1.3.16-memalign.patch delete mode 100644 yaboot-1.3.16-no-strict-aliasing.patch delete mode 100644 yaboot-1.3.16-powervm.patch delete mode 100644 yaboot-ppc64.patch diff --git a/.gitignore b/.gitignore index ee86d42..455757c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -yaboot-1.3.14.tar.gz +/yaboot-1.3.17.tar.gz +yaboot-1.3.17 diff --git a/sources b/sources index 2f23db7..1eeefcf 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ -dd346812667ab3818248c9784fe8e38e yaboot-1.3.14.tar.gz -dd8f436cf23d562c8a9f6ff513e1f435 yaboot-1.3.16.tar.gz +f599f52d1887a86fd798252d2946f635 yaboot-1.3.17.tar.gz diff --git a/yaboot-1.3.13-pegasos-claim.patch b/yaboot-1.3.13-pegasos-claim.patch index eff5571..5b5b2a4 100644 --- a/yaboot-1.3.13-pegasos-claim.patch +++ b/yaboot-1.3.13-pegasos-claim.patch @@ -1,15 +1,14 @@ ---- 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); +--- yaboot-1.3.17/second/prom.c.orig 2011-10-18 12:41:46.924310275 +1100 ++++ yaboot-1.3.17/second/prom.c 2011-10-18 12:43:17.202121228 +1100 +@@ -622,6 +622,11 @@ + void *ret; + + 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 ++ ret = (void *)-1; ++ + if (ret == (void *)-1) + prom_printf("ERROR: claim of 0x%x at 0x%x failed\n", size, (int)virt); + else diff --git a/yaboot-1.3.13-pegasos-ext2.patch b/yaboot-1.3.13-pegasos-ext2.patch index 2792f21..8408881 100644 --- a/yaboot-1.3.13-pegasos-ext2.patch +++ b/yaboot-1.3.13-pegasos-ext2.patch @@ -1,15 +1,15 @@ ---- 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 +--- yaboot-1.3.17/ybin/ybin.orig 2011-10-18 12:33:25.000000000 +1100 ++++ yaboot-1.3.17/ybin/ybin 2011-10-18 12:46:28.621720442 +1100 +@@ -77,6 +77,8 @@ + fstype=raw + elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'PowerNV') ; 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() +@@ -281,13 +283,13 @@ fi case "$fstype" in @@ -26,7 +26,7 @@ fi local CONFERR=1 ;; -@@ -942,12 +944,16 @@ util_install() +@@ -950,12 +952,16 @@ ## used by mnt_install so mntpoint= can be supported in a cleaner way. mnt() { @@ -45,7 +45,7 @@ if [ -e "$TMP/bootstrap.$$" ] ; then echo 1>&2 "$PRG: $TMP/bootstrap.$$ exists, aborting." return 1 -@@ -966,7 +972,7 @@ mnt() +@@ -974,7 +980,7 @@ fi [ "$VERBOSE" = 1 ] && echo "$PRG: Mounting $boot..." @@ -54,7 +54,7 @@ if [ $? != 0 ] ; then echo 1>&2 "$PRG: An error occured mounting $boot" return 1 -@@ -1252,6 +1258,25 @@ mkoffs() +@@ -1261,6 +1267,25 @@ fi return 0 ;; diff --git a/yaboot-1.3.13-pegasos-serial.patch b/yaboot-1.3.13-pegasos-serial.patch index 8341e12..fe6f358 100644 --- a/yaboot-1.3.13-pegasos-serial.patch +++ b/yaboot-1.3.13-pegasos-serial.patch @@ -1,14 +1,14 @@ ---- 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]; +--- yaboot-1.3.17/second/prom.c.orig 2011-10-18 12:48:11.388505271 +1100 ++++ yaboot-1.3.17/second/prom.c 2011-10-18 12:49:36.553326950 +1100 +@@ -395,10 +395,8 @@ + char c; 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) +- while ((a = (int)call_prom ("read", 3, 1, prom_stdin, &c, 1)) == 0) ++ while ((a = (int)call_prom ("read", 3, 1, prom_stdin, &c, 1)) <= 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]; + return c; + } + diff --git a/yaboot-1.3.14-256-RMA.patch b/yaboot-1.3.14-256-RMA.patch deleted file mode 100644 index 285c10a..0000000 --- a/yaboot-1.3.14-256-RMA.patch +++ /dev/null @@ -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; - diff --git a/yaboot-1.3.14-better_netboot.patch b/yaboot-1.3.14-better_netboot.patch deleted file mode 100644 index f06fce5..0000000 --- a/yaboot-1.3.14-better_netboot.patch +++ /dev/null @@ -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", ¶ms->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", ¶ms->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", ¶ms->sysmap)) { - prom_printf("%s: Unable to parse\n", imagepath); diff --git a/yaboot-1.3.14-better_netboot2.patch b/yaboot-1.3.14-better_netboot2.patch deleted file mode 100644 index 1561e88..0000000 --- a/yaboot-1.3.14-better_netboot2.patch +++ /dev/null @@ -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; jsubnetmask == 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 diff --git a/yaboot-1.3.14-dhcp_truncate.patch b/yaboot-1.3.14-dhcp_truncate.patch deleted file mode 100644 index 749408a..0000000 --- a/yaboot-1.3.14-dhcp_truncate.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -ru yaboot-1.3.16.orig/second/file.c yaboot-1.3.16/second/file.c ---- yaboot-1.3.16.orig/second/file.c 2011-08-11 10:32:58.654006637 +1000 -+++ yaboot-1.3.16/second/file.c 2011-08-11 10:34:04.877846737 +1000 -@@ -223,7 +223,12 @@ - continue; - - len = options[i++]; -- memcpy(&value, &options[i], len); -+ /* Clamp the maxium length of the memcpy() to the right size for -+ * value. */ -+ if (len > sizeof(value)) -+ memcpy(&value, &options[i], sizeof(value)); -+ else -+ memcpy(&value, &options[i], len); - - #if DEBUG - { diff --git a/yaboot-1.3.14-dont_of_open_native_partitions.patch b/yaboot-1.3.14-dont_of_open_native_partitions.patch deleted file mode 100644 index 048349b..0000000 --- a/yaboot-1.3.14-dont_of_open_native_partitions.patch +++ /dev/null @@ -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 diff --git a/yaboot-1.3.14-ipv6.patch b/yaboot-1.3.14-ipv6.patch deleted file mode 100644 index 0ec08be..0000000 --- a/yaboot-1.3.14-ipv6.patch +++ /dev/null @@ -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); diff --git a/yaboot-1.3.14-iscsi.patch b/yaboot-1.3.14-iscsi.patch deleted file mode 100644 index 816bae7..0000000 --- a/yaboot-1.3.14-iscsi.patch +++ /dev/null @@ -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; - } diff --git a/yaboot-1.3.14-move_kernel.patch b/yaboot-1.3.14-move_kernel.patch deleted file mode 100644 index 8142646..0000000 --- a/yaboot-1.3.14-move_kernel.patch +++ /dev/null @@ -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)); - } diff --git a/yaboot-1.3.14-netinfo.patch b/yaboot-1.3.14-netinfo.patch deleted file mode 100644 index b366956..0000000 --- a/yaboot-1.3.14-netinfo.patch +++ /dev/null @@ -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 ---- -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); - } - diff --git a/yaboot-1.3.14-prom_getchars.patch b/yaboot-1.3.14-prom_getchars.patch deleted file mode 100644 index bf4e048..0000000 --- a/yaboot-1.3.14-prom_getchars.patch +++ /dev/null @@ -1,95 +0,0 @@ -Date: Sun, 11 Apr 2010 14:05:59 +1000 -From: Anton Blanchard -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 -Signed-off-by: Tony Breeds - ---- -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) - { diff --git a/yaboot-1.3.16-args-cas.patch b/yaboot-1.3.16-args-cas.patch deleted file mode 100644 index 28ff872..0000000 --- a/yaboot-1.3.16-args-cas.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff -up yaboot-1.3.16/second/yaboot.c.args-cas yaboot-1.3.16/second/yaboot.c ---- yaboot-1.3.16/second/yaboot.c.args-cas 2011-10-17 21:56:53.728000031 +0200 -+++ yaboot-1.3.16/second/yaboot.c 2011-10-17 21:56:53.731000031 +0200 -@@ -751,9 +751,10 @@ int get_params(struct boot_param_t* para - if (!imagename) { - if (bootoncelabel[0] != 0) - imagename = bootoncelabel; -- else if (bootlastlabel[0] != 0) -- imagename = bootlastlabel; -- else -+ else if (bootlastlabel[0] != 0) { -+ imagename = bootlastlabel; -+ word_split(&imagename, ¶ms->args); -+ } else - imagename = cfg_get_default(); - } - if (imagename) -@@ -815,7 +816,13 @@ int get_params(struct boot_param_t* para - imagename = cfg_get_default(); - - /* write the imagename out so it can be reused on reboot if necessary */ -- prom_set_options("boot-last-label", imagename, strlen(imagename)); -+ strcpy(bootlastlabel, imagename); -+ if (params->args && params->args[0]) { -+ strcat(bootlastlabel, " "); -+ strcat(bootlastlabel, params->args); -+ } -+ prom_set_options("boot-last-label", bootlastlabel, -+ strlen(bootlastlabel) + 1); - - label = 0; - defdevice = boot.dev; diff --git a/yaboot-1.3.16-memalign.patch b/yaboot-1.3.16-memalign.patch deleted file mode 100644 index 43e97af..0000000 --- a/yaboot-1.3.16-memalign.patch +++ /dev/null @@ -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; diff --git a/yaboot-1.3.16-no-strict-aliasing.patch b/yaboot-1.3.16-no-strict-aliasing.patch deleted file mode 100644 index 7895bd6..0000000 --- a/yaboot-1.3.16-no-strict-aliasing.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -uNr yaboot-1.3.16.orig/Makefile yaboot-1.3.16/Makefile ---- yaboot-1.3.16.orig/Makefile 2011-08-31 15:24:40.920001343 +1000 -+++ yaboot-1.3.16/Makefile 2011-08-31 15:38:22.050001354 +1000 -@@ -42,6 +42,7 @@ - YBCFLAGS += -DMALLOCADDR=$(MALLOCADDR) -DMALLOCSIZE=$(MALLOCSIZE) - YBCFLAGS += -DKERNELADDR=$(KERNELADDR) - YBCFLAGS += -I ./include -+YBCFLAGS += -fno-strict-aliasing - - ifeq ($(CONFIG_COLOR_TEXT),y) - YBCFLAGS += -DCONFIG_COLOR_TEXT diff --git a/yaboot-1.3.16-powervm.patch b/yaboot-1.3.16-powervm.patch deleted file mode 100644 index ebdd970..0000000 --- a/yaboot-1.3.16-powervm.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff -uNr yaboot-1.3.16.orig/second/yaboot.c yaboot-1.3.16/second/yaboot.c ---- yaboot-1.3.16.orig/second/yaboot.c 2011-08-31 15:24:40.940001350 +1000 -+++ yaboot-1.3.16/second/yaboot.c 2011-08-31 15:30:43.890002019 +1000 -@@ -233,6 +233,9 @@ - else if (prom_getprop(root, "device_type", model, 256 ) > 0 && - !strncmp("chrp", model, 4)) - _machine = _MACH_chrp; -+ else if (prom_getprop(root, "compatible", model, 256 ) > 0 && -+ strstr(model, "ibm,powernv")) -+ _machine = _MACH_chrp; - else { - if (prom_getprop(root, "model", model, 256 ) > 0 && - !strncmp(model, "IBM", 3)) -diff -uNr yaboot-1.3.16.orig/ybin/ybin yaboot-1.3.16/ybin/ybin ---- yaboot-1.3.16.orig/ybin/ybin 2011-08-31 15:24:40.910001339 +1000 -+++ yaboot-1.3.16/ybin/ybin 2011-08-31 15:34:58.630001563 +1000 -@@ -73,7 +73,9 @@ - - ## defaults - usemount=no --if (cat /proc/cpuinfo 2> /dev/null | grep ^machine | grep -q 'CHRP IBM') ; then -+if (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'pSeries') ; then -+ fstype=raw -+elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'PowerNV') ; then - fstype=raw - elif (cat /proc/cpuinfo 2> /dev/null | grep ^machine | grep -q 'Pegasos') ; then - fstype=ext2 -@@ -508,7 +510,11 @@ - echo 1>&2 - [ "$nonvram" = 0 ] && echo 1>&2 "$PRG: OldWorld PowerMac, nvram will not be updated" - nonvram=1 -- elif (cat /proc/cpuinfo 2> /dev/null | grep ^machine | grep -q 'CHRP IBM') ; then -+ elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'pSeries') ; then -+ ## IBM hardware does not need nvram update AFAICT -+ nonvram=1 -+ ADDNOTE=yes -+ elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'PowerNV') ; then - ## IBM hardware does not need nvram update AFAICT - nonvram=1 - ADDNOTE=yes diff --git a/yaboot-1.3.3-man.patch b/yaboot-1.3.3-man.patch index 24557e9..c444761 100644 --- a/yaboot-1.3.3-man.patch +++ b/yaboot-1.3.3-man.patch @@ -1,7 +1,7 @@ -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 @@ +diff -bpurN yaboot-1.3.17.orig/man/mkofboot.8 yaboot-1.3.17/man/mkofboot.8 +--- yaboot-1.3.17.orig/man/mkofboot.8 2011-10-18 12:33:25.000000000 +1100 ++++ yaboot-1.3.17/man/mkofboot.8 2011-10-18 14:51:53.540964413 +1100 +@@ -88,7 +88,7 @@ utility. You should only need to define .TP .BR \-i ,\ \-\-install\ \fIboot-file Use \fIboot-file\fR as the primary boot loader executable, instead of @@ -10,7 +10,7 @@ diff -urN -X CVS man/mkofboot.8 man.deb/mkofboot.8 .TP .BR \-C ,\ \-\-config\ \fIconfig-file Use \fIconfig-file\fR as the \fBmkofboot\fR/\fByaboot\fR(8) configuration -@@ -200,8 +200,8 @@ +@@ -162,8 +162,8 @@ Print out usage information and exit. Print out the version number and exit. .SH FILES .nf @@ -21,7 +21,7 @@ diff -urN -X CVS man/mkofboot.8 man.deb/mkofboot.8 /etc/yaboot.conf \- boot loader/mkofboot configuration file .fi .SH ENVIRONMENT -@@ -218,7 +218,7 @@ +@@ -179,7 +179,7 @@ it is important that your system use a s program otherwise \fBmkofboot\fR will be vulnerable to race conditions. The Debian mktemp is derived from OpenBSD and thus should be secure. @@ -30,10 +30,10 @@ diff -urN -X CVS man/mkofboot.8 man.deb/mkofboot.8 \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 @@ +diff -bpurN yaboot-1.3.17.orig/man/yaboot.conf.5 yaboot-1.3.17/man/yaboot.conf.5 +--- yaboot-1.3.17.orig/man/yaboot.conf.5 2011-10-18 12:33:25.000000000 +1100 ++++ yaboot-1.3.17/man/yaboot.conf.5 2011-10-18 14:51:53.541964410 +1100 +@@ -136,7 +136,7 @@ Example: boot=/dev/hda2 device=hd: partition=3 @@ -42,7 +42,7 @@ diff -urN -X CVS man/yaboot.conf.5 man.deb/yaboot.conf.5 timeout=50 root=/dev/hda3 read-only -@@ -228,7 +228,7 @@ +@@ -228,7 +228,7 @@ executable so this can be optional. Whe 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 @@ -51,7 +51,7 @@ diff -urN -X CVS man/yaboot.conf.5 man.deb/yaboot.conf.5 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 @@ +@@ -307,7 +307,7 @@ You must also have the BSD bootloader 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 @@ -60,7 +60,7 @@ diff -urN -X CVS man/yaboot.conf.5 man.deb/yaboot.conf.5 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 @@ +@@ -316,7 +316,7 @@ The OpenFirmware or Unix device path to 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 @@ -69,7 +69,7 @@ diff -urN -X CVS man/yaboot.conf.5 man.deb/yaboot.conf.5 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 @@ +@@ -326,7 +326,7 @@ The OpenFirmware or unix device path to 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 @@ -78,7 +78,7 @@ diff -urN -X CVS man/yaboot.conf.5 man.deb/yaboot.conf.5 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 @@ +@@ -347,7 +347,7 @@ The OpenFirmware or unix device path to 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 @@ -87,7 +87,7 @@ diff -urN -X CVS man/yaboot.conf.5 man.deb/yaboot.conf.5 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 @@ +@@ -591,8 +591,8 @@ device=hd: root=/dev/hda3 partition=3 timeout=20 @@ -98,10 +98,10 @@ diff -urN -X CVS man/yaboot.conf.5 man.deb/yaboot.conf.5 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 @@ +diff -bpurN yaboot-1.3.17.orig/man/ybin.8 yaboot-1.3.17/man/ybin.8 +--- yaboot-1.3.17.orig/man/ybin.8 2011-10-18 12:33:25.000000000 +1100 ++++ yaboot-1.3.17/man/ybin.8 2011-10-18 14:51:53.541964410 +1100 +@@ -103,7 +103,7 @@ You should only need to define this opti .TP .BR \-i ,\ \-\-install\ \fIboot-file Use \fIboot-file\fR as the primary boot loader executable, instead of @@ -110,7 +110,7 @@ diff -urN -X CVS man/ybin.8 man.deb/ybin.8 .TP .BR \-C ,\ \-\-config\ \fIconfig-file Use \fIconfig-file\fR as the \fBybin\fR/\fByaboot\fR(8) configuration -@@ -214,8 +214,8 @@ +@@ -176,8 +176,8 @@ Print out usage information and exit. Print out the version number and exit. .SH FILES .nf @@ -121,7 +121,7 @@ diff -urN -X CVS man/ybin.8 man.deb/ybin.8 /etc/yaboot.conf \- boot loader/ybin configuration file .fi .SH ENVIRONMENT -@@ -232,7 +232,7 @@ +@@ -193,7 +193,7 @@ It is important that your system use a s program, otherwise \fBybin\fR will be vulnerable to race conditions. The Debian mktemp is derived from OpenBSD and thus should be secure. diff --git a/yaboot-ppc64.patch b/yaboot-ppc64.patch deleted file mode 100644 index 1ed2d54..0000000 --- a/yaboot-ppc64.patch +++ /dev/null @@ -1,14 +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) - diff --git a/yaboot-sha2.patch b/yaboot-sha2.patch index b70c4ad..a3cb924 100644 --- a/yaboot-sha2.patch +++ b/yaboot-sha2.patch @@ -1,7 +1,7 @@ -diff -urN --exclude '*~' yaboot/doc/yaboot-howto.sgml yaboot-1.3.14/doc/yaboot-howto.sgml ---- yaboot/doc/yaboot-howto.sgml 2008-04-15 15:34:48.000000000 +0200 -+++ yaboot-1.3.14/doc/yaboot-howto.sgml 2010-01-13 17:12:26.046808859 +0100 -@@ -487,17 +487,17 @@ +diff -purN yaboot-1.3.17.orig/doc/yaboot-howto.sgml yaboot-1.3.17/doc/yaboot-howto.sgml +--- yaboot-1.3.17.orig/doc/yaboot-howto.sgml 2011-10-18 15:11:10.000000000 +1100 ++++ yaboot-1.3.17/doc/yaboot-howto.sgml 2011-10-18 16:07:39.409445997 +1100 +@@ -487,17 +487,17 @@ password will be required.

@@ -24,10 +24,10 @@ diff -urN --exclude '*~' yaboot/doc/yaboot-howto.sgml yaboot-1.3.14/doc/yaboot-h -diff -urN --exclude '*~' yaboot/etc/yaboot.conf yaboot-1.3.14/etc/yaboot.conf ---- yaboot/etc/yaboot.conf 2010-01-12 22:39:21.593765245 +0100 -+++ yaboot-1.3.14/etc/yaboot.conf 2010-01-13 17:09:25.957808951 +0100 -@@ -53,6 +53,10 @@ +diff -purN yaboot-1.3.17.orig/etc/yaboot.conf yaboot-1.3.17/etc/yaboot.conf +--- yaboot-1.3.17.orig/etc/yaboot.conf 2011-10-18 16:03:10.731008572 +1100 ++++ yaboot-1.3.17/etc/yaboot.conf 2011-10-18 16:07:39.409445997 +1100 +@@ -53,6 +53,10 @@ bgcolor=black #password=$1$saltstrg$HnJ/gcM3oKhNbnzUPgXTD/ @@ -38,9 +38,9 @@ diff -urN --exclude '*~' yaboot/etc/yaboot.conf yaboot-1.3.14/etc/yaboot.conf ## A password is only required to boot an image specified here if ## parameters are specified on the command line or if the user enters ## an image is not specified in the configuration file at all (ie. -diff -urN --exclude '*~' yaboot/include/string.h yaboot-1.3.14/include/string.h ---- yaboot/include/string.h 2008-04-15 15:34:48.000000000 +0200 -+++ yaboot-1.3.14/include/string.h 2010-01-13 14:18:51.293809297 +0100 +diff -purN yaboot-1.3.17.orig/include/string.h yaboot-1.3.17/include/string.h +--- yaboot-1.3.17.orig/include/string.h 2011-10-18 15:11:10.000000000 +1100 ++++ yaboot-1.3.17/include/string.h 2011-10-18 16:07:39.410445994 +1100 @@ -7,6 +7,7 @@ extern char * ___strtok; extern char * strcpy(char *,const char *); @@ -49,10 +49,10 @@ diff -urN --exclude '*~' yaboot/include/string.h yaboot-1.3.14/include/string.h extern char * strcat(char *, const char *); extern char * strncat(char *, const char *, size_t); extern char * strchr(const char *,int); -diff -urN --exclude '*~' yaboot/include/yaboot.h yaboot-1.3.14/include/yaboot.h ---- yaboot/include/yaboot.h 2008-04-15 15:34:48.000000000 +0200 -+++ yaboot-1.3.14/include/yaboot.h 2010-01-12 22:43:37.092766857 +0100 -@@ -59,4 +59,7 @@ +diff -purN yaboot-1.3.17.orig/include/yaboot.h yaboot-1.3.17/include/yaboot.h +--- yaboot-1.3.17.orig/include/yaboot.h 2011-10-18 15:11:10.000000000 +1100 ++++ yaboot-1.3.17/include/yaboot.h 2011-10-18 16:07:39.410445994 +1100 +@@ -58,4 +58,7 @@ extern char bootdevice[]; extern char *bootpath; extern int bootpartition; @@ -60,9 +60,9 @@ diff -urN --exclude '*~' yaboot/include/yaboot.h yaboot-1.3.14/include/yaboot.h +extern char *sha512_crypt (const char *key, const char *salt); + #endif -diff -urN --exclude '*~' yaboot/lib/stpncpy.c yaboot-1.3.14/lib/stpncpy.c ---- yaboot/lib/stpncpy.c 1970-01-01 01:00:00.000000000 +0100 -+++ yaboot-1.3.14/lib/stpncpy.c 2010-01-13 14:55:22.663809519 +0100 +diff -purN yaboot-1.3.17.orig/lib/stpncpy.c yaboot-1.3.17/lib/stpncpy.c +--- yaboot-1.3.17.orig/lib/stpncpy.c 1970-01-01 10:00:00.000000000 +1000 ++++ yaboot-1.3.17/lib/stpncpy.c 2011-10-18 16:07:39.411445992 +1100 @@ -0,0 +1,21 @@ +#include "string.h" + @@ -85,23 +85,21 @@ diff -urN --exclude '*~' yaboot/lib/stpncpy.c yaboot-1.3.14/lib/stpncpy.c + res = dest; + return res; +} -diff -urN --exclude '*~' yaboot/Makefile yaboot-1.3.14/Makefile ---- yaboot/Makefile 2010-01-12 22:39:21.669786352 +0100 -+++ yaboot-1.3.14/Makefile 2010-01-13 14:20:28.214809232 +0100 -@@ -85,7 +85,8 @@ - OBJS = second/crt0.o second/yaboot.o second/cache.o second/prom.o second/file.o \ +diff -purN yaboot-1.3.17.orig/Makefile yaboot-1.3.17/Makefile +--- yaboot-1.3.17.orig/Makefile 2011-10-18 16:03:10.746008540 +1100 ++++ yaboot-1.3.17/Makefile 2011-10-18 16:08:30.787338414 +1100 +@@ -88,6 +88,7 @@ OBJS = second/crt0.o second/yaboot.o sec second/partition.o second/fs.o second/cfg.o second/setjmp.o second/cmdline.o \ - second/fs_of.o second/fs_ext2.o second/fs_iso.o second/iso_util.o \ -- lib/nosys.o lib/string.o lib/strtol.o lib/vsprintf.o lib/ctype.o lib/malloc.o lib/strstr.o -+ second/sha256crypt.o second/sha512crypt.o \ -+ lib/nosys.o lib/string.o lib/strtol.o lib/vsprintf.o lib/ctype.o lib/malloc.o lib/stpncpy.o lib/strstr.o + second/fs_of.o second/fs_ext2.o second/fs_iso.o second/fs_swap.o \ + second/iso_util.o \ ++ second/sha256crypt.o second/sha512crypt.o lib/stpncpy.o \ + lib/nonstd.o \ + lib/nosys.o lib/string.o lib/strtol.o lib/vsprintf.o lib/ctype.o lib/malloc.o lib/strstr.o - ifeq ($(USE_MD5_PASSWORDS),y) - OBJS += second/md5.o -diff -urN --exclude '*~' yaboot/man/yaboot.conf.5 yaboot-1.3.14/man/yaboot.conf.5 ---- yaboot/man/yaboot.conf.5 2010-01-12 22:39:21.565767002 +0100 -+++ yaboot-1.3.14/man/yaboot.conf.5 2010-01-13 17:10:00.334808308 +0100 -@@ -258,8 +258,9 @@ +diff -purN yaboot-1.3.17.orig/man/yaboot.conf.5 yaboot-1.3.17/man/yaboot.conf.5 +--- yaboot-1.3.17.orig/man/yaboot.conf.5 2011-10-18 16:03:10.725008585 +1100 ++++ yaboot-1.3.17/man/yaboot.conf.5 2011-10-18 16:07:39.412445990 +1100 +@@ -258,8 +258,9 @@ first 2000 bytes of this file will be re .TP .BI "password=" password Protect booting by a password. The password is given in either @@ -113,9 +111,9 @@ diff -urN --exclude '*~' yaboot/man/yaboot.conf.5 yaboot-1.3.14/man/yaboot.conf. configuration file should be only readable by the superuser and the password should differ if possible from other passwords on the system. See -diff -urN --exclude '*~' yaboot/second/sha256crypt.c yaboot-1.3.14/second/sha256crypt.c ---- yaboot/second/sha256crypt.c 1970-01-01 01:00:00.000000000 +0100 -+++ yaboot-1.3.14/second/sha256crypt.c 2010-01-13 16:56:46.453807903 +0100 +diff -purN yaboot-1.3.17.orig/second/sha256crypt.c yaboot-1.3.17/second/sha256crypt.c +--- yaboot-1.3.17.orig/second/sha256crypt.c 1970-01-01 10:00:00.000000000 +1000 ++++ yaboot-1.3.17/second/sha256crypt.c 2011-10-18 16:07:39.413445987 +1100 @@ -0,0 +1,735 @@ +/* SHA256-based Unix crypt implementation. + Released into the Public Domain by Ulrich Drepper . @@ -852,9 +850,9 @@ diff -urN --exclude '*~' yaboot/second/sha256crypt.c yaboot-1.3.14/second/sha256 + return result; +} +#endif -diff -urN --exclude '*~' yaboot/second/sha512crypt.c yaboot-1.3.14/second/sha512crypt.c ---- yaboot/second/sha512crypt.c 1970-01-01 01:00:00.000000000 +0100 -+++ yaboot-1.3.14/second/sha512crypt.c 2010-01-13 16:56:43.390807820 +0100 +diff -purN yaboot-1.3.17.orig/second/sha512crypt.c yaboot-1.3.17/second/sha512crypt.c +--- yaboot-1.3.17.orig/second/sha512crypt.c 1970-01-01 10:00:00.000000000 +1000 ++++ yaboot-1.3.17/second/sha512crypt.c 2011-10-18 16:07:39.415445982 +1100 @@ -0,0 +1,804 @@ +/* SHA512-based Unix crypt implementation. + Released into the Public Domain by Ulrich Drepper . @@ -1660,12 +1658,12 @@ diff -urN --exclude '*~' yaboot/second/sha512crypt.c yaboot-1.3.14/second/sha512 + return result; +} +#endif -diff -urN --exclude '*~' yaboot/second/yaboot.c yaboot-1.3.14/second/yaboot.c ---- yaboot/second/yaboot.c 2010-01-12 22:39:21.670784810 +0100 -+++ yaboot-1.3.14/second/yaboot.c 2010-01-13 17:07:06.972808719 +0100 -@@ -634,13 +634,17 @@ +diff -purN yaboot-1.3.17.orig/second/yaboot.c yaboot-1.3.17/second/yaboot.c +--- yaboot-1.3.17.orig/second/yaboot.c 2011-10-18 15:11:10.000000000 +1100 ++++ yaboot-1.3.17/second/yaboot.c 2011-10-18 16:07:39.417445978 +1100 +@@ -608,13 +608,17 @@ void check_password(char *str) if (!strncmp (password, "$1$", 3)) { - if (!check_md5_password(passwdbuff, password)) + if (!check_md5_password((unsigned char*)passwdbuff, (unsigned char*)password)) return; + } else +#endif /* USE_MD5_PASSWORDS */ diff --git a/yaboot.spec b/yaboot.spec index d9315c2..c31e3c9 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot -Version: 1.3.16 -Release: 7%{?dist} +Version: 1.3.17 +Release: 1%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -19,49 +19,11 @@ 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 - -# Truncate memcpy() in extract_vendor_options() -# https://bugzilla.redhat.com/show_bug.cgi?id=729684 -Patch46: yaboot-1.3.14-dhcp_truncate.patch -Patch47: yaboot-1.3.16-no-strict-aliasing.patch -Patch48: yaboot-1.3.16-powervm.patch - -# Yaboot discards parameters after CAS reboot -Patch49: yaboot-1.3.16-args-cas.patch - URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root Obsoletes: ybin @@ -87,36 +49,21 @@ 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 -%patch46 -p1 -b .dhcppad -%patch47 -p1 -b .aliasing -%patch48 -p1 -b .powervm -%patch49 -p1 -b .args-cas +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch17 -p1 +%patch18 -p1 +%patch21 -p1 +%patch22 -p1 +%patch28 -p1 +%patch40 -p1 %build make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1 @@ -157,6 +104,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Mon Oct 18 2011 Tony Breeds - 1.3.17-1 +- Update to upstream 1.3.18 release + * Mon Oct 17 2011 Jiri Skala - 1.3.16-7 - fixes #746408 - yaboot discards parameters after CAS reboot From 6c095a99ca8c7f787e507bdcb641065ee67f34f3 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Tue, 18 Oct 2011 17:22:02 +1100 Subject: [PATCH 47/55] 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 --- yaboot-1.3.17-no-werror.patch | 10 ++++++++++ yaboot.spec | 5 +++++ 2 files changed, 15 insertions(+) create mode 100644 yaboot-1.3.17-no-werror.patch diff --git a/yaboot-1.3.17-no-werror.patch b/yaboot-1.3.17-no-werror.patch new file mode 100644 index 0000000..5bd02f8 --- /dev/null +++ b/yaboot-1.3.17-no-werror.patch @@ -0,0 +1,10 @@ +--- yaboot-1.3.17/Makefile.orig 2011-10-18 17:08:21.488819995 +1100 ++++ yaboot-1.3.17/Makefile 2011-10-18 17:08:30.038802076 +1100 +@@ -40,7 +40,6 @@ + YBCFLAGS += -DTEXTADDR=$(TEXTADDR) -DDEBUG=$(DEBUG) + YBCFLAGS += -DMALLOCADDR=$(MALLOCADDR) -DMALLOCSIZE=$(MALLOCSIZE) + YBCFLAGS += -DKERNELADDR=$(KERNELADDR) +-YBCFLAGS += -Werror -fdiagnostics-show-option + YBCFLAGS += -I ./include + YBCFLAGS += -fno-strict-aliasing + diff --git a/yaboot.spec b/yaboot.spec index c31e3c9..cf35e42 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -24,6 +24,10 @@ Patch28: yaboot-1.3.13-dontwritehome.patch # Don't use insecure MD5, use SHA-2 Patch40: yaboot-sha2.patch +# Do not use Werror, the compiler in F16/Rawhide is hitting warnings that +# Upstream doesn't see. Bypass them for now. +Patch41: yaboot-1.3.17-no-werror.patch + URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root Obsoletes: ybin @@ -64,6 +68,7 @@ yaboot can also bootload IBM pSeries machines. %patch22 -p1 %patch28 -p1 %patch40 -p1 +%patch41 -p1 %build make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1 From 15ed53c8e0c93ff3893a314797c3141c38e284e4 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Wed, 19 Oct 2011 13:51:41 +1100 Subject: [PATCH 48/55] Fix fs_swap to not break DVD boots. Signed-off-by: Tony Breeds --- yaboot-1.3.17-fs_swap.patch | 41 +++++++++++++++++++++++++++++++++++++ yaboot.spec | 9 +++++++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 yaboot-1.3.17-fs_swap.patch diff --git a/yaboot-1.3.17-fs_swap.patch b/yaboot-1.3.17-fs_swap.patch new file mode 100644 index 0000000..a754ea5 --- /dev/null +++ b/yaboot-1.3.17-fs_swap.patch @@ -0,0 +1,41 @@ +From f6058147054159eba994eb9589e2ebabe4a05570 Mon Sep 17 00:00:00 2001 +From: Tony Breeds +Date: Wed, 19 Oct 2011 13:36:49 +1100 +Subject: [PATCH] fs_swap: Reduce severity of not finding a partition table on + boot device. + +When booted from a cdrom the fs_swap would exit with FILE_ERR_BADDEV, +this causes fs_open to abort too early. + +We don't need to check file->device_kind != FILE_DEVICE_BLOCK as we're +only called when that is true. + +Demote the return value to FILE_ERR_BAD_FSYS which allows fs_open to +look for other filesystems on the device. + +Signed-off-by: Tony Breeds +--- + second/fs_swap.c | 7 ++++--- + 1 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/second/fs_swap.c b/second/fs_swap.c +index 87da877..1efb96e 100644 +--- a/second/fs_swap.c ++++ b/second/fs_swap.c +@@ -59,9 +59,10 @@ swap_open(struct boot_file_t* file, struct partition_t* part, + DEBUG_ENTER; + DEBUG_OPEN; + +- if (file->device_kind != FILE_DEVICE_BLOCK || part == NULL) { +- DEBUG_LEAVE(FILE_ERR_BADDEV); +- return FILE_ERR_BADDEV; ++ if (part == NULL) { ++ DEBUG_F("No partions on %s, not checking for swap\n", device_name); ++ DEBUG_LEAVE(FILE_ERR_BAD_FSYS); ++ return FILE_ERR_BAD_FSYS; + } + + /* We assume that device is "short" and is correctly NULL terminsated */ +-- +1.7.6.4 + diff --git a/yaboot.spec b/yaboot.spec index cf35e42..e8d4935 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.17 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -27,6 +27,9 @@ Patch40: yaboot-sha2.patch # Do not use Werror, the compiler in F16/Rawhide is hitting warnings that # Upstream doesn't see. Bypass them for now. Patch41: yaboot-1.3.17-no-werror.patch +# When booted from a cdrom the fs_swap would exit with FILE_ERR_BADDEV, +# this causes fs_open to abort too early and breaks booting from DVD +Patch42: yaboot-1.3.17-fs_swap.patch URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root @@ -69,6 +72,7 @@ yaboot can also bootload IBM pSeries machines. %patch28 -p1 %patch40 -p1 %patch41 -p1 +%patch42 -p1 %build make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1 @@ -109,6 +113,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Mon Oct 19 2011 Tony Breeds - 1.3.17-2 +- Fix fs_swap to not break boot CDs + * Mon Oct 18 2011 Tony Breeds - 1.3.17-1 - Update to upstream 1.3.18 release From adb2d133d491dc10a49ce1f382d79a1f6e09a940 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Sat, 14 Jan 2012 03:23:07 -0600 Subject: [PATCH 49/55] - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild --- yaboot.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yaboot.spec b/yaboot.spec index e8d4935..3dd5b74 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.17 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -113,6 +113,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Sat Jan 14 2012 Fedora Release Engineering - 1.3.17-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + * Mon Oct 19 2011 Tony Breeds - 1.3.17-2 - Fix fs_swap to not break boot CDs From 52acfa14b2a31265a0f1294278d7804ecd306943 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Sun, 22 Jul 2012 02:30:12 -0500 Subject: [PATCH 50/55] - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild --- yaboot.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yaboot.spec b/yaboot.spec index 3dd5b74..75e38f4 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.17 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -113,6 +113,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Sun Jul 22 2012 Fedora Release Engineering - 1.3.17-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + * Sat Jan 14 2012 Fedora Release Engineering - 1.3.17-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild From b275d8e0b7ff27d53364001c36f63b3f0d870b91 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Wed, 5 Sep 2012 11:10:08 +1000 Subject: [PATCH 51/55] 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 --- yaboot-1.3.17-link_with_new_e2fsprogs.patch | 380 ++++++++++++++++++++ yaboot.spec | 7 +- 2 files changed, 386 insertions(+), 1 deletion(-) create mode 100644 yaboot-1.3.17-link_with_new_e2fsprogs.patch diff --git a/yaboot-1.3.17-link_with_new_e2fsprogs.patch b/yaboot-1.3.17-link_with_new_e2fsprogs.patch new file mode 100644 index 0000000..855806e --- /dev/null +++ b/yaboot-1.3.17-link_with_new_e2fsprogs.patch @@ -0,0 +1,380 @@ +From cf53e4804fb8862bf6ac6564ba5fa458bf3c0600 Mon Sep 17 00:00:00 2001 +From: Tony Breeds +Date: Tue, 12 Jun 2012 15:19:02 +1000 +Subject: [PATCH] Add more libc helper functions for e2fsprogs. + +I've added debug() statements for all of the stub functions. So if +things get "strange" we at least know we've been playing around in this +backwater. + +Portions of this patch are based on the work by Joseph Jezak +specifically the *_chk() functions. + +Signed-off-by: Tony Breeds +--- + include/nonstd.h | 48 +++++++++++- + lib/malloc.c | 7 ++ + lib/nonstd.c | 235 ++++++++++++++++++++++++++++++++++++++++++++++++++++- + 3 files changed, 284 insertions(+), 6 deletions(-) + +diff --git a/include/nonstd.h b/include/nonstd.h +index bad5f48..a967380 100644 +--- a/include/nonstd.h ++++ b/include/nonstd.h +@@ -22,14 +22,60 @@ + #ifndef NONSTD_H + #define NONSTD_H + ++/* Copied from asm-generic/errno-base.h */ ++#define EPERM 1 /* Operation not permitted */ ++#define EBADF 9 /* Bad file number */ ++#define EACCES 13 /* Permission denied */ ++ + typedef int FILE; + ++typedef unsigned int uid_t; ++typedef int pid_t; ++typedef unsigned int mode_t; ++typedef int ssize_t; ++typedef long long off64_t; ++typedef long off_t; ++ ++struct stat; ++struct timezone; ++struct timeval; ++ + extern FILE *stdout; ++extern FILE *stderr; + + int printf(const char *format, ...); + int fprintf(FILE *stream, const char *format, ...); + int fputs(const char *s, FILE *stream); + int fflush(FILE *stream); + char *getenv(const char *name); +- ++int gethostname(char *name, size_t len); ++int gettimeofday(struct timeval *tv, struct timezone *tz); ++int * __errno_location(void); ++unsigned int sleep(unsigned int seconds); ++int rand(void); ++void srand(unsigned int seed); ++long int random(void); ++void srandom(unsigned int seed); ++uid_t geteuid(void); ++uid_t getuid(void); ++pid_t getpid(void); ++int stat(const char *path, struct stat *buf); ++int stat64(const char *path, struct stat *buf); ++int fstat(int fd, struct stat *buf); ++int fstat64(int fd, struct stat *buf); ++int open(const char *pathname, int flags, mode_t mode); ++int open64(const char *pathname, int flags, mode_t mode); ++off_t lseek(int fd, off_t offset, int whence); ++off64_t lseek64(int fd, off64_t offset, int whence); ++ssize_t read(int fildes, void *buf, size_t nbyte); ++int close(int fd); ++void *calloc(size_t nmemb, size_t size); ++void perror(const char *s); ++void exit(int status); ++int ioctl(int d, int request, ...); ++size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); ++long sysconf(int name); ++int getpagesize(void); ++void qsort(void *base, size_t nmemb, size_t size, ++ int(*compar)(const void *, const void *)); + #endif +diff --git a/lib/malloc.c b/lib/malloc.c +index 0121112..b21490c 100644 +--- a/lib/malloc.c ++++ b/lib/malloc.c +@@ -107,6 +107,13 @@ int posix_memalign(void **memptr, size_t alignment, size_t size) + return 0; + } + ++void *calloc(size_t nmemb, size_t size) ++{ ++ unsigned char *p = malloc(nmemb * size); ++ memset(p, 0x0, nmemb * size); ++ return p; ++} ++ + void *realloc(void *ptr, unsigned int size) + { + char *caddr, *oaddr = ptr; +diff --git a/lib/nonstd.c b/lib/nonstd.c +index 5aeb0cb..6549283 100644 +--- a/lib/nonstd.c ++++ b/lib/nonstd.c +@@ -23,11 +23,142 @@ + #include "types.h" + #include "stddef.h" + #include "stdlib.h" ++#include "string.h" + #include "ctype.h" + #include "prom.h" + #include "nonstd.h" ++#include "debug.h" + +-FILE *stdout; ++#define __unused __attribute__((unused)) ++ ++static FILE _stdout; ++static FILE _stderr; ++FILE *stdout = &_stdout; ++FILE *stderr = &_stderr; ++ ++static int fake_errno; ++ ++int * __errno_location(void) ++{ ++ DEBUG_F("Stub function called"); ++ return &fake_errno; ++} ++ ++uid_t geteuid(void) ++{ ++ DEBUG_F("Stub function called"); ++ return 0; ++} ++ ++uid_t getuid(void) ++{ ++ DEBUG_F("Stub function called"); ++ return 0; ++} ++ ++pid_t getpid(void) ++{ ++ DEBUG_F("Stub function called"); ++ return 1; ++} ++ ++/* selected by roll of a six sided dice ... that's random right? */ ++int rand(void) ++{ ++ DEBUG_F("Stub function called"); ++ return 4; ++} ++ ++void srand(unsigned int seed __unused) ++{ ++ DEBUG_F("Stub function called"); ++} ++ ++long int random(void) ++{ ++ DEBUG_F("Stub function called"); ++ return 4; ++} ++ ++void srandom(unsigned int seed __unused) ++{ ++ DEBUG_F("Stub function called"); ++} ++ ++unsigned int sleep(unsigned int seconds) ++{ ++ prom_sleep(seconds); ++ return 0; ++} ++ ++int stat(const char *path __unused, struct stat *buf __unused) ++{ ++ DEBUG_F("Stub function called"); ++ return EACCES; ++} ++ ++int stat64(const char *path __unused, struct stat *buf __unused) ++{ ++ DEBUG_F("Stub function called"); ++ return EACCES; ++} ++ ++int fstat(int fd __unused, struct stat *buf __unused) ++{ ++ DEBUG_F("Stub function called"); ++ return EBADF; ++} ++ ++int fstat64(int fd __unused, struct stat *buf __unused) ++{ ++ DEBUG_F("Stub function called"); ++ return EBADF; ++} ++ ++int open(const char *pathname, int flags __unused, mode_t mode __unused) ++{ ++ return (int) prom_open((char *)pathname); ++} ++ ++int open64(const char *pathname, int flags __unused, mode_t mode __unused) ++{ ++ return (int) prom_open((char *)pathname); ++} ++ ++off_t lseek(int fd __unused, off_t offset __unused, int whence __unused) ++{ ++ DEBUG_F("Stub function called"); ++ return EBADF; ++} ++ ++off64_t lseek64(int fd __unused, off64_t offset __unused, int whence __unused) ++{ ++ DEBUG_F("Stub function called"); ++ return EBADF; ++} ++ ++ssize_t read(int filedes, void *buf, size_t nbyte) ++{ ++ return prom_read((void *)filedes, buf, nbyte); ++} ++ ++int close(int fd __unused) ++{ ++ prom_close((void *)fd); ++ return 0; ++} ++ ++int gethostname(char *name __unused, size_t len __unused) ++{ ++ DEBUG_F("Stub function called"); ++ return EPERM; ++} ++ ++int gettimeofday(struct timeval *tv __unused, struct timezone *tz __unused) ++{ ++ DEBUG_F("Stub function called"); ++ return EPERM; ++} + + int printf(const char *format, ...) + { +@@ -39,7 +170,7 @@ int printf(const char *format, ...) + return 0; + } + +-int fprintf(FILE *stream, const char *format, ...) ++int fprintf(FILE *stream __unused, const char *format, ...) + { + va_list ap; + va_start (ap, format); +@@ -49,19 +180,113 @@ int fprintf(FILE *stream, const char *format, ...) + return 0; + } + +-int fputs(const char *s, FILE *stream) ++int fputs(const char *s, FILE *stream __unused) + { + prom_printf("%s", s); + + return 0; + } + +-int fflush(FILE *stream) ++int fflush(FILE *stream __unused) + { ++ DEBUG_F("Stub function called"); + return 0; + } + +-char *getenv(const char *name) ++char *getenv(const char *name __unused) + { ++ DEBUG_F("Stub function called"); + return NULL; + } ++ ++int __printf_chk(int flag __unused, const char *format, ...) ++{ ++ va_list ap; ++ va_start (ap, format); ++ prom_vfprintf (prom_stdout, format, ap); ++ va_end (ap); ++ ++ DEBUG_F("Stub function called"); ++ return 0; ++} ++ ++int __sprintf_chk(char *str __unused, int flag __unused, ++ size_t strlen __unused, const char * format __unused, ...) ++{ ++ DEBUG_F("Stub function called"); ++ return 0; ++ ++} ++ ++int __fprintf_chk(FILE *stream __unused, int flag __unused, ++ const char *format, ...) ++{ ++ va_list ap; ++ va_start (ap, format); ++ prom_vfprintf (prom_stdout, format, ap); ++ va_end (ap); ++ ++ return 0; ++} ++ ++void *__memcpy_chk(void *dest, const void *src, size_t n, ++ size_t destlen __unused) ++{ ++ DEBUG_F("Stub function called"); ++ /* FIXME: We really could check that dest+destlen < src, to ensure ++ * we're not overwriting the src */ ++ return memcpy(dest, src, n); ++} ++ ++void perror(const char *s) ++{ ++ DEBUG_F("Stub function called"); ++ prom_printf(s); ++} ++ ++void exit(int status __unused) ++{ ++ prom_exit(); ++ for(;;); ++} ++ ++int ioctl(int d __unused, int request __unused, ...) ++{ ++ DEBUG_F("Stub function called"); ++ return 0; ++} ++ ++/* As we do not implement fopen() I think we're only going to get called ++ * with stdout and stderr. If that's the case we degenerate to prom_write() ++ * on stdout */ ++size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) ++{ ++ if ((stream == stdout) || (stream == stderr)) { ++ DEBUG_F("Stub function called on known stream"); ++ prom_write(prom_stdout, (void *)ptr, size * nmemb); ++ } else { ++ DEBUG_F("Stub function called on unknown stream"); ++ } ++ return nmemb; ++} ++ ++long sysconf(int name __unused) ++{ ++ DEBUG_F("Stub function called"); ++ return -1; ++} ++ ++int getpagesize(void) ++{ ++ DEBUG_F("Stub function called"); ++ /* I think this is safe to assume */ ++ return 4096; ++} ++ ++void qsort(void *base __unused, size_t nmemb __unused, size_t size __unused, ++ int(*compar)(const void *, const void *)) ++{ ++ DEBUG_F("Stub function called"); ++ /* I'm quite nervous about not implementing this. Could we end up with ++ * disk corruption. Couldn't we? */ ++} +-- +1.7.7.6 + diff --git a/yaboot.spec b/yaboot.spec index 3dd5b74..01189b8 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.17 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -30,6 +30,7 @@ Patch41: yaboot-1.3.17-no-werror.patch # When booted from a cdrom the fs_swap would exit with FILE_ERR_BADDEV, # this causes fs_open to abort too early and breaks booting from DVD Patch42: yaboot-1.3.17-fs_swap.patch +Patch43: yaboot-1.3.17-link_with_new_e2fsprogs.patch URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root @@ -73,6 +74,7 @@ yaboot can also bootload IBM pSeries machines. %patch40 -p1 %patch41 -p1 %patch42 -p1 +%patch43 -p1 %build make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1 @@ -113,6 +115,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Wed Sep 05 2012 Tony Breeds - 1.3.17-4 +- Add patch from upstream to link with newer e2fsprogs + * Sat Jan 14 2012 Fedora Release Engineering - 1.3.17-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild From d96847345fc3606d25e821beeae5468b0f0371f8 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Wed, 5 Sep 2012 15:10:59 +1000 Subject: [PATCH 52/55] 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 --- yaboot-1.3.17-link_with_new_e2fsprogs2.patch | 145 +++++++++++++++++++ yaboot.spec | 7 +- 2 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 yaboot-1.3.17-link_with_new_e2fsprogs2.patch diff --git a/yaboot-1.3.17-link_with_new_e2fsprogs2.patch b/yaboot-1.3.17-link_with_new_e2fsprogs2.patch new file mode 100644 index 0000000..40310d6 --- /dev/null +++ b/yaboot-1.3.17-link_with_new_e2fsprogs2.patch @@ -0,0 +1,145 @@ +diff --git a/include/nonstd.h b/include/nonstd.h +index a967380..a23f98e 100644 +--- a/include/nonstd.h ++++ b/include/nonstd.h +@@ -26,6 +26,7 @@ + #define EPERM 1 /* Operation not permitted */ + #define EBADF 9 /* Bad file number */ + #define EACCES 13 /* Permission denied */ ++#define EFAULT 14 /* Bad address */ + + typedef int FILE; + +@@ -37,8 +38,11 @@ typedef long long off64_t; + typedef long off_t; + + struct stat; ++struct stat64; + struct timezone; + struct timeval; ++struct rlimit; ++struct utsname; + + extern FILE *stdout; + extern FILE *stderr; +@@ -78,4 +82,14 @@ long sysconf(int name); + int getpagesize(void); + void qsort(void *base, size_t nmemb, size_t size, + int(*compar)(const void *, const void *)); ++ssize_t write(int fd, const void *buf, size_t count); ++int fallocate(int fd, int mode, off_t offset, off_t len); ++unsigned long long int strtoull(const char *nptr, char **endptr, int base); ++int fsync(int fd); ++int __open64_2(const char *pathname, int flags); ++int __xstat64(int vers, const char *name, struct stat64 *buf); ++int uname(struct utsname *buf); ++int getrlimit(int resource, struct rlimit *rlim); ++int setrlimit(int resource, const struct rlimit *rlim); ++int __fxstat64(int vers, int fd, struct stat64 *buf); + #endif +diff --git a/include/stdlib.h b/include/stdlib.h +index 0b5e99a..921fc9b 100644 +--- a/include/stdlib.h ++++ b/include/stdlib.h +@@ -19,6 +19,7 @@ extern void release (void *ptr); + extern int sprintf(char * buf, const char *fmt, ...); + extern int vsprintf(char *buf, const char *fmt, va_list args); + extern long simple_strtol(const char *cp,char **endp,unsigned int base); ++extern unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base); + #define strtol(x,y,z) simple_strtol(x,y,z) + + #endif +diff --git a/lib/nonstd.c b/lib/nonstd.c +index 6549283..129d674 100644 +--- a/lib/nonstd.c ++++ b/lib/nonstd.c +@@ -115,6 +115,19 @@ int fstat64(int fd __unused, struct stat *buf __unused) + return EBADF; + } + ++int __xstat64(int vers __unused, const char *name __unused, ++ struct stat64 *buf __unused) ++{ ++ DEBUG_F("Stub function called"); ++ return EBADF; ++} ++ ++int __fxstat64(int vers __unused, int fd __unused, struct stat64 *buf __unused) ++{ ++ DEBUG_F("Stub function called"); ++ return EBADF; ++} ++ + int open(const char *pathname, int flags __unused, mode_t mode __unused) + { + return (int) prom_open((char *)pathname); +@@ -125,6 +138,11 @@ int open64(const char *pathname, int flags __unused, mode_t mode __unused) + return (int) prom_open((char *)pathname); + } + ++int __open64_2(const char *pathname, int flags __unused) ++{ ++ return (int) prom_open((char *)pathname); ++} ++ + off_t lseek(int fd __unused, off_t offset __unused, int whence __unused) + { + DEBUG_F("Stub function called"); +@@ -290,3 +308,57 @@ void qsort(void *base __unused, size_t nmemb __unused, size_t size __unused, + /* I'm quite nervous about not implementing this. Could we end up with + * disk corruption. Couldn't we? */ + } ++ ++/* FIXME: I'd like to call prom_write here, but we can't ber certain that ++ * we'll have "text" so just move along nothing to see here ++ */ ++ssize_t write(int fd, const void *buf, size_t count) ++{ ++ DEBUG_F("Stub function called"); ++ return 0; ++} ++ ++int fallocate(int fd __unused, int mode __unused, off_t offset __unused, ++ off_t len __unused) ++{ ++ DEBUG_F("Stub function called"); ++ return 0; ++} ++ ++unsigned long long int strtoull(const char *nptr, char **endptr, int base) ++{ ++ return simple_strtoull(nptr, endptr, base); ++} ++ ++int fsync(int fd __unused) ++{ ++ DEBUG_F("Stub function called"); ++ return 0; ++} ++ ++/* Return EFAULT here as it's too hard in yaboot to know the size of struct ++ * utsname. If we don't touch it and return 0 bad things might happen. ++ * Lets hope the caller handles failure ++ */ ++int uname(struct utsname *buf __unused) ++{ ++ DEBUG_F("Stub function called"); ++ return EFAULT; ++} ++ ++int getrlimit(int resource __unused, struct rlimit *rlim __unused) ++{ ++ DEBUG_F("Stub function called"); ++ return 0; ++} ++ ++int setrlimit(int resource __unused, const struct rlimit *rlim __unused) ++{ ++ DEBUG_F("Stub function called"); ++ return 0; ++} ++ ++void __stack_chk_fail(void) ++{ ++ DEBUG_F("Stub function called"); ++} diff --git a/yaboot.spec b/yaboot.spec index 6678071..fc6bb53 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.17 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -31,6 +31,7 @@ Patch41: yaboot-1.3.17-no-werror.patch # this causes fs_open to abort too early and breaks booting from DVD Patch42: yaboot-1.3.17-fs_swap.patch Patch43: yaboot-1.3.17-link_with_new_e2fsprogs.patch +Patch44: yaboot-1.3.17-link_with_new_e2fsprogs2.patch URL: http://yaboot.ozlabs.org/ BuildRoot: %{_tmppath}/%{name}-root @@ -75,6 +76,7 @@ yaboot can also bootload IBM pSeries machines. %patch41 -p1 %patch42 -p1 %patch43 -p1 +%patch44 -p1 %build make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1 @@ -115,6 +117,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Wed Sep 05 2012 Tony Breeds - 1.3.17-6 +- Add patch to link against *even newer* e2fsprogs. + * Wed Sep 05 2012 Tony Breeds - 1.3.17-5 - Add patch from upstream to link with newer e2fsprogs From 1038948f76c88a2711dca6a73203d742bd89a4d7 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Thu, 14 Feb 2013 22:08:02 -0600 Subject: [PATCH 53/55] - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild --- yaboot.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yaboot.spec b/yaboot.spec index fc6bb53..089aee1 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.17 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -117,6 +117,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Fri Feb 15 2013 Fedora Release Engineering - 1.3.17-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + * Wed Sep 05 2012 Tony Breeds - 1.3.17-6 - Add patch to link against *even newer* e2fsprogs. From 54ff840af092f3cbb4096d9371c34aa0cbda0b7f Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Sun, 4 Aug 2013 04:25:45 -0500 Subject: [PATCH 54/55] - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild --- yaboot.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yaboot.spec b/yaboot.spec index 089aee1..f68ad62 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ Summary: Linux bootloader for Power Macintosh "New World" computers. Name: yaboot Version: 1.3.17 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -117,6 +117,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Sun Aug 04 2013 Fedora Release Engineering - 1.3.17-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + * Fri Feb 15 2013 Fedora Release Engineering - 1.3.17-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild From 12fa183e80a7ae2c172383066b87de50cc27acb4 Mon Sep 17 00:00:00 2001 From: Till Maas Date: Mon, 2 Jun 2014 20:55:10 +0200 Subject: [PATCH 55/55] 2014-06-02: ppc32 package, ppc32 support is dropped in Fedora 21 --- .gitignore | 2 - dead.package | 1 + efika.forth | 336 ---- mirrors | 3 - sources | 1 - upstream | 1 - upstream-key.gpg | 37 - yaboot-1.3.10-configfile.patch | 27 - yaboot-1.3.10-ext3.patch | 11 - yaboot-1.3.10-parted.patch | 29 - yaboot-1.3.10-proddiscover.patch | 59 - yaboot-1.3.10-sbindir.patch | 51 - yaboot-1.3.13-allow-deep-mntpoint.patch | 32 - yaboot-1.3.13-dontwritehome.patch | 13 - yaboot-1.3.13-pegasos-claim.patch | 14 - yaboot-1.3.13-pegasos-ext2.patch | 82 - yaboot-1.3.13-pegasos-serial.patch | 14 - yaboot-1.3.13-yabootconfig.patch | 249 --- yaboot-1.3.17-fs_swap.patch | 41 - yaboot-1.3.17-link_with_new_e2fsprogs.patch | 380 ---- yaboot-1.3.17-link_with_new_e2fsprogs2.patch | 145 -- yaboot-1.3.17-no-werror.patch | 10 - yaboot-1.3.3-man.patch | 132 -- yaboot-1.3.6-ofboot.patch | 29 - yaboot-1.3.6-rh.patch | 94 - yaboot-sha2.patch | 1685 ------------------ yaboot.spec | 472 ----- 27 files changed, 1 insertion(+), 3949 deletions(-) delete mode 100644 .gitignore create mode 100644 dead.package delete mode 100644 efika.forth delete mode 100644 mirrors delete mode 100644 sources delete mode 100644 upstream delete mode 100644 upstream-key.gpg delete mode 100644 yaboot-1.3.10-configfile.patch delete mode 100644 yaboot-1.3.10-ext3.patch delete mode 100644 yaboot-1.3.10-parted.patch delete mode 100644 yaboot-1.3.10-proddiscover.patch delete mode 100644 yaboot-1.3.10-sbindir.patch delete mode 100644 yaboot-1.3.13-allow-deep-mntpoint.patch delete mode 100644 yaboot-1.3.13-dontwritehome.patch delete mode 100644 yaboot-1.3.13-pegasos-claim.patch delete mode 100644 yaboot-1.3.13-pegasos-ext2.patch delete mode 100644 yaboot-1.3.13-pegasos-serial.patch delete mode 100644 yaboot-1.3.13-yabootconfig.patch delete mode 100644 yaboot-1.3.17-fs_swap.patch delete mode 100644 yaboot-1.3.17-link_with_new_e2fsprogs.patch delete mode 100644 yaboot-1.3.17-link_with_new_e2fsprogs2.patch delete mode 100644 yaboot-1.3.17-no-werror.patch delete mode 100644 yaboot-1.3.3-man.patch delete mode 100644 yaboot-1.3.6-ofboot.patch delete mode 100644 yaboot-1.3.6-rh.patch delete mode 100644 yaboot-sha2.patch delete mode 100644 yaboot.spec diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 455757c..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/yaboot-1.3.17.tar.gz -yaboot-1.3.17 diff --git a/dead.package b/dead.package new file mode 100644 index 0000000..6cd6f16 --- /dev/null +++ b/dead.package @@ -0,0 +1 @@ +2014-06-02: ppc32 package, ppc32 support is dropped in Fedora 21 diff --git a/efika.forth b/efika.forth deleted file mode 100644 index 786212e..0000000 --- a/efika.forth +++ /dev/null @@ -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 diff --git a/mirrors b/mirrors deleted file mode 100644 index 695ca10..0000000 --- a/mirrors +++ /dev/null @@ -1,3 +0,0 @@ -http://penguinppc.org/projects/yaboot/ -http://penguinppc.org/~eb/yaboot-archived/ -http://penguinppc.org/~eb/yaboot-archived/yaboot.old/ diff --git a/sources b/sources deleted file mode 100644 index 1eeefcf..0000000 --- a/sources +++ /dev/null @@ -1 +0,0 @@ -f599f52d1887a86fd798252d2946f635 yaboot-1.3.17.tar.gz diff --git a/upstream b/upstream deleted file mode 100644 index b15d255..0000000 --- a/upstream +++ /dev/null @@ -1 +0,0 @@ -yaboot-1.3.12.tar.gz diff --git a/upstream-key.gpg b/upstream-key.gpg deleted file mode 100644 index 41b2723..0000000 --- a/upstream-key.gpg +++ /dev/null @@ -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----- diff --git a/yaboot-1.3.10-configfile.patch b/yaboot-1.3.10-configfile.patch deleted file mode 100644 index 2b3b0b1..0000000 --- a/yaboot-1.3.10-configfile.patch +++ /dev/null @@ -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 diff --git a/yaboot-1.3.10-ext3.patch b/yaboot-1.3.10-ext3.patch deleted file mode 100644 index af6fc15..0000000 --- a/yaboot-1.3.10-ext3.patch +++ /dev/null @@ -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) diff --git a/yaboot-1.3.10-parted.patch b/yaboot-1.3.10-parted.patch deleted file mode 100644 index 815f93b..0000000 --- a/yaboot-1.3.10-parted.patch +++ /dev/null @@ -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 '\'` ; 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..." diff --git a/yaboot-1.3.10-proddiscover.patch b/yaboot-1.3.10-proddiscover.patch deleted file mode 100644 index a28e57e..0000000 --- a/yaboot-1.3.10-proddiscover.patch +++ /dev/null @@ -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 - - --Red Hat Linux First Stage Bootstrap -+$PRODUCT First Stage Bootstrap - - - : .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 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 for boot options.\\n\\n\"" - - ## generate global section of yaboot.conf - GLOBAL="boot=${BOOT}${DEVICE:-} diff --git a/yaboot-1.3.10-sbindir.patch b/yaboot-1.3.10-sbindir.patch deleted file mode 100644 index f16b276..0000000 --- a/yaboot-1.3.10-sbindir.patch +++ /dev/null @@ -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 diff --git a/yaboot-1.3.13-allow-deep-mntpoint.patch b/yaboot-1.3.13-allow-deep-mntpoint.patch deleted file mode 100644 index 3080662..0000000 --- a/yaboot-1.3.13-allow-deep-mntpoint.patch +++ /dev/null @@ -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 - diff --git a/yaboot-1.3.13-dontwritehome.patch b/yaboot-1.3.13-dontwritehome.patch deleted file mode 100644 index 5005418..0000000 --- a/yaboot-1.3.13-dontwritehome.patch +++ /dev/null @@ -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 diff --git a/yaboot-1.3.13-pegasos-claim.patch b/yaboot-1.3.13-pegasos-claim.patch deleted file mode 100644 index 5b5b2a4..0000000 --- a/yaboot-1.3.13-pegasos-claim.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- yaboot-1.3.17/second/prom.c.orig 2011-10-18 12:41:46.924310275 +1100 -+++ yaboot-1.3.17/second/prom.c 2011-10-18 12:43:17.202121228 +1100 -@@ -622,6 +622,11 @@ - void *ret; - - ret = call_prom ("claim", 3, 1, virt, size, align); -+ -+ /* Pegasos II SmartFirmware returns zero for failure, usefully */ -+ if (virt && !ret) -+ ret = (void *)-1; -+ - if (ret == (void *)-1) - prom_printf("ERROR: claim of 0x%x at 0x%x failed\n", size, (int)virt); - else diff --git a/yaboot-1.3.13-pegasos-ext2.patch b/yaboot-1.3.13-pegasos-ext2.patch deleted file mode 100644 index 8408881..0000000 --- a/yaboot-1.3.13-pegasos-ext2.patch +++ /dev/null @@ -1,82 +0,0 @@ ---- yaboot-1.3.17/ybin/ybin.orig 2011-10-18 12:33:25.000000000 +1100 -+++ yaboot-1.3.17/ybin/ybin 2011-10-18 12:46:28.621720442 +1100 -@@ -77,6 +77,8 @@ - fstype=raw - elif (cat /proc/cpuinfo 2> /dev/null | grep ^platform | grep -q 'PowerNV') ; then - fstype=raw -+elif (cat /proc/cpuinfo 2> /dev/null | grep ^machine | grep -q 'Pegasos') ; then -+ fstype=ext2 - else - fstype=hfs - fi -@@ -281,13 +283,13 @@ - 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 - ;; -@@ -950,12 +952,16 @@ - ## 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 -@@ -974,7 +980,7 @@ - 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 -@@ -1261,6 +1267,25 @@ - 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 - } - diff --git a/yaboot-1.3.13-pegasos-serial.patch b/yaboot-1.3.13-pegasos-serial.patch deleted file mode 100644 index fe6f358..0000000 --- a/yaboot-1.3.13-pegasos-serial.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- yaboot-1.3.17/second/prom.c.orig 2011-10-18 12:48:11.388505271 +1100 -+++ yaboot-1.3.17/second/prom.c 2011-10-18 12:49:36.553326950 +1100 -@@ -395,10 +395,8 @@ - char c; - int a; - -- while ((a = (int)call_prom ("read", 3, 1, prom_stdin, &c, 1)) == 0) -+ while ((a = (int)call_prom ("read", 3, 1, prom_stdin, &c, 1)) <= 0) - ; -- if (a == -1) -- prom_abort ("EOF on console\n"); - return c; - } - diff --git a/yaboot-1.3.13-yabootconfig.patch b/yaboot-1.3.13-yabootconfig.patch deleted file mode 100644 index 7360cd1..0000000 --- a/yaboot-1.3.13-yabootconfig.patch +++ /dev/null @@ -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 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 diff --git a/yaboot-1.3.17-fs_swap.patch b/yaboot-1.3.17-fs_swap.patch deleted file mode 100644 index a754ea5..0000000 --- a/yaboot-1.3.17-fs_swap.patch +++ /dev/null @@ -1,41 +0,0 @@ -From f6058147054159eba994eb9589e2ebabe4a05570 Mon Sep 17 00:00:00 2001 -From: Tony Breeds -Date: Wed, 19 Oct 2011 13:36:49 +1100 -Subject: [PATCH] fs_swap: Reduce severity of not finding a partition table on - boot device. - -When booted from a cdrom the fs_swap would exit with FILE_ERR_BADDEV, -this causes fs_open to abort too early. - -We don't need to check file->device_kind != FILE_DEVICE_BLOCK as we're -only called when that is true. - -Demote the return value to FILE_ERR_BAD_FSYS which allows fs_open to -look for other filesystems on the device. - -Signed-off-by: Tony Breeds ---- - second/fs_swap.c | 7 ++++--- - 1 files changed, 4 insertions(+), 3 deletions(-) - -diff --git a/second/fs_swap.c b/second/fs_swap.c -index 87da877..1efb96e 100644 ---- a/second/fs_swap.c -+++ b/second/fs_swap.c -@@ -59,9 +59,10 @@ swap_open(struct boot_file_t* file, struct partition_t* part, - DEBUG_ENTER; - DEBUG_OPEN; - -- if (file->device_kind != FILE_DEVICE_BLOCK || part == NULL) { -- DEBUG_LEAVE(FILE_ERR_BADDEV); -- return FILE_ERR_BADDEV; -+ if (part == NULL) { -+ DEBUG_F("No partions on %s, not checking for swap\n", device_name); -+ DEBUG_LEAVE(FILE_ERR_BAD_FSYS); -+ return FILE_ERR_BAD_FSYS; - } - - /* We assume that device is "short" and is correctly NULL terminsated */ --- -1.7.6.4 - diff --git a/yaboot-1.3.17-link_with_new_e2fsprogs.patch b/yaboot-1.3.17-link_with_new_e2fsprogs.patch deleted file mode 100644 index 855806e..0000000 --- a/yaboot-1.3.17-link_with_new_e2fsprogs.patch +++ /dev/null @@ -1,380 +0,0 @@ -From cf53e4804fb8862bf6ac6564ba5fa458bf3c0600 Mon Sep 17 00:00:00 2001 -From: Tony Breeds -Date: Tue, 12 Jun 2012 15:19:02 +1000 -Subject: [PATCH] Add more libc helper functions for e2fsprogs. - -I've added debug() statements for all of the stub functions. So if -things get "strange" we at least know we've been playing around in this -backwater. - -Portions of this patch are based on the work by Joseph Jezak -specifically the *_chk() functions. - -Signed-off-by: Tony Breeds ---- - include/nonstd.h | 48 +++++++++++- - lib/malloc.c | 7 ++ - lib/nonstd.c | 235 ++++++++++++++++++++++++++++++++++++++++++++++++++++- - 3 files changed, 284 insertions(+), 6 deletions(-) - -diff --git a/include/nonstd.h b/include/nonstd.h -index bad5f48..a967380 100644 ---- a/include/nonstd.h -+++ b/include/nonstd.h -@@ -22,14 +22,60 @@ - #ifndef NONSTD_H - #define NONSTD_H - -+/* Copied from asm-generic/errno-base.h */ -+#define EPERM 1 /* Operation not permitted */ -+#define EBADF 9 /* Bad file number */ -+#define EACCES 13 /* Permission denied */ -+ - typedef int FILE; - -+typedef unsigned int uid_t; -+typedef int pid_t; -+typedef unsigned int mode_t; -+typedef int ssize_t; -+typedef long long off64_t; -+typedef long off_t; -+ -+struct stat; -+struct timezone; -+struct timeval; -+ - extern FILE *stdout; -+extern FILE *stderr; - - int printf(const char *format, ...); - int fprintf(FILE *stream, const char *format, ...); - int fputs(const char *s, FILE *stream); - int fflush(FILE *stream); - char *getenv(const char *name); -- -+int gethostname(char *name, size_t len); -+int gettimeofday(struct timeval *tv, struct timezone *tz); -+int * __errno_location(void); -+unsigned int sleep(unsigned int seconds); -+int rand(void); -+void srand(unsigned int seed); -+long int random(void); -+void srandom(unsigned int seed); -+uid_t geteuid(void); -+uid_t getuid(void); -+pid_t getpid(void); -+int stat(const char *path, struct stat *buf); -+int stat64(const char *path, struct stat *buf); -+int fstat(int fd, struct stat *buf); -+int fstat64(int fd, struct stat *buf); -+int open(const char *pathname, int flags, mode_t mode); -+int open64(const char *pathname, int flags, mode_t mode); -+off_t lseek(int fd, off_t offset, int whence); -+off64_t lseek64(int fd, off64_t offset, int whence); -+ssize_t read(int fildes, void *buf, size_t nbyte); -+int close(int fd); -+void *calloc(size_t nmemb, size_t size); -+void perror(const char *s); -+void exit(int status); -+int ioctl(int d, int request, ...); -+size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); -+long sysconf(int name); -+int getpagesize(void); -+void qsort(void *base, size_t nmemb, size_t size, -+ int(*compar)(const void *, const void *)); - #endif -diff --git a/lib/malloc.c b/lib/malloc.c -index 0121112..b21490c 100644 ---- a/lib/malloc.c -+++ b/lib/malloc.c -@@ -107,6 +107,13 @@ int posix_memalign(void **memptr, size_t alignment, size_t size) - return 0; - } - -+void *calloc(size_t nmemb, size_t size) -+{ -+ unsigned char *p = malloc(nmemb * size); -+ memset(p, 0x0, nmemb * size); -+ return p; -+} -+ - void *realloc(void *ptr, unsigned int size) - { - char *caddr, *oaddr = ptr; -diff --git a/lib/nonstd.c b/lib/nonstd.c -index 5aeb0cb..6549283 100644 ---- a/lib/nonstd.c -+++ b/lib/nonstd.c -@@ -23,11 +23,142 @@ - #include "types.h" - #include "stddef.h" - #include "stdlib.h" -+#include "string.h" - #include "ctype.h" - #include "prom.h" - #include "nonstd.h" -+#include "debug.h" - --FILE *stdout; -+#define __unused __attribute__((unused)) -+ -+static FILE _stdout; -+static FILE _stderr; -+FILE *stdout = &_stdout; -+FILE *stderr = &_stderr; -+ -+static int fake_errno; -+ -+int * __errno_location(void) -+{ -+ DEBUG_F("Stub function called"); -+ return &fake_errno; -+} -+ -+uid_t geteuid(void) -+{ -+ DEBUG_F("Stub function called"); -+ return 0; -+} -+ -+uid_t getuid(void) -+{ -+ DEBUG_F("Stub function called"); -+ return 0; -+} -+ -+pid_t getpid(void) -+{ -+ DEBUG_F("Stub function called"); -+ return 1; -+} -+ -+/* selected by roll of a six sided dice ... that's random right? */ -+int rand(void) -+{ -+ DEBUG_F("Stub function called"); -+ return 4; -+} -+ -+void srand(unsigned int seed __unused) -+{ -+ DEBUG_F("Stub function called"); -+} -+ -+long int random(void) -+{ -+ DEBUG_F("Stub function called"); -+ return 4; -+} -+ -+void srandom(unsigned int seed __unused) -+{ -+ DEBUG_F("Stub function called"); -+} -+ -+unsigned int sleep(unsigned int seconds) -+{ -+ prom_sleep(seconds); -+ return 0; -+} -+ -+int stat(const char *path __unused, struct stat *buf __unused) -+{ -+ DEBUG_F("Stub function called"); -+ return EACCES; -+} -+ -+int stat64(const char *path __unused, struct stat *buf __unused) -+{ -+ DEBUG_F("Stub function called"); -+ return EACCES; -+} -+ -+int fstat(int fd __unused, struct stat *buf __unused) -+{ -+ DEBUG_F("Stub function called"); -+ return EBADF; -+} -+ -+int fstat64(int fd __unused, struct stat *buf __unused) -+{ -+ DEBUG_F("Stub function called"); -+ return EBADF; -+} -+ -+int open(const char *pathname, int flags __unused, mode_t mode __unused) -+{ -+ return (int) prom_open((char *)pathname); -+} -+ -+int open64(const char *pathname, int flags __unused, mode_t mode __unused) -+{ -+ return (int) prom_open((char *)pathname); -+} -+ -+off_t lseek(int fd __unused, off_t offset __unused, int whence __unused) -+{ -+ DEBUG_F("Stub function called"); -+ return EBADF; -+} -+ -+off64_t lseek64(int fd __unused, off64_t offset __unused, int whence __unused) -+{ -+ DEBUG_F("Stub function called"); -+ return EBADF; -+} -+ -+ssize_t read(int filedes, void *buf, size_t nbyte) -+{ -+ return prom_read((void *)filedes, buf, nbyte); -+} -+ -+int close(int fd __unused) -+{ -+ prom_close((void *)fd); -+ return 0; -+} -+ -+int gethostname(char *name __unused, size_t len __unused) -+{ -+ DEBUG_F("Stub function called"); -+ return EPERM; -+} -+ -+int gettimeofday(struct timeval *tv __unused, struct timezone *tz __unused) -+{ -+ DEBUG_F("Stub function called"); -+ return EPERM; -+} - - int printf(const char *format, ...) - { -@@ -39,7 +170,7 @@ int printf(const char *format, ...) - return 0; - } - --int fprintf(FILE *stream, const char *format, ...) -+int fprintf(FILE *stream __unused, const char *format, ...) - { - va_list ap; - va_start (ap, format); -@@ -49,19 +180,113 @@ int fprintf(FILE *stream, const char *format, ...) - return 0; - } - --int fputs(const char *s, FILE *stream) -+int fputs(const char *s, FILE *stream __unused) - { - prom_printf("%s", s); - - return 0; - } - --int fflush(FILE *stream) -+int fflush(FILE *stream __unused) - { -+ DEBUG_F("Stub function called"); - return 0; - } - --char *getenv(const char *name) -+char *getenv(const char *name __unused) - { -+ DEBUG_F("Stub function called"); - return NULL; - } -+ -+int __printf_chk(int flag __unused, const char *format, ...) -+{ -+ va_list ap; -+ va_start (ap, format); -+ prom_vfprintf (prom_stdout, format, ap); -+ va_end (ap); -+ -+ DEBUG_F("Stub function called"); -+ return 0; -+} -+ -+int __sprintf_chk(char *str __unused, int flag __unused, -+ size_t strlen __unused, const char * format __unused, ...) -+{ -+ DEBUG_F("Stub function called"); -+ return 0; -+ -+} -+ -+int __fprintf_chk(FILE *stream __unused, int flag __unused, -+ const char *format, ...) -+{ -+ va_list ap; -+ va_start (ap, format); -+ prom_vfprintf (prom_stdout, format, ap); -+ va_end (ap); -+ -+ return 0; -+} -+ -+void *__memcpy_chk(void *dest, const void *src, size_t n, -+ size_t destlen __unused) -+{ -+ DEBUG_F("Stub function called"); -+ /* FIXME: We really could check that dest+destlen < src, to ensure -+ * we're not overwriting the src */ -+ return memcpy(dest, src, n); -+} -+ -+void perror(const char *s) -+{ -+ DEBUG_F("Stub function called"); -+ prom_printf(s); -+} -+ -+void exit(int status __unused) -+{ -+ prom_exit(); -+ for(;;); -+} -+ -+int ioctl(int d __unused, int request __unused, ...) -+{ -+ DEBUG_F("Stub function called"); -+ return 0; -+} -+ -+/* As we do not implement fopen() I think we're only going to get called -+ * with stdout and stderr. If that's the case we degenerate to prom_write() -+ * on stdout */ -+size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) -+{ -+ if ((stream == stdout) || (stream == stderr)) { -+ DEBUG_F("Stub function called on known stream"); -+ prom_write(prom_stdout, (void *)ptr, size * nmemb); -+ } else { -+ DEBUG_F("Stub function called on unknown stream"); -+ } -+ return nmemb; -+} -+ -+long sysconf(int name __unused) -+{ -+ DEBUG_F("Stub function called"); -+ return -1; -+} -+ -+int getpagesize(void) -+{ -+ DEBUG_F("Stub function called"); -+ /* I think this is safe to assume */ -+ return 4096; -+} -+ -+void qsort(void *base __unused, size_t nmemb __unused, size_t size __unused, -+ int(*compar)(const void *, const void *)) -+{ -+ DEBUG_F("Stub function called"); -+ /* I'm quite nervous about not implementing this. Could we end up with -+ * disk corruption. Couldn't we? */ -+} --- -1.7.7.6 - diff --git a/yaboot-1.3.17-link_with_new_e2fsprogs2.patch b/yaboot-1.3.17-link_with_new_e2fsprogs2.patch deleted file mode 100644 index 40310d6..0000000 --- a/yaboot-1.3.17-link_with_new_e2fsprogs2.patch +++ /dev/null @@ -1,145 +0,0 @@ -diff --git a/include/nonstd.h b/include/nonstd.h -index a967380..a23f98e 100644 ---- a/include/nonstd.h -+++ b/include/nonstd.h -@@ -26,6 +26,7 @@ - #define EPERM 1 /* Operation not permitted */ - #define EBADF 9 /* Bad file number */ - #define EACCES 13 /* Permission denied */ -+#define EFAULT 14 /* Bad address */ - - typedef int FILE; - -@@ -37,8 +38,11 @@ typedef long long off64_t; - typedef long off_t; - - struct stat; -+struct stat64; - struct timezone; - struct timeval; -+struct rlimit; -+struct utsname; - - extern FILE *stdout; - extern FILE *stderr; -@@ -78,4 +82,14 @@ long sysconf(int name); - int getpagesize(void); - void qsort(void *base, size_t nmemb, size_t size, - int(*compar)(const void *, const void *)); -+ssize_t write(int fd, const void *buf, size_t count); -+int fallocate(int fd, int mode, off_t offset, off_t len); -+unsigned long long int strtoull(const char *nptr, char **endptr, int base); -+int fsync(int fd); -+int __open64_2(const char *pathname, int flags); -+int __xstat64(int vers, const char *name, struct stat64 *buf); -+int uname(struct utsname *buf); -+int getrlimit(int resource, struct rlimit *rlim); -+int setrlimit(int resource, const struct rlimit *rlim); -+int __fxstat64(int vers, int fd, struct stat64 *buf); - #endif -diff --git a/include/stdlib.h b/include/stdlib.h -index 0b5e99a..921fc9b 100644 ---- a/include/stdlib.h -+++ b/include/stdlib.h -@@ -19,6 +19,7 @@ extern void release (void *ptr); - extern int sprintf(char * buf, const char *fmt, ...); - extern int vsprintf(char *buf, const char *fmt, va_list args); - extern long simple_strtol(const char *cp,char **endp,unsigned int base); -+extern unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base); - #define strtol(x,y,z) simple_strtol(x,y,z) - - #endif -diff --git a/lib/nonstd.c b/lib/nonstd.c -index 6549283..129d674 100644 ---- a/lib/nonstd.c -+++ b/lib/nonstd.c -@@ -115,6 +115,19 @@ int fstat64(int fd __unused, struct stat *buf __unused) - return EBADF; - } - -+int __xstat64(int vers __unused, const char *name __unused, -+ struct stat64 *buf __unused) -+{ -+ DEBUG_F("Stub function called"); -+ return EBADF; -+} -+ -+int __fxstat64(int vers __unused, int fd __unused, struct stat64 *buf __unused) -+{ -+ DEBUG_F("Stub function called"); -+ return EBADF; -+} -+ - int open(const char *pathname, int flags __unused, mode_t mode __unused) - { - return (int) prom_open((char *)pathname); -@@ -125,6 +138,11 @@ int open64(const char *pathname, int flags __unused, mode_t mode __unused) - return (int) prom_open((char *)pathname); - } - -+int __open64_2(const char *pathname, int flags __unused) -+{ -+ return (int) prom_open((char *)pathname); -+} -+ - off_t lseek(int fd __unused, off_t offset __unused, int whence __unused) - { - DEBUG_F("Stub function called"); -@@ -290,3 +308,57 @@ void qsort(void *base __unused, size_t nmemb __unused, size_t size __unused, - /* I'm quite nervous about not implementing this. Could we end up with - * disk corruption. Couldn't we? */ - } -+ -+/* FIXME: I'd like to call prom_write here, but we can't ber certain that -+ * we'll have "text" so just move along nothing to see here -+ */ -+ssize_t write(int fd, const void *buf, size_t count) -+{ -+ DEBUG_F("Stub function called"); -+ return 0; -+} -+ -+int fallocate(int fd __unused, int mode __unused, off_t offset __unused, -+ off_t len __unused) -+{ -+ DEBUG_F("Stub function called"); -+ return 0; -+} -+ -+unsigned long long int strtoull(const char *nptr, char **endptr, int base) -+{ -+ return simple_strtoull(nptr, endptr, base); -+} -+ -+int fsync(int fd __unused) -+{ -+ DEBUG_F("Stub function called"); -+ return 0; -+} -+ -+/* Return EFAULT here as it's too hard in yaboot to know the size of struct -+ * utsname. If we don't touch it and return 0 bad things might happen. -+ * Lets hope the caller handles failure -+ */ -+int uname(struct utsname *buf __unused) -+{ -+ DEBUG_F("Stub function called"); -+ return EFAULT; -+} -+ -+int getrlimit(int resource __unused, struct rlimit *rlim __unused) -+{ -+ DEBUG_F("Stub function called"); -+ return 0; -+} -+ -+int setrlimit(int resource __unused, const struct rlimit *rlim __unused) -+{ -+ DEBUG_F("Stub function called"); -+ return 0; -+} -+ -+void __stack_chk_fail(void) -+{ -+ DEBUG_F("Stub function called"); -+} diff --git a/yaboot-1.3.17-no-werror.patch b/yaboot-1.3.17-no-werror.patch deleted file mode 100644 index 5bd02f8..0000000 --- a/yaboot-1.3.17-no-werror.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- yaboot-1.3.17/Makefile.orig 2011-10-18 17:08:21.488819995 +1100 -+++ yaboot-1.3.17/Makefile 2011-10-18 17:08:30.038802076 +1100 -@@ -40,7 +40,6 @@ - YBCFLAGS += -DTEXTADDR=$(TEXTADDR) -DDEBUG=$(DEBUG) - YBCFLAGS += -DMALLOCADDR=$(MALLOCADDR) -DMALLOCSIZE=$(MALLOCSIZE) - YBCFLAGS += -DKERNELADDR=$(KERNELADDR) --YBCFLAGS += -Werror -fdiagnostics-show-option - YBCFLAGS += -I ./include - YBCFLAGS += -fno-strict-aliasing - diff --git a/yaboot-1.3.3-man.patch b/yaboot-1.3.3-man.patch deleted file mode 100644 index c444761..0000000 --- a/yaboot-1.3.3-man.patch +++ /dev/null @@ -1,132 +0,0 @@ -diff -bpurN yaboot-1.3.17.orig/man/mkofboot.8 yaboot-1.3.17/man/mkofboot.8 ---- yaboot-1.3.17.orig/man/mkofboot.8 2011-10-18 12:33:25.000000000 +1100 -+++ yaboot-1.3.17/man/mkofboot.8 2011-10-18 14:51:53.540964413 +1100 -@@ -88,7 +88,7 @@ utility. You should only need to define - .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 -@@ -162,8 +162,8 @@ Print out usage information and exit. - 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 -@@ -179,7 +179,7 @@ it is important that your system use a s - 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 -bpurN yaboot-1.3.17.orig/man/yaboot.conf.5 yaboot-1.3.17/man/yaboot.conf.5 ---- yaboot-1.3.17.orig/man/yaboot.conf.5 2011-10-18 12:33:25.000000000 +1100 -+++ yaboot-1.3.17/man/yaboot.conf.5 2011-10-18 14:51:53.541964410 +1100 -@@ -136,7 +136,7 @@ Example: - 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 @@ executable so this can be optional. Whe - 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 -@@ -307,7 +307,7 @@ You must also have the BSD bootloader - 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 -@@ -316,7 +316,7 @@ The OpenFirmware or Unix device path to - 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. -@@ -326,7 +326,7 @@ The OpenFirmware or unix device path to - 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. -@@ -347,7 +347,7 @@ The OpenFirmware or unix device path to - 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. -@@ -591,8 +591,8 @@ device=hd: - 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 -bpurN yaboot-1.3.17.orig/man/ybin.8 yaboot-1.3.17/man/ybin.8 ---- yaboot-1.3.17.orig/man/ybin.8 2011-10-18 12:33:25.000000000 +1100 -+++ yaboot-1.3.17/man/ybin.8 2011-10-18 14:51:53.541964410 +1100 -@@ -103,7 +103,7 @@ You should only need to define this opti - .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 -@@ -176,8 +176,8 @@ Print out usage information and exit. - 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 -@@ -193,7 +193,7 @@ It is important that your system use a s - 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 diff --git a/yaboot-1.3.6-ofboot.patch b/yaboot-1.3.6-ofboot.patch deleted file mode 100644 index cd35657..0000000 --- a/yaboot-1.3.6-ofboot.patch +++ /dev/null @@ -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 - - --PowerPC GNU/Linux First Stage Bootstrap -+Red Hat Linux First Stage Bootstrap - - - : .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 diff --git a/yaboot-1.3.6-rh.patch b/yaboot-1.3.6-rh.patch deleted file mode 100644 index f701474..0000000 --- a/yaboot-1.3.6-rh.patch +++ /dev/null @@ -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 diff --git a/yaboot-sha2.patch b/yaboot-sha2.patch deleted file mode 100644 index a3cb924..0000000 --- a/yaboot-sha2.patch +++ /dev/null @@ -1,1685 +0,0 @@ -diff -purN yaboot-1.3.17.orig/doc/yaboot-howto.sgml yaboot-1.3.17/doc/yaboot-howto.sgml ---- yaboot-1.3.17.orig/doc/yaboot-howto.sgml 2011-10-18 15:11:10.000000000 +1100 -+++ yaboot-1.3.17/doc/yaboot-howto.sgml 2011-10-18 16:07:39.409445997 +1100 -@@ -487,17 +487,17 @@ password will be required. - -

- --The password= line may either be a plaintext password or an MD5 --hash (the same format as the Linux /etc/shadow file). To make an --md5 hash use the following perl snippet: -+The password= line may either be a plaintext password or a -+hash (the same format as the Linux /etc/shadow file, using MD5, -+SHA-256 or SHA-512). To make a SHA-512 hash use the following perl snippet: - - -- $ perl -e 'printf("%s\n", crypt("secret", "\$1\$saltstrg"))' -+ $ perl -e 'printf("%s\n", crypt("secret", "\$6\$saltstrg"))' - - The saltstrg should be a random string, for example one generated by - - -- makepasswd --chars=8 -+ makepasswd --chars=16 - - - -diff -purN yaboot-1.3.17.orig/etc/yaboot.conf yaboot-1.3.17/etc/yaboot.conf ---- yaboot-1.3.17.orig/etc/yaboot.conf 2011-10-18 16:03:10.731008572 +1100 -+++ yaboot-1.3.17/etc/yaboot.conf 2011-10-18 16:07:39.409445997 +1100 -@@ -53,6 +53,10 @@ bgcolor=black - - #password=$1$saltstrg$HnJ/gcM3oKhNbnzUPgXTD/ - -+## Password supplied as a SHA-2 hash, see above -+ -+#password=6$saltstrg$RtV84gQMyM4d9gENIlyHmaGKQXckHJBjhU4aBOpbyzcvDMSxK/dJI7e/sYJtRwl4sR9WTFCfKJLVaDY.5VdjU1 -+ - ## A password is only required to boot an image specified here if - ## parameters are specified on the command line or if the user enters - ## an image is not specified in the configuration file at all (ie. -diff -purN yaboot-1.3.17.orig/include/string.h yaboot-1.3.17/include/string.h ---- yaboot-1.3.17.orig/include/string.h 2011-10-18 15:11:10.000000000 +1100 -+++ yaboot-1.3.17/include/string.h 2011-10-18 16:07:39.410445994 +1100 -@@ -7,6 +7,7 @@ - extern char * ___strtok; - extern char * strcpy(char *,const char *); - extern char * strncpy(char *,const char *, size_t); -+extern char * stpncpy(char *,const char *, size_t); - extern char * strcat(char *, const char *); - extern char * strncat(char *, const char *, size_t); - extern char * strchr(const char *,int); -diff -purN yaboot-1.3.17.orig/include/yaboot.h yaboot-1.3.17/include/yaboot.h ---- yaboot-1.3.17.orig/include/yaboot.h 2011-10-18 15:11:10.000000000 +1100 -+++ yaboot-1.3.17/include/yaboot.h 2011-10-18 16:07:39.410445994 +1100 -@@ -58,4 +58,7 @@ extern char bootdevice[]; - extern char *bootpath; - extern int bootpartition; - -+extern char *sha256_crypt (const char *key, const char *salt); -+extern char *sha512_crypt (const char *key, const char *salt); -+ - #endif -diff -purN yaboot-1.3.17.orig/lib/stpncpy.c yaboot-1.3.17/lib/stpncpy.c ---- yaboot-1.3.17.orig/lib/stpncpy.c 1970-01-01 10:00:00.000000000 +1000 -+++ yaboot-1.3.17/lib/stpncpy.c 2011-10-18 16:07:39.411445992 +1100 -@@ -0,0 +1,21 @@ -+#include "string.h" -+ -+char * -+stpncpy (char *dest, const char *src, size_t n) -+{ -+ char *res; -+ -+ res = NULL; -+ while (n != 0) { -+ *dest = *src; -+ if (*src != 0) -+ src++; -+ else if (res == NULL) -+ res = dest; -+ dest++; -+ n--; -+ } -+ if (res == NULL) -+ res = dest; -+ return res; -+} -diff -purN yaboot-1.3.17.orig/Makefile yaboot-1.3.17/Makefile ---- yaboot-1.3.17.orig/Makefile 2011-10-18 16:03:10.746008540 +1100 -+++ yaboot-1.3.17/Makefile 2011-10-18 16:08:30.787338414 +1100 -@@ -88,6 +88,7 @@ OBJS = second/crt0.o second/yaboot.o sec - second/partition.o second/fs.o second/cfg.o second/setjmp.o second/cmdline.o \ - second/fs_of.o second/fs_ext2.o second/fs_iso.o second/fs_swap.o \ - second/iso_util.o \ -+ second/sha256crypt.o second/sha512crypt.o lib/stpncpy.o \ - lib/nonstd.o \ - lib/nosys.o lib/string.o lib/strtol.o lib/vsprintf.o lib/ctype.o lib/malloc.o lib/strstr.o - -diff -purN yaboot-1.3.17.orig/man/yaboot.conf.5 yaboot-1.3.17/man/yaboot.conf.5 ---- yaboot-1.3.17.orig/man/yaboot.conf.5 2011-10-18 16:03:10.725008585 +1100 -+++ yaboot-1.3.17/man/yaboot.conf.5 2011-10-18 16:07:39.412445990 +1100 -@@ -258,8 +258,9 @@ first 2000 bytes of this file will be re - .TP - .BI "password=" password - Protect booting by a password. The password is given in either --cleartext or an md5 hash (of the same format as used in GNU/Linux --passwd files)in the configuration file. Because of that, the -+cleartext or an hash (of the same format as used in GNU/Linux -+passwd files, using MD5, SHA-256 or SHA-512) in the configuration file. -+Because of that, the - configuration file should be only readable by the superuser and the - password should differ if possible from other passwords on the system. - See -diff -purN yaboot-1.3.17.orig/second/sha256crypt.c yaboot-1.3.17/second/sha256crypt.c ---- yaboot-1.3.17.orig/second/sha256crypt.c 1970-01-01 10:00:00.000000000 +1000 -+++ yaboot-1.3.17/second/sha256crypt.c 2011-10-18 16:07:39.413445987 +1100 -@@ -0,0 +1,735 @@ -+/* SHA256-based Unix crypt implementation. -+ Released into the Public Domain by Ulrich Drepper . -+ Adapted for yaboot by Miloslav Trmac . */ -+ -+#include -+#include "prom.h" -+#include "stdlib.h" -+#include "string.h" -+#include "types.h" -+ -+#define TEST -+typedef size_t uintptr_t; -+#define alloca(SIZE) (__builtin_alloca (SIZE)) -+#define MIN(a, b) ((a) < (b) ? (a) : (b)) -+#define MAX(a, b) ((a) > (b) ? (a) : (b)) -+ -+/* Structure to save state of computation between the single steps. */ -+struct sha256_ctx -+{ -+ uint32_t H[8]; -+ -+ uint32_t total[2]; -+ uint32_t buflen; -+ char buffer[128]; /* NB: always correctly aligned for uint32_t. */ -+}; -+ -+ -+#if 0 /* __BYTE_ORDER == __LITTLE_ENDIAN */ -+# define SWAP(n) \ -+ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) -+#else -+# define SWAP(n) (n) -+#endif -+ -+ -+/* This array contains the bytes used to pad the buffer to the next -+ 64-byte boundary. (FIPS 180-2:5.1.1) */ -+static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; -+ -+ -+/* Constants for SHA256 from FIPS 180-2:4.2.2. */ -+static const uint32_t K[64] = -+ { -+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, -+ 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, -+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, -+ 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, -+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, -+ 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, -+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, -+ 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, -+ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, -+ 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, -+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, -+ 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, -+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, -+ 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, -+ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, -+ 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 -+ }; -+ -+ -+/* Process LEN bytes of BUFFER, accumulating context into CTX. -+ It is assumed that LEN % 64 == 0. */ -+static void -+sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx) -+{ -+ const uint32_t *words = buffer; -+ size_t nwords = len / sizeof (uint32_t); -+ uint32_t a = ctx->H[0]; -+ uint32_t b = ctx->H[1]; -+ uint32_t c = ctx->H[2]; -+ uint32_t d = ctx->H[3]; -+ uint32_t e = ctx->H[4]; -+ uint32_t f = ctx->H[5]; -+ uint32_t g = ctx->H[6]; -+ uint32_t h = ctx->H[7]; -+ -+ /* First increment the byte count. FIPS 180-2 specifies the possible -+ length of the file up to 2^64 bits. Here we only compute the -+ number of bytes. Do a double word increment. */ -+ ctx->total[0] += len; -+ if (ctx->total[0] < len) -+ ++ctx->total[1]; -+ -+ /* Process all bytes in the buffer with 64 bytes in each round of -+ the loop. */ -+ while (nwords > 0) -+ { -+ uint32_t W[64]; -+ uint32_t a_save = a; -+ uint32_t b_save = b; -+ uint32_t c_save = c; -+ uint32_t d_save = d; -+ uint32_t e_save = e; -+ uint32_t f_save = f; -+ uint32_t g_save = g; -+ uint32_t h_save = h; -+ unsigned int t; -+ -+ /* Operators defined in FIPS 180-2:4.1.2. */ -+#define Ch(x, y, z) ((x & y) ^ (~x & z)) -+#define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z)) -+#define S0(x) (CYCLIC (x, 2) ^ CYCLIC (x, 13) ^ CYCLIC (x, 22)) -+#define S1(x) (CYCLIC (x, 6) ^ CYCLIC (x, 11) ^ CYCLIC (x, 25)) -+#define R0(x) (CYCLIC (x, 7) ^ CYCLIC (x, 18) ^ (x >> 3)) -+#define R1(x) (CYCLIC (x, 17) ^ CYCLIC (x, 19) ^ (x >> 10)) -+ -+ /* It is unfortunate that C does not provide an operator for -+ cyclic rotation. Hope the C compiler is smart enough. */ -+#define CYCLIC(w, s) ((w >> s) | (w << (32 - s))) -+ -+ /* Compute the message schedule according to FIPS 180-2:6.2.2 step 2. */ -+ for (t = 0; t < 16; ++t) -+ { -+ W[t] = SWAP (*words); -+ ++words; -+ } -+ for (t = 16; t < 64; ++t) -+ W[t] = R1 (W[t - 2]) + W[t - 7] + R0 (W[t - 15]) + W[t - 16]; -+ -+ /* The actual computation according to FIPS 180-2:6.2.2 step 3. */ -+ for (t = 0; t < 64; ++t) -+ { -+ uint32_t T1 = h + S1 (e) + Ch (e, f, g) + K[t] + W[t]; -+ uint32_t T2 = S0 (a) + Maj (a, b, c); -+ h = g; -+ g = f; -+ f = e; -+ e = d + T1; -+ d = c; -+ c = b; -+ b = a; -+ a = T1 + T2; -+ } -+ -+ /* Add the starting values of the context according to FIPS 180-2:6.2.2 -+ step 4. */ -+ a += a_save; -+ b += b_save; -+ c += c_save; -+ d += d_save; -+ e += e_save; -+ f += f_save; -+ g += g_save; -+ h += h_save; -+ -+ /* Prepare for the next round. */ -+ nwords -= 16; -+ } -+ -+ /* Put checksum in context given as argument. */ -+ ctx->H[0] = a; -+ ctx->H[1] = b; -+ ctx->H[2] = c; -+ ctx->H[3] = d; -+ ctx->H[4] = e; -+ ctx->H[5] = f; -+ ctx->H[6] = g; -+ ctx->H[7] = h; -+} -+ -+ -+/* Initialize structure containing state of computation. -+ (FIPS 180-2:5.3.2) */ -+static void -+sha256_init_ctx (struct sha256_ctx *ctx) -+{ -+ ctx->H[0] = 0x6a09e667; -+ ctx->H[1] = 0xbb67ae85; -+ ctx->H[2] = 0x3c6ef372; -+ ctx->H[3] = 0xa54ff53a; -+ ctx->H[4] = 0x510e527f; -+ ctx->H[5] = 0x9b05688c; -+ ctx->H[6] = 0x1f83d9ab; -+ ctx->H[7] = 0x5be0cd19; -+ -+ ctx->total[0] = ctx->total[1] = 0; -+ ctx->buflen = 0; -+} -+ -+ -+/* Process the remaining bytes in the internal buffer and the usual -+ prolog according to the standard and write the result to RESBUF. -+ -+ IMPORTANT: On some systems it is required that RESBUF is correctly -+ aligned for a 32 bits value. */ -+static void * -+sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf) -+{ -+ /* Take yet unprocessed bytes into account. */ -+ uint32_t bytes = ctx->buflen; -+ size_t pad; -+ unsigned int i; -+ -+ /* Now count remaining bytes. */ -+ ctx->total[0] += bytes; -+ if (ctx->total[0] < bytes) -+ ++ctx->total[1]; -+ -+ pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; -+ memcpy (&ctx->buffer[bytes], fillbuf, pad); -+ -+ /* Put the 64-bit file length in *bits* at the end of the buffer. */ -+ *(uint32_t *) &ctx->buffer[bytes + pad + 4] = SWAP (ctx->total[0] << 3); -+ *(uint32_t *) &ctx->buffer[bytes + pad] = SWAP ((ctx->total[1] << 3) | -+ (ctx->total[0] >> 29)); -+ -+ /* Process last bytes. */ -+ sha256_process_block (ctx->buffer, bytes + pad + 8, ctx); -+ -+ /* Put result from CTX in first 32 bytes following RESBUF. */ -+ for (i = 0; i < 8; ++i) -+ ((uint32_t *) resbuf)[i] = SWAP (ctx->H[i]); -+ -+ return resbuf; -+} -+ -+ -+static void -+sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx) -+{ -+ /* When we already have some bits in our internal buffer concatenate -+ both inputs first. */ -+ if (ctx->buflen != 0) -+ { -+ size_t left_over = ctx->buflen; -+ size_t add = 128 - left_over > len ? len : 128 - left_over; -+ -+ memcpy (&ctx->buffer[left_over], buffer, add); -+ ctx->buflen += add; -+ -+ if (ctx->buflen > 64) -+ { -+ sha256_process_block (ctx->buffer, ctx->buflen & ~63, ctx); -+ -+ ctx->buflen &= 63; -+ /* The regions in the following copy operation cannot overlap. */ -+ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], -+ ctx->buflen); -+ } -+ -+ buffer = (const char *) buffer + add; -+ len -= add; -+ } -+ -+ /* Process available complete blocks. */ -+ if (len >= 64) -+ { -+/* To check alignment gcc has an appropriate operator. Other -+ compilers don't. */ -+#if __GNUC__ >= 2 -+# define UNALIGNED_P(p) (((uintptr_t) p) % __alignof__ (uint32_t) != 0) -+#else -+# define UNALIGNED_P(p) (((uintptr_t) p) % sizeof (uint32_t) != 0) -+#endif -+ if (UNALIGNED_P (buffer)) -+ while (len > 64) -+ { -+ sha256_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); -+ buffer = (const char *) buffer + 64; -+ len -= 64; -+ } -+ else -+ { -+ sha256_process_block (buffer, len & ~63, ctx); -+ buffer = (const char *) buffer + (len & ~63); -+ len &= 63; -+ } -+ } -+ -+ /* Move remaining bytes into internal buffer. */ -+ if (len > 0) -+ { -+ size_t left_over = ctx->buflen; -+ -+ memcpy (&ctx->buffer[left_over], buffer, len); -+ left_over += len; -+ if (left_over >= 64) -+ { -+ sha256_process_block (ctx->buffer, 64, ctx); -+ left_over -= 64; -+ memcpy (ctx->buffer, &ctx->buffer[64], left_over); -+ } -+ ctx->buflen = left_over; -+ } -+} -+ -+ -+/* Define our magic string to mark salt for SHA256 "encryption" -+ replacement. */ -+static const char sha256_salt_prefix[] = "$5$"; -+ -+/* Prefix for optional rounds specification. */ -+static const char sha256_rounds_prefix[] = "rounds="; -+ -+/* Maximum salt string length. */ -+#define SALT_LEN_MAX 16 -+/* Default number of rounds if not explicitly specified. */ -+#define ROUNDS_DEFAULT 5000 -+/* Minimum number of rounds. */ -+#define ROUNDS_MIN 1000 -+/* Maximum number of rounds. */ -+#define ROUNDS_MAX 999999999 -+ -+/* Table with characters for base64 transformation. */ -+static const char b64t[64] = -+"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; -+ -+ -+static char * -+sha256_crypt_r (const char *key, const char *salt, char *buffer, int buflen) -+{ -+ unsigned char alt_result[32] -+ __attribute__ ((__aligned__ (__alignof__ (uint32_t)))); -+ unsigned char temp_result[32] -+ __attribute__ ((__aligned__ (__alignof__ (uint32_t)))); -+ struct sha256_ctx ctx; -+ struct sha256_ctx alt_ctx; -+ size_t salt_len; -+ size_t key_len; -+ size_t cnt; -+ char *cp; -+ char *copied_key = NULL; -+ char *copied_salt = NULL; -+ char *p_bytes; -+ char *s_bytes; -+ /* Default number of rounds. */ -+ size_t rounds = ROUNDS_DEFAULT; -+ bool rounds_custom = false; -+ -+ /* Find beginning of salt string. The prefix should normally always -+ be present. Just in case it is not. */ -+ if (strncmp (sha256_salt_prefix, salt, sizeof (sha256_salt_prefix) - 1) == 0) -+ /* Skip salt prefix. */ -+ salt += sizeof (sha256_salt_prefix) - 1; -+ -+ if (strncmp (salt, sha256_rounds_prefix, sizeof (sha256_rounds_prefix) - 1) -+ == 0) -+ { -+ const char *num = salt + sizeof (sha256_rounds_prefix) - 1; -+ char *endp; -+ unsigned long int srounds = (unsigned long)strtol (num, &endp, 10); -+ if (*endp == '$') -+ { -+ salt = endp + 1; -+ rounds = MAX (ROUNDS_MIN, MIN (srounds, ROUNDS_MAX)); -+ rounds_custom = true; -+ } -+ } -+ -+ { -+ char *salt_end; -+ -+ salt_end = strchr (salt, '$'); -+ if (salt_end == NULL) -+ salt_end = strchr (salt, '\0'); -+ salt_len = salt_end - salt; -+ } -+ salt_len = MIN (salt_len, SALT_LEN_MAX); -+ key_len = strlen (key); -+ -+ if ((key - (char *) 0) % __alignof__ (uint32_t) != 0) -+ { -+ char *tmp = (char *) alloca (key_len + __alignof__ (uint32_t)); -+ key = copied_key = -+ memcpy (tmp + __alignof__ (uint32_t) -+ - (tmp - (char *) 0) % __alignof__ (uint32_t), -+ key, key_len); -+ } -+ -+ if ((salt - (char *) 0) % __alignof__ (uint32_t) != 0) -+ { -+ char *tmp = (char *) alloca (salt_len + __alignof__ (uint32_t)); -+ salt = copied_salt = -+ memcpy (tmp + __alignof__ (uint32_t) -+ - (tmp - (char *) 0) % __alignof__ (uint32_t), -+ salt, salt_len); -+ } -+ -+ /* Prepare for the real work. */ -+ sha256_init_ctx (&ctx); -+ -+ /* Add the key string. */ -+ sha256_process_bytes (key, key_len, &ctx); -+ -+ /* The last part is the salt string. This must be at most 16 -+ characters and it ends at the first `$' character (for -+ compatibility with existing implementations). */ -+ sha256_process_bytes (salt, salt_len, &ctx); -+ -+ -+ /* Compute alternate SHA256 sum with input KEY, SALT, and KEY. The -+ final result will be added to the first context. */ -+ sha256_init_ctx (&alt_ctx); -+ -+ /* Add key. */ -+ sha256_process_bytes (key, key_len, &alt_ctx); -+ -+ /* Add salt. */ -+ sha256_process_bytes (salt, salt_len, &alt_ctx); -+ -+ /* Add key again. */ -+ sha256_process_bytes (key, key_len, &alt_ctx); -+ -+ /* Now get result of this (32 bytes) and add it to the other -+ context. */ -+ sha256_finish_ctx (&alt_ctx, alt_result); -+ -+ /* Add for any character in the key one byte of the alternate sum. */ -+ for (cnt = key_len; cnt > 32; cnt -= 32) -+ sha256_process_bytes (alt_result, 32, &ctx); -+ sha256_process_bytes (alt_result, cnt, &ctx); -+ -+ /* Take the binary representation of the length of the key and for every -+ 1 add the alternate sum, for every 0 the key. */ -+ for (cnt = key_len; cnt > 0; cnt >>= 1) -+ if ((cnt & 1) != 0) -+ sha256_process_bytes (alt_result, 32, &ctx); -+ else -+ sha256_process_bytes (key, key_len, &ctx); -+ -+ /* Create intermediate result. */ -+ sha256_finish_ctx (&ctx, alt_result); -+ -+ /* Start computation of P byte sequence. */ -+ sha256_init_ctx (&alt_ctx); -+ -+ /* For every character in the password add the entire password. */ -+ for (cnt = 0; cnt < key_len; ++cnt) -+ sha256_process_bytes (key, key_len, &alt_ctx); -+ -+ /* Finish the digest. */ -+ sha256_finish_ctx (&alt_ctx, temp_result); -+ -+ /* Create byte sequence P. */ -+ cp = p_bytes = alloca (key_len); -+ for (cnt = key_len; cnt >= 32; cnt -= 32) -+ { -+ memcpy (cp, temp_result, 32); -+ cp += 32; -+ } -+ memcpy (cp, temp_result, cnt); -+ -+ /* Start computation of S byte sequence. */ -+ sha256_init_ctx (&alt_ctx); -+ -+ /* For every character in the password add the entire password. */ -+ for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt) -+ sha256_process_bytes (salt, salt_len, &alt_ctx); -+ -+ /* Finish the digest. */ -+ sha256_finish_ctx (&alt_ctx, temp_result); -+ -+ /* Create byte sequence S. */ -+ cp = s_bytes = alloca (salt_len); -+ for (cnt = salt_len; cnt >= 32; cnt -= 32) -+ { -+ memcpy (cp, temp_result, 32); -+ cp += 32; -+ } -+ memcpy (cp, temp_result, cnt); -+ -+ /* Repeatedly run the collected hash value through SHA256 to burn -+ CPU cycles. */ -+ for (cnt = 0; cnt < rounds; ++cnt) -+ { -+ /* New context. */ -+ sha256_init_ctx (&ctx); -+ -+ /* Add key or last result. */ -+ if ((cnt & 1) != 0) -+ sha256_process_bytes (p_bytes, key_len, &ctx); -+ else -+ sha256_process_bytes (alt_result, 32, &ctx); -+ -+ /* Add salt for numbers not divisible by 3. */ -+ if (cnt % 3 != 0) -+ sha256_process_bytes (s_bytes, salt_len, &ctx); -+ -+ /* Add key for numbers not divisible by 7. */ -+ if (cnt % 7 != 0) -+ sha256_process_bytes (p_bytes, key_len, &ctx); -+ -+ /* Add key or last result. */ -+ if ((cnt & 1) != 0) -+ sha256_process_bytes (alt_result, 32, &ctx); -+ else -+ sha256_process_bytes (p_bytes, key_len, &ctx); -+ -+ /* Create intermediate result. */ -+ sha256_finish_ctx (&ctx, alt_result); -+ } -+ -+ /* Now we can construct the result string. It consists of three -+ parts. */ -+ cp = stpncpy (buffer, sha256_salt_prefix, MAX (0, buflen)); -+ buflen -= sizeof (sha256_salt_prefix) - 1; -+ -+ if (rounds_custom) -+ { -+ char sbuf[64]; -+ sprintf (sbuf, "%s%Lu$", sha256_rounds_prefix, -+ (unsigned long long)rounds); -+ size_t n = strlen (sbuf); -+ memcpy (cp, sbuf, MIN (MAX (0, buflen), n)); -+ cp += n; -+ buflen -= n; -+ } -+ -+ cp = stpncpy (cp, salt, MIN ((size_t) MAX (0, buflen), salt_len)); -+ buflen -= MIN ((size_t) MAX (0, buflen), salt_len); -+ -+ if (buflen > 0) -+ { -+ *cp++ = '$'; -+ --buflen; -+ } -+ -+#define b64_from_24bit(B2, B1, B0, N) \ -+ do { \ -+ unsigned int w = ((B2) << 16) | ((B1) << 8) | (B0); \ -+ int n = (N); \ -+ while (n-- > 0 && buflen > 0) \ -+ { \ -+ *cp++ = b64t[w & 0x3f]; \ -+ --buflen; \ -+ w >>= 6; \ -+ } \ -+ } while (0) -+ -+ b64_from_24bit (alt_result[0], alt_result[10], alt_result[20], 4); -+ b64_from_24bit (alt_result[21], alt_result[1], alt_result[11], 4); -+ b64_from_24bit (alt_result[12], alt_result[22], alt_result[2], 4); -+ b64_from_24bit (alt_result[3], alt_result[13], alt_result[23], 4); -+ b64_from_24bit (alt_result[24], alt_result[4], alt_result[14], 4); -+ b64_from_24bit (alt_result[15], alt_result[25], alt_result[5], 4); -+ b64_from_24bit (alt_result[6], alt_result[16], alt_result[26], 4); -+ b64_from_24bit (alt_result[27], alt_result[7], alt_result[17], 4); -+ b64_from_24bit (alt_result[18], alt_result[28], alt_result[8], 4); -+ b64_from_24bit (alt_result[9], alt_result[19], alt_result[29], 4); -+ b64_from_24bit (0, alt_result[31], alt_result[30], 3); -+ if (buflen <= 0) -+ buffer = NULL; -+ else -+ *cp = '\0'; /* Terminate the string. */ -+ -+ /* Clear the buffer for the intermediate result so that people -+ attaching to processes or reading core dumps cannot get any -+ information. We do it in this way to clear correct_words[] -+ inside the SHA256 implementation as well. */ -+ sha256_init_ctx (&ctx); -+ sha256_finish_ctx (&ctx, alt_result); -+ memset (temp_result, '\0', sizeof (temp_result)); -+ memset (p_bytes, '\0', key_len); -+ memset (s_bytes, '\0', salt_len); -+ memset (&ctx, '\0', sizeof (ctx)); -+ memset (&alt_ctx, '\0', sizeof (alt_ctx)); -+ if (copied_key != NULL) -+ memset (copied_key, '\0', key_len); -+ if (copied_salt != NULL) -+ memset (copied_salt, '\0', salt_len); -+ -+ return buffer; -+} -+ -+ -+/* This entry point is equivalent to the `crypt' function in Unix -+ libcs. */ -+char * -+sha256_crypt (const char *key, const char *salt) -+{ -+ /* We don't want to have an arbitrary limit in the size of the -+ password. We can compute an upper bound for the size of the -+ result in advance and so we can prepare the buffer we pass to -+ `sha256_crypt_r'. */ -+ static char *buffer; -+ static int buflen; -+ int needed = (sizeof (sha256_salt_prefix) - 1 -+ + sizeof (sha256_rounds_prefix) + 9 + 1 -+ + strlen (salt) + 1 + 43 + 1); -+ -+ if (buflen < needed) -+ { -+ char *new_buffer = (char *) realloc (buffer, needed); -+ if (new_buffer == NULL) -+ return NULL; -+ -+ buffer = new_buffer; -+ buflen = needed; -+ } -+ -+ return sha256_crypt_r (key, salt, buffer, buflen); -+} -+ -+ -+#ifdef TEST -+static const struct -+{ -+ const char *input; -+ const char result[32]; -+} tests[] = -+ { -+ /* Test vectors from FIPS 180-2: appendix B.1. */ -+ { "abc", -+ "\xba\x78\x16\xbf\x8f\x01\xcf\xea\x41\x41\x40\xde\x5d\xae\x22\x23" -+ "\xb0\x03\x61\xa3\x96\x17\x7a\x9c\xb4\x10\xff\x61\xf2\x00\x15\xad" }, -+ /* Test vectors from FIPS 180-2: appendix B.2. */ -+ { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", -+ "\x24\x8d\x6a\x61\xd2\x06\x38\xb8\xe5\xc0\x26\x93\x0c\x3e\x60\x39" -+ "\xa3\x3c\xe4\x59\x64\xff\x21\x67\xf6\xec\xed\xd4\x19\xdb\x06\xc1" }, -+ /* Test vectors from the NESSIE project. */ -+ { "", -+ "\xe3\xb0\xc4\x42\x98\xfc\x1c\x14\x9a\xfb\xf4\xc8\x99\x6f\xb9\x24" -+ "\x27\xae\x41\xe4\x64\x9b\x93\x4c\xa4\x95\x99\x1b\x78\x52\xb8\x55" }, -+ { "a", -+ "\xca\x97\x81\x12\xca\x1b\xbd\xca\xfa\xc2\x31\xb3\x9a\x23\xdc\x4d" -+ "\xa7\x86\xef\xf8\x14\x7c\x4e\x72\xb9\x80\x77\x85\xaf\xee\x48\xbb" }, -+ { "message digest", -+ "\xf7\x84\x6f\x55\xcf\x23\xe1\x4e\xeb\xea\xb5\xb4\xe1\x55\x0c\xad" -+ "\x5b\x50\x9e\x33\x48\xfb\xc4\xef\xa3\xa1\x41\x3d\x39\x3c\xb6\x50" }, -+ { "abcdefghijklmnopqrstuvwxyz", -+ "\x71\xc4\x80\xdf\x93\xd6\xae\x2f\x1e\xfa\xd1\x44\x7c\x66\xc9\x52" -+ "\x5e\x31\x62\x18\xcf\x51\xfc\x8d\x9e\xd8\x32\xf2\xda\xf1\x8b\x73" }, -+ { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", -+ "\x24\x8d\x6a\x61\xd2\x06\x38\xb8\xe5\xc0\x26\x93\x0c\x3e\x60\x39" -+ "\xa3\x3c\xe4\x59\x64\xff\x21\x67\xf6\xec\xed\xd4\x19\xdb\x06\xc1" }, -+ { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", -+ "\xdb\x4b\xfc\xbd\x4d\xa0\xcd\x85\xa6\x0c\x3c\x37\xd3\xfb\xd8\x80" -+ "\x5c\x77\xf1\x5f\xc6\xb1\xfd\xfe\x61\x4e\xe0\xa7\xc8\xfd\xb4\xc0" }, -+ { "123456789012345678901234567890123456789012345678901234567890" -+ "12345678901234567890", -+ "\xf3\x71\xbc\x4a\x31\x1f\x2b\x00\x9e\xef\x95\x2d\xd8\x3c\xa8\x0e" -+ "\x2b\x60\x02\x6c\x8e\x93\x55\x92\xd0\xf9\xc3\x08\x45\x3c\x81\x3e" } -+ }; -+#define ntests (sizeof (tests) / sizeof (tests[0])) -+ -+ -+static const struct -+{ -+ const char *salt; -+ const char *input; -+ const char *expected; -+} tests2[] = -+{ -+ { "$5$saltstring", "Hello world!", -+ "$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5" }, -+ { "$5$rounds=10000$saltstringsaltstring", "Hello world!", -+ "$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2." -+ "opqey6IcA" }, -+ { "$5$rounds=5000$toolongsaltstring", "This is just a test", -+ "$5$rounds=5000$toolongsaltstrin$Un/5jzAHMgOGZ5.mWJpuVolil07guHPvOW8" -+ "mGRcvxa5" }, -+ { "$5$rounds=1400$anotherlongsaltstring", -+ "a very much longer text to encrypt. This one even stretches over more" -+ "than one line.", -+ "$5$rounds=1400$anotherlongsalts$Rx.j8H.h8HjEDGomFU8bDkXm3XIUnzyxf12" -+ "oP84Bnq1" }, -+ { "$5$rounds=77777$short", -+ "we have a short salt string but not a short password", -+ "$5$rounds=77777$short$JiO1O3ZpDAxGJeaDIuqCoEFysAe1mZNJRs3pw0KQRd/" }, -+ { "$5$rounds=123456$asaltof16chars..", "a short string", -+ "$5$rounds=123456$asaltof16chars..$gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/" -+ "cZKmF/wJvD" }, -+ { "$5$rounds=10$roundstoolow", "the minimum number is still observed", -+ "$5$rounds=1000$roundstoolow$yfvwcWrQ8l/K0DAWyuPMDNHpIVlTQebY9l/gL97" -+ "2bIC" }, -+}; -+#define ntests2 (sizeof (tests2) / sizeof (tests2[0])) -+ -+ -+int -+sha256_test (void) -+{ -+ struct sha256_ctx ctx; -+ char sum[32]; -+ int result = 0; -+ int cnt, i; -+ -+ for (cnt = 0; cnt < (int) ntests; ++cnt) -+ { -+ sha256_init_ctx (&ctx); -+ sha256_process_bytes (tests[cnt].input, strlen (tests[cnt].input), &ctx); -+ sha256_finish_ctx (&ctx, sum); -+ if (memcmp (tests[cnt].result, sum, 32) != 0) -+ { -+ prom_printf ("test %d run %d failed\n", cnt, 1); -+ result = 1; -+ } -+ -+ sha256_init_ctx (&ctx); -+ for (i = 0; tests[cnt].input[i] != '\0'; ++i) -+ sha256_process_bytes (&tests[cnt].input[i], 1, &ctx); -+ sha256_finish_ctx (&ctx, sum); -+ if (memcmp (tests[cnt].result, sum, 32) != 0) -+ { -+ prom_printf ("test %d run %d failed\n", cnt, 2); -+ result = 1; -+ } -+ } -+ -+ /* Test vector from FIPS 180-2: appendix B.3. */ -+ char buf[1000]; -+ memset (buf, 'a', sizeof (buf)); -+ sha256_init_ctx (&ctx); -+ for (i = 0; i < 1000; ++i) -+ sha256_process_bytes (buf, sizeof (buf), &ctx); -+ sha256_finish_ctx (&ctx, sum); -+ static const char expected[32] = -+ "\xcd\xc7\x6e\x5c\x99\x14\xfb\x92\x81\xa1\xc7\xe2\x84\xd7\x3e\x67" -+ "\xf1\x80\x9a\x48\xa4\x97\x20\x0e\x04\x6d\x39\xcc\xc7\x11\x2c\xd0"; -+ if (memcmp (expected, sum, 32) != 0) -+ { -+ prom_printf ("test %d failed\n", cnt); -+ result = 1; -+ } -+ -+ for (cnt = 0; cnt < ntests2; ++cnt) -+ { -+ char *cp = sha256_crypt (tests2[cnt].input, tests2[cnt].salt); -+ -+ if (strcmp (cp, tests2[cnt].expected) != 0) -+ { -+ prom_printf ("test %d: expected \"%s\", got \"%s\"\n", -+ cnt, tests2[cnt].expected, cp); -+ result = 1; -+ } -+ } -+ -+ if (result == 0) -+ prom_printf ("all tests OK\n"); -+ -+ return result; -+} -+#endif -diff -purN yaboot-1.3.17.orig/second/sha512crypt.c yaboot-1.3.17/second/sha512crypt.c ---- yaboot-1.3.17.orig/second/sha512crypt.c 1970-01-01 10:00:00.000000000 +1000 -+++ yaboot-1.3.17/second/sha512crypt.c 2011-10-18 16:07:39.415445982 +1100 -@@ -0,0 +1,804 @@ -+/* SHA512-based Unix crypt implementation. -+ Released into the Public Domain by Ulrich Drepper . -+ Adapted for yaboot by Miloslav Trmac . */ -+ -+#include -+#include "prom.h" -+#include "stdlib.h" -+#include "string.h" -+#include "types.h" -+ -+#define TEST -+typedef size_t uintptr_t; -+#define UINT64_C(X) X ## ULL -+#define alloca(SIZE) (__builtin_alloca (SIZE)) -+#define MIN(a, b) ((a) < (b) ? (a) : (b)) -+#define MAX(a, b) ((a) > (b) ? (a) : (b)) -+ -+/* Structure to save state of computation between the single steps. */ -+struct sha512_ctx -+{ -+ uint64_t H[8]; -+ -+ uint64_t total[2]; -+ uint64_t buflen; -+ char buffer[256]; /* NB: always correctly aligned for uint64_t. */ -+}; -+ -+ -+#if 0 /* __BYTE_ORDER == __LITTLE_ENDIAN */ -+# define SWAP(n) \ -+ (((n) << 56) \ -+ | (((n) & 0xff00) << 40) \ -+ | (((n) & 0xff0000) << 24) \ -+ | (((n) & 0xff000000) << 8) \ -+ | (((n) >> 8) & 0xff000000) \ -+ | (((n) >> 24) & 0xff0000) \ -+ | (((n) >> 40) & 0xff00) \ -+ | ((n) >> 56)) -+#else -+# define SWAP(n) (n) -+#endif -+ -+ -+/* This array contains the bytes used to pad the buffer to the next -+ 64-byte boundary. (FIPS 180-2:5.1.2) */ -+static const unsigned char fillbuf[128] = { 0x80, 0 /* , 0, 0, ... */ }; -+ -+ -+/* Constants for SHA512 from FIPS 180-2:4.2.3. */ -+static const uint64_t K[80] = -+ { -+ UINT64_C (0x428a2f98d728ae22), UINT64_C (0x7137449123ef65cd), -+ UINT64_C (0xb5c0fbcfec4d3b2f), UINT64_C (0xe9b5dba58189dbbc), -+ UINT64_C (0x3956c25bf348b538), UINT64_C (0x59f111f1b605d019), -+ UINT64_C (0x923f82a4af194f9b), UINT64_C (0xab1c5ed5da6d8118), -+ UINT64_C (0xd807aa98a3030242), UINT64_C (0x12835b0145706fbe), -+ UINT64_C (0x243185be4ee4b28c), UINT64_C (0x550c7dc3d5ffb4e2), -+ UINT64_C (0x72be5d74f27b896f), UINT64_C (0x80deb1fe3b1696b1), -+ UINT64_C (0x9bdc06a725c71235), UINT64_C (0xc19bf174cf692694), -+ UINT64_C (0xe49b69c19ef14ad2), UINT64_C (0xefbe4786384f25e3), -+ UINT64_C (0x0fc19dc68b8cd5b5), UINT64_C (0x240ca1cc77ac9c65), -+ UINT64_C (0x2de92c6f592b0275), UINT64_C (0x4a7484aa6ea6e483), -+ UINT64_C (0x5cb0a9dcbd41fbd4), UINT64_C (0x76f988da831153b5), -+ UINT64_C (0x983e5152ee66dfab), UINT64_C (0xa831c66d2db43210), -+ UINT64_C (0xb00327c898fb213f), UINT64_C (0xbf597fc7beef0ee4), -+ UINT64_C (0xc6e00bf33da88fc2), UINT64_C (0xd5a79147930aa725), -+ UINT64_C (0x06ca6351e003826f), UINT64_C (0x142929670a0e6e70), -+ UINT64_C (0x27b70a8546d22ffc), UINT64_C (0x2e1b21385c26c926), -+ UINT64_C (0x4d2c6dfc5ac42aed), UINT64_C (0x53380d139d95b3df), -+ UINT64_C (0x650a73548baf63de), UINT64_C (0x766a0abb3c77b2a8), -+ UINT64_C (0x81c2c92e47edaee6), UINT64_C (0x92722c851482353b), -+ UINT64_C (0xa2bfe8a14cf10364), UINT64_C (0xa81a664bbc423001), -+ UINT64_C (0xc24b8b70d0f89791), UINT64_C (0xc76c51a30654be30), -+ UINT64_C (0xd192e819d6ef5218), UINT64_C (0xd69906245565a910), -+ UINT64_C (0xf40e35855771202a), UINT64_C (0x106aa07032bbd1b8), -+ UINT64_C (0x19a4c116b8d2d0c8), UINT64_C (0x1e376c085141ab53), -+ UINT64_C (0x2748774cdf8eeb99), UINT64_C (0x34b0bcb5e19b48a8), -+ UINT64_C (0x391c0cb3c5c95a63), UINT64_C (0x4ed8aa4ae3418acb), -+ UINT64_C (0x5b9cca4f7763e373), UINT64_C (0x682e6ff3d6b2b8a3), -+ UINT64_C (0x748f82ee5defb2fc), UINT64_C (0x78a5636f43172f60), -+ UINT64_C (0x84c87814a1f0ab72), UINT64_C (0x8cc702081a6439ec), -+ UINT64_C (0x90befffa23631e28), UINT64_C (0xa4506cebde82bde9), -+ UINT64_C (0xbef9a3f7b2c67915), UINT64_C (0xc67178f2e372532b), -+ UINT64_C (0xca273eceea26619c), UINT64_C (0xd186b8c721c0c207), -+ UINT64_C (0xeada7dd6cde0eb1e), UINT64_C (0xf57d4f7fee6ed178), -+ UINT64_C (0x06f067aa72176fba), UINT64_C (0x0a637dc5a2c898a6), -+ UINT64_C (0x113f9804bef90dae), UINT64_C (0x1b710b35131c471b), -+ UINT64_C (0x28db77f523047d84), UINT64_C (0x32caab7b40c72493), -+ UINT64_C (0x3c9ebe0a15c9bebc), UINT64_C (0x431d67c49c100d4c), -+ UINT64_C (0x4cc5d4becb3e42b6), UINT64_C (0x597f299cfc657e2a), -+ UINT64_C (0x5fcb6fab3ad6faec), UINT64_C (0x6c44198c4a475817) -+ }; -+ -+ -+/* Process LEN bytes of BUFFER, accumulating context into CTX. -+ It is assumed that LEN % 128 == 0. */ -+static void -+sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx) -+{ -+ const uint64_t *words = buffer; -+ size_t nwords = len / sizeof (uint64_t); -+ uint64_t a = ctx->H[0]; -+ uint64_t b = ctx->H[1]; -+ uint64_t c = ctx->H[2]; -+ uint64_t d = ctx->H[3]; -+ uint64_t e = ctx->H[4]; -+ uint64_t f = ctx->H[5]; -+ uint64_t g = ctx->H[6]; -+ uint64_t h = ctx->H[7]; -+ -+ /* First increment the byte count. FIPS 180-2 specifies the possible -+ length of the file up to 2^128 bits. Here we only compute the -+ number of bytes. Do a double word increment. */ -+ ctx->total[0] += len; -+ if (ctx->total[0] < len) -+ ++ctx->total[1]; -+ -+ /* Process all bytes in the buffer with 128 bytes in each round of -+ the loop. */ -+ while (nwords > 0) -+ { -+ uint64_t W[80]; -+ uint64_t a_save = a; -+ uint64_t b_save = b; -+ uint64_t c_save = c; -+ uint64_t d_save = d; -+ uint64_t e_save = e; -+ uint64_t f_save = f; -+ uint64_t g_save = g; -+ uint64_t h_save = h; -+ unsigned int t; -+ -+ /* Operators defined in FIPS 180-2:4.1.2. */ -+#define Ch(x, y, z) ((x & y) ^ (~x & z)) -+#define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z)) -+#define S0(x) (CYCLIC (x, 28) ^ CYCLIC (x, 34) ^ CYCLIC (x, 39)) -+#define S1(x) (CYCLIC (x, 14) ^ CYCLIC (x, 18) ^ CYCLIC (x, 41)) -+#define R0(x) (CYCLIC (x, 1) ^ CYCLIC (x, 8) ^ (x >> 7)) -+#define R1(x) (CYCLIC (x, 19) ^ CYCLIC (x, 61) ^ (x >> 6)) -+ -+ /* It is unfortunate that C does not provide an operator for -+ cyclic rotation. Hope the C compiler is smart enough. */ -+#define CYCLIC(w, s) ((w >> s) | (w << (64 - s))) -+ -+ /* Compute the message schedule according to FIPS 180-2:6.3.2 step 2. */ -+ for (t = 0; t < 16; ++t) -+ { -+ W[t] = SWAP (*words); -+ ++words; -+ } -+ for (t = 16; t < 80; ++t) -+ W[t] = R1 (W[t - 2]) + W[t - 7] + R0 (W[t - 15]) + W[t - 16]; -+ -+ /* The actual computation according to FIPS 180-2:6.3.2 step 3. */ -+ for (t = 0; t < 80; ++t) -+ { -+ uint64_t T1 = h + S1 (e) + Ch (e, f, g) + K[t] + W[t]; -+ uint64_t T2 = S0 (a) + Maj (a, b, c); -+ h = g; -+ g = f; -+ f = e; -+ e = d + T1; -+ d = c; -+ c = b; -+ b = a; -+ a = T1 + T2; -+ } -+ -+ /* Add the starting values of the context according to FIPS 180-2:6.3.2 -+ step 4. */ -+ a += a_save; -+ b += b_save; -+ c += c_save; -+ d += d_save; -+ e += e_save; -+ f += f_save; -+ g += g_save; -+ h += h_save; -+ -+ /* Prepare for the next round. */ -+ nwords -= 16; -+ } -+ -+ /* Put checksum in context given as argument. */ -+ ctx->H[0] = a; -+ ctx->H[1] = b; -+ ctx->H[2] = c; -+ ctx->H[3] = d; -+ ctx->H[4] = e; -+ ctx->H[5] = f; -+ ctx->H[6] = g; -+ ctx->H[7] = h; -+} -+ -+ -+/* Initialize structure containing state of computation. -+ (FIPS 180-2:5.3.3) */ -+static void -+sha512_init_ctx (struct sha512_ctx *ctx) -+{ -+ ctx->H[0] = UINT64_C (0x6a09e667f3bcc908); -+ ctx->H[1] = UINT64_C (0xbb67ae8584caa73b); -+ ctx->H[2] = UINT64_C (0x3c6ef372fe94f82b); -+ ctx->H[3] = UINT64_C (0xa54ff53a5f1d36f1); -+ ctx->H[4] = UINT64_C (0x510e527fade682d1); -+ ctx->H[5] = UINT64_C (0x9b05688c2b3e6c1f); -+ ctx->H[6] = UINT64_C (0x1f83d9abfb41bd6b); -+ ctx->H[7] = UINT64_C (0x5be0cd19137e2179); -+ -+ ctx->total[0] = ctx->total[1] = 0; -+ ctx->buflen = 0; -+} -+ -+ -+/* Process the remaining bytes in the internal buffer and the usual -+ prolog according to the standard and write the result to RESBUF. -+ -+ IMPORTANT: On some systems it is required that RESBUF is correctly -+ aligned for a 32 bits value. */ -+static void * -+sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf) -+{ -+ /* Take yet unprocessed bytes into account. */ -+ uint64_t bytes = ctx->buflen; -+ size_t pad; -+ unsigned int i; -+ -+ /* Now count remaining bytes. */ -+ ctx->total[0] += bytes; -+ if (ctx->total[0] < bytes) -+ ++ctx->total[1]; -+ -+ pad = bytes >= 112 ? 128 + 112 - bytes : 112 - bytes; -+ memcpy (&ctx->buffer[bytes], fillbuf, pad); -+ -+ /* Put the 128-bit file length in *bits* at the end of the buffer. */ -+ *(uint64_t *) &ctx->buffer[bytes + pad + 8] = SWAP (ctx->total[0] << 3); -+ *(uint64_t *) &ctx->buffer[bytes + pad] = SWAP ((ctx->total[1] << 3) | -+ (ctx->total[0] >> 61)); -+ -+ /* Process last bytes. */ -+ sha512_process_block (ctx->buffer, bytes + pad + 16, ctx); -+ -+ /* Put result from CTX in first 64 bytes following RESBUF. */ -+ for (i = 0; i < 8; ++i) -+ ((uint64_t *) resbuf)[i] = SWAP (ctx->H[i]); -+ -+ return resbuf; -+} -+ -+ -+static void -+sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx) -+{ -+ /* When we already have some bits in our internal buffer concatenate -+ both inputs first. */ -+ if (ctx->buflen != 0) -+ { -+ size_t left_over = ctx->buflen; -+ size_t add = 256 - left_over > len ? len : 256 - left_over; -+ -+ memcpy (&ctx->buffer[left_over], buffer, add); -+ ctx->buflen += add; -+ -+ if (ctx->buflen > 128) -+ { -+ sha512_process_block (ctx->buffer, ctx->buflen & ~127, ctx); -+ -+ ctx->buflen &= 127; -+ /* The regions in the following copy operation cannot overlap. */ -+ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~127], -+ ctx->buflen); -+ } -+ -+ buffer = (const char *) buffer + add; -+ len -= add; -+ } -+ -+ /* Process available complete blocks. */ -+ if (len >= 128) -+ { -+#if !_STRING_ARCH_unaligned -+/* To check alignment gcc has an appropriate operator. Other -+ compilers don't. */ -+# if __GNUC__ >= 2 -+# define UNALIGNED_P(p) (((uintptr_t) p) % __alignof__ (uint64_t) != 0) -+# else -+# define UNALIGNED_P(p) (((uintptr_t) p) % sizeof (uint64_t) != 0) -+# endif -+ if (UNALIGNED_P (buffer)) -+ while (len > 128) -+ { -+ sha512_process_block (memcpy (ctx->buffer, buffer, 128), 128, -+ ctx); -+ buffer = (const char *) buffer + 128; -+ len -= 128; -+ } -+ else -+#endif -+ { -+ sha512_process_block (buffer, len & ~127, ctx); -+ buffer = (const char *) buffer + (len & ~127); -+ len &= 127; -+ } -+ } -+ -+ /* Move remaining bytes into internal buffer. */ -+ if (len > 0) -+ { -+ size_t left_over = ctx->buflen; -+ -+ memcpy (&ctx->buffer[left_over], buffer, len); -+ left_over += len; -+ if (left_over >= 128) -+ { -+ sha512_process_block (ctx->buffer, 128, ctx); -+ left_over -= 128; -+ memcpy (ctx->buffer, &ctx->buffer[128], left_over); -+ } -+ ctx->buflen = left_over; -+ } -+} -+ -+ -+/* Define our magic string to mark salt for SHA512 "encryption" -+ replacement. */ -+static const char sha512_salt_prefix[] = "$6$"; -+ -+/* Prefix for optional rounds specification. */ -+static const char sha512_rounds_prefix[] = "rounds="; -+ -+/* Maximum salt string length. */ -+#define SALT_LEN_MAX 16 -+/* Default number of rounds if not explicitly specified. */ -+#define ROUNDS_DEFAULT 5000 -+/* Minimum number of rounds. */ -+#define ROUNDS_MIN 1000 -+/* Maximum number of rounds. */ -+#define ROUNDS_MAX 999999999 -+ -+/* Table with characters for base64 transformation. */ -+static const char b64t[64] = -+"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; -+ -+ -+static char * -+sha512_crypt_r (const char *key, const char *salt, char *buffer, int buflen) -+{ -+ unsigned char alt_result[64] -+ __attribute__ ((__aligned__ (__alignof__ (uint64_t)))); -+ unsigned char temp_result[64] -+ __attribute__ ((__aligned__ (__alignof__ (uint64_t)))); -+ struct sha512_ctx ctx; -+ struct sha512_ctx alt_ctx; -+ size_t salt_len; -+ size_t key_len; -+ size_t cnt; -+ char *cp; -+ char *copied_key = NULL; -+ char *copied_salt = NULL; -+ char *p_bytes; -+ char *s_bytes; -+ /* Default number of rounds. */ -+ size_t rounds = ROUNDS_DEFAULT; -+ bool rounds_custom = false; -+ -+ /* Find beginning of salt string. The prefix should normally always -+ be present. Just in case it is not. */ -+ if (strncmp (sha512_salt_prefix, salt, sizeof (sha512_salt_prefix) - 1) == 0) -+ /* Skip salt prefix. */ -+ salt += sizeof (sha512_salt_prefix) - 1; -+ -+ if (strncmp (salt, sha512_rounds_prefix, sizeof (sha512_rounds_prefix) - 1) -+ == 0) -+ { -+ const char *num = salt + sizeof (sha512_rounds_prefix) - 1; -+ char *endp; -+ unsigned long int srounds = (unsigned long)strtol (num, &endp, 10); -+ if (*endp == '$') -+ { -+ salt = endp + 1; -+ rounds = MAX (ROUNDS_MIN, MIN (srounds, ROUNDS_MAX)); -+ rounds_custom = true; -+ } -+ } -+ -+ { -+ char *salt_end; -+ -+ salt_end = strchr (salt, '$'); -+ if (salt_end == NULL) -+ salt_end = strchr (salt, '\0'); -+ salt_len = salt_end - salt; -+ } -+ key_len = strlen (key); -+ -+ if ((key - (char *) 0) % __alignof__ (uint64_t) != 0) -+ { -+ char *tmp = (char *) alloca (key_len + __alignof__ (uint64_t)); -+ key = copied_key = -+ memcpy (tmp + __alignof__ (uint64_t) -+ - (tmp - (char *) 0) % __alignof__ (uint64_t), -+ key, key_len); -+ } -+ -+ if ((salt - (char *) 0) % __alignof__ (uint64_t) != 0) -+ { -+ char *tmp = (char *) alloca (salt_len + __alignof__ (uint64_t)); -+ salt = copied_salt = -+ memcpy (tmp + __alignof__ (uint64_t) -+ - (tmp - (char *) 0) % __alignof__ (uint64_t), -+ salt, salt_len); -+ } -+ -+ /* Prepare for the real work. */ -+ sha512_init_ctx (&ctx); -+ -+ /* Add the key string. */ -+ sha512_process_bytes (key, key_len, &ctx); -+ -+ /* The last part is the salt string. This must be at most 16 -+ characters and it ends at the first `$' character (for -+ compatibility with existing implementations). */ -+ sha512_process_bytes (salt, salt_len, &ctx); -+ -+ -+ /* Compute alternate SHA512 sum with input KEY, SALT, and KEY. The -+ final result will be added to the first context. */ -+ sha512_init_ctx (&alt_ctx); -+ -+ /* Add key. */ -+ sha512_process_bytes (key, key_len, &alt_ctx); -+ -+ /* Add salt. */ -+ sha512_process_bytes (salt, salt_len, &alt_ctx); -+ -+ /* Add key again. */ -+ sha512_process_bytes (key, key_len, &alt_ctx); -+ -+ /* Now get result of this (64 bytes) and add it to the other -+ context. */ -+ sha512_finish_ctx (&alt_ctx, alt_result); -+ -+ /* Add for any character in the key one byte of the alternate sum. */ -+ for (cnt = key_len; cnt > 64; cnt -= 64) -+ sha512_process_bytes (alt_result, 64, &ctx); -+ sha512_process_bytes (alt_result, cnt, &ctx); -+ -+ /* Take the binary representation of the length of the key and for every -+ 1 add the alternate sum, for every 0 the key. */ -+ for (cnt = key_len; cnt > 0; cnt >>= 1) -+ if ((cnt & 1) != 0) -+ sha512_process_bytes (alt_result, 64, &ctx); -+ else -+ sha512_process_bytes (key, key_len, &ctx); -+ -+ /* Create intermediate result. */ -+ sha512_finish_ctx (&ctx, alt_result); -+ -+ /* Start computation of P byte sequence. */ -+ sha512_init_ctx (&alt_ctx); -+ -+ /* For every character in the password add the entire password. */ -+ for (cnt = 0; cnt < key_len; ++cnt) -+ sha512_process_bytes (key, key_len, &alt_ctx); -+ -+ /* Finish the digest. */ -+ sha512_finish_ctx (&alt_ctx, temp_result); -+ -+ /* Create byte sequence P. */ -+ cp = p_bytes = alloca (key_len); -+ for (cnt = key_len; cnt >= 64; cnt -= 64) -+ { -+ memcpy (cp, temp_result, 64); -+ cp += 64; -+ } -+ memcpy (cp, temp_result, cnt); -+ -+ /* Start computation of S byte sequence. */ -+ sha512_init_ctx (&alt_ctx); -+ -+ /* For every character in the password add the entire password. */ -+ for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt) -+ sha512_process_bytes (salt, salt_len, &alt_ctx); -+ -+ /* Finish the digest. */ -+ sha512_finish_ctx (&alt_ctx, temp_result); -+ -+ /* Create byte sequence S. */ -+ cp = s_bytes = alloca (salt_len); -+ for (cnt = salt_len; cnt >= 64; cnt -= 64) -+ { -+ memcpy (cp, temp_result, 64); -+ cp += 64; -+ } -+ memcpy (cp, temp_result, cnt); -+ -+ /* Repeatedly run the collected hash value through SHA512 to burn -+ CPU cycles. */ -+ for (cnt = 0; cnt < rounds; ++cnt) -+ { -+ /* New context. */ -+ sha512_init_ctx (&ctx); -+ -+ /* Add key or last result. */ -+ if ((cnt & 1) != 0) -+ sha512_process_bytes (p_bytes, key_len, &ctx); -+ else -+ sha512_process_bytes (alt_result, 64, &ctx); -+ -+ /* Add salt for numbers not divisible by 3. */ -+ if (cnt % 3 != 0) -+ sha512_process_bytes (s_bytes, salt_len, &ctx); -+ -+ /* Add key for numbers not divisible by 7. */ -+ if (cnt % 7 != 0) -+ sha512_process_bytes (p_bytes, key_len, &ctx); -+ -+ /* Add key or last result. */ -+ if ((cnt & 1) != 0) -+ sha512_process_bytes (alt_result, 64, &ctx); -+ else -+ sha512_process_bytes (p_bytes, key_len, &ctx); -+ -+ /* Create intermediate result. */ -+ sha512_finish_ctx (&ctx, alt_result); -+ } -+ -+ /* Now we can construct the result string. It consists of three -+ parts. */ -+ cp = stpncpy (buffer, sha512_salt_prefix, MAX (0, buflen)); -+ buflen -= sizeof (sha512_salt_prefix) - 1; -+ -+ if (rounds_custom) -+ { -+ char sbuf[64]; -+ sprintf (sbuf, "%s%Lu$", sha512_rounds_prefix, -+ (unsigned long long)rounds); -+ size_t n = strlen (sbuf); -+ memcpy (cp, sbuf, MIN (MAX (0, buflen), n)); -+ cp += n; -+ buflen -= n; -+ } -+ -+ cp = stpncpy (cp, salt, MIN ((size_t) MAX (0, buflen), salt_len)); -+ buflen -= MIN ((size_t) MAX (0, buflen), salt_len); -+ -+ if (buflen > 0) -+ { -+ *cp++ = '$'; -+ --buflen; -+ } -+ -+#define b64_from_24bit(B2, B1, B0, N) \ -+ do { \ -+ unsigned int w = ((B2) << 16) | ((B1) << 8) | (B0); \ -+ int n = (N); \ -+ while (n-- > 0 && buflen > 0) \ -+ { \ -+ *cp++ = b64t[w & 0x3f]; \ -+ --buflen; \ -+ w >>= 6; \ -+ } \ -+ } while (0) -+ -+ b64_from_24bit (alt_result[0], alt_result[21], alt_result[42], 4); -+ b64_from_24bit (alt_result[22], alt_result[43], alt_result[1], 4); -+ b64_from_24bit (alt_result[44], alt_result[2], alt_result[23], 4); -+ b64_from_24bit (alt_result[3], alt_result[24], alt_result[45], 4); -+ b64_from_24bit (alt_result[25], alt_result[46], alt_result[4], 4); -+ b64_from_24bit (alt_result[47], alt_result[5], alt_result[26], 4); -+ b64_from_24bit (alt_result[6], alt_result[27], alt_result[48], 4); -+ b64_from_24bit (alt_result[28], alt_result[49], alt_result[7], 4); -+ b64_from_24bit (alt_result[50], alt_result[8], alt_result[29], 4); -+ b64_from_24bit (alt_result[9], alt_result[30], alt_result[51], 4); -+ b64_from_24bit (alt_result[31], alt_result[52], alt_result[10], 4); -+ b64_from_24bit (alt_result[53], alt_result[11], alt_result[32], 4); -+ b64_from_24bit (alt_result[12], alt_result[33], alt_result[54], 4); -+ b64_from_24bit (alt_result[34], alt_result[55], alt_result[13], 4); -+ b64_from_24bit (alt_result[56], alt_result[14], alt_result[35], 4); -+ b64_from_24bit (alt_result[15], alt_result[36], alt_result[57], 4); -+ b64_from_24bit (alt_result[37], alt_result[58], alt_result[16], 4); -+ b64_from_24bit (alt_result[59], alt_result[17], alt_result[38], 4); -+ b64_from_24bit (alt_result[18], alt_result[39], alt_result[60], 4); -+ b64_from_24bit (alt_result[40], alt_result[61], alt_result[19], 4); -+ b64_from_24bit (alt_result[62], alt_result[20], alt_result[41], 4); -+ b64_from_24bit (0, 0, alt_result[63], 2); -+ -+ if (buflen <= 0) -+ buffer = NULL; -+ else -+ *cp = '\0'; /* Terminate the string. */ -+ -+ /* Clear the buffer for the intermediate result so that people -+ attaching to processes or reading core dumps cannot get any -+ information. We do it in this way to clear correct_words[] -+ inside the SHA512 implementation as well. */ -+ sha512_init_ctx (&ctx); -+ sha512_finish_ctx (&ctx, alt_result); -+ memset (temp_result, '\0', sizeof (temp_result)); -+ memset (p_bytes, '\0', key_len); -+ memset (s_bytes, '\0', salt_len); -+ memset (&ctx, '\0', sizeof (ctx)); -+ memset (&alt_ctx, '\0', sizeof (alt_ctx)); -+ if (copied_key != NULL) -+ memset (copied_key, '\0', key_len); -+ if (copied_salt != NULL) -+ memset (copied_salt, '\0', salt_len); -+ -+ return buffer; -+} -+ -+ -+/* This entry point is equivalent to the `crypt' function in Unix -+ libcs. */ -+char * -+sha512_crypt (const char *key, const char *salt) -+{ -+ /* We don't want to have an arbitrary limit in the size of the -+ password. We can compute an upper bound for the size of the -+ result in advance and so we can prepare the buffer we pass to -+ `sha512_crypt_r'. */ -+ static char *buffer; -+ static int buflen; -+ int needed = (sizeof (sha512_salt_prefix) - 1 -+ + sizeof (sha512_rounds_prefix) + 9 + 1 -+ + strlen (salt) + 1 + 86 + 1); -+ -+ if (buflen < needed) -+ { -+ char *new_buffer = (char *) realloc (buffer, needed); -+ if (new_buffer == NULL) -+ return NULL; -+ -+ buffer = new_buffer; -+ buflen = needed; -+ } -+ -+ return sha512_crypt_r (key, salt, buffer, buflen); -+} -+ -+ -+#ifdef TEST -+static const struct -+{ -+ const char *input; -+ const char result[64]; -+} tests[] = -+ { -+ /* Test vectors from FIPS 180-2: appendix C.1. */ -+ { "abc", -+ "\xdd\xaf\x35\xa1\x93\x61\x7a\xba\xcc\x41\x73\x49\xae\x20\x41\x31" -+ "\x12\xe6\xfa\x4e\x89\xa9\x7e\xa2\x0a\x9e\xee\xe6\x4b\x55\xd3\x9a" -+ "\x21\x92\x99\x2a\x27\x4f\xc1\xa8\x36\xba\x3c\x23\xa3\xfe\xeb\xbd" -+ "\x45\x4d\x44\x23\x64\x3c\xe8\x0e\x2a\x9a\xc9\x4f\xa5\x4c\xa4\x9f" }, -+ /* Test vectors from FIPS 180-2: appendix C.2. */ -+ { "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn" -+ "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", -+ "\x8e\x95\x9b\x75\xda\xe3\x13\xda\x8c\xf4\xf7\x28\x14\xfc\x14\x3f" -+ "\x8f\x77\x79\xc6\xeb\x9f\x7f\xa1\x72\x99\xae\xad\xb6\x88\x90\x18" -+ "\x50\x1d\x28\x9e\x49\x00\xf7\xe4\x33\x1b\x99\xde\xc4\xb5\x43\x3a" -+ "\xc7\xd3\x29\xee\xb6\xdd\x26\x54\x5e\x96\xe5\x5b\x87\x4b\xe9\x09" }, -+ /* Test vectors from the NESSIE project. */ -+ { "", -+ "\xcf\x83\xe1\x35\x7e\xef\xb8\xbd\xf1\x54\x28\x50\xd6\x6d\x80\x07" -+ "\xd6\x20\xe4\x05\x0b\x57\x15\xdc\x83\xf4\xa9\x21\xd3\x6c\xe9\xce" -+ "\x47\xd0\xd1\x3c\x5d\x85\xf2\xb0\xff\x83\x18\xd2\x87\x7e\xec\x2f" -+ "\x63\xb9\x31\xbd\x47\x41\x7a\x81\xa5\x38\x32\x7a\xf9\x27\xda\x3e" }, -+ { "a", -+ "\x1f\x40\xfc\x92\xda\x24\x16\x94\x75\x09\x79\xee\x6c\xf5\x82\xf2" -+ "\xd5\xd7\xd2\x8e\x18\x33\x5d\xe0\x5a\xbc\x54\xd0\x56\x0e\x0f\x53" -+ "\x02\x86\x0c\x65\x2b\xf0\x8d\x56\x02\x52\xaa\x5e\x74\x21\x05\x46" -+ "\xf3\x69\xfb\xbb\xce\x8c\x12\xcf\xc7\x95\x7b\x26\x52\xfe\x9a\x75" }, -+ { "message digest", -+ "\x10\x7d\xbf\x38\x9d\x9e\x9f\x71\xa3\xa9\x5f\x6c\x05\x5b\x92\x51" -+ "\xbc\x52\x68\xc2\xbe\x16\xd6\xc1\x34\x92\xea\x45\xb0\x19\x9f\x33" -+ "\x09\xe1\x64\x55\xab\x1e\x96\x11\x8e\x8a\x90\x5d\x55\x97\xb7\x20" -+ "\x38\xdd\xb3\x72\xa8\x98\x26\x04\x6d\xe6\x66\x87\xbb\x42\x0e\x7c" }, -+ { "abcdefghijklmnopqrstuvwxyz", -+ "\x4d\xbf\xf8\x6c\xc2\xca\x1b\xae\x1e\x16\x46\x8a\x05\xcb\x98\x81" -+ "\xc9\x7f\x17\x53\xbc\xe3\x61\x90\x34\x89\x8f\xaa\x1a\xab\xe4\x29" -+ "\x95\x5a\x1b\xf8\xec\x48\x3d\x74\x21\xfe\x3c\x16\x46\x61\x3a\x59" -+ "\xed\x54\x41\xfb\x0f\x32\x13\x89\xf7\x7f\x48\xa8\x79\xc7\xb1\xf1" }, -+ { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", -+ "\x20\x4a\x8f\xc6\xdd\xa8\x2f\x0a\x0c\xed\x7b\xeb\x8e\x08\xa4\x16" -+ "\x57\xc1\x6e\xf4\x68\xb2\x28\xa8\x27\x9b\xe3\x31\xa7\x03\xc3\x35" -+ "\x96\xfd\x15\xc1\x3b\x1b\x07\xf9\xaa\x1d\x3b\xea\x57\x78\x9c\xa0" -+ "\x31\xad\x85\xc7\xa7\x1d\xd7\x03\x54\xec\x63\x12\x38\xca\x34\x45" }, -+ { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", -+ "\x1e\x07\xbe\x23\xc2\x6a\x86\xea\x37\xea\x81\x0c\x8e\xc7\x80\x93" -+ "\x52\x51\x5a\x97\x0e\x92\x53\xc2\x6f\x53\x6c\xfc\x7a\x99\x96\xc4" -+ "\x5c\x83\x70\x58\x3e\x0a\x78\xfa\x4a\x90\x04\x1d\x71\xa4\xce\xab" -+ "\x74\x23\xf1\x9c\x71\xb9\xd5\xa3\xe0\x12\x49\xf0\xbe\xbd\x58\x94" }, -+ { "123456789012345678901234567890123456789012345678901234567890" -+ "12345678901234567890", -+ "\x72\xec\x1e\xf1\x12\x4a\x45\xb0\x47\xe8\xb7\xc7\x5a\x93\x21\x95" -+ "\x13\x5b\xb6\x1d\xe2\x4e\xc0\xd1\x91\x40\x42\x24\x6e\x0a\xec\x3a" -+ "\x23\x54\xe0\x93\xd7\x6f\x30\x48\xb4\x56\x76\x43\x46\x90\x0c\xb1" -+ "\x30\xd2\xa4\xfd\x5d\xd1\x6a\xbb\x5e\x30\xbc\xb8\x50\xde\xe8\x43" } -+ }; -+#define ntests (sizeof (tests) / sizeof (tests[0])) -+ -+ -+static const struct -+{ -+ const char *salt; -+ const char *input; -+ const char *expected; -+} tests2[] = -+{ -+ { "$6$saltstring", "Hello world!", -+ "$6$saltstring$svn8UoSVapNtMuq1ukKS4tPQd8iKwSMHWjl/O817G3uBnIFNjnQJu" -+ "esI68u4OTLiBFdcbYEdFCoEOfaS35inz1" }, -+ { "$6$rounds=10000$saltstringsaltstring", "Hello world!", -+ "$6$rounds=10000$saltstringsaltst$OW1/O6BYHV6BcXZu8QVeXbDWra3Oeqh0sb" -+ "HbbMCVNSnCM/UrjmM0Dp8vOuZeHBy/YTBmSK6H9qs/y3RnOaw5v." }, -+ { "$6$rounds=5000$toolongsaltstring", "This is just a test", -+ "$6$rounds=5000$toolongsaltstrin$lQ8jolhgVRVhY4b5pZKaysCLi0QBxGoNeKQ" -+ "zQ3glMhwllF7oGDZxUhx1yxdYcz/e1JSbq3y6JMxxl8audkUEm0" }, -+ { "$6$rounds=1400$anotherlongsaltstring", -+ "a very much longer text to encrypt. This one even stretches over more" -+ "than one line.", -+ "$6$rounds=1400$anotherlongsalts$POfYwTEok97VWcjxIiSOjiykti.o/pQs.wP" -+ "vMxQ6Fm7I6IoYN3CmLs66x9t0oSwbtEW7o7UmJEiDwGqd8p4ur1" }, -+ { "$6$rounds=77777$short", -+ "we have a short salt string but not a short password", -+ "$6$rounds=77777$short$WuQyW2YR.hBNpjjRhpYD/ifIw05xdfeEyQoMxIXbkvr0g" -+ "ge1a1x3yRULJ5CCaUeOxFmtlcGZelFl5CxtgfiAc0" }, -+ { "$6$rounds=123456$asaltof16chars..", "a short string", -+ "$6$rounds=123456$asaltof16chars..$BtCwjqMJGx5hrJhZywWvt0RLE8uZ4oPwc" -+ "elCjmw2kSYu.Ec6ycULevoBK25fs2xXgMNrCzIMVcgEJAstJeonj1" }, -+ { "$6$rounds=10$roundstoolow", "the minimum number is still observed", -+ "$6$rounds=1000$roundstoolow$kUMsbe306n21p9R.FRkW3IGn.S9NPN0x50YhH1x" -+ "hLsPuWGsUSklZt58jaTfF4ZEQpyUNGc0dqbpBYYBaHHrsX." }, -+}; -+#define ntests2 (sizeof (tests2) / sizeof (tests2[0])) -+ -+ -+int -+sha512_test (void) -+{ -+ struct sha512_ctx ctx; -+ char sum[64]; -+ int result = 0; -+ int cnt, i; -+ -+ for (cnt = 0; cnt < (int) ntests; ++cnt) -+ { -+ sha512_init_ctx (&ctx); -+ sha512_process_bytes (tests[cnt].input, strlen (tests[cnt].input), &ctx); -+ sha512_finish_ctx (&ctx, sum); -+ if (memcmp (tests[cnt].result, sum, 64) != 0) -+ { -+ prom_printf ("test %d run %d failed\n", cnt, 1); -+ result = 1; -+ } -+ -+ sha512_init_ctx (&ctx); -+ for (i = 0; tests[cnt].input[i] != '\0'; ++i) -+ sha512_process_bytes (&tests[cnt].input[i], 1, &ctx); -+ sha512_finish_ctx (&ctx, sum); -+ if (memcmp (tests[cnt].result, sum, 64) != 0) -+ { -+ prom_printf ("test %d run %d failed\n", cnt, 2); -+ result = 1; -+ } -+ } -+ -+ /* Test vector from FIPS 180-2: appendix C.3. */ -+ char buf[1000]; -+ memset (buf, 'a', sizeof (buf)); -+ sha512_init_ctx (&ctx); -+ for (i = 0; i < 1000; ++i) -+ sha512_process_bytes (buf, sizeof (buf), &ctx); -+ sha512_finish_ctx (&ctx, sum); -+ static const char expected[64] = -+ "\xe7\x18\x48\x3d\x0c\xe7\x69\x64\x4e\x2e\x42\xc7\xbc\x15\xb4\x63" -+ "\x8e\x1f\x98\xb1\x3b\x20\x44\x28\x56\x32\xa8\x03\xaf\xa9\x73\xeb" -+ "\xde\x0f\xf2\x44\x87\x7e\xa6\x0a\x4c\xb0\x43\x2c\xe5\x77\xc3\x1b" -+ "\xeb\x00\x9c\x5c\x2c\x49\xaa\x2e\x4e\xad\xb2\x17\xad\x8c\xc0\x9b"; -+ if (memcmp (expected, sum, 64) != 0) -+ { -+ prom_printf ("test %d failed\n", cnt); -+ result = 1; -+ } -+ -+ for (cnt = 0; cnt < ntests2; ++cnt) -+ { -+ char *cp = sha512_crypt (tests2[cnt].input, tests2[cnt].salt); -+ -+ if (strcmp (cp, tests2[cnt].expected) != 0) -+ { -+ prom_printf ("test %d: expected \"%s\", got \"%s\"\n", -+ cnt, tests2[cnt].expected, cp); -+ result = 1; -+ } -+ } -+ -+ if (result == 0) -+ prom_printf ("all tests OK\n"); -+ -+ return result; -+} -+#endif -diff -purN yaboot-1.3.17.orig/second/yaboot.c yaboot-1.3.17/second/yaboot.c ---- yaboot-1.3.17.orig/second/yaboot.c 2011-10-18 15:11:10.000000000 +1100 -+++ yaboot-1.3.17/second/yaboot.c 2011-10-18 16:07:39.417445978 +1100 -@@ -608,13 +608,17 @@ void check_password(char *str) - if (!strncmp (password, "$1$", 3)) { - if (!check_md5_password((unsigned char*)passwdbuff, (unsigned char*)password)) - return; -+ } else -+#endif /* USE_MD5_PASSWORDS */ -+ if (!strncmp (password, "$5$", 3)) { -+ if (!strcmp (password, sha256_crypt (passwdbuff, password))) -+ return; -+ } else if (!strncmp (password, "$6$", 3)) { -+ if (!strcmp (password, sha512_crypt (passwdbuff, password))) -+ return; - } - else if (!strcmp (password, passwdbuff)) - return; --#else /* !MD5 */ -- if (!strcmp (password, passwdbuff)) -- return; --#endif /* USE_MD5_PASSWORDS */ - if (i < 2) { - prom_sleep(1); - prom_printf ("Incorrect password. Try again."); diff --git a/yaboot.spec b/yaboot.spec deleted file mode 100644 index f68ad62..0000000 --- a/yaboot.spec +++ /dev/null @@ -1,472 +0,0 @@ -Summary: Linux bootloader for Power Macintosh "New World" computers. -Name: yaboot -Version: 1.3.17 -Release: 8%{?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 -Patch28: yaboot-1.3.13-dontwritehome.patch - -# Don't use insecure MD5, use SHA-2 -Patch40: yaboot-sha2.patch - -# Do not use Werror, the compiler in F16/Rawhide is hitting warnings that -# Upstream doesn't see. Bypass them for now. -Patch41: yaboot-1.3.17-no-werror.patch -# When booted from a cdrom the fs_swap would exit with FILE_ERR_BADDEV, -# this causes fs_open to abort too early and breaks booting from DVD -Patch42: yaboot-1.3.17-fs_swap.patch -Patch43: yaboot-1.3.17-link_with_new_e2fsprogs.patch -Patch44: yaboot-1.3.17-link_with_new_e2fsprogs2.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 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 -%patch17 -p1 -%patch18 -p1 -%patch21 -p1 -%patch22 -p1 -%patch28 -p1 -%patch40 -p1 -%patch41 -p1 -%patch42 -p1 -%patch43 -p1 -%patch44 -p1 - -%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 -* Sun Aug 04 2013 Fedora Release Engineering - 1.3.17-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild - -* Fri Feb 15 2013 Fedora Release Engineering - 1.3.17-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild - -* Wed Sep 05 2012 Tony Breeds - 1.3.17-6 -- Add patch to link against *even newer* e2fsprogs. - -* Wed Sep 05 2012 Tony Breeds - 1.3.17-5 -- Add patch from upstream to link with newer e2fsprogs - -* Sun Jul 22 2012 Fedora Release Engineering - 1.3.17-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild - -* Sat Jan 14 2012 Fedora Release Engineering - 1.3.17-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild - -* Mon Oct 19 2011 Tony Breeds - 1.3.17-2 -- Fix fs_swap to not break boot CDs - -* Mon Oct 18 2011 Tony Breeds - 1.3.17-1 -- Update to upstream 1.3.18 release - -* Mon Oct 17 2011 Jiri Skala - 1.3.16-7 -- fixes #746408 - yaboot discards parameters after CAS reboot - -* Mon Sep 26 2011 Tony Breeds - 1.3.16-6 -- Add no-strict-aliasing to YBCFLAGS -- Add detection for PowerVM Firmware. - -* Wed Aug 31 2011 Tony Breeds - 1.3.16-5 -- yaboot-ppc64.patch incorrectly removed the -melfppc32linux from LDFLAGS. DOn't know why this hasn't been a problem 'til now. - -* Thu Aug 11 2011 Tony Breeds - 1.3.16-4 -- truncate memcpy() extract_vendor_options() to avoid clobbering the stack. (closes 729684) - -* Tue Apr 12 2011 Tony Breeds - 1.3.16-3 -- Add fix for failing to link against posix_memalign() (closes 689415) - -* Tue Feb 08 2011 Fedora Release Engineering - 1.3.16-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild - -* Mon Jul 19 2010 Roman Rakus - 1.3.16-1 -- Update to 1.3.16 version - -* Thu Jun 03 2010 Roman Rakus - 1.3.14-34 -- added dependency on e2fsprogs-static package - -* Wed May 26 2010 Roman Rakus - 1.3.14-33 -- Allow yaboot to allocate up to 256MB of memory - -* Wed May 26 2010 Roman Rakus - 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 1.3.14-22 -- SHA2 support - -* Thu Oct 29 2009 Roman Rakus - 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 - 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 - 1.3.14-19 -- Increase TFTP buffer to 32MB - -* Wed Sep 09 2009 Roman Rakus - 1.3.14-18 -- Do not require hfsutils on RHEL 6 - -* Fri Aug 14 2009 Roman Rakus - 1.3.14-17 -- ipv6 support -- don't build debuginfo package - -* Fri Aug 07 2009 Bill Nottingham - 1.3.14-16 -- fix patch file for (#515555) - -* Fri Aug 07 2009 Roman Rakus - 1.3.14-15 -- Fix bad return code in verbose mode (#515555) - -* Mon Jul 27 2009 Fedora Release Engineering - 1.3.14-14 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild - -* Sun Jun 07 2009 David Woodhouse - 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 - 1.3.14-10 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild - -* Thu Jan 22 2009 Josh Boyer - 1.3.14-9 -- Add patch to handle relocatable kernels - -* Thu Nov 27 2008 Roman Rakus - 1.3.14-8 -- Bumped release, so preupgrade is now silent and go through - -* Fri Nov 21 2008 David Woodhouse - 1.3.14-7 -- Fix 'ybin --bootonce' (#471425) -- Fix maximum token length, to fix preupgrade (#471321) - -* Wed Nov 05 2008 Roman Rakus - 1.3.14-6 -- Changed kernel load base address - Resolves: #468492 - -* Mon Aug 11 2008 Roman Rakus - 1.3.14-5 -- Clearing in specfile -- Fixed patches for --fuzz=0 - -* Wed May 28 2008 Tom "spot" Callaway - 1.3.14-4 -- fix license tag - -* Wed Apr 16 2008 Roman Rakus - 1.3.14-3 -- Upstream 1.3.14 - -* Thu Mar 27 2008 David Woodhouse - 1.3.13-11 -- Correct off-by-one error in Amiga partition numbers - -* Thu Mar 27 2008 David Woodhouse - 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 - 1.3.13-9 -- Rebuild for gcc-4.3 - -* Wed Nov 28 2007 David Woodhouse - 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 - 1.3.13-7 -- Add efika.forth for fixing up Efika device-tree - -* Tue Nov 27 2007 David Woodhouse - 1.3.13-6 -- Detect broken bplan firmware and don't add ":0" to block device names - -* Tue Aug 21 2007 David Cantrell - 1.3.13-5 -- Rebuild - -* Thu Nov 16 2006 Paul Nasrat - 1.3.13-4 -- Add support for usb/firewire from Alex Kanavin (#208768) - -* Thu Nov 09 2006 Paul Nasrat - 1.3.13-3 -- Apply addnote patch (#184714) - -* Wed Aug 23 2006 Paul Nasrat - 1.3.13-2 -- Fix ybin with SELinux (#201414) - -* Mon Aug 21 2006 Paul Nasrat - 1.3.13-1 -- Fix multi disk G5 patch for all cases - -* Wed Jul 12 2006 Jesse Keating - 1.3.13-0.18.1 -- rebuild - -* Tue Feb 21 2006 Paul Nasrat - 1.3.13-0.18 -- Drop telnet console patch for now (#182180) - -* Fri Feb 10 2006 Jesse Keating - 1.3.13-0.17.1 -- bump again for double-long bug on ppc(64) - -* Thu Feb 09 2006 Paul Nasrat - 1.3.13-0.17 -- Fix ofpath for multi-disk G5 (#180182) - -* Tue Feb 07 2006 Jesse Keating - 1.3.13-0.16.2 -- rebuilt for new gcc4.1 snapshot and glibc changes - -* Fri Dec 09 2005 Jesse Keating -- rebuilt - -* Wed Sep 14 2005 Jeremy Katz - 1.3.13-0.16 -- fix paths - -* Wed Sep 14 2005 Jeremy Katz - 1.3.13-0.15 -- fix build on ppc64 - -* Wed Sep 14 2005 Paul Nasrat - 1.3.13-0.14 -- New netboot patch handling device=alias: for non network case - -* Tue Sep 13 2005 David Woodhouse - 1.3.13-0.13 -- Print version-release of yaboot - -* Mon Sep 12 2005 Paul Nasrat - 1.3.13-0.12 -- reworking of netboot patch (Nathan Lynch) - -* Sat Aug 20 2005 Paul Nasrat - 1.3.13-0.11 -- drop netboot patch as mac cds fail to load yaboot.conf - -* Wed Aug 17 2005 Paul Nasrat - 1.3.13-0.10 -- No colours on unsupported consoles (eg telnet) -- Improved pSeries netbooting (Nathan Lynch) - -* Sun Aug 14 2005 David Woodhouse - 1.3.13-0.9 -- Try harder to allocate malloc region - -* Thu Aug 11 2005 David Woodhouse - 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 - 1.3.13-0.7 -- Fix error in swraid2 patch -- don't dereference NULL pointer. - -* Tue Aug 9 2005 David Woodhouse - 1.3.13-0.6 -- Fix handling of prom 'read' method, to make Pegasos serial work - -* Tue Aug 9 2005 David Woodhouse - 1.3.13-0.5 -- Fix Pegasos partition hack - -* Tue Aug 9 2005 David Woodhouse - 1.3.13-0.4 -- Make default boot after timeout work again -- Pegasos disagrees about partition numbering - -* Sat Jul 30 2005 David Woodhouse - 1.3.13-0.3 -- Accept config file path on command line -- Make ofpath work on Pegasos - -* Fri Jul 29 2005 David Woodhouse - 1.3.13-0.2 -- Workaround claim bug in Pegasos SmartFirmware -- Handle ext2 boot partition - -* Fri Jul 22 2005 Paul Nasrat - 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 - 1.3.12-9 -- GCC 4 rebuild - -* Wed Feb 02 2005 Paul Nasrat - 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 - 1.3.12-7 -- Add yaboot.conf as ghost - -* Sat Jul 10 2004 Paul Nasrat - 1.3.12-6 -- Rebuild - -* Sat Jul 10 2004 Paul Nasrat - 1.3.12-5 -- Added hfsutils requires for pmac - -* Wed Jun 23 2004 David Woodhouse - 1.3.12-4 -- Increase TFTP load buffer size to 8MiB. - -* Fri Jun 18 2004 Jeremy Katz - 1.3.12-3 -- s/Copyright/License/ -- fix build with gcc 3.4 - -* Tue Jun 15 2004 Elliot Lee -- rebuilt - -* Mon May 24 2004 Paul Nasrat 1.3.12-1 -- update to 1.3.12 - -* Tue Apr 20 2004 David Woodhouse 1.3.10-10 -- make yabootconfig use parted if available - -* Fri Feb 13 2004 Elliot Lee -- rebuilt - -* Fri Aug 22 2003 Elliot Lee 1.3.10-8 -- Build for rawhide - -* Fri Jun 20 2003 Jeremy Katz 1.3.10-7 -- allow passing configfile name to yabootconfig with -C - -* Wed Jun 18 2003 Jeremy Katz 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 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 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 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 1.3.10-2 -- add patch from Peter Bergner to add support for - ppc64 initrds (warning: breaks ppc32 initrds) - -* Thu Mar 20 2003 Jeremy Katz 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 1.3.8-1 -- Update to new version - -* Wed Dec 11 2002 Tim Powers 1.3.6-1b.2rh -- rebuild -- added ExclusiveArch - -* Wed Mar 06 2002 Dan Burcaw -- modify for YDL 2.2 - -* Fri Dec 07 2001 Dan Burcaw -- update to 1.3.6 - -* Sat Oct 06 2001 Dan Burcaw -- update to 1.3.4 - -* Sun Sep 30 2001 Dan Burcaw -- updated to yaboot 1.3.3 - -* Tue Sep 25 2001 Dan Burcaw -- add makefile patch - -* Sun Sep 23 2001 Dan Burcaw -- update to 1.3.1 -- obsoletes ybin - -* Thu Aug 08 2001 Dan Burcaw -- updated to 1.2.3 per Ben H's urgent announcement -- removed obsoleted patches - -* Tue Jan 16 2001 Hollis Blanchard -- 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 -- 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 -- modified for YDL - -* Wed Jan 18 2000 Tom Rini -- created