[ptxdist] [PATCH] gcclibs: typo: don't install liblsan.so when GCCLIBS_LIBTSAN is enabled

2018-12-21 Thread Roland Hieber
As mentioned in gcclibs.in, the GCCLIBS_LIBTSAN symbol is meant to
install the ThreadSanitizer library, libtsan.so. The typo here,
"liblsan.so" was probably copied from the rule above it.

Reported-by: horizon on irc://chat.freenode.net/#ptxdist
Fixes: 60ae2f93bed3a1d5a7e6 ("gcclibs: add more sanitizer")
Signed-off-by: Roland Hieber 
---
 rules/gcclibs.make | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rules/gcclibs.make b/rules/gcclibs.make
index 6b1a31ebf..187c80c15 100644
--- a/rules/gcclibs.make
+++ b/rules/gcclibs.make
@@ -56,11 +56,11 @@ endif
 ifdef PTXCONF_GCCLIBS_LIBLSAN
@$(call install_copy_toolchain_lib, gcclibs, liblsan.so)
 endif
 
 ifdef PTXCONF_GCCLIBS_LIBTSAN
-   @$(call install_copy_toolchain_lib, gcclibs, liblsan.so)
+   @$(call install_copy_toolchain_lib, gcclibs, libtsan.so)
 endif
 
 ifdef PTXCONF_GCCLIBS_LIBUBSAN
@$(call install_copy_toolchain_lib, gcclibs, libubsan.so)
 endif
-- 
2.19.2


___
ptxdist mailing list
ptxdist@pengutronix.de

[ptxdist] [PATCH v1] kernel: add vmlinuz support

2018-12-21 Thread Oleksij Rempel
it is compressed ELF image. Mostly interesting for MIPS platforms.

Signed-off-by: Oleksij Rempel 
---
 platforms/kernel.in | 8 
 rules/kernel.make   | 3 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/platforms/kernel.in b/platforms/kernel.in
index fc89c9aaf..f7a2613d3 100644
--- a/platforms/kernel.in
+++ b/platforms/kernel.in
@@ -161,6 +161,13 @@ choice
 This is the target to get the kernel image as an ELF. Mostly
 used for debugging purposes.
 
+   config KERNEL_IMAGE_VMLINUZ
+   bool
+   prompt "vmlinuz"
+   help
+This is the target to get the compressed kernel image as an 
ELF.
+Mostly used for debugging purposes or for MIPS.
+
config KERNEL_IMAGE_RAW
bool
prompt "Image"
@@ -208,6 +215,7 @@ config KERNEL_IMAGE
default "uImage"  if KERNEL_IMAGE_U
default "vmImage" if KERNEL_IMAGE_VM
default "vmlinux" if KERNEL_IMAGE_VMLINUX
+   default "vmlinuz" if KERNEL_IMAGE_VMLINUZ
default "Image"   if KERNEL_IMAGE_RAW
default "simpleImage.${PTXCONF_KERNEL_IMAGE_SIMPLE_TARGET}.elf" if 
KERNEL_IMAGE_SIMPLE
 
diff --git a/rules/kernel.make b/rules/kernel.make
index aee16792a..b888ffe67 100644
--- a/rules/kernel.make
+++ b/rules/kernel.make
@@ -77,8 +77,9 @@ KERNEL_IMAGE := $(call remove_quotes, $(PTXCONF_KERNEL_IMAGE))
 # these are sane default
 KERNEL_IMAGE_PATH_y := 
$(KERNEL_DIR)/arch/$(PTXCONF_KERNEL_ARCH_STRING)/boot/$(KERNEL_IMAGE)
 
-# vmlinux is special
+# vmlinux and vmlinuz are special
 KERNEL_IMAGE_PATH_$(PTXCONF_KERNEL_IMAGE_VMLINUX) := $(KERNEL_DIR)/vmlinux
+KERNEL_IMAGE_PATH_$(PTXCONF_KERNEL_IMAGE_VMLINUZ) := $(KERNEL_DIR)/vmlinuz
 # avr32 is also special
 KERNEL_IMAGE_PATH_$(PTXCONF_ARCH_AVR32) := 
