added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -0,0 +1,67 @@
From aca1030d29f627314d13884ebc7b2c313d718df7 Mon Sep 17 00:00:00 2001
From: Ovidiu Panait <ovidiu.panait@windriver.com>
Date: Wed, 13 Apr 2022 17:17:54 +0300
Subject: [PATCH] sys/targets/targets.go: allow users to override hardcoded
cross-compilers
Currently, cross compiler names are hardcoded for each os/arch combo. However,
toolchain tuples differ, especially when using vendor provided toolchains.
Allow users to specify the cross compiler for an os/arch combo using
SYZ_CC_<os>_<arch> environment variables.
Also, remove hardcoded "-march=armv6" flag to fix compilation on arm.
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
---
sys/targets/targets.go | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/sys/targets/targets.go b/sys/targets/targets.go
index f3be708f3..19a8bb681 100644
--- a/sys/targets/targets.go
+++ b/sys/targets/targets.go
@@ -258,7 +258,6 @@ var List = map[string]map[string]*Target{
PtrSize: 4,
PageSize: 4 << 10,
LittleEndian: true,
- CFlags: []string{"-D__LINUX_ARM_ARCH__=6", "-march=armv6"},
Triple: "arm-linux-gnueabi",
KernelArch: "arm",
KernelHeaderArch: "arm",
@@ -670,12 +669,16 @@ func initTarget(target *Target, OS, arch string) {
for i := range target.CFlags {
target.replaceSourceDir(&target.CFlags[i], sourceDir)
}
- if OS == Linux && arch == runtime.GOARCH {
- // Don't use cross-compiler for native compilation, there are cases when this does not work:
- // https://github.com/google/syzkaller/pull/619
- // https://github.com/google/syzkaller/issues/387
- // https://github.com/google/syzkaller/commit/06db3cec94c54e1cf720cdd5db72761514569d56
- target.Triple = ""
+ if OS == Linux {
+ if cc := os.Getenv("SYZ_CC_" + OS + "_" + arch); cc != "" {
+ target.CCompiler = cc
+ } else if arch == runtime.GOARCH {
+ // Don't use cross-compiler for native compilation, there are cases when this does not work:
+ // https://github.com/google/syzkaller/pull/619
+ // https://github.com/google/syzkaller/issues/387
+ // https://github.com/google/syzkaller/commit/06db3cec94c54e1cf720cdd5db72761514569d56
+ target.Triple = ""
+ }
}
if target.CCompiler == "" {
target.setCompiler(useClang)
@@ -803,7 +806,7 @@ func (target *Target) lazyInit() {
// On CI we want to fail loudly if cross-compilation breaks.
// Also fail if SOURCEDIR_GOOS is set b/c in that case user probably assumes it will work.
if (target.OS != runtime.GOOS || !runningOnCI) && os.Getenv("SOURCEDIR_"+strings.ToUpper(target.OS)) == "" {
- if _, err := exec.LookPath(target.CCompiler); err != nil {
+ if _, err := exec.LookPath(strings.Fields(target.CCompiler)[0]); err != nil {
target.BrokenCompiler = fmt.Sprintf("%v is missing (%v)", target.CCompiler, err)
return
}
--
2.25.1

View File

@@ -0,0 +1,73 @@
DESCRIPTION = "syzkaller is an unsupervised coverage-guided kernel fuzzer"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=5335066555b14d832335aa4660d6c376"
inherit go-mod
GO_IMPORT = "github.com/google/syzkaller"
SRC_URI = "git://${GO_IMPORT};protocol=https;destsuffix=${BPN}-${PV}/src/${GO_IMPORT};branch=master \
file://0001-sys-targets-targets.go-allow-users-to-override-hardc.patch;patchdir=src/${GO_IMPORT} \
"
SRCREV = "67cb024cd1a3c95e311263a5c95e957f9abfd8ca"
COMPATIBLE_HOST = "(x86_64|i.86|arm|aarch64).*-linux"
B = "${S}/src/${GO_IMPORT}/bin"
GO_EXTRA_LDFLAGS += ' -X ${GO_IMPORT}/prog.GitRevision=${SRCREV}'
export GOHOSTFLAGS="${GO_LINKSHARED} ${GOBUILDFLAGS}"
export GOTARGETFLAGS="${GO_LINKSHARED} ${GOBUILDFLAGS}"
export TARGETOS = '${GOOS}'
export TARGETARCH = '${GOARCH}'
export TARGETVMARCH = '${GOARCH}'
CGO_ENABLED = "0"
DEPENDS:class-native += "qemu-system-native"
do_compile:class-native() {
export HOSTOS="${GOHOSTOS}"
export HOSTARCH="${GOHOSTARCH}"
oe_runmake HOSTGO="${GO}" host
}
do_compile:class-target() {
export HOSTOS="${GOOS}"
export HOSTARCH="${GOARCH}"
export SYZ_CC_${TARGETOS}_${TARGETARCH}="${CC}"
# Unset GOOS and GOARCH so that the correct syz-sysgen binary can be
# generated. Fixes:
# go install: cannot install cross-compiled binaries when GOBIN is set
unset GOOS
unset GOARCH
oe_runmake GO="${GO}" CC="${CXX}" CFLAGS="${CXXFLAGS} ${LDFLAGS}" REV=${SRCREV} target
}
do_install:class-native() {
SYZ_BINS_NATIVE="syz-manager syz-runtest syz-repro syz-mutate syz-prog2c \
syz-db syz-upgrade"
install -d ${D}${bindir}
for i in ${SYZ_BINS_NATIVE}; do
install -m 0755 ${B}/${i} ${D}${bindir}
done
}
do_install:class-target() {
SYZ_TARGET_DIR="${TARGETOS}_${TARGETARCH}"
SYZ_BINS_TARGET="syz-fuzzer syz-execprog syz-stress syz-executor"
install -d ${D}${bindir}/${SYZ_TARGET_DIR}
for i in ${SYZ_BINS_TARGET}; do
install -m 0755 ${B}/${SYZ_TARGET_DIR}/${i} ${D}${bindir}/${SYZ_TARGET_DIR}
done
}
BBCLASSEXTEND += "native"