Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 151921 Details for
Bug 235608
No kexec-tools on PowerPC
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
kexec-tools-1.101-ppc-boots-ppc64.patch
kexec-tools-1.101-ppc-boots-ppc64.patch (text/plain), 16.50 KB, created by
David Woodhouse
on 2007-04-07 21:44:06 UTC
(
hide
)
Description:
kexec-tools-1.101-ppc-boots-ppc64.patch
Filename:
MIME Type:
Creator:
David Woodhouse
Created:
2007-04-07 21:44:06 UTC
Size:
16.50 KB
patch
obsolete
>diff -u kexec-tools-1.101.ppc-boots-ppc64-v2/kexec/arch/ppc64/kexec-elf-ppc64.c kexec-tools-1.101.ppc-boots-ppc64/kexec/arch/ppc64/kexec-elf-ppc64.c >--- kexec-tools-1.101.ppc-boots-ppc64-v2/kexec/arch/ppc64/kexec-elf-ppc64.c 2007-04-07 14:55:20.000000000 -0400 >+++ kexec-tools-1.101.ppc-boots-ppc64/kexec/arch/ppc64/kexec-elf-ppc64.c 2007-04-07 14:23:14.000000000 -0400 >@@ -1,3 +1,4 @@ >+#define DEBUG > /* > * kexec: Linux boots Linux > * >@@ -42,11 +43,11 @@ > #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 *); >-int my_r2(struct mem_ehdr *ehdr); >+uint64_t my_r2(struct mem_ehdr *ehdr); > > int elf_ppc64_probe(const char *buf, off_t len) > { >@@ -76,19 +77,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 +227,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 +260,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)); > >@@ -299,7 +300,7 @@ > elf_rel_set_symbol(&info->rhdr, "stack", &my_stack, sizeof(my_stack)); > > /* Set toc */ >- toc_addr = (unsigned long) my_r2(&info->rhdr); >+ toc_addr = (uint64_t) my_r2(&info->rhdr); > elf_rel_set_symbol(&info->rhdr, "my_toc", &toc_addr, sizeof(toc_addr)); > > #ifdef DEBUG >unchanged: >--- kexec-tools-1.101/kexec/arch/ppc64/kexec-elf-rel-ppc64.c 2007-04-07 15:01:17.000000000 -0400 >+++ kexec-tools-1.101.ppc-boots-ppc64-v2/kexec/arch/ppc64/kexec-elf-rel-ppc64.c 2007-04-07 14:43:33.000000000 -0400 >@@ -35,7 +35,7 @@ static struct mem_shdr *toc_section(cons > /* r2 is the TOC pointer: it actually points 0x8000 into the TOC (this > gives the value maximum span in an instruction which uses a signed > offset) */ >-unsigned long my_r2(const struct mem_ehdr *ehdr) >+uint64_t my_r2(const struct mem_ehdr *ehdr) > { > struct mem_shdr *shdr; > shdr = toc_section(ehdr); >@@ -47,7 +47,7 @@ unsigned long my_r2(const struct mem_ehd > > > void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type, >- void *location, unsigned long address, unsigned long value) >+ void *location, uint64_t address, uint64_t value) > { > switch(r_type) { > case R_PPC64_ADDR32: >unchanged: >--- kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.c 2007-04-07 15:01:18.000000000 -0400 >+++ kexec-tools-1.101.ppc-boots-ppc64-v2/kexec/arch/ppc64/kexec-ppc64.c 2007-04-07 14:37:25.000000000 -0400 >@@ -17,7 +17,7 @@ > * along with this program; if not, write to the Free Software > * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. > */ >- >+#define DEBUG > #include <stddef.h> > #include <stdio.h> > #include <errno.h> >@@ -35,12 +35,12 @@ > #include <arch/options.h> > > 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 @@ static int get_base_ranges() > 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 get_base_ranges() > 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_base_ranges() > 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 sort_ranges() > */ > 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 @@ static int get_devtree_details(unsigned > 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); >@@ -215,6 +215,8 @@ static int get_devtree_details(unsigned > /* Add kernel memory to exclude_range */ > exclude_range[i].start = 0x0UL; > exclude_range[i].end = kernel_end; >+ printf("%d: set exclude_range[%d] to %llx,%llx\n", >+ __LINE__, i, exclude_range[i].start, exclude_range[i].end); > i++; > > if (kexec_flags & KEXEC_ON_CRASH) { >@@ -228,7 +230,7 @@ static int get_devtree_details(unsigned > 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 +250,7 @@ static int get_devtree_details(unsigned > 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 +283,7 @@ static int get_devtree_details(unsigned > 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 +300,7 @@ static int get_devtree_details(unsigned > 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); >@@ -308,6 +310,8 @@ static int get_devtree_details(unsigned > /* Add htab address to exclude_range - NON-LPAR only */ > exclude_range[i].start = htab_base; > exclude_range[i].end = htab_base + htab_size; >+ printf("%d: set exclude_range[%d] to %llx,%llx\n", >+ __LINE__, i, exclude_range[i].start, exclude_range[i].end); > i++; > } /* chosen */ > >@@ -347,6 +351,8 @@ static int get_devtree_details(unsigned > /* Add rtas to exclude_range */ > exclude_range[i].start = rtas_base; > exclude_range[i].end = rtas_base + rtas_size; >+ printf("%d: set exclude_range[%d] to %llx,%llx\n", >+ __LINE__, i, exclude_range[i].start, exclude_range[i].end); > i++; > if (kexec_flags & KEXEC_ON_CRASH) > add_usable_mem_rgns(rtas_base, rtas_size); >@@ -367,8 +373,8 @@ static int get_devtree_details(unsigned > 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 > 0x30000000UL) > rmo_top = 0x30000000UL; > >@@ -389,7 +395,7 @@ static int get_devtree_details(unsigned > 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); >@@ -416,6 +422,8 @@ static int get_devtree_details(unsigned > /* Add tce to exclude_range - NON-LPAR only */ > exclude_range[i].start = tce_base; > exclude_range[i].end = tce_base + tce_size; >+ printf("%d: set exclude_range[%d] to %llx,%llx\n", >+ __LINE__, i, exclude_range[i].start, exclude_range[i].end); > i++; > if (kexec_flags & KEXEC_ON_CRASH) > add_usable_mem_rgns(tce_base, tce_size); >@@ -454,7 +462,7 @@ static int get_devtree_details(unsigned > #ifdef DEBUG > int k; > for (k = 0; k < i; k++) >- fprintf(stderr, "exclude_range sorted exclude_range[%d] start:%lx, end:%lx\n", k, exclude_range[k].start, exclude_range[k].end); >+ fprintf(stderr, "exclude_range sorted exclude_range[%d] start:%llx, end:%llx\n", k, exclude_range[k].start, exclude_range[k].end); > #endif > return 0; > } >@@ -529,7 +537,7 @@ int setup_memory_ranges(unsigned long ke > #ifdef DEBUG > int k; > for (k = 0; k < j; k++) >- fprintf(stderr, "setup_memory_ranges memory_range[%d] start:%lx, end:%lx\n", k, memory_range[k].start, memory_range[k].end); >+ fprintf(stderr, "setup_memory_ranges memory_range[%d] start:%llx, end:%llx\n", k, memory_range[k].start, memory_range[k].end); > #endif > return 0; > } >unchanged: >--- kexec-tools-1.101/kexec/kexec.c 2007-04-07 15:01:18.000000000 -0400 >+++ kexec-tools-1.101.ppc-boots-ppc64-v2/kexec/kexec.c 2007-04-07 14:37:25.000000000 -0400 >@@ -126,6 +126,7 @@ void print_segments(FILE *f, struct kexe > fprintf(f, "segment[%d].bufsz = %zx\n", i, info->segment[i].bufsz); > fprintf(f, "segment[%d].mem = %p\n", i, info->segment[i].mem); > fprintf(f, "segment[%d].memsz = %zx\n", i, info->segment[i].memsz); >+ fprintf(f, "segment[%d] crc32 = %x\n", i, crc32(0,info->segment[i].buf, info->segment[i].bufsz)); > } > } > >@@ -497,6 +498,18 @@ char *slurp_decompress_file(const char * > } > #endif > >+void do_hexdump(char *foo, unsigned char *bar, int len) >+{ >+ int i = 0; >+ printf("%s (%x at %lx)", foo, len, bar); >+ while (len--) { >+ if (!(i%16)) >+ printf("\n%08x: ", i); >+ printf(" %02x", bar[i]); >+ i++; >+ } >+ printf("\n"); >+} > static void update_purgatory(struct kexec_info *info) > { > static const uint8_t null_buf[256]; >@@ -504,6 +517,7 @@ static void update_purgatory(struct kexe > sha256_digest_t digest; > struct sha256_region region[SHA256_REGIONS]; > int i, j; >+ int pseg = -1, fd = -1; > /* Don't do anything if we are not using purgatory */ > if (!info->rhdr.e_shdr) { > return; >@@ -520,6 +534,7 @@ static void update_purgatory(struct kexe > * A very clever/careful person could probably improve this. > */ > if (info->segment[i].mem == (void *)info->rhdr.rel_addr) { >+ pseg = i; > continue; > } > sha256_update(&ctx, info->segment[i].buf, info->segment[i].bufsz); >@@ -537,8 +552,19 @@ static void update_purgatory(struct kexe > j++; > } > sha256_finish(&ctx, digest); >+ do_hexdump("sha256_regions", ®ion, sizeof(region)); > elf_rel_set_symbol(&info->rhdr, "sha256_regions", ®ion, sizeof(region)); >+ do_hexdump("sha256_digest", &digest, sizeof(digest)); > elf_rel_set_symbol(&info->rhdr, "sha256_digest", &digest, sizeof(digest)); >+ >+ if (pseg >= 0) { >+ >+ fd = open("/tmp/purgatory", O_WRONLY|O_TRUNC|O_CREAT, 0644); >+ } >+ if (fd >= 0) { >+ write(fd, info->segment[pseg].buf, info->segment[pseg].bufsz); >+ close(fd); >+ } > } > > /* >@@ -571,7 +597,7 @@ static int my_load(const char *type, int > kernel = argv[fileind]; > /* slurp in the input kernel */ > kernel_buf = slurp_decompress_file(kernel, &kernel_size); >-#if 0 >+#if 1 > fprintf(stderr, "kernel: %p kernel_size: %lx\n", > kernel_buf, kernel_size); > #endif >@@ -638,7 +664,7 @@ static int my_load(const char *type, int > } > /* if purgatory is loaded update it */ > update_purgatory(&info); >-#if 0 >+#if 1 > fprintf(stderr, "kexec_load: entry = %p flags = %lx\n", > info.entry, info.kexec_flags); > print_segments(stderr, &info); >unchanged: >--- kexec-tools-1.101/kexec/kexec-elf.h 2007-04-07 15:01:18.000000000 -0400 >+++ kexec-tools-1.101.ppc-boots-ppc64-v2/kexec/kexec-elf.h 2007-04-07 14:37:25.000000000 -0400 >@@ -127,6 +127,6 @@ unsigned long elf_max_addr(const struct > /* Architecture specific helper functions */ > extern int machine_verify_elf_rel(struct mem_ehdr *ehdr); > extern void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type, >- void *location, unsigned long address, unsigned long value); >+ void *location, uint64_t address, uint64_t value); > #endif /* KEXEC_ELF_H */ > >unchanged: >--- kexec-tools-1.101/kexec/kexec-sha256.h 2007-04-07 15:01:17.000000000 -0400 >+++ kexec-tools-1.101.ppc-boots-ppc64-v2/kexec/kexec-sha256.h 2007-04-07 14:37:25.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 >unchanged: >--- kexec-tools-1.101/purgatory/Makefile 2007-04-07 15:01:17.000000000 -0400 >+++ kexec-tools-1.101.ppc-boots-ppc64-v2/purgatory/Makefile 2007-04-07 14:37:25.000000000 -0400 >@@ -11,7 +11,7 @@ ifeq ($(ARCH),ppc64) > LDFLAGS = -melf64ppc > endif > >-PCFLAGS:=-Wall -Os \ >+PCFLAGS:=-Wall -Os -m64 -mcall-aixdesc \ > -I$(shell $(CC) -print-file-name=include) \ > -Ipurgatory/include -Ipurgatory/arch/$(ARCH)/include \ > $(CPPFLAGS) >@@ -59,7 +59,7 @@ $(PURGATORY_S_OBJS): $(OBJDIR)/%.o: %.S > >-$(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)" >diff -urp kexec-tools-1.101.ppc-boots-ppc64-v2/purgatory/purgatory.c kexec-tools-1.101/purgatory/purgatory.c >--- kexec-tools-1.101.ppc-boots-ppc64-v2/purgatory/purgatory.c 2007-04-07 15:03:34.000000000 -0400 >+++ kexec-tools-1.101/purgatory/purgatory.c 2007-04-07 15:31:52.000000000 -0400 >@@ -46,3 +46,5 @@ void purgatory(void) > verify_sha256_digest(); > post_verification_setup_arch(); > } >+ >+#include "../util_lib/sha256.c" >--- kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.h 2007-04-07 15:03:34.000000000 -0400 >+++ kexec-tools-1.101.ppc-boots-ppc64/kexec/arch/ppc64/kexec-ppc64.h 2007-04-07 11:32:08.000000000 -0400 >@@ -13,9 +13,9 @@ int elf_ppc64_probe(const char *buf, off > int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len, > struct kexec_info *info); > void elf_ppc64_usage(void); >-void reserve(unsigned long long where, unsigned long long length); >+void reserve(uint64_t where, uint64_t 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, >@@ -33,7 +33,7 @@ struct arch_options_t { > }; > > struct exclude_range { >- unsigned long long start, end; >+ uint64_t start, end; > }; > > typedef struct mem_rgns {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 235608
:
151921
|
152118