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