From c10fc7070560eeaa9e3c4edfeb46716ac751ffcf Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 10 Apr 2007 18:09:16 +0000 Subject: [PATCH] Relates: bz 235608 --- kexec-tools-1.101-ppc-boots-ppc64.patch | 280 ++++++++++++++++++++++++ kexec-tools.spec | 25 ++- 2 files changed, 298 insertions(+), 7 deletions(-) create mode 100644 kexec-tools-1.101-ppc-boots-ppc64.patch diff --git a/kexec-tools-1.101-ppc-boots-ppc64.patch b/kexec-tools-1.101-ppc-boots-ppc64.patch new file mode 100644 index 0000000..11cfc61 --- /dev/null +++ b/kexec-tools-1.101-ppc-boots-ppc64.patch @@ -0,0 +1,280 @@ +--- kexec-tools-1.101/kexec/arch/ppc64/kexec-elf-rel-ppc64.c.orig 2007-04-10 13:33:39.000000000 -0400 ++++ kexec-tools-1.101/kexec/arch/ppc64/kexec-elf-rel-ppc64.c 2007-04-10 13:33:49.000000000 -0400 +@@ -101,10 +101,10 @@ + break; + + case R_PPC64_ADDR16_HIGHEST: +- *(uint16_t *)location = ((value>>48) & 0xffff); ++ *(uint16_t *)location = (((uint64_t)value>>48) & 0xffff); + break; + case R_PPC64_ADDR16_HIGHER: +- *(uint16_t *)location = ((value>>32) & 0xffff); ++ *(uint16_t *)location = (((uint64_t)value>>32) & 0xffff); + break; + + default: +--- kexec-tools-1.101/kexec/arch/ppc64/kexec-elf-ppc64.c.orig 2007-04-10 13:33:39.000000000 -0400 ++++ kexec-tools-1.101/kexec/arch/ppc64/kexec-elf-ppc64.c 2007-04-10 13:33:49.000000000 -0400 +@@ -42,7 +42,7 @@ + #define BOOTLOADER "kexec" + #define BOOTLOADER_VERSION VERSION + +-unsigned long initrd_base, initrd_size; ++uint64_t initrd_base, initrd_size; + + int create_flatten_tree(struct kexec_info *, unsigned char **, unsigned long *, + char *); +@@ -76,19 +76,19 @@ + char *cmdline, *modified_cmdline; + const char *ramdisk, *devicetreeblob; + int cmdline_len, modified_cmdline_len; +- unsigned long long max_addr, hole_addr; ++ uint64_t max_addr, hole_addr; + unsigned char *seg_buf = NULL; + off_t seg_size = 0; + struct mem_phdr *phdr; + size_t size; +- unsigned long long *rsvmap_ptr; ++ uint64_t *rsvmap_ptr; + struct bootblock *bb_ptr; + unsigned int nr_segments, i; + int result, opt; +- unsigned long my_kernel, my_dt_offset; ++ uint64_t my_kernel, my_dt_offset; + unsigned int my_panic_kernel; +- unsigned long my_stack, my_backup_start; +- unsigned long toc_addr; ++ uint64_t my_stack, my_backup_start; ++ uint64_t toc_addr; + + #define OPT_APPEND (OPT_ARCH_MAX+0) + #define OPT_RAMDISK (OPT_ARCH_MAX+1) +@@ -226,10 +226,10 @@ + } + seg_buf = (unsigned char *)slurp_file(ramdisk, &seg_size); + add_buffer(info, seg_buf, seg_size, seg_size, 0, 0, max_addr, 1); +- hole_addr = (unsigned long long) ++ hole_addr = (uint64_t) + info->segment[info->nr_segments-1].mem; + initrd_base = hole_addr; +- initrd_size = (unsigned long long) ++ initrd_size = (uint64_t) + info->segment[info->nr_segments-1].memsz; + } /* ramdisk */ + +@@ -259,25 +259,25 @@ + */ + bb_ptr = (struct bootblock *)( + (unsigned char *)info->segment[(info->nr_segments)-1].buf); +- rsvmap_ptr = (unsigned long long *)( ++ rsvmap_ptr = (uint64_t *)( + (unsigned char *)info->segment[(info->nr_segments)-1].buf + + bb_ptr->off_mem_rsvmap); + while (*rsvmap_ptr || *(rsvmap_ptr+1)) + rsvmap_ptr += 2; + rsvmap_ptr -= 2; +- *rsvmap_ptr = (unsigned long long)( ++ *rsvmap_ptr = (uint64_t)( + info->segment[(info->nr_segments)-1].mem); + rsvmap_ptr++; +- *rsvmap_ptr = (unsigned long long)bb_ptr->totalsize; ++ *rsvmap_ptr = (uint64_t)bb_ptr->totalsize; + + nr_segments = info->nr_segments; + + /* Set kernel */ +- my_kernel = (unsigned long )info->segment[0].mem; ++ my_kernel = (uint64_t)info->segment[0].mem; + elf_rel_set_symbol(&info->rhdr, "kernel", &my_kernel, sizeof(my_kernel)); + + /* Set dt_offset */ +- my_dt_offset = (unsigned long )info->segment[nr_segments-1].mem; ++ my_dt_offset = (uint64_t)info->segment[nr_segments-1].mem; + elf_rel_set_symbol(&info->rhdr, "dt_offset", &my_dt_offset, + sizeof(my_dt_offset)); + +--- kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.h.orig 2007-04-10 13:33:39.000000000 -0400 ++++ kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.h 2007-04-10 13:33:49.000000000 -0400 +@@ -15,7 +15,7 @@ + void elf_ppc64_usage(void); + void reserve(unsigned long long where, unsigned long long length); + +-extern unsigned long initrd_base, initrd_size; ++extern uint64_t initrd_base, initrd_size; + /* boot block version 2 as defined by the linux kernel */ + struct bootblock { + unsigned magic, +--- kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.c.orig 2007-04-10 13:33:39.000000000 -0400 ++++ kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.c 2007-04-10 13:36:19.000000000 -0400 +@@ -35,12 +35,12 @@ + #include + + static struct exclude_range exclude_range[MAX_MEMORY_RANGES]; +-static unsigned long long rmo_top; ++static uint64_t rmo_top; + static struct memory_range memory_range[MAX_MEMORY_RANGES]; + static struct memory_range base_memory_range[MAX_MEMORY_RANGES]; +-unsigned long long memory_max = 0; ++uint64_t memory_max = 0; + static int nr_memory_ranges, nr_exclude_ranges; +-unsigned long long crash_base, crash_size; ++uint64_t crash_base, crash_size; + + static int sort_base_ranges(); + +@@ -90,10 +90,10 @@ + if (local_memory_ranges >= MAX_MEMORY_RANGES) + break; + base_memory_range[local_memory_ranges].start = +- ((unsigned long long *)buf)[0]; ++ ((uint64_t *)buf)[0]; + base_memory_range[local_memory_ranges].end = + base_memory_range[local_memory_ranges].start + +- ((unsigned long long *)buf)[1]; ++ ((uint64_t *)buf)[1]; + base_memory_range[local_memory_ranges].type = RANGE_RAM; + local_memory_ranges++; + #ifdef DEBUG +@@ -120,7 +120,7 @@ + static int sort_base_ranges() + { + int i, j; +- unsigned long long tstart, tend; ++ uint64_t tstart, tend; + + for (i = 0; i < nr_memory_ranges - 1; i++) { + for (j = 0; j < nr_memory_ranges - i - 1; j++) { +@@ -141,7 +141,7 @@ + static int sort_ranges() + { + int i, j; +- unsigned long long tstart, tend; ++ uint64_t tstart, tend; + for (i = 0; i < nr_exclude_ranges - 1; i++) { + for (j = 0; j < nr_exclude_ranges - i - 1; j++) { + if (exclude_range[j].start > exclude_range[j+1].start) { +@@ -162,12 +162,12 @@ + */ + static int get_devtree_details(unsigned long kexec_flags) + { +- unsigned long long rmo_base; +- unsigned long long tce_base; ++ uint64_t rmo_base; ++ uint64_t tce_base; + unsigned int tce_size; + unsigned int rtas_base, rtas_size; +- unsigned long long htab_base, htab_size; +- unsigned long long kernel_end; ++ uint64_t htab_base, htab_size; ++ uint64_t kernel_end; + char buf[MAXBYTES-1]; + char device_tree[256] = "/proc/device-tree/"; + char fname[256]; +@@ -203,7 +203,7 @@ + closedir(dir); + return -1; + } +- if (fread(&kernel_end, sizeof(unsigned long), 1, file) != 1) { ++ if (fread(&kernel_end, sizeof(uint64_t), 1, file) != 1) { + perror(fname); + fclose(file); + closedir(cdir); +@@ -228,7 +228,7 @@ + closedir(dir); + return -1; + } +- if (fread(&crash_base, sizeof(unsigned long), 1, ++ if (fread(&crash_base, sizeof(uint64_t), 1, + file) != 1) { + perror(fname); + fclose(file); +@@ -248,7 +248,7 @@ + closedir(dir); + return -1; + } +- if (fread(&crash_size, sizeof(unsigned long), 1, ++ if (fread(&crash_size, sizeof(uint64_t), 1, + file) != 1) { + perror(fname); + fclose(file); +@@ -281,7 +281,7 @@ + closedir(dir); + return -1; + } +- if (fread(&htab_base, sizeof(unsigned long), 1, file) != 1) { ++ if (fread(&htab_base, sizeof(uint64_t), 1, file) != 1) { + perror(fname); + fclose(file); + closedir(cdir); +@@ -298,7 +298,7 @@ + closedir(dir); + return -1; + } +- if (fread(&htab_size, sizeof(unsigned long), 1, file) != 1) { ++ if (fread(&htab_size, sizeof(uint64_t), 1, file) != 1) { + perror(fname); + fclose(file); + closedir(cdir); +@@ -367,8 +367,8 @@ + closedir(dir); + return -1; + } +- rmo_base = ((unsigned long long *)buf)[0]; +- rmo_top = rmo_base + ((unsigned long long *)buf)[1]; ++ rmo_base = ((uint64_t *)buf)[0]; ++ rmo_top = rmo_base + ((uint64_t *)buf)[1]; + if (rmo_top > 0x07C00000UL) + rmo_top = 0x07C00000UL; + +@@ -389,7 +389,7 @@ + closedir(dir); + return -1; + } +- if (fread(&tce_base, sizeof(unsigned long), 1, file) != 1) { ++ if (fread(&tce_base, sizeof(uint64_t), 1, file) != 1) { + perror(fname); + fclose(file); + closedir(cdir); +--- kexec-tools-1.101/kexec/kexec-sha256.h.orig 2007-04-10 13:33:39.000000000 -0400 ++++ kexec-tools-1.101/kexec/kexec-sha256.h 2007-04-10 13:33:49.000000000 -0400 +@@ -2,8 +2,8 @@ + #define KEXEC_SHA256_H + + struct sha256_region { +- const void *start; +- unsigned long len; ++ uint64_t start; ++ uint64_t len; + }; + + #define SHA256_REGIONS 16 +--- kexec-tools-1.101/purgatory/Makefile.orig 2007-04-10 13:33:39.000000000 -0400 ++++ kexec-tools-1.101/purgatory/Makefile 2007-04-10 13:33:49.000000000 -0400 +@@ -57,9 +57,9 @@ + $(MKDIR) -p $(@D) + $(CC) $(PCFLAGS) -o $@ -c $< + +-$(PURGATORY): $(PURGATORY_OBJS) $(UTIL_LIB) ++$(PURGATORY): $(PURGATORY_OBJS) + $(MKDIR) -p $(@D) +- $(LD) $(LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB) ++ $(LD) $(LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) + + echo:: + @echo "PURGATORY_C_SRCS $(PURGATORY_C_SRCS)" +--- kexec-tools-1.101/purgatory/arch/ppc64/Makefile.orig 2007-04-10 13:33:39.000000000 -0400 ++++ kexec-tools-1.101/purgatory/arch/ppc64/Makefile 2007-04-10 13:33:49.000000000 -0400 +@@ -6,3 +6,5 @@ + PURGATORY_C_SRCS += purgatory/arch/ppc64/purgatory-ppc64.c + PURGATORY_C_SRCS += purgatory/arch/ppc64/console-ppc64.c + PURGATORY_C_SRCS += purgatory/arch/ppc64/crashdump_backup.c ++ ++PCFLAGS += -m64 -mcall-aixdesc +--- kexec-tools-1.101/purgatory/purgatory.c.orig 2007-04-10 13:33:39.000000000 -0400 ++++ kexec-tools-1.101/purgatory/purgatory.c 2007-04-10 13:33:49.000000000 -0400 +@@ -46,3 +46,5 @@ + verify_sha256_digest(); + post_verification_setup_arch(); + } ++ ++#include "../util_lib/sha256.c" diff --git a/kexec-tools.spec b/kexec-tools.spec index 4a11044..99e7b62 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools Version: 1.101 -Release: 66%{?dist} +Release: 67%{?dist} License: GPL Group: Applications/System Summary: The kexec/kdump userspace component. @@ -23,8 +23,7 @@ Requires(pre): coreutils chkconfig sed Requires: busybox >= 1.2.0 BuildRequires: zlib-devel elfutils-libelf-devel glib2-devel pkgconfig BuildRequires: elfutils-libelf-devel elfutils-devel-static gettext -ExcludeArch: ppc -%ifarch %{ix86} x86_64 ppc64 ia64 +%ifarch %{ix86} x86_64 ppc64 ia64 ppc Obsoletes: diskdumputils netdump %endif @@ -66,6 +65,7 @@ Patch304: kexec-tools-1.101-ppc64-platform-fix.patch Patch305: kexec-tools-1.101-ppc64-64k-pages.patch Patch306: kexec-tools-1.101-ppc64-memory_regions.patch Patch307: kexec-tools-1.101-ppc64_rmo_top.patch +Patch308: kexec-tools-1.101-ppc-boots-ppc64.patch # # Patches 401 through 500 are meant for s390 kexec-tools enablement @@ -120,6 +120,9 @@ rm -f ../kexec-tools-1.101.spec %patch305 -p1 %patch306 -p1 %patch307 -p1 +%ifarch ppc +%patch308 -p1 +%endif %patch401 -p1 %patch501 -p1 %patch601 -p1 @@ -128,6 +131,7 @@ rm -f ../kexec-tools-1.101.spec mkdir -p -m755 kcp tar -z -x -v -f %{SOURCE9} + %patch603 -p1 %patch604 -p1 %patch605 -p1 @@ -135,6 +139,10 @@ tar -z -x -v -f %{SOURCE9} tar -z -x -v -f %{SOURCE13} +%ifarch ppc +%define archdef ARCH=ppc64 +%endif + %build %configure \ %ifarch ppc64 @@ -144,15 +152,15 @@ tar -z -x -v -f %{SOURCE13} --sbindir=/sbin rm -f kexec-tools.spec.in cp %{SOURCE10} . -make -%ifarch %{ix86} x86_64 ia64 ppc64 +make %{?archdef} +%ifarch %{ix86} x86_64 ia64 ppc64 ppc make -C makedumpfile %endif make -C po %install rm -rf $RPM_BUILD_ROOT -make install DESTDIR=$RPM_BUILD_ROOT +make install %{?archdef} DESTDIR=$RPM_BUILD_ROOT make -C po install DESTDIR=$RPM_BUILD_ROOT mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig @@ -171,7 +179,7 @@ install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8 install -m 755 %{SOURCE11} $RPM_BUILD_ROOT%{_datadir}/kdump/firstboot_kdump.py install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8 -%ifarch %{ix86} x86_64 ia64 ppc64 +%ifarch %{ix86} x86_64 ia64 ppc64 ppc install -m 755 makedumpfile/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile install -m 755 makedumpfile/makedumpfile-R.pl $RPM_BUILD_ROOT/sbin/makedumpfile-reasm %endif @@ -241,6 +249,9 @@ rm -f %{_datadir}/firstboot/modules/firstboot_kdump.py %doc kexec-kdump-howto.txt %changelog +* Tue Apr 10 2007 Neil Horman - 1.101-67%{dist} +- Allow ppc to boot ppc64 kernels (bz 235608) + * Tue Apr 10 2007 Neil Horman - 1.101-66%{dist} - Reduce rmo_top to 0x7c000000 for PS3 (bz 235030)