From d322c6e63a9d3b7d9a8388f0393b3930ce3cfe79 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Tue, 29 Sep 2009 07:27:27 +0000 Subject: [PATCH 01/16] Initialize branch F-12 for yaboot --- branch | 1 + 1 file changed, 1 insertion(+) create mode 100644 branch diff --git a/branch b/branch new file mode 100644 index 0000000..06de2d2 --- /dev/null +++ b/branch @@ -0,0 +1 @@ +F-12 From 539cb978487ed9bb0f716d3ef2ce101018a41656 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Mon, 19 Oct 2009 00:35:12 +0000 Subject: [PATCH 02/16] Only require hfsutils on fedora and rhel <= 5 --- yaboot.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/yaboot.spec b/yaboot.spec index 92f7c50..03b7722 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 @@ -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%{?fedora} || 0%{?rhel} < 6 Requires: hfsutils %endif BuildRequires: e2fsprogs-devel @@ -118,6 +118,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Mon Oct 19 2009 Tony Breed - 1.3.14-20 +- Only require hfsutils on fedora and rhel <= 5 + * Thu Sep 09 2009 Roman Rakus - 1.3.14-19 - Increase TFTP buffer to 32MB From 5d9054cda7b712535d6c7ce0dbeab11c1ecd11c2 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Mon, 19 Oct 2009 00:45:31 +0000 Subject: [PATCH 03/16] Explicitly build a DEBUG=1 version of yaboot to aid in debugging --- yaboot.spec | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/yaboot.spec b/yaboot.spec index 03b7722..2a4d8c0 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 @@ -85,6 +85,9 @@ yaboot can also bootload IBM pSeries machines. %patch36 -p1 -b .ipv6 %build +make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1 +cp -a second/yaboot{,.debug} +make clean make VERSIONEXTRA='\ (Red Hat %version-%release)' %install @@ -108,6 +111,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,6 +122,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Mon Oct 19 2009 Tony Breed - 1.3.14-21 +- Explicitly build a DEBUG=1 version of yaboot to aid in debugging + * Mon Oct 19 2009 Tony Breed - 1.3.14-20 - Only require hfsutils on fedora and rhel <= 5 From 4ac3509d2a92ae35739188864c0f69d713b9484a Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Mon, 19 Oct 2009 01:03:26 +0000 Subject: [PATCH 04/16] Actually install the newly built yaboot.debug ... Ooops :D --- yaboot.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/yaboot.spec b/yaboot.spec index 2a4d8c0..517ad47 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -96,6 +96,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 From 5b95bf30b39c320f249a93221b497f8e92a03dde Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Mon, 19 Oct 2009 01:12:43 +0000 Subject: [PATCH 05/16] 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). --- ...ot-1.3.14-dont_of_open_native_partitions.patch | 15 +++++++++++++++ yaboot.spec | 9 ++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) 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 517ad47..357a0eb 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 @@ -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 @@ -83,6 +85,7 @@ 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 @@ -123,6 +126,10 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Mon Oct 19 2009 Tony Breed - 1.3.14-20 +- 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). + * Mon Oct 19 2009 Tony Breed - 1.3.14-21 - Explicitly build a DEBUG=1 version of yaboot to aid in debugging From ab7103ae3689ded669c3555d11158a4ccbe15244 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Mon, 19 Oct 2009 01:14:10 +0000 Subject: [PATCH 06/16] Fix stupid copy-n-paste error --- yaboot.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yaboot.spec b/yaboot.spec index 357a0eb..9cd6539 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -126,7 +126,7 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog -* Mon Oct 19 2009 Tony Breed - 1.3.14-20 +* Mon Oct 19 2009 Tony Breed - 1.3.14-22 - 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). From 1fc50adbf4e15bdf9d895c775cb10f881c91913b Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Thu, 29 Oct 2009 10:58:41 +0000 Subject: [PATCH 07/16] 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 9cd6539..5b817ab 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: 23%{?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-23 +- 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 Tony Breed - 1.3.14-22 - 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). From a30d45513356a9800b27869bd3a8f8ac460db21d Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 26 Nov 2009 01:12:02 +0000 Subject: [PATCH 08/16] 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 efe1194777430ca5c37187f6cf552da934a2277b Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Tue, 1 Dec 2009 15:00:26 +0000 Subject: [PATCH 09/16] Changes for merge review --- yaboot.spec | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/yaboot.spec b/yaboot.spec index 5b817ab..1c6de04 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,7 +1,7 @@ -Summary: Linux bootloader for Power Macintosh "New World" computers. +Summary: Linux bootloader for Power Macintosh "New World" computers Name: yaboot Version: 1.3.14 -Release: 23%{?dist} +Release: 24%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -44,8 +44,7 @@ Patch38: yaboot-1.3.14-better_netboot2.patch Patch39: yaboot-1.3.14-move_kernel.patch URL: http://yaboot.ozlabs.org/ -BuildRoot: %{_tmppath}/%{name}-root -Obsoletes: ybin +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) ExclusiveArch: ppc # hfsutils will not be in RHEL6. @@ -96,18 +95,24 @@ yaboot can also bootload IBM pSeries machines. %patch39 -p1 -b .movekernel %build +iconv -f ISO88592 -t utf-8 -o doc/yaboot-howto.de.try.sgml \ + doc/yaboot-howto.de.sgml && mv -f doc/yaboot-howto.de.try.sgml \ + doc/yaboot-howto.de.sgml make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1 cp -a second/yaboot{,.debug} make clean make VERSIONEXTRA='\ (Red Hat %version-%release)' %install +rm -rf $RPM_BUILD_ROOT %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/ +rm -f $RPM_BUILD_ROOT/usr/share/doc/yaboot-1.3.14/README.man.patch +rm -f $RPM_BUILD_ROOT/usr/share/doc/yaboot-1.3.14/Makefile %clean rm -rf $RPM_BUILD_ROOT @@ -120,6 +125,7 @@ rm -rf $RPM_BUILD_ROOT /sbin/ybin /sbin/yabootconfig /sbin/mkofboot +/usr/lib/yaboot/ /usr/lib/yaboot/addnote /usr/lib/yaboot/ofboot /usr/lib/yaboot/yaboot @@ -134,6 +140,14 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Tue Dec 01 2009 Roman Rakus - 1.3.14-24 +- Fixed summary, buildroot +- Converted doc/yaboot-howto.de.sgml to utf8 +- Clear buildroot before install +- Removed README.man.patch and Makefile from doc dir +- Own /usr/lib/yaboot/ +- Fixes (#226661) + * Thu Oct 29 2009 Roman Rakus - 1.3.14-23 - When netbooting "clobber" the LOAD_BUFFER and move the kernel into it to make room for RTAS (#530330) From 03b7dc8be1cef81e647e63635e7d1248ab82b797 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Thu, 3 Dec 2009 10:15:31 +0000 Subject: [PATCH 10/16] fixed defattr --- yaboot.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yaboot.spec b/yaboot.spec index 1c6de04..1ba8ce7 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -118,7 +118,7 @@ rm -f $RPM_BUILD_ROOT/usr/share/doc/yaboot-1.3.14/Makefile rm -rf $RPM_BUILD_ROOT %files -%defattr(-,root,root) +%defattr(-,root,root,-) %doc COPYING README* doc/* /boot/efika.forth /sbin/ofpath @@ -146,6 +146,7 @@ rm -rf $RPM_BUILD_ROOT - Clear buildroot before install - Removed README.man.patch and Makefile from doc dir - Own /usr/lib/yaboot/ +- defattr(-,root,root,-) - Fixes (#226661) * Thu Oct 29 2009 Roman Rakus - 1.3.14-23 From ef2bfac0e664963d4d9b340cd9a79930fd4c0b93 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Tue, 12 Jan 2010 12:09:15 +0000 Subject: [PATCH 11/16] Use correct upstream source tarball. Patch changed for that source --- sources | 2 +- yaboot-1.3.14-better_netboot.patch | 168 +++++++++++++--------------- yaboot-1.3.14-better_netboot2.patch | 62 +++++----- yaboot-1.3.14-ipv6.patch | 32 +++--- yaboot.spec | 10 +- 5 files changed, 129 insertions(+), 145 deletions(-) diff --git a/sources b/sources index de9d08c..1dd3877 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -dd346812667ab3818248c9784fe8e38e yaboot-1.3.14.tar.gz +9b1246c474eeb37f61081ad762563b35 yaboot-1.3.14.tar.gz diff --git a/yaboot-1.3.14-better_netboot.patch b/yaboot-1.3.14-better_netboot.patch index f06fce5..2e29eec 100644 --- a/yaboot-1.3.14-better_netboot.patch +++ b/yaboot-1.3.14-better_netboot.patch @@ -1,7 +1,6 @@ -diff --git a/include/debug.h b/include/debug.h -index 47a9cce..dcac25a 100644 ---- a/include/debug.h -+++ b/include/debug.h +diff -up yaboot-1.3.14/include/debug.h.netboot yaboot-1.3.14/include/debug.h +--- yaboot-1.3.14/include/debug.h.netboot 2007-08-17 16:29:26.000000000 +0200 ++++ yaboot-1.3.14/include/debug.h 2010-01-12 12:14:00.000000000 +0100 @@ -32,8 +32,8 @@ prom_printf( fmt, ## args );\ } @@ -13,10 +12,9 @@ index 47a9cce..dcac25a 100644 # 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 +diff -up yaboot-1.3.14/include/file.h.netboot yaboot-1.3.14/include/file.h +--- yaboot-1.3.14/include/file.h.netboot 2007-08-17 16:29:26.000000000 +0200 ++++ yaboot-1.3.14/include/file.h 2010-01-12 12:14:00.000000000 +0100 @@ -39,7 +39,13 @@ struct boot_file_t; struct boot_fspec_t { char* dev; /* OF device path */ @@ -40,10 +38,9 @@ index b6b9fe5..ca76a52 100644 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 +diff -up yaboot-1.3.14/include/fs.h.netboot yaboot-1.3.14/include/fs.h +--- yaboot-1.3.14/include/fs.h.netboot 2007-08-17 16:29:26.000000000 +0200 ++++ yaboot-1.3.14/include/fs.h 2010-01-12 12:14:00.000000000 +0100 @@ -27,14 +27,14 @@ #include "file.h" @@ -71,10 +68,9 @@ index d960fea..1ff7986 100644 + 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 +diff -up yaboot-1.3.14/second/file.c.netboot yaboot-1.3.14/second/file.c +--- yaboot-1.3.14/second/file.c.netboot 2007-08-17 16:29:26.000000000 +0200 ++++ yaboot-1.3.14/second/file.c 2010-01-12 12:14:00.000000000 +0100 @@ -38,19 +38,56 @@ extern char bootdevice[]; @@ -139,7 +135,7 @@ index 4054dd1..e429272 100644 /* 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) +@@ -77,46 +114,110 @@ static char *netdev_path_to_filename(con if (tmp && tmp > args) args = tmp + strlen("rarp"); @@ -153,15 +149,15 @@ index 4054dd1..e429272 100644 + str = malloc(strlen(args) + 1); /*long enough to hold all strings */ + if (!str) + return 0; ++ ++ if (args[-1] != ':') ++ args++; /* If comma(,) is not immediately followed by ':' then go past the , */ - 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 @@ -255,16 +251,16 @@ index 4054dd1..e429272 100644 +extract_netboot_args(char *imagepath, struct boot_fspec_t *result) +{ + int ret; ++ ++ DEBUG_F("imagepath = %s\n", imagepath); - strncpy(filename, args, len); - filename[len - 1] = '\0'; -+ DEBUG_F("imagepath = %s\n", imagepath); ++ if (!imagepath) ++ return 1; - DEBUG_F("filename = %s\n", filename); - return filename; -+ if (!imagepath) -+ return 1; -+ + ret = extract_ipv4_args(imagepath, result); + ret |= extract_netinfo_args(result); + @@ -280,7 +276,7 @@ index 4054dd1..e429272 100644 } static char *netdev_path_to_dev(const char *path) -@@ -163,6 +264,10 @@ static char *netdev_path_to_dev(const char *path) +@@ -163,6 +264,10 @@ static char *netdev_path_to_dev(const ch - enet:,/tftpboot/vmlinux - enet:bootp - enet:0 @@ -291,7 +287,7 @@ index 4054dd1..e429272 100644 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, +@@ -179,6 +284,9 @@ parse_device_path(char *imagepath, char char *defdev = NULL; int device_kind = -1; @@ -301,7 +297,7 @@ index 4054dd1..e429272 100644 result->dev = NULL; result->part = -1; result->file = NULL; -@@ -247,10 +355,15 @@ parse_device_path(char *imagepath, char *defdevice, int defpart, +@@ -247,10 +355,15 @@ parse_device_path(char *imagepath, char } if (device_kind == FILE_DEVICE_NET) { @@ -320,7 +316,7 @@ index 4054dd1..e429272 100644 if (!defdev) result->dev = netdev_path_to_dev(ipath); -@@ -287,15 +400,14 @@ parse_device_path(char *imagepath, char *defdevice, int defpart, +@@ -287,15 +400,14 @@ parse_device_path(char *imagepath, char static int file_block_open( struct boot_file_t* file, @@ -338,7 +334,7 @@ index 4054dd1..e429272 100644 found = NULL; #if DEBUG -@@ -308,7 +420,7 @@ file_block_open( struct boot_file_t* file, +@@ -308,7 +420,7 @@ file_block_open( struct boot_file_t* fil DEBUG_F("number: %02d, start: 0x%08lx, length: 0x%08lx\n", p->part_number, p->part_start, p->part_size ); if (partition == -1) { @@ -347,7 +343,7 @@ index 4054dd1..e429272 100644 if (file->fs == NULL || fserrorno != FILE_ERR_OK) continue; else { -@@ -328,7 +440,7 @@ file_block_open( struct boot_file_t* file, +@@ -328,7 +440,7 @@ file_block_open( struct boot_file_t* fil * cases, let OF figure out a default partition. */ DEBUG_F( "Using OF defaults.. (found = %p)\n", found ); @@ -380,7 +376,7 @@ index 4054dd1..e429272 100644 { int result; -@@ -399,10 +509,10 @@ int open_file(const struct boot_fspec_t* spec, struct boot_file_t* file) +@@ -399,10 +509,10 @@ int open_file(const struct boot_fspec_t* switch(file->device_kind) { case FILE_DEVICE_BLOCK: DEBUG_F("device is a block device\n"); @@ -393,11 +389,10 @@ index 4054dd1..e429272 100644 } 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 */ +diff -up yaboot-1.3.14/second/fs.c.netboot yaboot-1.3.14/second/fs.c +--- yaboot-1.3.14/second/fs.c.netboot 2007-08-17 16:29:26.000000000 +0200 ++++ yaboot-1.3.14/second/fs.c 2010-01-12 12:14:00.000000000 +0100 +@@ -56,12 +56,12 @@ const struct fs_t *fs_of = &of_filesyste const struct fs_t *fs_of_netboot = &of_net_filesystem; /* needed by file.c */ const struct fs_t * @@ -413,11 +408,10 @@ index 2ae7066..b748bed 100644 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; +diff -up yaboot-1.3.14/second/fs_ext2.c.netboot yaboot-1.3.14/second/fs_ext2.c +--- yaboot-1.3.14/second/fs_ext2.c.netboot 2010-01-12 12:14:00.000000000 +0100 ++++ yaboot-1.3.14/second/fs_ext2.c 2010-01-12 12:14:00.000000000 +0100 +@@ -45,9 +45,8 @@ typedef int FILE; #include "ext2fs/ext2fs.h" static int ext2_open( struct boot_file_t* file, @@ -428,7 +422,7 @@ index 67571f2..d24450d 100644 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,...) +@@ -122,14 +121,15 @@ void com_err (const char *a, long i, con static int ext2_open( struct boot_file_t* file, @@ -446,10 +440,9 @@ index 67571f2..d24450d 100644 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 +diff -up yaboot-1.3.14/second/fs_iso.c.netboot yaboot-1.3.14/second/fs_iso.c +--- yaboot-1.3.14/second/fs_iso.c.netboot 2007-08-17 16:29:26.000000000 +0200 ++++ yaboot-1.3.14/second/fs_iso.c 2010-01-12 12:14:00.000000000 +0100 @@ -29,9 +29,8 @@ #include "errors.h" @@ -472,16 +465,12 @@ index 303790f..33d43b3 100644 { 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 +diff -up yaboot-1.3.14/second/fs_of.c.netboot yaboot-1.3.14/second/fs_of.c +--- yaboot-1.3.14/second/fs_of.c.netboot 2007-08-17 16:29:26.000000000 +0200 ++++ yaboot-1.3.14/second/fs_of.c 2010-01-12 12:17:30.000000000 +0100 +@@ -48,15 +48,15 @@ + /* this cannot be safely increased any further */ + #define LOAD_BUFFER_SIZE 0x600000 -static int of_open(struct boot_file_t* file, const char* dev_name, - struct partition_t* part, const char* file_name); @@ -499,7 +488,7 @@ index 95c131d..5c7dd9b 100644 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 = +@@ -80,8 +80,8 @@ struct fs_t of_net_filesystem = }; static int @@ -510,7 +499,7 @@ index 95c131d..5c7dd9b 100644 { static char buffer[1024]; char *filename; -@@ -89,7 +89,7 @@ of_open(struct boot_file_t* file, const char* dev_name, +@@ -90,7 +90,7 @@ of_open(struct boot_file_t* file, const DEBUG_ENTER; DEBUG_OPEN; @@ -519,7 +508,7 @@ index 95c131d..5c7dd9b 100644 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, +@@ -102,10 +102,10 @@ of_open(struct boot_file_t* file, const sprintf(pn, "%02d", part->part_number); strcat(buffer, pn); } @@ -532,7 +521,7 @@ index 95c131d..5c7dd9b 100644 for (p = filename; *p; p++) if (*p == '/') *p = '\\'; -@@ -131,25 +131,47 @@ of_open(struct boot_file_t* file, const char* dev_name, +@@ -132,25 +132,47 @@ of_open(struct boot_file_t* file, const } static int @@ -589,11 +578,10 @@ index 95c131d..5c7dd9b 100644 } 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 @@ +diff -up yaboot-1.3.14/second/fs_reiserfs.c.netboot yaboot-1.3.14/second/fs_reiserfs.c +--- yaboot-1.3.14/second/fs_reiserfs.c.netboot 2007-08-17 16:29:26.000000000 +0200 ++++ yaboot-1.3.14/second/fs_reiserfs.c 2010-01-12 12:14:00.000000000 +0100 +@@ -32,8 +32,8 @@ #include "reiserfs/reiserfs.h" /* Exported in struct fs_t */ @@ -604,7 +592,7 @@ index 238f523..4b83a7a 100644 static int reiserfs_read( struct boot_file_t *file, unsigned int size, void *buffer ); -@@ -63,10 +63,12 @@ int errnum; +@@ -62,10 +62,12 @@ int errnum; static int @@ -619,7 +607,7 @@ index 238f523..4b83a7a 100644 DEBUG_ENTER; DEBUG_OPEN; -@@ -74,7 +76,7 @@ reiserfs_open( struct boot_file_t *file, const char *dev_name, +@@ -73,7 +75,7 @@ reiserfs_open( struct boot_file_t *file, memset( INFO, 0, sizeof(struct reiserfs_state) ); INFO->file = file; @@ -628,11 +616,10 @@ index 238f523..4b83a7a 100644 { 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); +diff -up yaboot-1.3.14/second/fs_xfs.c.netboot yaboot-1.3.14/second/fs_xfs.c +--- yaboot-1.3.14/second/fs_xfs.c.netboot 2007-08-17 16:29:26.000000000 +0200 ++++ yaboot-1.3.14/second/fs_xfs.c 2010-01-12 12:19:15.000000000 +0100 +@@ -38,8 +38,8 @@ int xfs_read_data (char *buf, int len); int xfs_dir (char *dirname); /* Exported in struct fs_t */ @@ -643,7 +630,7 @@ index 04d6cf3..e27d857 100644 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; +@@ -58,8 +58,8 @@ uint64_t partition_offset; int errnum; static int @@ -654,21 +641,19 @@ index 04d6cf3..e27d857 100644 { static char buffer[1024]; -@@ -78,11 +78,11 @@ xfs_open(struct boot_file_t *file, const char *dev_name, +@@ -77,9 +77,9 @@ xfs_open(struct boot_file_t *file, const 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 */ +- sprintf(buffer, "%s:%d", dev_name, 0); /* 0 is full disk in OF */ ++ sprintf(buffer, "%s:%d", fspec->dev, 0); /* 0 is full disk in 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, +@@ -102,8 +102,8 @@ xfs_open(struct boot_file_t *file, const return FILE_ERR_BAD_FSYS; } @@ -679,7 +664,7 @@ index 04d6cf3..e27d857 100644 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, +@@ -113,7 +113,7 @@ xfs_open(struct boot_file_t *file, const return errnum; } @@ -688,11 +673,10 @@ index 04d6cf3..e27d857 100644 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) +diff -up yaboot-1.3.14/second/yaboot.c.netboot yaboot-1.3.14/second/yaboot.c +--- yaboot-1.3.14/second/yaboot.c.netboot 2010-01-12 12:14:00.000000000 +0100 ++++ yaboot-1.3.14/second/yaboot.c 2010-01-12 12:22:45.000000000 +0100 +@@ -290,6 +290,7 @@ void print_message_file(char *filename) } strncpy(msgpath, filename, sizeof(msgpath)); @@ -700,7 +684,7 @@ index 3db7b4f..8a74d7a 100644 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) +@@ -918,6 +919,7 @@ int get_params(struct boot_param_t* para if (!label && password) check_password ("To boot a custom image you must enter the password."); @@ -708,15 +692,15 @@ index 3db7b4f..8a74d7a 100644 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 */ +@@ -931,6 +933,7 @@ int get_params(struct boot_param_t* para + if (p && *p) { + DEBUG_F("Parsing initrd path <%s>\n", p); + strncpy(initrdpath, p, 1024); ++ 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) +@@ -941,6 +944,7 @@ int get_params(struct boot_param_t* para if (p && *p) { DEBUG_F("Parsing sysmap path <%s>\n", p); strncpy(sysmappath, p, 1024); diff --git a/yaboot-1.3.14-better_netboot2.patch b/yaboot-1.3.14-better_netboot2.patch index 1561e88..0f8264e 100644 --- a/yaboot-1.3.14-better_netboot2.patch +++ b/yaboot-1.3.14-better_netboot2.patch @@ -1,6 +1,6 @@ -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 +diff -up yaboot-1.3.14/include/file.h.netboot2 yaboot-1.3.14/include/file.h +--- yaboot-1.3.14/include/file.h.netboot2 2010-01-12 12:27:00.000000000 +0100 ++++ yaboot-1.3.14/include/file.h 2010-01-12 12:27:00.000000000 +0100 @@ -45,6 +45,7 @@ struct boot_fspec_t { char* giaddr; /* Gateway address */ char* bootp_retries; /* Bootp retries */ @@ -9,10 +9,10 @@ diff -purN yaboot-1.3.14.orig/include/file.h yaboot-1.3.14/include/file.h 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 { +diff -up yaboot-1.3.14/include/prom.h.netboot2 yaboot-1.3.14/include/prom.h +--- yaboot-1.3.14/include/prom.h.netboot2 2010-01-12 12:27:00.000000000 +0100 ++++ yaboot-1.3.14/include/prom.h 2010-01-12 12:27:00.000000000 +0100 +@@ -149,7 +149,7 @@ struct bootp_packet { unsigned char chaddr[16]; unsigned char sname[64]; unsigned char file[128]; @@ -21,9 +21,9 @@ diff -purN yaboot-1.3.14.orig/include/prom.h yaboot-1.3.14/include/prom.h }; 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 +diff -up yaboot-1.3.14/second/cfg.c.netboot2 yaboot-1.3.14/second/cfg.c +--- yaboot-1.3.14/second/cfg.c.netboot2 2010-01-12 12:27:00.000000000 +0100 ++++ yaboot-1.3.14/second/cfg.c 2010-01-12 12:27:00.000000000 +0100 @@ -597,6 +597,9 @@ int cfg_set_default_by_mac (char *mac_ad char * label = NULL; int haslabel = 0; @@ -34,9 +34,9 @@ diff -purN yaboot-1.3.14.orig/second/cfg.c yaboot-1.3.14/second/cfg.c /* 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 +diff -up yaboot-1.3.14/second/file.c.netboot2 yaboot-1.3.14/second/file.c +--- yaboot-1.3.14/second/file.c.netboot2 2010-01-12 12:27:00.000000000 +0100 ++++ yaboot-1.3.14/second/file.c 2010-01-12 12:27:00.000000000 +0100 @@ -51,6 +51,42 @@ ipv4_to_str(__u32 ip) return buf; } @@ -202,19 +202,19 @@ diff -purN yaboot-1.3.14.orig/second/file.c yaboot-1.3.14/second/file.c /* 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 +diff -up yaboot-1.3.14/second/fs_of.c.netboot2 yaboot-1.3.14/second/fs_of.c +--- yaboot-1.3.14/second/fs_of.c.netboot2 2010-01-12 12:27:00.000000000 +0100 ++++ yaboot-1.3.14/second/fs_of.c 2010-01-12 12:28:06.000000000 +0100 @@ -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 +-#define LOAD_BUFFER_POS 0x600000 ++#define LOAD_BUFFER_POS 0x000000 + /* this cannot be safely increased any further */ + #define LOAD_BUFFER_SIZE 0x600000 - static int of_open(struct boot_file_t* file, -@@ -137,6 +137,7 @@ of_net_open(struct boot_file_t* file, +@@ -138,6 +138,7 @@ of_net_open(struct boot_file_t* file, static char buffer[1024]; char *filename = NULL; char *p; @@ -222,7 +222,7 @@ diff -purN yaboot-1.3.14.orig/second/fs_of.c yaboot-1.3.14/second/fs_of.c DEBUG_ENTER; DEBUG_OPEN; -@@ -148,34 +149,47 @@ of_net_open(struct boot_file_t* file, +@@ -149,34 +150,47 @@ of_net_open(struct boot_file_t* file, *p = '\\'; } @@ -286,10 +286,10 @@ diff -purN yaboot-1.3.14.orig/second/fs_of.c yaboot-1.3.14/second/fs_of.c } 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 ( +diff -up yaboot-1.3.14/second/prom.c.netboot2 yaboot-1.3.14/second/prom.c +--- yaboot-1.3.14/second/prom.c.netboot2 2010-01-12 12:27:00.000000000 +0100 ++++ yaboot-1.3.14/second/prom.c 2010-01-12 12:27:00.000000000 +0100 +@@ -666,6 +666,10 @@ struct bootp_packet * prom_get_netinfo ( void *bootp_response = NULL; char *propname; struct bootp_packet *packet; @@ -300,7 +300,7 @@ diff -purN yaboot-1.3.14.orig/second/prom.c yaboot-1.3.14/second/prom.c 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 ( +@@ -690,7 +694,7 @@ struct bootp_packet * prom_get_netinfo ( if (size <= 0) return NULL; @@ -309,10 +309,10 @@ diff -purN yaboot-1.3.14.orig/second/prom.c yaboot-1.3.14/second/prom.c 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 +diff -up yaboot-1.3.14/second/yaboot.c.netboot2 yaboot-1.3.14/second/yaboot.c +--- yaboot-1.3.14/second/yaboot.c.netboot2 2010-01-12 12:27:00.000000000 +0100 ++++ yaboot-1.3.14/second/yaboot.c 2010-01-12 12:27:00.000000000 +0100 +@@ -461,6 +461,10 @@ static int load_my_config_file(struct bo int minlen; packet = prom_get_netinfo(); diff --git a/yaboot-1.3.14-ipv6.patch b/yaboot-1.3.14-ipv6.patch index 0ec08be..04f750b 100644 --- a/yaboot-1.3.14-ipv6.patch +++ b/yaboot-1.3.14-ipv6.patch @@ -1,6 +1,6 @@ -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 +diff -up yaboot-1.3.14/include/file.h.ipv6 yaboot-1.3.14/include/file.h +--- yaboot-1.3.14/include/file.h.ipv6 2010-01-12 12:24:04.000000000 +0100 ++++ yaboot-1.3.14/include/file.h 2010-01-12 12:24:04.000000000 +0100 @@ -46,6 +46,11 @@ struct boot_fspec_t { char* bootp_retries; /* Bootp retries */ char* tftp_retries; /* TFTP retries */ @@ -13,20 +13,20 @@ diff -up yaboot-1.3.14/include/file.h.ipv6_4 yaboot-1.3.14/include/file.h }; 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 +diff -up yaboot-1.3.14/include/prom.h.ipv6 yaboot-1.3.14/include/prom.h +--- yaboot-1.3.14/include/prom.h.ipv6 2007-08-17 16:29:26.000000000 +0200 ++++ yaboot-1.3.14/include/prom.h 2010-01-12 12:25:38.000000000 +0100 @@ -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 + + struct prom_args; + typedef int (*prom_entry)(struct prom_args *); +diff -up yaboot-1.3.14/second/file.c.ipv6 yaboot-1.3.14/second/file.c +--- yaboot-1.3.14/second/file.c.ipv6 2010-01-12 12:24:04.000000000 +0100 ++++ yaboot-1.3.14/second/file.c 2010-01-12 12:24:04.000000000 +0100 @@ -193,6 +193,50 @@ extract_netinfo_args(struct boot_fspec_t } @@ -103,10 +103,10 @@ diff -up yaboot-1.3.14/second/file.c.ipv6_4 yaboot-1.3.14/second/file.c 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, +diff -up yaboot-1.3.14/second/fs_of.c.ipv6 yaboot-1.3.14/second/fs_of.c +--- yaboot-1.3.14/second/fs_of.c.ipv6 2010-01-12 12:24:04.000000000 +0100 ++++ yaboot-1.3.14/second/fs_of.c 2010-01-12 12:24:04.000000000 +0100 +@@ -149,14 +149,18 @@ of_net_open(struct boot_file_t* file, *p = '\\'; } diff --git a/yaboot.spec b/yaboot.spec index 1ba8ce7..bd2e39b 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: 24%{?dist} +Release: 25%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -19,9 +19,7 @@ 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 -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 @@ -80,9 +78,7 @@ yaboot can also bootload IBM pSeries machines. %patch18 -p1 -b .ext2 %patch21 -p1 -b .pegasos-serial %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 @@ -140,6 +136,10 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Tue Jan 12 2010 rrakus@redhat.com 1.3.14-25 +- Use correct upstream source tarball +- Patch changed for that source + * Tue Dec 01 2009 Roman Rakus - 1.3.14-24 - Fixed summary, buildroot - Converted doc/yaboot-howto.de.sgml to utf8 From 2d651616e597cac7ae859da881dbc388d7402ea8 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Fri, 5 Feb 2010 03:38:07 +0000 Subject: [PATCH 12/16] I "fat fingered" my own name and the copy'n'pasted it. Let's correct that. --- yaboot.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yaboot.spec b/yaboot.spec index bd2e39b..4b4cd17 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -154,14 +154,14 @@ rm -rf $RPM_BUILD_ROOT room for RTAS (#530330) - Adding better netboot support more work on (#458438) -* Mon Oct 19 2009 Tony Breed - 1.3.14-22 +* Mon Oct 19 2009 Tony Breeds - 1.3.14-22 - 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). -* Mon Oct 19 2009 Tony Breed - 1.3.14-21 +* Mon Oct 19 2009 Tony Breeds - 1.3.14-21 - Explicitly build a DEBUG=1 version of yaboot to aid in debugging -* Mon Oct 19 2009 Tony Breed - 1.3.14-20 +* Mon Oct 19 2009 Tony Breeds - 1.3.14-20 - Only require hfsutils on fedora and rhel <= 5 * Thu Sep 09 2009 Roman Rakus - 1.3.14-19 From 9611627dbf241c2c4f4752311d584b7cc68c81a9 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Tue, 9 Feb 2010 03:12:02 +0000 Subject: [PATCH 13/16] Recently it was discovered that the yaboot-1.3.14.tar.gz in the look asside cache was infact 37578220a9120f0a7770b0c6c6eae046ce72fc93 from the upstream yaboot git repo. This commit includes the patches from the yaboot-1.3.14 tag to that commit and corrects local Fedora patches to match. These additional patches have been well tested in Fedora. --- yaboot-1.3.14-better_netboot.patch | 129 ++--- yaboot-1.3.14-better_netboot2.patch | 63 ++- yaboot-1.3.14-gitpatches.patch | 725 ++++++++++++++++++++++++++++ yaboot.spec | 9 +- 4 files changed, 827 insertions(+), 99 deletions(-) create mode 100644 yaboot-1.3.14-gitpatches.patch diff --git a/yaboot-1.3.14-better_netboot.patch b/yaboot-1.3.14-better_netboot.patch index 2e29eec..0ed9afd 100644 --- a/yaboot-1.3.14-better_netboot.patch +++ b/yaboot-1.3.14-better_netboot.patch @@ -1,6 +1,6 @@ -diff -up yaboot-1.3.14/include/debug.h.netboot yaboot-1.3.14/include/debug.h ---- yaboot-1.3.14/include/debug.h.netboot 2007-08-17 16:29:26.000000000 +0200 -+++ yaboot-1.3.14/include/debug.h 2010-01-12 12:14:00.000000000 +0100 +diff -pur yaboot-1.3.14.orig/include/debug.h yaboot-1.3.14/include/debug.h +--- yaboot-1.3.14.orig/include/debug.h 2007-08-18 00:29:26.000000000 +1000 ++++ yaboot-1.3.14/include/debug.h 2010-02-08 13:07:31.954223039 +1100 @@ -32,8 +32,8 @@ prom_printf( fmt, ## args );\ } @@ -12,9 +12,9 @@ diff -up yaboot-1.3.14/include/debug.h.netboot yaboot-1.3.14/include/debug.h # define DEBUG_SLEEP prom_sleep(3) #else #define DEBUG_ENTER -diff -up yaboot-1.3.14/include/file.h.netboot yaboot-1.3.14/include/file.h ---- yaboot-1.3.14/include/file.h.netboot 2007-08-17 16:29:26.000000000 +0200 -+++ yaboot-1.3.14/include/file.h 2010-01-12 12:14:00.000000000 +0100 +diff -pur yaboot-1.3.14.orig/include/file.h yaboot-1.3.14/include/file.h +--- yaboot-1.3.14.orig/include/file.h 2007-08-18 00:29:26.000000000 +1000 ++++ yaboot-1.3.14/include/file.h 2010-02-08 13:07:31.955220185 +1100 @@ -39,7 +39,13 @@ struct boot_file_t; struct boot_fspec_t { char* dev; /* OF device path */ @@ -38,9 +38,9 @@ diff -up yaboot-1.3.14/include/file.h.netboot yaboot-1.3.14/include/file.h struct boot_file_t* file); extern int -diff -up yaboot-1.3.14/include/fs.h.netboot yaboot-1.3.14/include/fs.h ---- yaboot-1.3.14/include/fs.h.netboot 2007-08-17 16:29:26.000000000 +0200 -+++ yaboot-1.3.14/include/fs.h 2010-01-12 12:14:00.000000000 +0100 +diff -pur yaboot-1.3.14.orig/include/fs.h yaboot-1.3.14/include/fs.h +--- yaboot-1.3.14.orig/include/fs.h 2007-08-18 00:29:26.000000000 +1000 ++++ yaboot-1.3.14/include/fs.h 2010-02-08 13:07:31.958474719 +1100 @@ -27,14 +27,14 @@ #include "file.h" @@ -68,9 +68,9 @@ diff -up yaboot-1.3.14/include/fs.h.netboot yaboot-1.3.14/include/fs.h + struct partition_t *part, struct boot_fspec_t *fspec); #endif -diff -up yaboot-1.3.14/second/file.c.netboot yaboot-1.3.14/second/file.c ---- yaboot-1.3.14/second/file.c.netboot 2007-08-17 16:29:26.000000000 +0200 -+++ yaboot-1.3.14/second/file.c 2010-01-12 12:14:00.000000000 +0100 +diff -pur yaboot-1.3.14.orig/second/file.c yaboot-1.3.14/second/file.c +--- yaboot-1.3.14.orig/second/file.c 2007-08-18 00:29:26.000000000 +1000 ++++ yaboot-1.3.14/second/file.c 2010-02-08 13:07:31.960189430 +1100 @@ -38,19 +38,56 @@ extern char bootdevice[]; @@ -389,9 +389,9 @@ diff -up yaboot-1.3.14/second/file.c.netboot yaboot-1.3.14/second/file.c } return 0; } -diff -up yaboot-1.3.14/second/fs.c.netboot yaboot-1.3.14/second/fs.c ---- yaboot-1.3.14/second/fs.c.netboot 2007-08-17 16:29:26.000000000 +0200 -+++ yaboot-1.3.14/second/fs.c 2010-01-12 12:14:00.000000000 +0100 +diff -pur yaboot-1.3.14.orig/second/fs.c yaboot-1.3.14/second/fs.c +--- yaboot-1.3.14.orig/second/fs.c 2007-08-18 00:29:26.000000000 +1000 ++++ yaboot-1.3.14/second/fs.c 2010-02-08 13:07:31.963189318 +1100 @@ -56,12 +56,12 @@ const struct fs_t *fs_of = &of_filesyste const struct fs_t *fs_of_netboot = &of_net_filesystem; /* needed by file.c */ @@ -408,10 +408,10 @@ diff -up yaboot-1.3.14/second/fs.c.netboot yaboot-1.3.14/second/fs.c break; return *fs; -diff -up yaboot-1.3.14/second/fs_ext2.c.netboot yaboot-1.3.14/second/fs_ext2.c ---- yaboot-1.3.14/second/fs_ext2.c.netboot 2010-01-12 12:14:00.000000000 +0100 -+++ yaboot-1.3.14/second/fs_ext2.c 2010-01-12 12:14:00.000000000 +0100 -@@ -45,9 +45,8 @@ typedef int FILE; +diff -pur yaboot-1.3.14.orig/second/fs_ext2.c yaboot-1.3.14/second/fs_ext2.c +--- yaboot-1.3.14.orig/second/fs_ext2.c 2010-02-08 13:06:21.083438946 +1100 ++++ yaboot-1.3.14/second/fs_ext2.c 2010-02-08 13:07:31.964188908 +1100 +@@ -46,9 +46,8 @@ typedef int FILE; #include "ext2fs/ext2fs.h" static int ext2_open( struct boot_file_t* file, @@ -422,7 +422,7 @@ diff -up yaboot-1.3.14/second/fs_ext2.c.netboot yaboot-1.3.14/second/fs_ext2.c static int ext2_read( struct boot_file_t* file, unsigned int size, void* buffer); -@@ -122,14 +121,15 @@ void com_err (const char *a, long i, con +@@ -123,14 +122,15 @@ void com_err (const char *a, long i, con static int ext2_open( struct boot_file_t* file, @@ -440,9 +440,9 @@ diff -up yaboot-1.3.14/second/fs_ext2.c.netboot yaboot-1.3.14/second/fs_ext2.c DEBUG_ENTER; DEBUG_OPEN; -diff -up yaboot-1.3.14/second/fs_iso.c.netboot yaboot-1.3.14/second/fs_iso.c ---- yaboot-1.3.14/second/fs_iso.c.netboot 2007-08-17 16:29:26.000000000 +0200 -+++ yaboot-1.3.14/second/fs_iso.c 2010-01-12 12:14:00.000000000 +0100 +diff -pur yaboot-1.3.14.orig/second/fs_iso.c yaboot-1.3.14/second/fs_iso.c +--- yaboot-1.3.14.orig/second/fs_iso.c 2007-08-18 00:29:26.000000000 +1000 ++++ yaboot-1.3.14/second/fs_iso.c 2010-02-08 13:07:31.965185705 +1100 @@ -29,9 +29,8 @@ #include "errors.h" @@ -465,17 +465,20 @@ diff -up yaboot-1.3.14/second/fs_iso.c.netboot yaboot-1.3.14/second/fs_iso.c { return FILE_ERR_BAD_FSYS; } -diff -up yaboot-1.3.14/second/fs_of.c.netboot yaboot-1.3.14/second/fs_of.c ---- yaboot-1.3.14/second/fs_of.c.netboot 2007-08-17 16:29:26.000000000 +0200 -+++ yaboot-1.3.14/second/fs_of.c 2010-01-12 12:17:30.000000000 +0100 -@@ -48,15 +48,15 @@ - /* this cannot be safely increased any further */ - #define LOAD_BUFFER_SIZE 0x600000 +diff -pur 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 2010-02-08 13:06:21.058435316 +1100 ++++ yaboot-1.3.14/second/fs_of.c 2010-02-08 13:08:27.845210705 +1100 +@@ -45,17 +45,17 @@ + #include "debug.h" + + #define LOAD_BUFFER_POS 0x00000000 +-#define LOAD_BUFFER_SIZE 0x01000000 ++#define LOAD_BUFFER_SIZE 0x02000000 -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); ++ 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); @@ -484,11 +487,11 @@ diff -up yaboot-1.3.14/second/fs_of.c.netboot yaboot-1.3.14/second/fs_of.c -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); ++ 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); -@@ -80,8 +80,8 @@ struct fs_t of_net_filesystem = +@@ -79,8 +79,8 @@ struct fs_t of_net_filesystem = }; static int @@ -499,7 +502,7 @@ diff -up yaboot-1.3.14/second/fs_of.c.netboot yaboot-1.3.14/second/fs_of.c { static char buffer[1024]; char *filename; -@@ -90,7 +90,7 @@ of_open(struct boot_file_t* file, const +@@ -89,7 +89,7 @@ of_open(struct boot_file_t* file, const DEBUG_ENTER; DEBUG_OPEN; @@ -508,7 +511,7 @@ diff -up yaboot-1.3.14/second/fs_of.c.netboot yaboot-1.3.14/second/fs_of.c strcat(buffer, ":"); if (part) { if (part->sys_ind == LINUX_RAID) { -@@ -102,10 +102,10 @@ of_open(struct boot_file_t* file, const +@@ -101,10 +101,10 @@ of_open(struct boot_file_t* file, const sprintf(pn, "%02d", part->part_number); strcat(buffer, pn); } @@ -521,7 +524,7 @@ diff -up yaboot-1.3.14/second/fs_of.c.netboot yaboot-1.3.14/second/fs_of.c for (p = filename; *p; p++) if (*p == '/') *p = '\\'; -@@ -132,25 +132,47 @@ of_open(struct boot_file_t* file, const +@@ -131,25 +131,47 @@ of_open(struct boot_file_t* file, const } static int @@ -578,10 +581,10 @@ diff -up yaboot-1.3.14/second/fs_of.c.netboot yaboot-1.3.14/second/fs_of.c } DEBUG_F("Opening: \"%s\"\n", buffer); -diff -up yaboot-1.3.14/second/fs_reiserfs.c.netboot yaboot-1.3.14/second/fs_reiserfs.c ---- yaboot-1.3.14/second/fs_reiserfs.c.netboot 2007-08-17 16:29:26.000000000 +0200 -+++ yaboot-1.3.14/second/fs_reiserfs.c 2010-01-12 12:14:00.000000000 +0100 -@@ -32,8 +32,8 @@ +diff -pur yaboot-1.3.14.orig/second/fs_reiserfs.c yaboot-1.3.14/second/fs_reiserfs.c +--- yaboot-1.3.14.orig/second/fs_reiserfs.c 2010-02-08 13:06:21.058435316 +1100 ++++ yaboot-1.3.14/second/fs_reiserfs.c 2010-02-08 13:07:31.970189661 +1100 +@@ -33,8 +33,8 @@ #include "reiserfs/reiserfs.h" /* Exported in struct fs_t */ @@ -592,7 +595,7 @@ diff -up yaboot-1.3.14/second/fs_reiserfs.c.netboot yaboot-1.3.14/second/fs_reis static int reiserfs_read( struct boot_file_t *file, unsigned int size, void *buffer ); -@@ -62,10 +62,12 @@ int errnum; +@@ -63,10 +63,12 @@ int errnum; static int @@ -607,7 +610,7 @@ diff -up yaboot-1.3.14/second/fs_reiserfs.c.netboot yaboot-1.3.14/second/fs_reis DEBUG_ENTER; DEBUG_OPEN; -@@ -73,7 +75,7 @@ reiserfs_open( struct boot_file_t *file, +@@ -74,7 +76,7 @@ reiserfs_open( struct boot_file_t *file, memset( INFO, 0, sizeof(struct reiserfs_state) ); INFO->file = file; @@ -616,10 +619,10 @@ diff -up yaboot-1.3.14/second/fs_reiserfs.c.netboot yaboot-1.3.14/second/fs_reis { DEBUG_F( "Determining offset for partition %d\n", part->part_number ); INFO->partition_offset = ((uint64_t)part->part_start) * part->blocksize; -diff -up yaboot-1.3.14/second/fs_xfs.c.netboot yaboot-1.3.14/second/fs_xfs.c ---- yaboot-1.3.14/second/fs_xfs.c.netboot 2007-08-17 16:29:26.000000000 +0200 -+++ yaboot-1.3.14/second/fs_xfs.c 2010-01-12 12:19:15.000000000 +0100 -@@ -38,8 +38,8 @@ int xfs_read_data (char *buf, int len); +diff -pur yaboot-1.3.14.orig/second/fs_xfs.c yaboot-1.3.14/second/fs_xfs.c +--- yaboot-1.3.14.orig/second/fs_xfs.c 2010-02-08 13:06:21.059432320 +1100 ++++ yaboot-1.3.14/second/fs_xfs.c 2010-02-08 13:07:31.972189749 +1100 +@@ -39,8 +39,8 @@ int xfs_read_data (char *buf, int len); int xfs_dir (char *dirname); /* Exported in struct fs_t */ @@ -630,7 +633,7 @@ diff -up yaboot-1.3.14/second/fs_xfs.c.netboot yaboot-1.3.14/second/fs_xfs.c 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); -@@ -58,8 +58,8 @@ uint64_t partition_offset; +@@ -59,8 +59,8 @@ uint64_t partition_offset; int errnum; static int @@ -641,19 +644,21 @@ diff -up yaboot-1.3.14/second/fs_xfs.c.netboot yaboot-1.3.14/second/fs_xfs.c { static char buffer[1024]; -@@ -77,9 +77,9 @@ xfs_open(struct boot_file_t *file, const +@@ -78,11 +78,11 @@ 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 */ -+ sprintf(buffer, "%s:%d", fspec->dev, 0); /* 0 is full disk in OF */ +- 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) -@@ -102,8 +102,8 @@ xfs_open(struct boot_file_t *file, const +@@ -105,8 +105,8 @@ xfs_open(struct boot_file_t *file, const return FILE_ERR_BAD_FSYS; } @@ -664,7 +669,7 @@ diff -up yaboot-1.3.14/second/fs_xfs.c.netboot yaboot-1.3.14/second/fs_xfs.c if(!xfs_dir(buffer)) { DEBUG_F("xfs_dir() failed. errnum = %d\n", errnum); -@@ -113,7 +113,7 @@ xfs_open(struct boot_file_t *file, const +@@ -116,7 +116,7 @@ xfs_open(struct boot_file_t *file, const return errnum; } @@ -673,10 +678,10 @@ diff -up yaboot-1.3.14/second/fs_xfs.c.netboot yaboot-1.3.14/second/fs_xfs.c DEBUG_LEAVE(FILE_ERR_OK); return FILE_ERR_OK; -diff -up yaboot-1.3.14/second/yaboot.c.netboot yaboot-1.3.14/second/yaboot.c ---- yaboot-1.3.14/second/yaboot.c.netboot 2010-01-12 12:14:00.000000000 +0100 -+++ yaboot-1.3.14/second/yaboot.c 2010-01-12 12:22:45.000000000 +0100 -@@ -290,6 +290,7 @@ void print_message_file(char *filename) +diff -pur yaboot-1.3.14.orig/second/yaboot.c yaboot-1.3.14/second/yaboot.c +--- yaboot-1.3.14.orig/second/yaboot.c 2010-02-08 13:06:21.115436698 +1100 ++++ yaboot-1.3.14/second/yaboot.c 2010-02-08 13:07:31.975188101 +1100 +@@ -300,6 +300,7 @@ void print_message_file(char *filename) } strncpy(msgpath, filename, sizeof(msgpath)); @@ -684,7 +689,7 @@ diff -up yaboot-1.3.14/second/yaboot.c.netboot yaboot-1.3.14/second/yaboot.c if (!parse_device_path(msgpath, defdev, defpart, "/etc/yaboot.msg", &msgfile)) { prom_printf("%s: Unable to parse\n", msgpath); goto done; -@@ -918,6 +919,7 @@ int get_params(struct boot_param_t* para +@@ -988,6 +989,7 @@ int get_params(struct boot_param_t* para if (!label && password) check_password ("To boot a custom image you must enter the password."); @@ -692,15 +697,15 @@ diff -up yaboot-1.3.14/second/yaboot.c.netboot yaboot-1.3.14/second/yaboot.c if (!parse_device_path(imagepath, defdevice, defpart, "/vmlinux", ¶ms->kernel)) { prom_printf("%s: Unable to parse\n", imagepath); -@@ -931,6 +933,7 @@ int get_params(struct boot_param_t* para - if (p && *p) { - DEBUG_F("Parsing initrd path <%s>\n", p); - strncpy(initrdpath, p, 1024); -+ params->rd = boot; /* Copy all the original paramters */ +@@ -1009,6 +1011,7 @@ int get_params(struct boot_param_t* para + 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); -@@ -941,6 +944,7 @@ int get_params(struct boot_param_t* para +@@ -1019,6 +1022,7 @@ int get_params(struct boot_param_t* para if (p && *p) { DEBUG_F("Parsing sysmap path <%s>\n", p); strncpy(sysmappath, p, 1024); diff --git a/yaboot-1.3.14-better_netboot2.patch b/yaboot-1.3.14-better_netboot2.patch index 0f8264e..a3bb0f3 100644 --- a/yaboot-1.3.14-better_netboot2.patch +++ b/yaboot-1.3.14-better_netboot2.patch @@ -1,6 +1,6 @@ -diff -up yaboot-1.3.14/include/file.h.netboot2 yaboot-1.3.14/include/file.h ---- yaboot-1.3.14/include/file.h.netboot2 2010-01-12 12:27:00.000000000 +0100 -+++ yaboot-1.3.14/include/file.h 2010-01-12 12:27:00.000000000 +0100 +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 */ @@ -9,10 +9,10 @@ diff -up yaboot-1.3.14/include/file.h.netboot2 yaboot-1.3.14/include/file.h char* addl_params; /* copy all additional parameters */ /* Following fields are used only in ipv6 format */ -diff -up yaboot-1.3.14/include/prom.h.netboot2 yaboot-1.3.14/include/prom.h ---- yaboot-1.3.14/include/prom.h.netboot2 2010-01-12 12:27:00.000000000 +0100 -+++ yaboot-1.3.14/include/prom.h 2010-01-12 12:27:00.000000000 +0100 -@@ -149,7 +149,7 @@ struct bootp_packet { +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]; @@ -21,9 +21,9 @@ diff -up yaboot-1.3.14/include/prom.h.netboot2 yaboot-1.3.14/include/prom.h }; struct bootp_packet * prom_get_netinfo (void); -diff -up yaboot-1.3.14/second/cfg.c.netboot2 yaboot-1.3.14/second/cfg.c ---- yaboot-1.3.14/second/cfg.c.netboot2 2010-01-12 12:27:00.000000000 +0100 -+++ yaboot-1.3.14/second/cfg.c 2010-01-12 12:27:00.000000000 +0100 +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; @@ -34,9 +34,9 @@ diff -up yaboot-1.3.14/second/cfg.c.netboot2 yaboot-1.3.14/second/cfg.c /* 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 -up yaboot-1.3.14/second/file.c.netboot2 yaboot-1.3.14/second/file.c ---- yaboot-1.3.14/second/file.c.netboot2 2010-01-12 12:27:00.000000000 +0100 -+++ yaboot-1.3.14/second/file.c 2010-01-12 12:27:00.000000000 +0100 +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; } @@ -202,19 +202,10 @@ diff -up yaboot-1.3.14/second/file.c.netboot2 yaboot-1.3.14/second/file.c /* 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 -up yaboot-1.3.14/second/fs_of.c.netboot2 yaboot-1.3.14/second/fs_of.c ---- yaboot-1.3.14/second/fs_of.c.netboot2 2010-01-12 12:27:00.000000000 +0100 -+++ yaboot-1.3.14/second/fs_of.c 2010-01-12 12:28:06.000000000 +0100 -@@ -44,7 +44,7 @@ - #include "errors.h" - #include "debug.h" - --#define LOAD_BUFFER_POS 0x600000 -+#define LOAD_BUFFER_POS 0x000000 - /* this cannot be safely increased any further */ - #define LOAD_BUFFER_SIZE 0x600000 - -@@ -138,6 +138,7 @@ of_net_open(struct boot_file_t* file, +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 +@@ -137,6 +137,7 @@ of_net_open(struct boot_file_t* file, static char buffer[1024]; char *filename = NULL; char *p; @@ -222,7 +213,7 @@ diff -up yaboot-1.3.14/second/fs_of.c.netboot2 yaboot-1.3.14/second/fs_of.c DEBUG_ENTER; DEBUG_OPEN; -@@ -149,34 +150,47 @@ of_net_open(struct boot_file_t* file, +@@ -148,34 +149,47 @@ of_net_open(struct boot_file_t* file, *p = '\\'; } @@ -286,10 +277,10 @@ diff -up yaboot-1.3.14/second/fs_of.c.netboot2 yaboot-1.3.14/second/fs_of.c } DEBUG_F("Opening: \"%s\"\n", buffer); -diff -up yaboot-1.3.14/second/prom.c.netboot2 yaboot-1.3.14/second/prom.c ---- yaboot-1.3.14/second/prom.c.netboot2 2010-01-12 12:27:00.000000000 +0100 -+++ yaboot-1.3.14/second/prom.c 2010-01-12 12:27:00.000000000 +0100 -@@ -666,6 +666,10 @@ struct bootp_packet * prom_get_netinfo ( +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; @@ -300,7 +291,7 @@ diff -up yaboot-1.3.14/second/prom.c.netboot2 yaboot-1.3.14/second/prom.c int i = 0, size, offset = 0; prom_handle chosen; #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -@@ -690,7 +694,7 @@ struct bootp_packet * prom_get_netinfo ( +@@ -709,7 +713,7 @@ struct bootp_packet * prom_get_netinfo ( if (size <= 0) return NULL; @@ -309,10 +300,10 @@ diff -up yaboot-1.3.14/second/prom.c.netboot2 yaboot-1.3.14/second/prom.c prom_printf("Malformed %s property?\n", propname); return NULL; } -diff -up yaboot-1.3.14/second/yaboot.c.netboot2 yaboot-1.3.14/second/yaboot.c ---- yaboot-1.3.14/second/yaboot.c.netboot2 2010-01-12 12:27:00.000000000 +0100 -+++ yaboot-1.3.14/second/yaboot.c 2010-01-12 12:27:00.000000000 +0100 -@@ -461,6 +461,10 @@ static int load_my_config_file(struct bo +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(); diff --git a/yaboot-1.3.14-gitpatches.patch b/yaboot-1.3.14-gitpatches.patch new file mode 100644 index 0000000..6ccd918 --- /dev/null +++ b/yaboot-1.3.14-gitpatches.patch @@ -0,0 +1,725 @@ +commit 37578220a9120f0a7770b0c6c6eae046ce72fc93 +Author: David Woodhouse +Date: Fri Mar 28 00:04:02 2008 +0000 + + Pegasos and partition numbering + + The whole bplan partition numbering thing is a clusterfuck, but it + shouldn't be as crappy as it is. + + We can _cope_ with the fact that firmware is broken and has an + off-by-one in its partition numbering. All we need to do in yaboot is + add 1 to the partition numbers we infer from in /chosen/boot-device, if + we detect that we're on an afflicted machine. That's all we need to do, + and all we ever _should_ have done. And is already in yaboot. Yaboot + does its own block device handling, including partitions, and doesn't + ever care about the firmware's problems (in that respect, at least). + + It doesn't affect the installer at _all_, because the installer can't + set up the firmware's boot-device anyway and it has to be done by hand. + All it affects is the release notes telling the user how to make it + bootable. + + Unfortunately, we didn't make it that simple when we first supported the + Pegasos. For reasons which aren't entirely clear to me, we ended up with + Amiga partition table support in yaboot with the _same_ off-by-one + error, to match the firmware. And thus we have hacks in the installer to + use amiga partitions for Pegasos, and to cope with the off-by-one crap. + + It's only after avoiding all this crap purely by accident on Efika, by + using DOS partition tables, that I realise how stupid I was to blindly + copy the crap that other people were doing, and to believe that Pegasos + would only work with Amiga partition tables. + + I'd like to get rid of the off-by-one bug in yaboot's Amiga partition + handling. At the moment, our simple 'if bplan, partition++' in + yaboot_main() is wrong when we have Amiga partitions, although it's fine + for other partition types. + + Actually, I'd also like to make that same increment conditional on + !conf_given, so that if someone specifies 'conf=hd:1,/yaboot.conf' on + the command line, that partition number _isn't_ incremented. + + So any time you see a proper path specified as 'dev:part,/path/name' you + know it's a real one with proper partition numbers. Remember, the bplan + firmware doesn't allow that form, and takes a space between the + 'dev:part' bit and the filename: + boot hd:0 /yaboot/yaboot conf=hd:1,/yaboot/yaboot.conf + + Fixing the off-by-one bug in the Amiga partition handling means that + upgrades might break. I suppose we could have a 'noamigaoffbyone' + configuration option which all newly-written yaboot.conf files would + have, which controls this behaviour. But to be honest I just don't think + it's worth it. + +commit 0c0a18b7a1a6b44963da4469d21428e76f9c2b30 +Author: Mike Wolf +Date: Tue Jan 15 14:33:51 2008 -0600 + + use public interface to detect CAS reboots (take 2) + + This is the second pass of this patch. The fw variable name is changed + to use ibm,client-architecture-support-reboot field which is already present + in the firmware. Please disregard the previous patch. + + The firmware field used to detect CAS reboots (ibm,fw-nbr-reboots) is + really a private field that could change without warning. A new field + ibm,#reconfig-reboots will be added as a public interface intended to + be used for this detection. The patch will first check for + ibm,client-architecture-support-reboot if that is not found it will see + if ibm,fw-nbr-reboots is present and will use that instead. + + ------- + +commit 526b77920b050e1e37e842e8def4a5e7fb04cee6 +Author: Paul Nasrat +Date: Fri Jan 4 13:00:19 2008 +0000 + + The CAS (Client-Architecture Support) call tells firmware what capabilities the + OS has. These capabilities result in different modes which the device-tree is + configured in, as well as what processor capabilities are presented. So, if + the capabilities are different from what was previously booted, firmware has to + reboot to reconfigure the device-tree. The second boot will have the updated + device-tree and we can boot as normal. + + When this firmware initiated reboot occurs yaboot will now boot the same kernel + as the previous boot attempt with no action by the user needed. I have + successfully booted on POWER5 and POWER6 machines using various levels of the + kernel. + + Patch from: Mike Wolf + +commit f843e296a197cc94c0e0f80d49a67dc71c6785a2 +Author: Paul Nasrat +Date: Thu Jan 3 19:21:44 2008 +0000 + + Revert "The attached patch adds support for writing the nvram using the nvram" + + This reverts commit ac8fbd5ad52b43b820973f1828a29f85bed13a1d. + +commit 50b58606fb2d11aa6548d1fec606275c33a930c7 +Author: Paul Nasrat +Date: Thu Jan 3 19:21:22 2008 +0000 + + Revert "Fix shell syntax" + + This reverts commit 24679e706305e0910f181a9640b8b88a30662d03. + +commit 24679e706305e0910f181a9640b8b88a30662d03 +Author: Paul Nasrat +Date: Thu Jan 3 19:07:50 2008 +0000 + + Fix shell syntax + +commit ac8fbd5ad52b43b820973f1828a29f85bed13a1d +Author: Paul Nasrat +Date: Tue Dec 4 08:43:32 2007 +0000 + + The attached patch adds support for writing the nvram using the nvram + utility from the new powerpc-utils pkg from IBM; it also simplify a bit + the code. + + Patch from: Emanuele Giaquinta (exg@gentoo.org) + +commit 131e44d7e0bf592eaa8214e684fef38bf654410a +Author: Paul Nasrat +Date: Mon Dec 3 14:21:11 2007 +0000 + + Force build to be ppc32 + +commit ff0e80c9b39b18a907d1f1ffb8f836b13af4ebb1 +Author: Paul Nasrat +Date: Mon Dec 3 14:14:42 2007 +0000 + + Fix typo + +commit 66ffb9d32d2acb3613594ef492d341b5bacf02e5 +Author: Paul Nasrat +Date: Mon Dec 3 14:13:54 2007 +0000 + + Fix typo in patch porting + +commit 082b8310e3f92ea8da0b7011549bd86c9fd4ce95 +Author: Paul Nasrat +Date: Mon Dec 3 14:05:48 2007 +0000 + + Fix partition numbering handling with bplan firmware + Patch based on Fedora patch by dwmw2@infradead.org + +commit afaf577190536fe8e15fb5b2ed8372dbda82e7b1 +Author: Paul Nasrat +Date: Mon Dec 3 13:17:33 2007 +0000 + + Try harder to allocate malloc region + Patch from dwmw2@infradead.org + +commit 752525a7feb16e02b759ca7811fc9a0276712c3d +Author: Paul Nasrat +Date: Mon Dec 3 13:13:23 2007 +0000 + + Print version-release of yaboot + Patch from dwmw2@infradead.org + +commit c8b04c614770870d75825c19bcd4729cc779b84a +Author: Paul Nasrat +Date: Mon Dec 3 13:04:19 2007 +0000 + + Let prom_claim_chunk do the work for tftp images to support larger images. + + Patch from: Leonardo Rangel + +commit b6b70ff54df42432d58801ac69ba24e7d95e0426 +Author: Paul Nasrat +Date: Mon Dec 3 12:41:42 2007 +0000 + + These patch provides the function of load a alternative initrd file + specified by the user via Yaboot prompt. To load the new file, just use + the "initrd=" command. The could include + all the directory path to the file. + + Using only the "initrd" command, Yaboot will load the default kernel + specified in the configuration file and the initrd file specified by the + user. The user can, also, specify an initrd file to any other label of + the configuration file, just adding the "initrd" command before the + label's name. + + Signed-off-by: Paulo Ricardo Paz Vital + +commit 4ba173298fa8630628c9014028fccc22e511d48a +Author: Paul Nasrat +Date: Mon Dec 3 12:39:06 2007 +0000 + + move the tftp load space and use prom_claim_chunk to claim the memory. + Growing kernels mean that the 6MB that was allotted is not enough. + + Patch from Scott Moser + +commit f3d8af0e0ac4642499d5430c202ac57d1d4c5ceb +Author: Paul Nasrat +Date: Mon Dec 3 12:37:10 2007 +0000 + + The patch from Scott Moser moves the "search-for-prom_claim'able" routine that + was present in load_elf64 and load_elf32 to a function named + prom_claim_chunk. This reduces the code-snippit duplication and makes + the function available for of_net_open. + + Scott Moser ssmoser@us.ibm.com +-------------------------------------------------------------------------------- +diff --git a/Makefile b/Makefile +index ce0dc06..fe2f2fd 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 = 0x00C00000 ++KERNELADDR = 0x00000000 + + # Set this to the prefix of your cross-compiler, if you have one. + # Else leave it empty. +@@ -35,8 +35,8 @@ OBJCOPY := $(CROSS)objcopy + + # The flags for the yaboot binary. + # +-YBCFLAGS = -Os $(CFLAGS) -nostdinc -Wall -isystem `$(CC) -print-file-name=include` -fsigned-char +-YBCFLAGS += -DVERSION=\"${VERSION}\" #" ++YBCFLAGS = -Os $(CFLAGS) -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) +@@ -64,7 +64,7 @@ endif + + # Link flags + # +-LFLAGS = -Ttext $(TEXTADDR) -Bstatic ++LFLAGS = -Ttext $(TEXTADDR) -Bstatic -melf32ppclinux + + # Libraries + # +@@ -99,7 +99,7 @@ OBJS += second/fs_reiserfs.o + endif + + # compilation +-lgcc = `$(CC) -print-libgcc-file-name` ++lgcc = `$(CC) -m32 -print-libgcc-file-name` + + all: yaboot addnote mkofboot + +diff --git a/include/bootinfo.h b/include/bootinfo.h +index f61409a..7602e48 100644 +--- a/include/bootinfo.h ++++ b/include/bootinfo.h +@@ -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" +diff --git a/include/prom.h b/include/prom.h +index f5ee88f..eacee77 100644 +--- a/include/prom.h ++++ b/include/prom.h +@@ -37,6 +37,9 @@ 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 PROM_CLAIM_MAX_ADDR 0x8000000 ++#define BOOTLASTSZ 1024 ++#define FW_NBR_REBOOTSZ 4 + + struct prom_args; + typedef int (*prom_entry)(struct prom_args *); +@@ -85,6 +88,7 @@ int prom_set_color(prom_handle device, int color, int r, int g, int b); + + /* memory */ + ++void *prom_claim_chunk(void *virt, unsigned int size, unsigned int align); + void *prom_claim (void *virt, unsigned int size, unsigned int align); + void prom_release(void *virt, unsigned int size); + void prom_map (void *phys, void *virt, int size); +diff --git a/second/fs_ext2.c b/second/fs_ext2.c +index 3240ce2..67571f2 100644 +--- a/second/fs_ext2.c ++++ b/second/fs_ext2.c +@@ -35,6 +35,7 @@ + #include "fs.h" + #include "errors.h" + #include "debug.h" ++#include "bootinfo.h" + + #define FAST_VERSION + #define MAX_READ_RANGE 256 +@@ -170,7 +171,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); + +diff --git a/second/fs_of.c b/second/fs_of.c +index 76474ee..0d554c5 100644 +--- a/second/fs_of.c ++++ b/second/fs_of.c +@@ -44,9 +44,8 @@ + #include "errors.h" + #include "debug.h" + +-#define LOAD_BUFFER_POS 0x600000 +-/* this cannot be safely increased any further */ +-#define LOAD_BUFFER_SIZE 0x600000 ++#define LOAD_BUFFER_POS 0x00000000 ++#define LOAD_BUFFER_SIZE 0x01000000 + + static int of_open(struct boot_file_t* file, const char* dev_name, + struct partition_t* part, const char* file_name); +@@ -166,7 +165,9 @@ of_net_open(struct boot_file_t* file, const char* dev_name, + return FILE_ERR_BAD_FSYS; + } + +- file->buffer = prom_claim((void *)LOAD_BUFFER_POS, LOAD_BUFFER_SIZE, 0); ++ ++ file->buffer = prom_claim_chunk((void *)LOAD_BUFFER_POS, ++ LOAD_BUFFER_SIZE, 0); + if (file->buffer == (void *)-1) { + prom_printf("Can't claim memory for TFTP download\n"); + prom_close(file->of_device); +diff --git a/second/fs_reiserfs.c b/second/fs_reiserfs.c +index 4ad1c2e..238f523 100644 +--- a/second/fs_reiserfs.c ++++ b/second/fs_reiserfs.c +@@ -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, const char *dev_name, + 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 ); +diff --git a/second/fs_xfs.c b/second/fs_xfs.c +index 9a2aaa6..04d6cf3 100644 +--- a/second/fs_xfs.c ++++ b/second/fs_xfs.c +@@ -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 char *dev_name, + 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); +diff --git a/second/partition.c b/second/partition.c +index 0cb8ae8..d20a0ed 100644 +--- a/second/partition.c ++++ b/second/partition.c +@@ -40,6 +40,7 @@ + #include "linux/iso_fs.h" + #include "debug.h" + #include "errors.h" ++#include "bootinfo.h" + #include "byteorder.h" + + /* We currently don't check the partition type, some users +@@ -286,7 +287,7 @@ partition_amiga_lookup( const char *dev_name, prom_handle disk, + 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++) + { +@@ -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); +diff --git a/second/prom.c b/second/prom.c +index e9c5843..4ad7277 100644 +--- a/second/prom.c ++++ b/second/prom.c +@@ -568,6 +568,25 @@ prom_sleep (int seconds) + while (prom_getms() <= end); + } + ++/* if address given is claimed look for other addresses to get the needed ++ * space before giving up ++ */ ++void * ++prom_claim_chunk(void *virt, unsigned int size, unsigned int align) ++{ ++ void *found, *addr; ++ for(addr=virt; addr <= (void*)PROM_CLAIM_MAX_ADDR; ++ addr+=(0x100000/sizeof(addr))) { ++ found = prom_claim(addr, size, 0); ++ if (found != (void *)-1) { ++ DEBUG_F("claimed %i at 0x%x (0x%x)\n",size,(int)found,(int)virt); ++ return(found); ++ } ++ } ++ prom_printf("Claim error, can't allocate %x at 0x%x\n",size,(int)virt); ++ return((void*)-1); ++} ++ + void * + prom_claim (void *virt, unsigned int size, unsigned int align) + { +diff --git a/second/yaboot.c b/second/yaboot.c +index 0232d33..d6e8017 100644 +--- a/second/yaboot.c ++++ b/second/yaboot.c +@@ -114,6 +114,9 @@ int useconf = 0; + char bootdevice[BOOTDEVSZ]; + char bootoncelabel[1024]; + char bootargs[1024]; ++char bootlastlabel[BOOTLASTSZ] = {0}; ++char fw_nbr_reboots[FW_NBR_REBOOTSZ] = {0}; ++long fw_reboot_cnt = 0; + char *password = NULL; + struct boot_fspec_t boot; + int _machine = _MACH_Pmac; +@@ -178,6 +181,7 @@ yaboot_start (unsigned long r3, unsigned long r4, unsigned long r5) + { + int result; + void* malloc_base = NULL; ++ unsigned long addr; + prom_handle root; + + /* OF seems to do it, but I'm not very confident */ +@@ -196,7 +200,10 @@ yaboot_start (unsigned long r3, unsigned long r4, unsigned long r5) + 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); +@@ -219,7 +226,10 @@ yaboot_start (unsigned long r3, unsigned long r4, unsigned long r5) + 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 { +@@ -455,7 +465,7 @@ static int load_my_config_file(struct boot_fspec_t *orig_fspec) + struct bootp_packet *packet; + int rc = 0; + struct boot_fspec_t fspec = *orig_fspec; +- char *cfgpath = (_machine == _MACH_chrp) ? "/etc/" : ""; ++ char *cfgpath = (_machine == _MACH_chrp || _machine == _MACH_bplan) ? "/etc/" : ""; + int flen; + int minlen; + +@@ -654,6 +664,8 @@ int get_params(struct boot_param_t* params) + static char imagepath[1024]; + static char initrdpath[1024]; + static char sysmappath[1024]; ++ static char manualinitrd[1024]; ++ static int definitrd = 1, hasarg = 0; + + pause_after = 0; + memset(params, 0, sizeof(*params)); +@@ -665,7 +677,7 @@ int get_params(struct boot_param_t* params) + + cmdinit(); + +- if (first) { ++ if (first && !fw_reboot_cnt) { + first = 0; + imagename = bootargs; + word_split(&imagename, ¶ms->args); +@@ -680,6 +692,13 @@ int get_params(struct boot_param_t* params) + timeout = simple_strtol(q, NULL, 0); + } + ++ /* If this is a reboot due to FW detecting CAS changes then ++ * set timeout to 1. The last kernel booted will be booted ++ * again automatically. It should seem seamless to the user ++ */ ++ if (fw_reboot_cnt) ++ timeout = 1; ++ + prom_printf("boot: "); + c = -1; + if (timeout != -1) { +@@ -716,7 +735,9 @@ int get_params(struct boot_param_t* params) + if (!imagename) { + if (bootoncelabel[0] != 0) + imagename = bootoncelabel; +- else ++ else if (bootlastlabel[0] != 0) ++ imagename = bootlastlabel; ++ else + imagename = cfg_get_default(); + } + if (imagename) +@@ -733,10 +754,53 @@ int get_params(struct boot_param_t* params) + word_split(&imagename, ¶ms->args); + } + ++ /* initrd setup via cmd console */ ++ /* first, check if the user uses it with some label */ ++ if (!strncmp(params->args, "initrd=", 7)) { ++ DEBUG_F("params->args: %s\n", params->args); ++ definitrd = 0; ++ } ++ /* after, check if there is the 'initrd=' in the imagename string */ ++ if (!strncmp(imagename, "initrd=", 7) || !definitrd) { ++ ++ /* return the value of definitrd to 1 */ ++ if (!definitrd) ++ definitrd = 1; ++ ++ /* args = "initrd=blah" */ ++ char *args = NULL; ++ ++ if (params->args) { ++ args = params->args; ++ params->args = NULL; ++ hasarg = 1; ++ } else ++ args = imagename; ++ ++ if (strlen(args)){ ++ /* copy the string after the '=' to manualinitrd */ ++ strcpy(manualinitrd, args+7); ++ definitrd = 0; ++ prom_printf("New initrd file specified: %s\n", manualinitrd); ++ } else { ++ prom_printf("ERROR: no initrd specified!\n"); ++ return 0; ++ } ++ ++ /* set imagename with the default values of the config file */ ++ if ((prom_get_devtype(boot.dev) == FILE_DEVICE_NET) && !hasarg) ++ imagename = cfg_get_default(); ++ else ++ imagename = cfg_get_default(); ++ } ++ + /* chrp gets this wrong, force it -- Cort */ + if ( useconf && (!imagename || imagename[0] == 0 )) + 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)); ++ + label = 0; + defdevice = boot.dev; + +@@ -794,6 +858,12 @@ int get_params(struct boot_param_t* params) + "resides on, and \"partno\" is the partition number the image resides on.\n" + "Note that the comma (,) is only required if you specify an OpenFirmware\n" + "device, if you only specify a filename you should not start it with a \",\"\n\n" ++ "To boot a alternative initrd file rather than specified in the yaboot\n" ++ "configuration file, use the \"initrd\" command on Yaboot's prompt: \n" ++ "\"initrd=[name.img]\". This will load the \"name.img\" file after the default\n" ++ "kernel image. You can, also, specify a different initrd file to any other\n" ++ "label of the yaboot configuration file. Just type \"label initrd=[name.img]\"\n" ++ "and the specified initrd file will be loaded.\n\n" + "To load an alternative config file rather than /etc/yaboot.conf, enter\n" + "its device, partno and path, on Open Firmware Prompt:\n" + "boot conf=device:partno,/path/to/configfile\n." +@@ -923,14 +993,22 @@ int get_params(struct boot_param_t* params) + prom_printf("%s: Unable to parse\n", imagepath); + return 0; + } +- DEBUG_F("after parse_device_path: dev=%s part=%d file=%s\n", params->kernel.dev, +- params->kernel.part, params->kernel.file); +- ++ DEBUG_F("after parse_device_path: dev=%s part=%d file=%s\n", params->kernel.dev, params->kernel.part, params->kernel.file); + if (useconf) { + p = cfg_get_strg(label, "initrd"); + if (p && *p) { +- DEBUG_F("Parsing initrd path <%s>\n", p); +- strncpy(initrdpath, p, 1024); ++ ++ /* check if user seted to use a initrd file from boot console */ ++ if (!definitrd && p != manualinitrd) { ++ if (manualinitrd[0] != "/" && (prom_get_devtype(defdevice_bak) != FILE_DEVICE_NET)) { ++ strcpy(initrdpath, "/"); ++ strcat(initrdpath, manualinitrd); ++ } else ++ strncpy(initrdpath, manualinitrd, 1024); ++ } else ++ strncpy(initrdpath, p, 1024); ++ ++ DEBUG_F("Parsing initrd path <%s>\n", initrdpath); + if (!parse_device_path(initrdpath, defdevice, defpart, + "/root.bin", ¶ms->rd)) { + prom_printf("%s: Unable to parse\n", imagepath); +@@ -1233,7 +1311,7 @@ load_elf32(struct boot_file_t *file, loadinfo_t *loadinfo) + Elf32_Ehdr *e = &(loadinfo->elf.elf32hdr); + Elf32_Phdr *p, *ph; + int size = sizeof(Elf32_Ehdr) - sizeof(Elf_Ident); +- unsigned long addr, loadaddr; ++ unsigned long loadaddr; + + /* Read the rest of the Elf header... */ + if ((*(file->fs->read))(file, size, &e->e_version) < size) { +@@ -1321,13 +1399,7 @@ load_elf32(struct boot_file_t *file, loadinfo_t *loadinfo) + loadaddr = loadinfo->load_loc; + } + +- /* On some systems, loadaddr may already be claimed, so try some +- * other nearby addresses before giving up. +- */ +- for(addr=loadaddr; addr <= loadaddr * 8 ;addr+=0x100000) { +- loadinfo->base = prom_claim((void *)addr, loadinfo->memsize, 0); +- if (loadinfo->base != (void *)-1) break; +- } ++ loadinfo->base = prom_claim_chunk((void *)loadaddr, loadinfo->memsize, 0); + if (loadinfo->base == (void *)-1) { + prom_printf("Claim error, can't allocate kernel memory\n"); + goto bail; +@@ -1377,7 +1449,7 @@ load_elf64(struct boot_file_t *file, loadinfo_t *loadinfo) + Elf64_Ehdr *e = &(loadinfo->elf.elf64hdr); + Elf64_Phdr *p, *ph; + int size = sizeof(Elf64_Ehdr) - sizeof(Elf_Ident); +- unsigned long addr, loadaddr; ++ unsigned long loadaddr; + + /* Read the rest of the Elf header... */ + if ((*(file->fs->read))(file, size, &e->e_version) < size) { +@@ -1465,13 +1537,7 @@ load_elf64(struct boot_file_t *file, loadinfo_t *loadinfo) + loadaddr = e->e_entry; + } + +- /* On some systems, loadaddr may already be claimed, so try some +- * other nearby addresses before giving up. +- */ +- for(addr=loadaddr; addr <= loadaddr * 8 ;addr+=0x100000) { +- loadinfo->base = prom_claim((void *)addr, loadinfo->memsize, 0); +- if (loadinfo->base != (void *)-1) break; +- } ++ loadinfo->base = prom_claim_chunk((void *)loadaddr, loadinfo->memsize, 0); + if (loadinfo->base == (void *)-1) { + prom_printf("Claim error, can't allocate kernel memory\n"); + goto bail; +@@ -1625,6 +1691,7 @@ int + yaboot_main(void) + { + char *ptype; ++ char *endp; + int conf_given = 0; + char conf_path[1024]; + +@@ -1635,6 +1702,11 @@ yaboot_main(void) + DEBUG_F("/chosen/bootargs = %s\n", bootargs); + prom_get_chosen("bootpath", bootdevice, BOOTDEVSZ); + DEBUG_F("/chosen/bootpath = %s\n", bootdevice); ++ if (prom_get_options("ibm,client-architecture-support-reboot",fw_nbr_reboots, FW_NBR_REBOOTSZ) == -1 ) ++ prom_get_options("ibm,fw-nbr-reboots",fw_nbr_reboots, FW_NBR_REBOOTSZ); ++ fw_reboot_cnt = simple_strtol(fw_nbr_reboots,&endp,10); ++ if (fw_reboot_cnt > 0L) ++ prom_get_options("boot-last-label", bootlastlabel, BOOTLASTSZ); + + /* If conf= specified on command line, it overrides + Usage: conf=device:partition,/path/to/conffile +@@ -1678,11 +1750,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.spec b/yaboot.spec index 4b4cd17..78536ed 100644 --- a/yaboot.spec +++ b/yaboot.spec @@ -1,11 +1,12 @@ Summary: Linux bootloader for Power Macintosh "New World" computers Name: yaboot Version: 1.3.14 -Release: 25%{?dist} +Release: 26%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz Source1: efika.forth +Patch0: yaboot-1.3.14-gitpatches.patch Patch1: yaboot-1.3.3-man.patch Patch2: yaboot-1.3.6-ofboot.patch Patch3: yaboot-1.3.6-rh.patch @@ -65,6 +66,7 @@ yaboot can also bootload IBM pSeries machines. %prep %setup -q +%patch0 -p1 -b .git %patch1 -p0 -b .man %patch2 -p1 -b .ofboot %patch3 -p1 -b .rh @@ -136,6 +138,11 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Mon Feb 08 2010 Tony Breeds Date: Tue, 9 Feb 2010 05:05:04 +0000 Subject: [PATCH 14/16] *** empty log message *** --- yaboot-1.3.14-gitpatches.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yaboot-1.3.14-gitpatches.patch b/yaboot-1.3.14-gitpatches.patch index 6ccd918..c7acb93 100644 --- a/yaboot-1.3.14-gitpatches.patch +++ b/yaboot-1.3.14-gitpatches.patch @@ -225,7 +225,7 @@ index ce0dc06..fe2f2fd 100644 -YBCFLAGS = -Os $(CFLAGS) -nostdinc -Wall -isystem `$(CC) -print-file-name=include` -fsigned-char -YBCFLAGS += -DVERSION=\"${VERSION}\" #" +YBCFLAGS = -Os $(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) YBCFLAGS += -DKERNELADDR=$(KERNELADDR) From e04d76097f5f19c208bb8e31217d7e5922a099a8 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Fri, 12 Feb 2010 07:11:50 +0000 Subject: [PATCH 15/16] Updated ipv6 patch to match .gitpatches --- yaboot-1.3.14-ipv6.patch | 28 ++++++++++++++-------------- yaboot.spec | 5 ++++- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/yaboot-1.3.14-ipv6.patch b/yaboot-1.3.14-ipv6.patch index 04f750b..57245e6 100644 --- a/yaboot-1.3.14-ipv6.patch +++ b/yaboot-1.3.14-ipv6.patch @@ -1,6 +1,6 @@ diff -up yaboot-1.3.14/include/file.h.ipv6 yaboot-1.3.14/include/file.h ---- yaboot-1.3.14/include/file.h.ipv6 2010-01-12 12:24:04.000000000 +0100 -+++ yaboot-1.3.14/include/file.h 2010-01-12 12:24:04.000000000 +0100 +--- yaboot-1.3.14/include/file.h.ipv6 2010-02-12 07:57:43.000000000 +0100 ++++ yaboot-1.3.14/include/file.h 2010-02-12 07:57:43.000000000 +0100 @@ -46,6 +46,11 @@ struct boot_fspec_t { char* bootp_retries; /* Bootp retries */ char* tftp_retries; /* TFTP retries */ @@ -14,19 +14,19 @@ diff -up yaboot-1.3.14/include/file.h.ipv6 yaboot-1.3.14/include/file.h struct boot_file_t { diff -up yaboot-1.3.14/include/prom.h.ipv6 yaboot-1.3.14/include/prom.h ---- yaboot-1.3.14/include/prom.h.ipv6 2007-08-17 16:29:26.000000000 +0200 -+++ yaboot-1.3.14/include/prom.h 2010-01-12 12:25:38.000000000 +0100 -@@ -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" +--- yaboot-1.3.14/include/prom.h.ipv6 2010-02-12 07:57:42.000000000 +0100 ++++ yaboot-1.3.14/include/prom.h 2010-02-12 08:01:12.000000000 +0100 +@@ -40,6 +40,7 @@ typedef void *phandle; + #define PROM_CLAIM_MAX_ADDR 0x8000000 + #define BOOTLASTSZ 1024 + #define FW_NBR_REBOOTSZ 4 ++#define TOK_IPV6 "ipv6" struct prom_args; typedef int (*prom_entry)(struct prom_args *); diff -up yaboot-1.3.14/second/file.c.ipv6 yaboot-1.3.14/second/file.c ---- yaboot-1.3.14/second/file.c.ipv6 2010-01-12 12:24:04.000000000 +0100 -+++ yaboot-1.3.14/second/file.c 2010-01-12 12:24:04.000000000 +0100 +--- yaboot-1.3.14/second/file.c.ipv6 2010-02-12 07:57:43.000000000 +0100 ++++ yaboot-1.3.14/second/file.c 2010-02-12 07:57:43.000000000 +0100 @@ -193,6 +193,50 @@ extract_netinfo_args(struct boot_fspec_t } @@ -104,9 +104,9 @@ diff -up yaboot-1.3.14/second/file.c.ipv6 yaboot-1.3.14/second/file.c return ret; } diff -up yaboot-1.3.14/second/fs_of.c.ipv6 yaboot-1.3.14/second/fs_of.c ---- yaboot-1.3.14/second/fs_of.c.ipv6 2010-01-12 12:24:04.000000000 +0100 -+++ yaboot-1.3.14/second/fs_of.c 2010-01-12 12:24:04.000000000 +0100 -@@ -149,14 +149,18 @@ of_net_open(struct boot_file_t* file, +--- yaboot-1.3.14/second/fs_of.c.ipv6 2010-02-12 07:57:43.000000000 +0100 ++++ yaboot-1.3.14/second/fs_of.c 2010-02-12 07:57:43.000000000 +0100 +@@ -148,14 +148,18 @@ of_net_open(struct boot_file_t* file, *p = '\\'; } diff --git a/yaboot.spec b/yaboot.spec index 78536ed..45e6dbf 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: 26%{?dist} +Release: 27%{?dist} License: GPLv2+ Group: System Environment/Base Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz @@ -138,6 +138,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %config(noreplace) %{_sysconfdir}/yaboot.conf %changelog +* Fri Feb 12 2010 Roman Rakus 1.3.14-27 +- Updated ipv6 patch to match .gitpatches + * Mon Feb 08 2010 Tony Breeds Date: Thu, 29 Jul 2010 16:17:57 +0000 Subject: [PATCH 16/16] dist-git conversion --- .cvsignore => .gitignore | 0 Makefile | 22 ---------------------- branch | 1 - 3 files changed, 23 deletions(-) rename .cvsignore => .gitignore (100%) delete mode 100644 Makefile delete mode 100644 branch 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) diff --git a/branch b/branch deleted file mode 100644 index 06de2d2..0000000 --- a/branch +++ /dev/null @@ -1 +0,0 @@ -F-12