Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1 | DESCRIPTION = "syzkaller is an unsupervised coverage-guided kernel fuzzer" |
| 2 | LICENSE = "Apache-2.0" |
| 3 | LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=5335066555b14d832335aa4660d6c376" |
| 4 | |
| 5 | inherit go-mod |
| 6 | |
| 7 | GO_IMPORT = "github.com/google/syzkaller" |
| 8 | |
| 9 | SRC_URI = "git://${GO_IMPORT};protocol=https;destsuffix=${BPN}-${PV}/src/${GO_IMPORT};branch=master \ |
| 10 | file://0001-sys-targets-targets.go-allow-users-to-override-hardc.patch;patchdir=src/${GO_IMPORT} \ |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 11 | file://0001-executor-Include-missing-linux-falloc.h.patch;patchdir=src/${GO_IMPORT} \ |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 12 | " |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 13 | SRCREV = "6d01f20890edf11b99bb54573025b11c1acd2d52" |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 14 | |
| 15 | COMPATIBLE_HOST = "(x86_64|i.86|arm|aarch64).*-linux" |
| 16 | |
| 17 | B = "${S}/src/${GO_IMPORT}/bin" |
| 18 | |
| 19 | GO_EXTRA_LDFLAGS += ' -X ${GO_IMPORT}/prog.GitRevision=${SRCREV}' |
| 20 | |
| 21 | export GOHOSTFLAGS="${GO_LINKSHARED} ${GOBUILDFLAGS}" |
| 22 | export GOTARGETFLAGS="${GO_LINKSHARED} ${GOBUILDFLAGS}" |
| 23 | export TARGETOS = '${GOOS}' |
| 24 | export TARGETARCH = '${GOARCH}' |
| 25 | export TARGETVMARCH = '${GOARCH}' |
| 26 | |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 27 | CGO_ENABLED = "1" |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 28 | |
| 29 | DEPENDS:class-native += "qemu-system-native" |
| 30 | |
| 31 | do_compile:class-native() { |
| 32 | export HOSTOS="${GOHOSTOS}" |
| 33 | export HOSTARCH="${GOHOSTARCH}" |
| 34 | |
| 35 | oe_runmake HOSTGO="${GO}" host |
| 36 | } |
| 37 | |
| 38 | do_compile:class-target() { |
| 39 | export HOSTOS="${GOOS}" |
| 40 | export HOSTARCH="${GOARCH}" |
| 41 | export SYZ_CC_${TARGETOS}_${TARGETARCH}="${CC}" |
| 42 | |
| 43 | # Unset GOOS and GOARCH so that the correct syz-sysgen binary can be |
| 44 | # generated. Fixes: |
| 45 | # go install: cannot install cross-compiled binaries when GOBIN is set |
| 46 | unset GOOS |
| 47 | unset GOARCH |
| 48 | |
| 49 | oe_runmake GO="${GO}" CC="${CXX}" CFLAGS="${CXXFLAGS} ${LDFLAGS}" REV=${SRCREV} target |
| 50 | } |
| 51 | |
| 52 | do_install:class-native() { |
| 53 | SYZ_BINS_NATIVE="syz-manager syz-runtest syz-repro syz-mutate syz-prog2c \ |
| 54 | syz-db syz-upgrade" |
| 55 | |
| 56 | install -d ${D}${bindir} |
| 57 | |
| 58 | for i in ${SYZ_BINS_NATIVE}; do |
| 59 | install -m 0755 ${B}/${i} ${D}${bindir} |
| 60 | done |
| 61 | } |
| 62 | |
| 63 | do_install:class-target() { |
| 64 | SYZ_TARGET_DIR="${TARGETOS}_${TARGETARCH}" |
| 65 | SYZ_BINS_TARGET="syz-fuzzer syz-execprog syz-stress syz-executor" |
| 66 | |
| 67 | install -d ${D}${bindir}/${SYZ_TARGET_DIR} |
| 68 | |
| 69 | for i in ${SYZ_BINS_TARGET}; do |
| 70 | install -m 0755 ${B}/${SYZ_TARGET_DIR}/${i} ${D}${bindir}/${SYZ_TARGET_DIR} |
| 71 | done |
| 72 | } |
| 73 | |
| 74 | BBCLASSEXTEND += "native" |