$(KERNEL_DIR)/arch/$(PTXCONF_KERNEL_ARCH_STRING)/boot/images/$(KERNEL_IMAGE)
 
-- 
2.19.1


___
ptxdist mailing list
ptxdist@pengutronix.de

Re: [ptxdist] Copying kernel and uboot to /boot in target filesystem image

2018-12-21 Thread Guillermo Rodriguez Garcia
Hello,

El vie., 21 dic. 2018 a las 15:16, Alexander Dahl () escribió:
>
> Hello,
>
> Am Freitag, 21. Dezember 2018, 14:27:12 CET schrieb Guillermo Rodriguez
> Garcia:
> > > PTXCONF_U_BOOT is in platformconfig, so I guess your .in file can only
> > > depend on it, if it extends the platformconfig as well, not the normal
> > > ptxconfig?
> > I see. How can I have my .in file "extend" the platformconfig ?
>
> Just move it from the folder 'rules' to 'platforms' or maybe better to config/
> yourplatform/platforms. You call 'make platformconfig' then and find it
> somewhere there.
>
> It's probably good to see some other platform packages in the ptxdist source
> in 'platforms' or in DistroKit e.g. in 'configs/platform-v7a/platforms'. IIRC
> the categories in the first line of the .in file differ.
>
> I'm not sure if all possibilities for the accompaning .make files apply, nor
> if that topic is covered in the documentation, but it should give you a
> starting point.

This got me on the right track, although it looks like it doesn't
matter whether the file is in rules, or platform or whatever -- what
matters is actually the category in the first line of the .in file.
In fact, I already have a modified u-boot.in in my BSP's rules
directory, so I just added a new option there; if this option is
enabled, any selected u-boot files will be installed to /boot in the
target filesystem, in addition to copying them to the platform image
directory.

Thank you for the pointer!

Guillermo

___
ptxdist mailing list
ptxdist@pengutronix.de

Re: [ptxdist] Copying kernel and uboot to /boot in target filesystem image

2018-12-21 Thread Alexander Dahl
Hello, 

Am Freitag, 21. Dezember 2018, 14:27:12 CET schrieb Guillermo Rodriguez 
Garcia:
> > PTXCONF_U_BOOT is in platformconfig, so I guess your .in file can only
> > depend on it, if it extends the platformconfig as well, not the normal
> > ptxconfig?
> I see. How can I have my .in file "extend" the platformconfig ?

Just move it from the folder 'rules' to 'platforms' or maybe better to config/
yourplatform/platforms. You call 'make platformconfig' then and find it 
somewhere there. 

It's probably good to see some other platform packages in the ptxdist source 
in 'platforms' or in DistroKit e.g. in 'configs/platform-v7a/platforms'. IIRC 
the categories in the first line of the .in file differ.

I'm not sure if all possibilities for the accompaning .make files apply, nor 
if that topic is covered in the documentation, but it should give you a 
starting point.

Greets
Alex


___
ptxdist mailing list
ptxdist@pengutronix.de

Re: [ptxdist] Copying kernel and uboot to /boot in target filesystem image

2018-12-21 Thread Guillermo Rodriguez Garcia
Hi Alexander,

El vie., 21 dic. 2018 a las 14:02, Alexander Dahl () escribió:
>
> Hei hei,
>
> Am Freitag, 21. Dezember 2018, 13:17:52 CET schrieb Guillermo Rodriguez
> Garcia:
> > I want to have ptxdist copy the generated kernel and uboot binaries to
> > the /boot directory in the target filesystem image.
>
> What about KERNEL_INSTALL in platformconfig? Do you have more files which are
> not covered by that?

I didn't know about that option. That's good -- it covers the kernel
and dts file. But I also need to copy the SPL and uboot binaries.

>
> > For this I need to setup a package that would depend on the kernel and
> > uboot packages, so that these are generated first. In the .in file I
> > added the following:
> >
> > select U_BOOT if ROOTFS_EXTRA_COPY_UBOOT_FILES
> > select KERNEL if ROOTFS_EXTRA_COPY_KERNEL_FILES
> >
> > But for u-boot I get the following:
> >
> > warning: 'select' used by config symbol 'ROOTFS_EXTRA' refers to
> > undefined symbol 'U_BOOT'
> >
> > Why is this, and how can I solve it?
>
> PTXCONF_U_BOOT is in platformconfig, so I guess your .in file can only depend
> on it, if it extends the platformconfig as well, not the normal ptxconfig?

I see. How can I have my .in file "extend" the platformconfig ?

Thanks,

Guillermo

___
ptxdist mailing list
ptxdist@pengutronix.de

Re: [ptxdist] Copying kernel and uboot to /boot in target filesystem image

2018-12-21 Thread Alexander Dahl
Hei hei,

Am Freitag, 21. Dezember 2018, 13:17:52 CET schrieb Guillermo Rodriguez 
Garcia:
> I want to have ptxdist copy the generated kernel and uboot binaries to
> the /boot directory in the target filesystem image.

What about KERNEL_INSTALL in platformconfig? Do you have more files which are 
not covered by that?

> For this I need to setup a package that would depend on the kernel and
> uboot packages, so that these are generated first. In the .in file I
> added the following:
> 
> select U_BOOT if ROOTFS_EXTRA_COPY_UBOOT_FILES
> select KERNEL if ROOTFS_EXTRA_COPY_KERNEL_FILES
> 
> But for u-boot I get the following:
> 
> warning: 'select' used by config symbol 'ROOTFS_EXTRA' refers to
> undefined symbol 'U_BOOT'
> 
> Why is this, and how can I solve it?

PTXCONF_U_BOOT is in platformconfig, so I guess your .in file can only depend 
on it, if it extends the platformconfig as well, not the normal ptxconfig?

Greets
Alex


___
ptxdist mailing list
ptxdist@pengutronix.de

[ptxdist] Copying kernel and uboot to /boot in target filesystem image

2018-12-21 Thread Guillermo Rodriguez Garcia
Hi all,

I want to have ptxdist copy the generated kernel and uboot binaries to
the /boot directory in the target filesystem image.

For this I need to setup a package that would depend on the kernel and
uboot packages, so that these are generated first. In the .in file I
added the following:

select U_BOOT if ROOTFS_EXTRA_COPY_UBOOT_FILES
select KERNEL if ROOTFS_EXTRA_COPY_KERNEL_FILES

But for u-boot I get the following:

warning: 'select' used by config symbol 'ROOTFS_EXTRA' refers to
undefined symbol 'U_BOOT'

Why is this, and how can I solve it?

Thank you,

Guillermo Rodriguez Garcia
guille.rodrig...@gmail.com

___
ptxdist mailing list
ptxdist@pengutronix.de

[ptxdist] [PATCH v3 3/3] barebox_mlo: add support for reproducible build

2018-12-21 Thread Baeuerle, Florian
Signed-off-by: Florian Bäuerle 
---
 rules/barebox_mlo.make | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/rules/barebox_mlo.make b/rules/barebox_mlo.make
index 368da0e8f..2f1da0ca7 100644
--- a/rules/barebox_mlo.make
+++ b/rules/barebox_mlo.make
@@ -39,7 +39,6 @@ BAREBOX_MLO_WRAPPER_BLACKLIST := \
TARGET_BUILD_ID
 
 BAREBOX_MLO_PATH   := PATH=$(CROSS_PATH)
-BAREBOX_MLO_CONF_ENV   := KCONFIG_NOTIMESTAMP=1
 BAREBOX_MLO_CONF_TOOL  := kconfig
 BAREBOX_MLO_CONF_OPT   := \
V=$(PTXDIST_VERBOSE) \
@@ -49,6 +48,15 @@ BAREBOX_MLO_CONF_OPT := \
 
 BAREBOX_MLO_MAKE_OPT   := $(BAREBOX_MLO_CONF_OPT)
 
+ifndef PTXCONF_SETUP_DISABLE_REPRODUCIBLE
+BAREBOX_MLO_MAKE_ENV := $(BAREBOX_MLO_MAKE_ENV) \
+   SOURCE_DATE_EPOCH="$(SOURCE_DATE_EPOCH)" \
+   KBUILD_BUILD_TIMESTAMP="$(shell date --utc --date 
@$(SOURCE_DATE_EPOCH))" \
+   KBUILD_BUILD_VERSION="0" \
+   KBUILD_BUILD_USER="ptxdist" \
+   KBUILD_BUILD_HOST="ptxdist"
+endif
+
 ifdef PTXCONF_BAREBOX_MLO
 $(BAREBOX_MLO_CONFIG):
@echo
-- 
2.19.2

___
ptxdist mailing list
ptxdist@pengutronix.de

[ptxdist] [PATCH v3 2/3] barebox: add support for reproducible build

2018-12-21 Thread Baeuerle, Florian
Signed-off-by: Florian Bäuerle 
---
 platforms/barebox.in | 3 +++
 rules/barebox.make   | 9 +
 2 files changed, 12 insertions(+)

diff --git a/platforms/barebox.in b/platforms/barebox.in
index 645366e93..46f3d8ced 100644
--- a/platforms/barebox.in
+++ b/platforms/barebox.in
@@ -113,4 +113,7 @@ config BAREBOX_NEEDS_HOST_LZOP
  lzop is used in order to compile lzop for your development
  host.
 
+ This option is required to produce reproducible lzop-
+ compressed barebox images.
+
 endif
diff --git a/rules/barebox.make b/rules/barebox.make
index 83a7126cc..080074f64 100644
--- a/rules/barebox.make
+++ b/rules/barebox.make
@@ -47,6 +47,15 @@ BAREBOX_WRAPPER_BLACKLIST := \
 BAREBOX_CONF_OPT := $(call barebox-opts, BAREBOX)
 BAREBOX_MAKE_OPT := $(BAREBOX_CONF_OPT)
 
+ifndef PTXCONF_SETUP_DISABLE_REPRODUCIBLE
+BAREBOX_MAKE_ENV := $(BAREBOX_MAKE_ENV) \
+   SOURCE_DATE_EPOCH="$(SOURCE_DATE_EPOCH)" \
+   KBUILD_BUILD_TIMESTAMP="$(shell date --utc --date 
@$(SOURCE_DATE_EPOCH))" \
+   KBUILD_BUILD_VERSION="0" \
+   KBUILD_BUILD_USER="ptxdist" \
+   KBUILD_BUILD_HOST="ptxdist"
+endif
+
 BAREBOX_TAGS_OPT := TAGS tags cscope
 
 ifdef PTXCONF_BAREBOX
-- 
2.19.2

___
ptxdist mailing list
ptxdist@pengutronix.de

[ptxdist] [PATCH v3 1/3] config/setup: make reproducible builds configurable

2018-12-21 Thread Baeuerle, Florian
Some of ptxdist's packages use SOURCE_DATE_EPOCH to make the build
results predictable. Make this behaviour more configurable via a newly
introduced ptxdist setup options.

By default, this will set SOURCE_DATE_EPOCH to the year and month of the
used OSELAS Toolchain version. If the used toolchain is not an
OSELAS-Toolchain, the PTXdist version is used as a fallback.

Signed-off-by: Florian Bäuerle 
---
 config/setup/Kconfig | 47 ++
 config/setup/ptxdistrc.default   |  5 +++
 scripts/lib/ptxd_lib_reproducible.sh | 49 +++-
 3 files changed, 100 insertions(+), 1 deletion(-)

diff --git a/config/setup/Kconfig b/config/setup/Kconfig
index 990da03a1..10adb970d 100644
--- a/config/setup/Kconfig
+++ b/config/setup/Kconfig
@@ -264,6 +264,53 @@ config SETUP_DISABLE_LOCAL_CHECK
  may fail under certain circumstances.
  Disable this check at your own risk.
 
