uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,80 @@
{ lib, stdenv, fetchurl, bzip2, lzo, zlib, xz, bash, python2, gnutar, gnused, gnugrep, which }:
stdenv.mkDerivation (rec {
pname = "xe-guest-utilities";
version = "6.2.0";
meta = {
description = "Citrix XenServer Tools";
homepage = "http://citrix.com/English/ps2/products/product.asp?contentID=683148&ntref=hp_nav_US";
maintainers = with lib.maintainers; [ benwbooth ];
platforms = lib.platforms.linux;
license = [ lib.licenses.gpl2 lib.licenses.lgpl21 ];
};
src = fetchurl {
url = "https://sources.archlinux.org/other/community/xe-guest-utilities/xe-guest-utilities_${version}-1120.tar.gz";
sha256 = "f9593cd9588188f80253e736f48d8dd94c5b517abb18316085f86acffab48794";
};
buildInputs = [ bzip2 gnutar gnused python2 lzo zlib xz gnugrep which ];
patches = [ ./ip-address.patch ];
postPatch = ''
tar xf "$NIX_BUILD_TOP/$name/xenstore-sources.tar.bz2"
'';
# Workaround build failure on -fno-common toolchains:
# ld: utils.o:xenstore/utils.h:27:
# multiple definition of `xprintf'; xenstored_core.o:xenstore/utils.h:27: first defined here
NIX_CFLAGS_COMPILE = "-fcommon";
buildPhase = ''
export CC=gcc
export CFLAGS='-Wall -Wstrict-prototypes -Wno-unused-local-typedefs -Wno-sizeof-pointer-memaccess'
export PYTHON=python2
cd "$NIX_BUILD_TOP/$name/uclibc-sources"
for file in Config.mk tools/libxc/Makefile tools/misc/Makefile tools/misc/lomount/Makefile tools/xenstore/Makefile; do
substituteInPlace "$file" --replace -Werror ""
done
make -C tools/include
make -C tools/libxc
make -C tools/xenstore
'';
installPhase = ''
export CFLAGS+='-Wall -Wstrict-prototypes -Wno-unused-local-typedefs -Wno-sizeof-pointer-memaccess'
if [[ $CARCH == x86_64 ]]; then
export LIBLEAFDIR_x86_64=lib
fi
for f in include libxc xenstore; do
[[ ! -d $NIX_BUILD_TOP/$name/uclibc-sources/tools/$f ]] && continue
make -C "$NIX_BUILD_TOP/$name/uclibc-sources/tools/$f" DESTDIR="$out" BINDIR=/bin SBINDIR=/bin INCLUDEDIR=/include LIBDIR=/lib install
done
rm -r "$out"/var
cd "$NIX_BUILD_TOP/$name"
install -Dm755 xe-update-guest-attrs "$out/bin/xe-update-guest-attrs"
install -Dm755 xe-daemon "$out/bin/xe-daemon"
install -Dm644 xen-vcpu-hotplug.rules "$out/lib/udev/rules.d/10-xen-vcpu-hotplug.rules"
substituteInPlace "$out/bin/xe-daemon" --replace sbin bin
substituteInPlace "$out/bin/xe-daemon" --replace /usr/ "$out/"
substituteInPlace "$out/bin/xe-update-guest-attrs" --replace /usr/ "$out/"
substituteInPlace "$out/bin/xe-update-guest-attrs" --replace 'export PATH=' 'export PATH=$PATH:'
substituteInPlace "$out/lib/udev/rules.d/10-xen-vcpu-hotplug.rules" --replace /bin/sh '${bash}/bin/sh'
cat <<'EOS' >"$out/bin/xe-linux-distribution"
#!${bash}/bin/bash -eu
. /etc/os-release
if [[ $# -gt 0 ]]; then
mkdir -p "$(dirname "$1")"
exec 1>"$1"
fi
cat <<EOF
os_distro="$ID"
os_majorver="''${VERSION_ID%%.*}"
os_minorver="''${VERSION_ID#*.}"
os_uname="$(uname -r)"
os_name="$PRETTY_NAME"
EOF
EOS
chmod 0755 "$out/bin/xe-linux-distribution"
'';
})

View file

@ -0,0 +1,16 @@
diff -uNr a/xe-update-guest-attrs b/xe-update-guest-attrs
--- a/xe-update-guest-attrs 2012-09-25 12:45:14.000000000 +0200
+++ b/xe-update-guest-attrs 2012-11-21 16:46:35.000000000 +0100
@@ -177,9 +177,9 @@
# collisions:0 txqueuelen:0
# RX bytes:3604609 (3.4 MiB) TX bytes:3604609 (3.4 MiB)
-ifs=`/sbin/ifconfig | sed -n -e 's/^\([a-z0-9]\+\).*/name \1/p' \
- -e 's/.*inet addr:\('$IPADDR_RE'\) .*/ipv4 \1/p' \
- -e 's+.*inet6 addr: \('$IPADDR6_RE'\)/.*+ipv6 \1+p' | \
+ifs=`ip addr show | sed -n -e 's/^[[:digit:]]*: \([a-z0-9]*\): .*/name \1 /gp;' \
+ -e 's/^[[:space:]]\{4\}inet \('${IPADDR_RE}'\)\/.*/ipv4 \1 /gp;' \
+ -e 's/^[[:space:]]\{4\}inet6 \('${IPADDR6_RE}'\)\/.*/ipv6 \1 /gp;' | \
while read tag value; do
case "${tag}" in
name)