diff options
Diffstat (limited to 'meta-openembedded/meta-oe/recipes-test/syzkaller/syzkaller_git.bb')
-rw-r--r-- | meta-openembedded/meta-oe/recipes-test/syzkaller/syzkaller_git.bb | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/meta-openembedded/meta-oe/recipes-test/syzkaller/syzkaller_git.bb b/meta-openembedded/meta-oe/recipes-test/syzkaller/syzkaller_git.bb new file mode 100644 index 0000000000..f7c751f806 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-test/syzkaller/syzkaller_git.bb @@ -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" |