Announcement

Collapse
No announcement yet.

install.sh/host_depend.sh support for Gentoo (patch included)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • install.sh/host_depend.sh support for Gentoo (patch included)

    The patch will add support for portage/emerge to install.sh. To apply the patch copy gentoo.patch to <installdir> and run
    Code:
    cd <installdir>
    patch scripts/host_depend.sh < gentoo.patch
    The package "app-portage/gentoolkit" (equery) is needed in order to find already installed packages.

    gentoo.patch:
    Code:
    --- scripts_orig/host_depend.sh 2011-03-17 00:33:01.000000000 +0100
    +++ scripts/host_depend.sh 2014-04-29 14:30:45.000000000 +0200
    @@ -37,6 +37,7 @@
     echo "Detecting package manager utility..."
     HAVE_DPKG=0
     HAVE_RPM=0
    +HAVE_PORTAGE=0
    
     # Is dpkg (Debian, Ubuntu) installed and in use?
     dpkg-query -l 'coreutils' > /dev/null 2>&1
    @@ -50,8 +51,15 @@
      echo "Package manager: rpm detected."
      HAVE_RPM=1
      else
    - echo "Unable to detect supported package manager utility (dpkg or rpm)."
    - exit 1
    + # Is emerge (Gentoo) installed and in use? NOTE: package app-portage/gentoolkit needed
    + equery l "sys-apps/coreutils" > /dev/null 2>&1
    + if [ $? -eq 0 ] ; then
    + echo "Package manager: emerge detected."
    + HAVE_PORTAGE=1
    + else
    + echo "Unable to detect supported package manager utility (dpkg, rpm or emerge)."
    + exit 1
    + fi
      fi
     fi
    
    @@ -148,7 +156,7 @@
      HAVE_BISON=1
      fi
    
    -else # We don't have dpkg, so we must have rpm
    +elif [ $HAVE_RPM -eq 1 ] ; then # We don't have dpkg, do we have rpm?
      # Determine if gcc is installed
      rpm -q gcc > /dev/null 2>&1
      if [ $? -eq 0 ] ; then
    @@ -220,6 +228,79 @@
      if [ $? -eq 0 ] ; then
      HAVE_BISON=1
      fi
    +
    +else # We don't have dpkg and rpm, so we must have portage
    + # Determine if gcc is installed
    + equery l "sys-devel/gcc" > /dev/null 2>&1
    + if [ $? -eq 0 ] ; then
    + HAVE_GCC=1
    + fi
    +
    + # Determine if make is installed
    + equery l "sys-devel/make" > /dev/null 2>&1
    + if [ $? -eq 0 ] ; then
    + HAVE_MAKE=1
    + fi
    +
    + # Determine if python is installed
    + equery l "dev-lang/python" > /dev/null 2>&1
    + if [ $? -eq 0 ] ; then
    + HAVE_PYTHON=1
    + fi
    +
    + # Determine if libacl-dev is installed
    + equery l "sys-apps/acl" > /dev/null 2>&1
    + if [ $? -eq 0 ] ; then
    + HAVE_ACL_DEV=1
    + fi
    +
    + # Determine if ncurses-devel is installed
    + equery l "sys-libs/ncurses" > /dev/null 2>&1
    + if [ $? -eq 0 ] ; then
    + HAVE_NCURSES_DEV=1
    + fi
    +
    + # Determine if libtasn1-devel is installed
    + equery l "dev-libs/libtasn1" > /dev/null 2>&1
    + if [ $? -eq 0 ] ; then
    + HAVE_ASN_DEV=1
    + fi
    +
    + # Determine if tftp-server is installed
    + equery l "net-ftp/atftp" > /dev/null 2>&1
    + if [ $? -eq 0 ] ; then
    + HAVE_TFTPD=1
    + fi
    +
    + # Determine if nfs-utils is installed
    + equery l "net-fs/nfs-utils" > /dev/null 2>&1
    + if [ $? -eq 0 ] ; then
    + HAVE_NFS_KERNEL_SERVER=1
    + fi
    +
    + # Determine if zlib-devel is installed
    + equery l "sys-libs/zlib" > /dev/null 2>&1
    + if [ $? -eq 0 ] ; then
    + HAVE_ZLIB_DEV=1
    + fi
    +
    + # Determine if rsync is installed
    + equery l "net-misc/rsync" > /dev/null 2>&1
    + if [ $? -eq 0 ] ; then
    + HAVE_RSYNC=1
    + fi
    +
    + # Determine if flex is installed
    + equery l "sys-devel/flex" > /dev/null 2>&1
    + if [ $? -eq 0 ] ; then
    + HAVE_FLEX=1
    + fi
    +
    + # Determine if bison is installed
    + equery l "sys-devel/bison" > /dev/null 2>&1
    + if [ $? -eq 0 ] ; then
    + HAVE_BISON=1
    + fi
     fi
    
     #
    @@ -285,13 +366,14 @@
     HAVE_APT_GET=0
     HAVE_YUM=0
     HAVE_ZYPPER=0
    +HAVE_EMERGE=0
     if [ $HAVE_DPKG -eq 1 ] ; then
      apt-get -h > /dev/null 2>&1
      if [ $? -eq 0 ] ; then
      echo "Upgrade utility: apt-get detected."
      HAVE_APT_GET=1
      fi
    -else # HAVE_RPM
    +elif [ $HAVE_RPM -eq 1 ]; then
      yum --help > /dev/null 2>&1
      if [ $? -eq 0 ] ; then
      echo "Upgrade utility: yum detected."
    @@ -302,6 +384,12 @@
      echo "Upgrade utility: zypper detected."
      HAVE_ZYPPER=1
      fi
    +else # HAVE_PORTAGE
    + emerge --help > /dev/null 2>&1
    + if [ $? -eq 0 ] ; then
    + echo "Upgrade utility: emerge detected."
    + HAVE_EMERGE=1
    + fi
     fi
    
     #
    @@ -626,7 +714,21 @@
      fi
      fi
    
    -else # We don't have apt-get, yum or zypper
    +elif [ $HAVE_EMERGE -eq 1 ] ; then
    + # Update the package index files
    + sudo emerge --sync
    +
    + # Install 'Development Tools'
    + # gentoo always includes needed build tools
    +
    + # Install the python package
    + # gentoo always includes python (as emerge itself is implemented in python)
    +
    + # Install missing packages
    + # INFO: "update" option of emerge will prevent reinstallation of already installed packages
    + sudo emerge --verbose --ask --update sys-apps/acl sys-libs/ncurses dev-libs/libtasn1 net-ftp/atftp net-fs/nfs-utils sys-libs/zlib net-misc/rsync sys-devel/flex sys-devel/bison
    +
    +else # We don't have apt-get, yum, zypper or emerge
      echo "Missing package upgrade utility. Unable to install host development packages."
      exit 1
     fi
    Last edited by sigma; 10-18-2017, 01:18 PM.

  • #2
    The patch still works with SDK 2.0.0.10.
    In order to compile with a newer glibc the patch for mtd-utils-1.2.0 must be extended, though.

    Replace the contents of the file mtd-utils-1.2.0.patch in the SDK root directory with:
    Code:
    diff -Naur mtd-utils-1.2.0/serve_image.c mtd-utils-1.2.0.fixed/serve_image.c
    --- mtd-utils-1.2.0/serve_image.c    2008-06-27 18:21:28.000000000 +0200
    +++ mtd-utils-1.2.0.fixed/serve_image.c    2017-10-17 14:09:22.969285234 +0200
    @@ -1,4 +1,5 @@
     #define _POSIX_C_SOURCE 199309
    +#define _GNU_SOURCE
    
     #include <time.h>
    
    diff -Naur mtd-utils-1.2.0/recv_image.c mtd-utils-1.2.0.fixed/recv_image.c
    --- mtd-utils-1.2.0/recv_image.c.old    2008-06-27 18:21:28.000000000 +0200
    +++ mtd-utils-1.2.0.fixed/recv_image.c    2017-10-17 14:09:00.738175491 +0200
    @@ -1,5 +1,5 @@
    -
     #define _XOPEN_SOURCE 500
    +#define _GNU_SOURCE
    
     #include <errno.h>
     #include <error.h>
    diff -Naur mtd-utils-1.2.0/ubi-utils/Makefile mtd-utils-1.2.0.fixed/ubi-utils/Makefile
    --- mtd-utils-1.2.0/ubi-utils/Makefile    2008-06-27 09:21:28.000000000 -0700
    +++ mtd-utils-1.2.0.fixed/ubi-utils/Makefile    2009-03-11 09:56:33.000000000 -0700
    @@ -9,7 +9,7 @@
     INCLUDEDIR=/usr/include
    
     CC := $(CROSS)gcc
    -CFLAGS ?= -O2 -g -Werror
    +CFLAGS ?= -O2 -g # -Werror
     CFLAGS += -Wall -Wwrite-strings -W
     CPPFLAGS += -I./inc -I./src -I$(KERNELHDR) \
         -std=gnu99 -DPACKAGE_VERSION=\"1.0\"
    diff -Naur mtd-utils-1.2.0/ubi-utils/new-utils/Makefile mtd-utils-1.2.0.fixed/ubi-utils/new-utils/Makefile
    --- mtd-utils-1.2.0/ubi-utils/new-utils/Makefile    2008-06-27 09:21:28.000000000 -0700
    +++ mtd-utils-1.2.0.fixed/ubi-utils/new-utils/Makefile    2009-03-11 10:08:37.000000000 -0700
    @@ -10,7 +10,7 @@
     INCLUDEDIR=/usr/include
    
     CC := $(CROSS)gcc
    -CFLAGS := -Iinclude -Isrc -I$(KERNELHDR) $(OPTFLAGS) -Werror -Wall
    +CFLAGS := -Iinclude -Isrc -I$(KERNELHDR) $(OPTFLAGS) -Wall # -Werror 
    
     LIBS = libubi libmtd libubigen libiniparser libscan
     UTILS = ubiupdatevol ubimkvol ubirmvol ubicrc32 ubinfo ubiattach \
    Tested with glibc-2.22 and glibc-2.23. The patch is needed because serve_image.c and recv_image.c from mtd-utils use "struct addrinfo" from netdb.h which is not part of the POSIX standard. To use it the GNU extensions must be enabled (which is done by adding "#define _GNU_SOURCE" to the source).

    Comment

    Working...
    X