+config SETUP_DISABLE_REPRODUCIBLE
+   bool
+   prompt "disable reproducible builds"
+   help
+ By default ptxdist will build some packages in a
+ reproducible way by injecting fake timestamps, user and
+ host name into the build.
+
+if !SETUP_DISABLE_REPRODUCIBLE
+
+choice
+   prompt "Fake timestamps source"
+   default SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN
+
+   config SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN
+   bool
+   prompt "toolchain version"
+
+   config SETUP_REPRODUCIBLE_TIMESTAMP_PTXDIST
+   bool
+   prompt "ptxdist version"
+
+   config SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM
+   bool
+   prompt "custom timestamp"
+
+endchoice
+
+config SETUP_REPRODUCIBLE_TIMESTAMP
+   string
+   default "toolchain" if SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN
+   default "ptxdist" if SETUP_REPRODUCIBLE_TIMESTAMP_PTXDIST
+   default "custom" if SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM
+
+if SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM
+
+config SETUP_REPRODUCIBLE_TIMESTAMP_STRING
+   string
+   prompt "Fake timestamp"
+   default "2018-11-01 UTC"
+   help
+ Supply a custom fake timestamp to be injected to the build.
+ The timestamp is passed to 'date --date'.
+
+endif
+endif
+
 config SETUP_ENV_WHITELIST
string "environment variable whitelist (space separated)"
help
diff --git a/config/setup/ptxdistrc.default b/config/setup/ptxdistrc.default
index 397b78eb7..8aa7dcc9a 100644
--- a/config/setup/ptxdistrc.default
+++ b/config/setup/ptxdistrc.default
@@ -61,6 +61,11 @@ PTXCONF_SETUP_JAVA_SDK="/usr/lib/jvm/default-java"
 # Developer Options 
 #
 # PTXCONF_SETUP_DISABLE_LOCAL_CHECK is not set
+# PTXCONF_SETUP_DISABLE_REPRODUCIBLE is not set
+PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN=y
+# PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_PTXDIST is not set
+# PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM is not set
+PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP="toolchain"
 PTXCONF_SETUP_ENV_WHITELIST=""
 # PTXCONF_SETUP_COMMON_CACHE is not set
 # PTXCONF_SETUP_GEN_DEP_TREE is not set
diff --git a/scripts/lib/ptxd_lib_reproducible.sh 
b/scripts/lib/ptxd_lib_reproducible.sh
index e2e664ba8..98c528ac2 100644
--- a/scripts/lib/ptxd_lib_reproducible.sh
+++ b/scripts/lib/ptxd_lib_reproducible.sh
@@ -8,8 +8,55 @@
 # see the README file.
 #
 
+ptxd_timestamp_ptxdist() {
+ptxd_reply="${PTXDIST_VERSION_YEAR}-${PTXDIST_VERSION_MONTH}-01 UTC"
+}
+
+ptxd_timestamp_toolchain() {
+local oselas_ptxconfig="$(readlink -f "${PTXDIST_TOOLCHAIN}/ptxconfig")"
+
+if [ -e "${oselas_ptxconfig}" ]; then
+local oselas_version="$(source "${oselas_ptxconfig}" && echo 
${PTXCONF_CONFIGFILE_VERSION})"
+local orig_IFS="${IFS}"
+local IFS="."
+set -- ${oselas_version}
+IFS="${orig_IFS}"
+ptxd_reply="${1}-${2}-01 UTC"
+else
+echo "${PTXDIST_LOG_PROMPT}warning: cannot deduce timestamp from 
toolchain, falling back to PTXdist version for reproducible timestamp"
+ptxd_timestamp_ptxdist
+fi
+}
+
+ptxd_timestamp_custom() {
+local ts="${PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_STRING}"
+
+if ! date --date "${ts}" > /dev/null 2>&1; then
+echo "${PTXDIST_LOG_PROMPT}warning: '${ts}' is not a valid timestamp, 
falling back to toolchain for reproducible timestamp"
+ptxd_timestamp_toolchain
+else
+ptxd_reply="${ts}"
+fi
+}
+
 ptxd_lib_reproducible() {
-SOURCE_DATE_EPOCH="$(echo $(date 
--date="${PTXDIST_VERSION_YEAR}-${PTXDIST_VERSION_MONTH}-01 UTC" "+%s"))"
+if [ "${PTXCONF_SETUP_DISABLE_REPRODUCIBLE}" = "y" ]; then
+ptxd_timestamp_ptxdist
+else
+case "${PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP}" in
+"custom")
+ptxd_timestamp_custom
+;;
+"ptxdist")
+ptxd_timestamp_ptxdist
+;;
+*)
+ptxd_timestamp_toolchain
+;;
+