Hi,

On Wed, 18 Jan 2012 21:45:09 +0800
Cong Wang <[email protected]> wrote:
> >>> ...
> >>> gcc -g -O2 -Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
> >>> -D_LARGEFILE64_SOURCE -DVERSION='"1.4.1"' -DRELEASE_DATE='"6 January
> >>> 2012"' -D__x86_64__  print_info.o dwarf_info.o elf_info.o erase_info.o
> >>> sadump_info.o arch/arm.o arch/x86.o arch/x86_64.o arch/ia64.o
> >>> arch/ppc64.o arch/s390x.o -o makedumpfile makedumpfile.c -static -ldw
> >>> -lbz2 -lebl -ldl -lelf -lz
> >>
> >> The parameter has -static, so you need libc.a, libdw.a and ...
> >> Or you can remove -static, but you should ensure that there are these
> >> dynamic librarys in the second os.
> > 
> > That's right.
> > It has been written in README file of makedumpfile:
> 
> Hey,
> 
> This means we have to patch the source code by ourselves, why not
> improve it? Something like below?

I guess someone will send "makedumpfile can't run on ..." even if
your patch is merged, because these dynamic libraries should be
included in the second os and it is easy to forget that.
The compiling error is an easy way to notice it, I feel.
What do you think, Kumagai-san ?


Thanks
Ken'ichi Ohmichi

---
> diff --git a/Makefile b/Makefile
> index 9afbe1c..1361700 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -28,6 +28,11 @@ SRC_PART = print_info.c dwarf_info.c elf_info.c
> erase_info.c sadump_info.c
>  OBJ_PART = print_info.o dwarf_info.o elf_info.o erase_info.o sadump_info.o
>  SRC_ARCH = arch/arm.c arch/x86.c arch/x86_64.c arch/ia64.c arch/ppc64.c
> arch/s390x.c
>  OBJ_ARCH = arch/arm.o arch/x86.o arch/x86_64.o arch/ia64.o arch/ppc64.o
> arch/s390x.o
> +LIBS := $(shell if $(CC) -static -ldw -lbz2 -lebl -ldl -lelf -lz
> >&/dev/null; then \
> +       echo "-static -ldw -lbz2 -lebl -ldl -lelf -lz"; \
> +       else \
> +       echo "-ldw -lbz2 -lebl -ldl -lelf -lz"; \
> +       fi)
> 
>  all: makedumpfile
> 
> @@ -38,7 +43,7 @@ $(OBJ_ARCH): $(SRC_ARCH)
>         $(CC) $(CFLAGS_ARCH) -c -o ./$@ ./$(@:.o=.c)
> 
>  makedumpfile: $(SRC) $(OBJ_PART) $(OBJ_ARCH)
> -       $(CC) $(CFLAGS) $(LDFLAGS) $(OBJ_PART) $(OBJ_ARCH) -o $@ $<
> -static -ldw -lbz2 -lebl -ldl -lelf -lz
> +       $(CC) $(CFLAGS) $(LDFLAGS) $(OBJ_PART) $(OBJ_ARCH) -o $@ $< $(LIBS)
>         echo .TH MAKEDUMPFILE 8 \"$(DATE)\" \"makedumpfile v$(VERSION)\"
> \"Linux System Administrator\'s Manual\" > temp.8
>         grep -v "^.TH MAKEDUMPFILE 8" makedumpfile.8 >> temp.8
>         mv temp.8 makedumpfile.8

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to