All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baruch Siach <baruch@tkos.co.il>
To: Nevo Hed <nhed+buildroot@starry.com>
Cc: Samuel Martin <s.martin49@gmail.com>, buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 1/1] package/nginx: override endianness
Date: Tue, 31 Aug 2021 14:55:41 +0300	[thread overview]
Message-ID: <87bl5drfm1.fsf@tarshish> (raw)
In-Reply-To: <CABGDZCngRCEfsjdy7iUpX7V8Yiz8iQzesyJre7xUxJ2zfqM-jA@mail.gmail.com>


On Tue, Aug 31 2021, Nevo Hed wrote:
> This is my first contribution attempt in buildroot. 
>
> Just noticed a couple of typos (missing words actually) in the top
> commit message.  Should I wait for other feedback or work on
> replacement patch asap (won't be in office for at least 5 from now).

You can do either.

In case you send v2 patch, make sure to mark this one as superseded in
the Buildroot patchwork:

  http://patchwork.ozlabs.org/project/buildroot/list/

baruch

> On Mon, Aug 30, 2021, 4:54 PM Nevo Hed <nhed+buildroot@starry.com> wrote:
>
>  Though several patches exist in buildroot's nginx package dir they do
>  not seem to address endianness.
>
>  The test program generated my the script compiles but fails to run (as
>  it is built for another architecture) but the script does not
>  distinguish between the failure to run the program and an indication
>  of certain endianness.  As such the fallback of big-endian is used.
>  This setting then causes http2 headers (anything not in the satic
>  dictionary) to come out as undecipherble trash.
>
>  This commit includes a patch to the configure script to allow a
>  `--force-endianness=big|little` flag as as setting that flag in
>  buildroot's package makefile.
>
>  Signed-off-by: Nevo Hed <nhed+buildroot@starry.com>
>  ---
>   ...-of-endianness-for-cross-compilation.patch | 115 ++++++++++++++++++
>   package/nginx/nginx.mk                        |   1 +
>   2 files changed, 116 insertions(+)
>   create mode 100644 package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch
>
>  diff --git a/package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch
>  b/package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch
>  new file mode 100644
>  index 0000000000..137ff6ea5d
>  --- /dev/null
>  +++ b/package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch
>  @@ -0,0 +1,115 @@
>  +From b1a6b13d8ac2cade71bae508c7d20fbee6807e4e Mon Sep 17 00:00:00 2001
>  +From: Nevo Hed <nhed+buildroot@starry.com>
>  +Date: Mon, 30 Aug 2021 13:28:13 -0400
>  +Subject: [PATCH] Allow forcing of endianness for cross-compilation
>  +
>  +Signed-off-by: Nevo Hed <nhed+buildroot@starry.com>
>  +---
>  + auto/endianness | 61 ++++++++++++++++++++++++++++++++-----------------
>  + auto/options    |  6 +++++
>  + 2 files changed, 46 insertions(+), 21 deletions(-)
>  +
>  +diff --git a/auto/endianness b/auto/endianness
>  +index 1b552b6b..4b2a3cd7 100644
>  +--- a/auto/endianness
>  ++++ b/auto/endianness
>  +@@ -26,25 +26,44 @@ int main(void) {
>  + 
>  + END
>  + 
>  +-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
>  +-          -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
>  +-
>  +-eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
>  +-
>  +-if [ -x $NGX_AUTOTEST ]; then
>  +-    if $NGX_AUTOTEST >/dev/null 2>&1; then
>  +-        echo " little endian"
>  ++case "${NGX_FORCE_ENDIANNESS}" in
>  ++    little)
>  ++        echo " little endian (forced)"
>  +         have=NGX_HAVE_LITTLE_ENDIAN . auto/have
>  +-    else
>  +-        echo " big endian"
>  +-    fi
>  +-
>  +-    rm -rf $NGX_AUTOTEST*
>  +-
>  +-else
>  +-    rm -rf $NGX_AUTOTEST*
>  +-
>  +-    echo
>  +-    echo "$0: error: cannot detect system byte ordering"
>  +-    exit 1
>  +-fi
>  ++    ;;
>  ++
>  ++    big)
>  ++        echo " big endian (forced)"
>  ++    ;;
>  ++
>  ++    "")
>  ++        ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
>  ++                  -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
>  ++
>  ++        eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
>  ++
>  ++        if [ -x $NGX_AUTOTEST ]; then
>  ++            if $NGX_AUTOTEST >/dev/null 2>&1; then
>  ++                echo " little endian"
>  ++                have=NGX_HAVE_LITTLE_ENDIAN . auto/have
>  ++            else
>  ++                echo " big endian"
>  ++            fi
>  ++
>  ++            rm -rf $NGX_AUTOTEST*
>  ++
>  ++        else
>  ++            rm -rf $NGX_AUTOTEST*
>  ++
>  ++            echo
>  ++            echo "$0: error: cannot detect system byte ordering"
>  ++            exit 1
>  ++        fi
>  ++    ;;
>  ++
>  ++    *)
>  ++        echo
>  ++        echo "$0: error: invalid \"--force-endianness=${NGX_FORCE_ENDIANNESS}\""
>  ++        exit 1
>  ++    ;;
>  ++esac
>  +diff --git a/auto/options b/auto/options
>  +index 80be906e..85a06456 100644
>  +--- a/auto/options
>  ++++ b/auto/options
>  +@@ -17,6 +17,8 @@ NGX_USER=
>  + NGX_GROUP=
>  + NGX_BUILD=
>  + 
>  ++NGX_FORCE_ENDIANNESS=
>  ++
>  + CC=${CC:-cc}
>  + CPP=
>  + NGX_OBJS=objs
>  +@@ -196,6 +198,8 @@ do
>  +         --user=*)                        NGX_USER="$value"          ;;
>  +         --group=*)                       NGX_GROUP="$value"         ;;
>  + 
>  ++        --force-endianness=*)            NGX_FORCE_ENDIANNESS="$value" ;;
>  ++
>  +         --crossbuild=*)                  NGX_PLATFORM="$value"      ;;
>  + 
>  +         --build=*)                       NGX_BUILD="$value"         ;;
>  +@@ -432,6 +436,8 @@ cat << END
>  +   --build=NAME                       set build name
>  +   --builddir=DIR                     set build directory
>  + 
>  ++  --force-endianness=<big>|<little>  force endianness
>  ++
>  +   --with-select_module               enable select module
>  +   --without-select_module            disable select module
>  +   --with-poll_module                 enable poll module
>  +-- 
>  +2.31.1
>  +
>  diff --git a/package/nginx/nginx.mk b/package/nginx/nginx.mk
>  index 1f996cc613..31b6e276b7 100644
>  --- a/package/nginx/nginx.mk
>  +++ b/package/nginx/nginx.mk
>  @@ -49,6 +49,7 @@ NGINX_CONF_ENV += \
>
>   # prefix: nginx root configuration location
>   NGINX_CONF_OPTS += \
>  +       --force-endianness=$(call qstrip,$(call LOWERCASE,$(BR2_ENDIAN))) \
>          --prefix=/usr \
>          --conf-path=/etc/nginx/nginx.conf \
>          --sbin-path=/usr/sbin/nginx \
>  -- 
>  2.31.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot


-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

  reply	other threads:[~2021-08-31 11:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30 20:53 [Buildroot] [PATCH 1/1] package/nginx: override endianness Nevo Hed
2021-08-31 11:11 ` Nevo Hed
2021-08-31 11:55   ` Baruch Siach [this message]
2021-08-31 13:45 ` Arnout Vandecappelle
2021-08-31 16:19   ` Nevo Hed
2021-08-31 16:39     ` Arnout Vandecappelle
  -- strict thread matches above, loose matches on Subject: below --
2021-08-31 20:24 [Buildroot] [PATCH v2 0/1] " Nevo Hed
2021-08-31 20:24 ` [Buildroot] [PATCH 1/1] " Nevo Hed
2021-09-10  9:59   ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bl5drfm1.fsf@tarshish \
    --to=baruch@tkos.co.il \
    --cc=buildroot@buildroot.org \
    --cc=nhed+buildroot@starry.com \
    --cc=s.martin49@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.