Skip to content

Instantly share code, notes, and snippets.

@fredldotme
Last active June 22, 2021 22:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredldotme/7cb6649bb6992140b3041f76dfa352a0 to your computer and use it in GitHub Desktop.
Save fredldotme/7cb6649bb6992140b3041f76dfa352a0 to your computer and use it in GitHub Desktop.
project build/soong/
diff --git a/cc/config/x86_darwin_host.go b/cc/config/x86_darwin_host.go
index 52d63514..1c7eb4ec 100644
--- a/cc/config/x86_darwin_host.go
+++ b/cc/config/x86_darwin_host.go
@@ -83,6 +83,7 @@ var (
"10.12",
"10.13",
"10.14",
+ "11.3",
}
darwinAvailableLibraries = append(
project external/elfutils/
diff --git a/libelf/elf.h b/libelf/elf.h
index 9e9ffdc2..bcc89454 100644
--- a/libelf/elf.h
+++ b/libelf/elf.h
@@ -23,6 +23,16 @@
#include <features.h>
#endif
+#ifdef __APPLE__
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS /* empty */
+# define __END_DECLS /* empty */
+#endif
+#endif
+
__BEGIN_DECLS
/* Standard ELF types. */
project halium/devices/
diff --git a/setup b/setup
index 31057d5..b4639bb 100755
--- a/setup
+++ b/setup
@@ -11,11 +11,18 @@ DEVICE=${1:=${DEVICE}}
JOBS=${JOBS:=12}
ARGS=($@)
REPO_ARGS=(${ARGS[@]:1})
+IS_LINUX=$(uname -s | grep -q "Linux" && echo 1 || echo 0)
-DEVICES_ROOT="$(dirname "$(readlink -f "${0}")")"
-REPO_ROOT="$(readlink -f ${DEVICES_ROOT}/../..)"
+if [ "$IS_LINUX" == "1" ]; then
+ DEVICES_ROOT="$(dirname "$(readlink -f "${0}")")"
+ REPO_ROOT="$(readlink -f ${DEVICES_ROOT}/../..)"
+ DEVICE_REGEX="([a-zA-Z0-9]+?)_([a-zA-Z0-9_]+)\.xml"
+else
+ DEVICES_ROOT="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
+ REPO_ROOT="${DEVICES_ROOT}/../.."
+ DEVICE_REGEX="([[:alnum:]]+)_([[:alnum:]]+)\.xml"
+fi
-DEVICE_REGEX="([a-zA-Z0-9]+?)_([a-zA-Z0-9_]+)\.xml"
if [ -z $DEVICE ]; then
echo "Please specify a device codename"
exit 0
project kernel/google/bonito/
diff --git a/security/apparmor/Makefile b/security/apparmor/Makefile
index 3a2d39530137..f7bda45361ff 100644
--- a/security/apparmor/Makefile
+++ b/security/apparmor/Makefile
@@ -2,6 +2,14 @@
#
obj-$(CONFIG_SECURITY_APPARMOR) += apparmor.o
+BUILD_HOST_KERNEL := $(shell uname -s)
+ifeq ($(BUILD_HOST_KERNEL),Linux)
+ SED_TOOL := sed
+endif
+ifeq ($(BUILD_HOST_KERNEL),Darwin)
+ SED_TOOL := gsed
+endif
+
apparmor-y := apparmorfs.o audit.o capability.o context.o ipc.o lib.o match.o \
path.o domain.o policy.o policy_unpack.o procattr.o lsm.o \
resource.o sid.o file.o label.o mount.o net.o af_unix.o \
@@ -25,13 +33,13 @@ clean-files := capability_names.h rlim_names.h net_names.h
# #define AA_FS_AF_MASK "local inet"
quiet_cmd_make-af = GEN $@
cmd_make-af = echo "static const char *address_family_names[] = {" > $@ ;\
- sed $< >>$@ -r -n -e "/AF_MAX/d" -e "/AF_LOCAL/d" -e "/AF_ROUTE/d" -e \
+ $(SED_TOOL) $< >>$@ -r -n -e "/AF_MAX/d" -e "/AF_LOCAL/d" -e "/AF_ROUTE/d" -e \
's/^\#define[ \t]+AF_([A-Z0-9_]+)[ \t]+([0-9]+)(.*)/[\2] = "\L\1",/p';\
echo "};" >> $@ ;\
- echo -n '\#define AA_FS_AF_MASK "' >> $@ ;\
- sed -r -n -e "/AF_MAX/d" -e "/AF_LOCAL/d" -e "/AF_ROUTE/d" -e \
+ printf '%s' '\#define AA_FS_AF_MASK "' >> $@ ;\
+ $(SED_TOOL) -r -n -e "/AF_MAX/d" -e "/AF_LOCAL/d" -e "/AF_ROUTE/d" -e \
's/^\#define[ \t]+AF_([A-Z0-9_]+)[ \t]+([0-9]+)(.*)/\L\1/p'\
- $< | tr '\n' ' ' | sed -e 's/ $$/"\n/' >> $@
+ $< | tr '\n' ' ' | $(SED_TOOL) -e 's/ $$/"\n/' >> $@
# Build a lower case string table of sock type names
# Transform lines from
@@ -40,7 +48,7 @@ cmd_make-af = echo "static const char *address_family_names[] = {" > $@ ;\
# [1] = "stream",
quiet_cmd_make-sock = GEN $@
cmd_make-sock = echo "static const char *sock_type_names[] = {" >> $@ ;\
- sed $^ >>$@ -r -n \
+ $(SED_TOOL) $^ >>$@ -r -n \
-e 's/^\tSOCK_([A-Z0-9_]+)[\t]+=[ \t]+([0-9]+)(.*)/[\2] = "\L\1",/p';\
echo "};" >> $@
@@ -51,13 +59,13 @@ cmd_make-sock = echo "static const char *sock_type_names[] = {" >> $@ ;\
# [1] = "dac_override",
quiet_cmd_make-caps = GEN $@
cmd_make-caps = echo "static const char *const capability_names[] = {" > $@ ;\
- sed $< >>$@ -r -n -e '/CAP_FS_MASK/d' \
+ $(SED_TOOL) $< >>$@ -r -n -e '/CAP_FS_MASK/d' \
-e 's/^\#define[ \t]+CAP_([A-Z0-9_]+)[ \t]+([0-9]+)/[\2] = "\L\1",/p';\
echo "};" >> $@ ;\
- echo -n '\#define AA_FS_CAPS_MASK "' >> $@ ;\
- sed $< -r -n -e '/CAP_FS_MASK/d' \
+ printf '%s' '\#define AA_FS_CAPS_MASK "' >> $@ ;\
+ $(SED_TOOL) $< -r -n -e '/CAP_FS_MASK/d' \
-e 's/^\#define[ \t]+CAP_([A-Z0-9_]+)[ \t]+([0-9]+)/\L\1/p' | \
- tr '\n' ' ' | sed -e 's/ $$/"\n/' >> $@
+ tr '\n' ' ' | $(SED_TOOL) -e 's/ $$/"\n/' >> $@
# Build a lower case string table of rlimit names.
@@ -66,7 +74,7 @@ cmd_make-caps = echo "static const char *const capability_names[] = {" > $@ ;\
# to
# [RLIMIT_STACK] = "stack",
#
-# and build a second integer table (with the second sed cmd), that maps
+# and build a second integer table (with the second $(SED_TOOL) cmd), that maps
# RLIMIT defines to the order defined in asm-generic/resource.h This is
# required by policy load to map policy ordering of RLIMITs to internal
# ordering for architectures that redefine an RLIMIT.
@@ -84,15 +92,15 @@ cmd_make-caps = echo "static const char *const capability_names[] = {" > $@ ;\
quiet_cmd_make-rlim = GEN $@
cmd_make-rlim = echo "static const char *const rlim_names[RLIM_NLIMITS] = {" \
> $@ ;\
- sed $< >> $@ -r -n \
+ $(SED_TOOL) $< >> $@ -r -n \
-e 's/^\# ?define[ \t]+(RLIMIT_([A-Z0-9_]+)).*/[\1] = "\L\2",/p';\
echo "};" >> $@ ;\
echo "static const int rlim_map[RLIM_NLIMITS] = {" >> $@ ;\
- sed -r -n "s/^\# ?define[ \t]+(RLIMIT_[A-Z0-9_]+).*/\1,/p" $< >> $@ ;\
+ $(SED_TOOL) -r -n "s/^\# ?define[ \t]+(RLIMIT_[A-Z0-9_]+).*/\1,/p" $< >> $@ ;\
echo "};" >> $@ ; \
- echo -n '\#define AA_FS_RLIMIT_MASK "' >> $@ ;\
- sed -r -n 's/^\# ?define[ \t]+RLIMIT_([A-Z0-9_]+).*/\L\1/p' $< | \
- tr '\n' ' ' | sed -e 's/ $$/"\n/' >> $@
+ printf '%s' '\#define AA_FS_RLIMIT_MASK "' >> $@ ;\
+ $(SED_TOOL) -r -n 's/^\# ?define[ \t]+RLIMIT_([A-Z0-9_]+).*/\L\1/p' $< | \
+ tr '\n' ' ' | $(SED_TOOL) -e 's/ $$/"\n/' >> $@
$(obj)/capability.o : $(obj)/capability_names.h
$(obj)/net.o : $(obj)/net_names.h
--- /Users/alfredneumayer/Projects/open/halium_manifest/default.xml 2021-06-23 00:23:45.000000000 +0200
+++ .repo/manifests/default.xml 2021-06-22 20:56:50.000000000 +0200
@@ -722,9 +722,7 @@
<project path="prebuilts/checkstyle" name="platform/prebuilts/checkstyle" groups="pdk" clone-depth="1" remote="aosp" />
-->
<project path="prebuilts/clang-tools" name="platform/prebuilts/clang-tools" groups="pdk" clone-depth="1" remote="aosp" />
-<!--
<project path="prebuilts/clang/host/darwin-x86" name="platform/prebuilts/clang/host/darwin-x86" groups="pdk,darwin" clone-depth="1" remote="aosp" />
--->
<project path="prebuilts/clang/host/linux-x86" name="platform/prebuilts/clang/host/linux-x86" groups="pdk" clone-depth="1" remote="aosp" />
<!--
<project path="prebuilts/deqp" name="platform/prebuilts/deqp" groups="pdk-fs" clone-depth="1" remote="aosp" />
@@ -742,8 +740,8 @@
<!--
<project path="prebuilts/gdb/darwin-x86" name="platform/prebuilts/gdb/darwin-x86" groups="darwin" clone-depth="1" remote="aosp" />
<project path="prebuilts/gdb/linux-x86" name="platform/prebuilts/gdb/linux-x86" groups="linux" clone-depth="1" remote="aosp" />
- <project path="prebuilts/go/darwin-x86" name="platform/prebuilts/go/darwin-x86" groups="darwin,pdk,tradefed" clone-depth="1" remote="aosp" />
-->
+ <project path="prebuilts/go/darwin-x86" name="platform/prebuilts/go/darwin-x86" groups="darwin,pdk,tradefed" clone-depth="1" remote="aosp" revision="4398d765548d6b5cc128a9e42ac8595e8722788c" />
<project path="prebuilts/go/linux-x86" name="platform/prebuilts/go/linux-x86" groups="linux,pdk,tradefed" clone-depth="1" remote="aosp" />
<!--
<project path="prebuilts/gradle-plugin" name="platform/prebuilts/gradle-plugin" groups="pdk,pdk-cw-fs,pdk-fs" clone-depth="1" remote="aosp" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment