* [Buildroot] [PATCH 1/1] package/makedumpfile: new package
@ 2020-08-29 7:59 Alexander Egorenkov
2020-08-29 20:17 ` Thomas Petazzoni
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Egorenkov @ 2020-08-29 7:59 UTC (permalink / raw)
To: buildroot
Signed-off-by: Alexander Egorenkov <egorenar-dev@posteo.net>
---
package/Config.in | 1 +
.../0001-Cross-compilation-fixes.patch | 13 +++++++
package/makedumpfile/0002-gcc10-fixes.patch | 35 +++++++++++++++++++
package/makedumpfile/Config.in | 11 ++++++
package/makedumpfile/makedumpfile.hash | 3 ++
package/makedumpfile/makedumpfile.mk | 23 ++++++++++++
6 files changed, 86 insertions(+)
create mode 100644 package/makedumpfile/0001-Cross-compilation-fixes.patch
create mode 100644 package/makedumpfile/0002-gcc10-fixes.patch
create mode 100644 package/makedumpfile/Config.in
create mode 100644 package/makedumpfile/makedumpfile.hash
create mode 100644 package/makedumpfile/makedumpfile.mk
diff --git a/package/Config.in b/package/Config.in
index d7e79f4795..10cb1f94d1 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2374,6 +2374,7 @@ menu "System tools"
source "package/kvmtool/Config.in"
source "package/libostree/Config.in"
source "package/lxc/Config.in"
+ source "package/makedumpfile/Config.in"
source "package/mender/Config.in"
source "package/mender-grubenv/Config.in"
source "package/mfoc/Config.in"
diff --git a/package/makedumpfile/0001-Cross-compilation-fixes.patch b/package/makedumpfile/0001-Cross-compilation-fixes.patch
new file mode 100644
index 0000000000..ebe495d89d
--- /dev/null
+++ b/package/makedumpfile/0001-Cross-compilation-fixes.patch
@@ -0,0 +1,13 @@
+Index: makedumpfile-1.6.7/Makefile
+===================================================================
+--- makedumpfile-1.6.7.orig/Makefile
++++ makedumpfile-1.6.7/Makefile
+@@ -8,7 +8,7 @@ ifeq ($(strip $CC),)
+ CC = gcc
+ endif
+
+-CFLAGS_BASE := $(CFLAGS) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
++CFLAGS_BASE := $(EXTRA_CFLAGS) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
+ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+ CFLAGS := $(CFLAGS_BASE) -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
+ CFLAGS_ARCH := $(CFLAGS_BASE)
diff --git a/package/makedumpfile/0002-gcc10-fixes.patch b/package/makedumpfile/0002-gcc10-fixes.patch
new file mode 100644
index 0000000000..10c4bf72c7
--- /dev/null
+++ b/package/makedumpfile/0002-gcc10-fixes.patch
@@ -0,0 +1,35 @@
+--- a/makedumpfile.h 2020-08-28 20:08:00.308241301 +0200
++++ b/makedumpfile.h 2020-08-28 20:08:10.484310117 +0200
+@@ -1262,7 +1262,9 @@
+ mdf_pfn_t end_pfn;
+ off_t offset_eraseinfo;
+ unsigned long size_eraseinfo;
+-} splitting_info_t;
++};
++
++typedef struct splitting_info splitting_info_t;
+
+ struct parallel_info {
+ int fd_memory;
+@@ -1275,7 +1277,9 @@
+ #ifdef USELZO
+ lzo_bytep wrkmem;
+ #endif
+-} parallel_info_t;
++};
++
++typedef struct parallel_info parallel_info_t;
+
+ struct ppc64_vmemmap {
+ unsigned long phys;
+@@ -2006,8 +2010,8 @@
+ };
+
+ #define CRASH_RESERVED_MEM_NR 8
+-struct memory_range crash_reserved_mem[CRASH_RESERVED_MEM_NR];
+-int crash_reserved_mem_nr;
++extern struct memory_range crash_reserved_mem[CRASH_RESERVED_MEM_NR];
++extern int crash_reserved_mem_nr;
+
+ unsigned long read_vmcoreinfo_symbol(char *str_symbol);
+ int readmem(int type_addr, unsigned long long addr, void *bufptr, size_t size);
diff --git a/package/makedumpfile/Config.in b/package/makedumpfile/Config.in
new file mode 100644
index 0000000000..6751282ea6
--- /dev/null
+++ b/package/makedumpfile/Config.in
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_MAKEDUMPFILE
+ bool "makedumpfile"
+ depends on BR2_TOOLCHAIN_HAS_THREADS
+ depends on !BR2_STATIC_LIBS # dlopen
+ select BR2_PACKAGE_ELFUTILS
+ select BR2_PACKAGE_ZLIB
+ select BR2_PACKAGE_BZIP2
+ select BR2_PACKAGE_LZO
+ select BR2_PACKAGE_XZ
+ help
+ Makes a small dumpfile of kdump.
diff --git a/package/makedumpfile/makedumpfile.hash b/package/makedumpfile/makedumpfile.hash
new file mode 100644
index 0000000000..6cf882e3e5
--- /dev/null
+++ b/package/makedumpfile/makedumpfile.hash
@@ -0,0 +1,3 @@
+# Locally computed:
+sha256 e702fbdf62b4cd829a76e46f3e24eb3fc7501918b85ebdcd8baef4f53d6ee2c8 makedumpfile-1.6.7.tar.gz
+sha256 ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6 COPYING
diff --git a/package/makedumpfile/makedumpfile.mk b/package/makedumpfile/makedumpfile.mk
new file mode 100644
index 0000000000..b240944eaf
--- /dev/null
+++ b/package/makedumpfile/makedumpfile.mk
@@ -0,0 +1,23 @@
+################################################################################
+#
+# makedumpfile
+#
+################################################################################
+
+MAKEDUMPFILE_VERSION = 1.6.7
+MAKEDUMPFILE_SITE = https://github.com/makedumpfile/makedumpfile/releases/download/Released-$(subst .,-,$(MAKEDUMPFILE_VERSION))
+MAKEDUMPFILE_DEPENDENCIES = zlib xz lzo
+MAKEDUMPFILE_LICENSE = GPL-2.0
+MAKEDUMPFILE_LICENSE_FILES = COPYING
+
+define MAKEDUMPFILE_BUILD_CMDS
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) CC="$(TARGET_CC)" \
+ EXTRA_CFLAGS="$(TARGET_CFLAGS)" TARGET=$(BR2_ARCH) USELZO=on LINKTYPE=dynamic
+endef
+
+define MAKEDUMPFILE_INSTALL_TARGET_CMDS
+ $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) install \
+ DESTDIR="$(TARGET_DIR)"
+endef
+
+$(eval $(generic-package))
--
2.28.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH 1/1] package/makedumpfile: new package
2020-08-29 7:59 [Buildroot] [PATCH 1/1] package/makedumpfile: new package Alexander Egorenkov
@ 2020-08-29 20:17 ` Thomas Petazzoni
2020-08-30 14:36 ` Alexander Egorenkov
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni @ 2020-08-29 20:17 UTC (permalink / raw)
To: buildroot
Hello Alexander,
On Sat, 29 Aug 2020 09:59:01 +0200
Alexander Egorenkov <egorenar-dev@posteo.net> wrote:
> Signed-off-by: Alexander Egorenkov <egorenar-dev@posteo.net>
Thanks for your contribution! See below for a number of comments.
> package/Config.in | 1 +
> .../0001-Cross-compilation-fixes.patch | 13 +++++++
> package/makedumpfile/0002-gcc10-fixes.patch | 35 +++++++++++++++++++
> package/makedumpfile/Config.in | 11 ++++++
> package/makedumpfile/makedumpfile.hash | 3 ++
> package/makedumpfile/makedumpfile.mk | 23 ++++++++++++
> 6 files changed, 86 insertions(+)
For all new packages, we need an entry to be added to the DEVELOPERS
file so we know who is in charge of which package, and you will receive
e-mail notifications when this package fails to build or needs to be
updated.
> diff --git a/package/makedumpfile/0001-Cross-compilation-fixes.patch b/package/makedumpfile/0001-Cross-compilation-fixes.patch
> new file mode 100644
> index 0000000000..ebe495d89d
> --- /dev/null
> +++ b/package/makedumpfile/0001-Cross-compilation-fixes.patch
> @@ -0,0 +1,13 @@
We need all patches to have a description and Signed-off-by line, and
be generated using "git format-patch -N" when the upstream project uses
git.
> +Index: makedumpfile-1.6.7/Makefile
> +===================================================================
> +--- makedumpfile-1.6.7.orig/Makefile
> ++++ makedumpfile-1.6.7/Makefile
> +@@ -8,7 +8,7 @@ ifeq ($(strip $CC),)
> + CC = gcc
> + endif
> +
> +-CFLAGS_BASE := $(CFLAGS) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
> ++CFLAGS_BASE := $(EXTRA_CFLAGS) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
It's not clear to me why you need this change though. I think the
intention of this code is that if you pass CFLAGS in the environment of
make and not as an option, it will do the right thing. Quick demo:
$ cat toto.mk
CFLAGS_BASE := $(CFLAGS) -foobar
CFLAGS := $(CFLAGS_BASE) -barfoo
all:
@echo $(CFLAGS)
$
$ make -f toto.mk CFLAGS=-baz
-baz
$ CFLAGS=-baz make -f toto.mk
-baz -foobar -barfoo
> + -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
> + CFLAGS := $(CFLAGS_BASE) -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
> + CFLAGS_ARCH := $(CFLAGS_BASE)
> diff --git a/package/makedumpfile/0002-gcc10-fixes.patch b/package/makedumpfile/0002-gcc10-fixes.patch
> new file mode 100644
> index 0000000000..10c4bf72c7
> --- /dev/null
> +++ b/package/makedumpfile/0002-gcc10-fixes.patch
> @@ -0,0 +1,35 @@
Again, we need this to have a proper description and Signed-off-by.
Also, could you submit it upstream ?
> diff --git a/package/makedumpfile/Config.in b/package/makedumpfile/Config.in
> new file mode 100644
> index 0000000000..6751282ea6
> --- /dev/null
> +++ b/package/makedumpfile/Config.in
> @@ -0,0 +1,11 @@
> +config BR2_PACKAGE_MAKEDUMPFILE
> + bool "makedumpfile"
> + depends on BR2_TOOLCHAIN_HAS_THREADS
> + depends on !BR2_STATIC_LIBS # dlopen
elfutils has plenty more dependencies that you need to replicate:
depends on BR2_USE_WCHAR
depends on !BR2_STATIC_LIBS
# Only glibc and uClibc implement the myriad of required GNUisms
depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC
> + select BR2_PACKAGE_ELFUTILS
> + select BR2_PACKAGE_ZLIB
> + select BR2_PACKAGE_BZIP2
> + select BR2_PACKAGE_LZO
> + select BR2_PACKAGE_XZ
> + help
> + Makes a small dumpfile of kdump.
You need to add the upstream URL of the project in the Config.in help
text, look at other packages for example.
Also, you need to add a comment about the Config.in dependencies. Look
at other packages for direction on how to do this. For example, in
package/elfutils/Config.in, we have:
comment "elfutils needs a uClibc or glibc toolchain w/ wchar, dynamic library"
depends on !BR2_USE_WCHAR || BR2_STATIC_LIBS \
|| !(BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC)
> +MAKEDUMPFILE_VERSION = 1.6.7
> +MAKEDUMPFILE_SITE = https://github.com/makedumpfile/makedumpfile/releases/download/Released-$(subst .,-,$(MAKEDUMPFILE_VERSION))
> +MAKEDUMPFILE_DEPENDENCIES = zlib xz lzo
Your Config.in file also selects bzip2 and elfutils... so it seems odd
they are not needed at build time. Could you confirm this ?
In any case, make sure you can run this:
$ make clean
$ make makedumpfile
if that doesn't work, you forgot some build dependencies.
Also, run:
$ cat > snippet.cfg<<EOF
BR2_PACKAGE_MAKEDUMPFILE=y
EOF
$ ./utils/test-pkg -c snippet.cfg -p makedumpfile
> +MAKEDUMPFILE_LICENSE = GPL-2.0
> +MAKEDUMPFILE_LICENSE_FILES = COPYING
> +
> +define MAKEDUMPFILE_BUILD_CMDS
> + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) CC="$(TARGET_CC)" \
> + EXTRA_CFLAGS="$(TARGET_CFLAGS)" TARGET=$(BR2_ARCH) USELZO=on LINKTYPE=dynamic
Could you instead pass TARGET_CONFIGURE_OPTS in the environment, like
this:
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \
TARGET=$(BR2_ARCH) USELZO=on LINKTYPE=dynamic
TARGET=$(BR2_ARCH): did you check it builds with all CPU architectures
supported by Buildroot? In the above proposed test with test-pkg, I'd
suggest doing one run with the -a option to check with all toolchains
supported by Buildroot.
Also, USELZO=on indicates that the LZO dependency, could you make it
optional? I.e, drop the select BR2_PACKAGE_LZO from Config.in, and in
the .mk file, do something like:
ifeq ($(BR2_PACKAGE_LZO),y)
MAKEDUMPFILE_DEPENDENCIES += lzo
MAKEDUMPFILE_MAKE_OPTS += USELZO=on
endif
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH 1/1] package/makedumpfile: new package
2020-08-29 20:17 ` Thomas Petazzoni
@ 2020-08-30 14:36 ` Alexander Egorenkov
0 siblings, 0 replies; 3+ messages in thread
From: Alexander Egorenkov @ 2020-08-30 14:36 UTC (permalink / raw)
To: buildroot
> For all new packages, we need an entry to be added to the DEVELOPERS
> file so we know who is in charge of which package, and you will receive
> e-mail notifications when this package fails to build or needs to be
> updated.
Fixed.
>
> We need all patches to have a description and Signed-off-by line, and
> be generated using "git format-patch -N" when the upstream project uses
> git.
>
Fixed.
> It's not clear to me why you need this change though. I think the
> intention of this code is that if you pass CFLAGS in the environment of
> make and not as an option, it will do the right thing. Quick demo:
>
> $ cat toto.mk
> CFLAGS_BASE := $(CFLAGS) -foobar
> CFLAGS := $(CFLAGS_BASE) -barfoo
>
> all:
> @echo $(CFLAGS)
>
> $
> $ make -f toto.mk CFLAGS=-baz
> -baz
> $ CFLAGS=-baz make -f toto.mk
> -baz -foobar -barfoo
>
>
Fixed. Thanks for pointing out.
> Again, we need this to have a proper description and Signed-off-by.
> Also, could you submit it upstream ?
>
The fix is already upstream but there is no release yet.
Anyways, i took the official patch now.
> elfutils has plenty more dependencies that you need to replicate:
>
> depends on BR2_USE_WCHAR
> depends on !BR2_STATIC_LIBS
> # Only glibc and uClibc implement the myriad of required GNUisms
> depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC
>
Fixed.
>
> You need to add the upstream URL of the project in the Config.in help
> text, look at other packages for example.
>
> Also, you need to add a comment about the Config.in dependencies. Look
> at other packages for direction on how to do this. For example, in
> package/elfutils/Config.in, we have:
>
> comment "elfutils needs a uClibc or glibc toolchain w/ wchar, dynamic library"
> depends on !BR2_USE_WCHAR || BR2_STATIC_LIBS \
> || !(BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC)
>
Fixed.
> Your Config.in file also selects bzip2 and elfutils... so it seems odd
> they are not needed at build time. Could you confirm this ?
>
> In any case, make sure you can run this:
>
> $ make clean
> $ make makedumpfile
>
Done. It works.
> if that doesn't work, you forgot some build dependencies.
>
> Also, run:
>
> $ cat > snippet.cfg<<EOF
> BR2_PACKAGE_MAKEDUMPFILE=y
> EOF
> $ ./utils/test-pkg -c snippet.cfg -p makedumpfile
>
$ ./utils/test-pkg -c snippet.cfg -p makedumpfile
br-arm-full [1/6]: FAILED
br-arm-cortex-a9-glibc [2/6]: OK
br-arm-cortex-m4-full [3/6]: SKIPPED
br-x86-64-musl [4/6]: SKIPPED
br-arm-full-static [5/6]: SKIPPED
sourcery-arm [6/6]: OK
6 builds, 3 skipped, 1 build failed, 0 legal-info failed
/home/egorenar/br-test-pkg/br-arm-full/host/bin/arm-linux-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g -O2 -Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__arm __ -U__x86_64__ -c -o ./arch/x86_64.o arch/x86_64.c
elf_info.c: In function ?get_elf64_phnum?:
elf_info.c:1050:23: error: ?PN_XNUM? undeclared (first use in this function)
if (ehdr->e_phnum == PN_XNUM) {
^
elf_info.c:1050:23: note: each undeclared identifier is reported only once for each function it appears in
/home/egorenar/br-test-pkg/br-arm-full/host/bin/arm-linux-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g -O2 -Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__arm __ -U__x86_64__ -c -o ./arch/ia64.o arch/ia64.c
make[1]: *** [Makefile:90: elf_info.o] Error 1
Not sure what is going on, because PN_XNUM is defined in
elfutils/libelf/elf.h
> Could you instead pass TARGET_CONFIGURE_OPTS in the environment, like
> this:
>
> $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \
> TARGET=$(BR2_ARCH) USELZO=on LINKTYPE=dynamic
>
> TARGET=$(BR2_ARCH): did you check it builds with all CPU architectures
> supported by Buildroot? In the above proposed test with test-pkg, I'd
> suggest doing one run with the -a option to check with all toolchains
> supported by Buildroot.
>
> Also, USELZO=on indicates that the LZO dependency, could you make it
> optional? I.e, drop the select BR2_PACKAGE_LZO from Config.in, and in
> the .mk file, do something like:
>
> ifeq ($(BR2_PACKAGE_LZO),y)
> MAKEDUMPFILE_DEPENDENCIES += lzo
> MAKEDUMPFILE_MAKE_OPTS += USELZO=on
> endif
Fixed.
Regards
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-30 14:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-29 7:59 [Buildroot] [PATCH 1/1] package/makedumpfile: new package Alexander Egorenkov
2020-08-29 20:17 ` Thomas Petazzoni
2020-08-30 14:36 ` Alexander Egorenkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox