From owner-freebsd-drivers@freebsd.org Tue Mar 23 21:43:54 2021 Return-Path: Delivered-To: freebsd-drivers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 253CA5BD3C5 for ; Tue, 23 Mar 2021 21:43:54 +0000 (UTC) (envelope-from andy_mitchell_fr@icloud.com) Received: from ms11p00im-qufo17281901.me.com (ms11p00im-qufo17281901.me.com [17.58.38.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F4lHY2RC0z4W2R for ; Tue, 23 Mar 2021 21:43:52 +0000 (UTC) (envelope-from andy_mitchell_fr@icloud.com) Received: from [192.168.1.21] (lfbn-mar-1-119-233.w86-229.abo.wanadoo.fr [86.229.90.233]) by ms11p00im-qufo17281901.me.com (Postfix) with ESMTPSA id 0564174036B for ; Tue, 23 Mar 2021 21:43:48 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andrew Mitchell Mime-Version: 1.0 (1.0) Date: Tue, 23 Mar 2021 22:43:46 +0100 Subject: Compiling a c program into .ko Message-Id: <79347B65-6929-4DDF-8528-06E31887F3CF@icloud.com> To: freebsd-drivers@freebsd.org X-Mailer: iPhone Mail (18D61) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-23_11:2021-03-23, 2021-03-23 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=366 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2006250000 definitions=main-2103230159 X-Rspamd-Queue-Id: 4F4lHY2RC0z4W2R X-Spamd-Bar: ------ X-Spamd-Result: default: False [-6.10 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEMAIL_FROM(0.00)[icloud.com]; MV_CASE(0.50)[]; TO_DN_NONE(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:17.58.0.0/16]; DKIM_TRACE(0.00)[icloud.com:+]; DMARC_POLICY_ALLOW(-0.50)[icloud.com,quarantine]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[icloud.com]; ASN(0.00)[asn:714, ipnet:17.58.32.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[17.58.38.56:from]; RCVD_IN_DNSWL_LOW(-0.10)[17.58.38.56:from]; ARC_NA(0.00)[]; SUBJECT_ENDS_SPACES(0.50)[]; R_DKIM_ALLOW(-0.20)[icloud.com:s=1a1hai]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_NONE(0.00)[icloud.com:dkim]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-drivers@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[17.58.38.56:from:127.0.2.255]; RWL_MAILSPIKE_NEUTRAL(0.00)[17.58.38.56:from]; WHITELIST_SPF_DKIM(-3.00)[icloud.com:d:+,icloud.com:s:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-drivers] X-Mailman-Approved-At: Wed, 24 Mar 2021 06:23:33 +0000 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Mar 2021 21:43:54 -0000 Hello, I haven=E2=80=99t been able for the last few weeks to understand why my file= .c won=E2=80=99t compile into a file.ko. I include in Makefile, but make returns an error which I can=E2= =80=99t explain. In all the documentation I have come across nothing is said= of SYSDIR, which is reported in the error message.=20 If you have met with this problem and found a practical solution, please sen= d me an answer so that I can unearth this arcana. Cheers, Andy=20 Envoy=C3=A9 de mon iPhone= From owner-freebsd-drivers@freebsd.org Thu Mar 25 07:35:44 2021 Return-Path: Delivered-To: freebsd-drivers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 207035B2628 for ; Thu, 25 Mar 2021 07:35:44 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F5cMz0hVZz4g3D for ; Thu, 25 Mar 2021 07:35:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82d.google.com with SMTP id y2so972007qtw.13 for ; Thu, 25 Mar 2021 00:35:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1wHaPz1XOsI9+KBGxXoBvTxPP9/hHFxEgxouDjb9OEc=; b=JE4f2eDltE4Jk2CXddPRS8IiMo7pRFp5xDNZ+4xxkDb0b5ylO1VxReOFZotMGuLzcO tUN4RCXZ0cIRGtFEKe+kO/xg7f/H78hhHxsT0klSONG/79A4ikYZ7p7KOfEGjc4NIed9 n/rxfIvvYQbaSiMp+2NDpqjvfaF22kPTCVcgjjD/z8wtCql3WisrhFeJRk+Px/fplHFX cHyBWvHmSina+zs9oNe9zlgV46BaLZzVJyNtr+qri7G++oMo7JKWIeORzfguSing6ZdU quem6MLBDHt7VnG9i9hO/2vNoMVM4FCSqExY9khEa6hX8kTnVHhZFUhD18CQoOy7tOxt R8gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1wHaPz1XOsI9+KBGxXoBvTxPP9/hHFxEgxouDjb9OEc=; b=aVc1BWVqEdJ/HEj0iFDHAmF1gye9XlbE61X7rbpzHkvdmRvjjKtywZvwUSTRQgwqEd ns9CZbOegV0MAzDnSdegE8uoHONQ8kKsGUjFAmJx65Zru4N8Q+gESAwwpo6IoGtqOZcW xjeGRhQLcCg8oNENo6+/siIHYSdxsj+hdGBs2bGL1QjZ0IMqJDfjm5AW5oH/xeuVch+B dW9vH0kYZcdvMl1g+qmTHvkZtLyF4H6PdeomE4YBQRw9+1vDBkw0w+UjUw+lJ0L/JT4+ oiISbNiv4U2f3OLg09wztRfBKjwcHLQJG/HxVKzCcs1HL9UMqPjdwpfxIexrc2g7jCRL FMtQ== X-Gm-Message-State: AOAM531ym21BYGlMwJSdrLI7+4HiAVak8K7/yT7BYKidssdOGE1KE6D8 9nV/8x1/OpMk1zorAb1CUeAg9BLJ5SkXy78jCoLXPRKXjSbqng== X-Google-Smtp-Source: ABdhPJyWDEjvdKFVrHpfqJR6O1daZz92zpxwyISHlRAaFImzmBtzZn09NsR42hzDtygaj7ugDwQfU8dGcFzvR4eqW4k= X-Received: by 2002:ac8:7e95:: with SMTP id w21mr5388695qtj.244.1616657741683; Thu, 25 Mar 2021 00:35:41 -0700 (PDT) MIME-Version: 1.0 References: <79347B65-6929-4DDF-8528-06E31887F3CF@icloud.com> In-Reply-To: <79347B65-6929-4DDF-8528-06E31887F3CF@icloud.com> From: Warner Losh Date: Thu, 25 Mar 2021 01:35:30 -0600 Message-ID: Subject: Re: Compiling a c program into .ko To: Andrew Mitchell Cc: freebsd-drivers@freebsd.org X-Rspamd-Queue-Id: 4F5cMz0hVZz4g3D X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=JE4f2eDl; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::82d) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.00 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-drivers@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::82d:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::82d:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; R_SPF_NA(0.00)[no SPF record]; FREEMAIL_TO(0.00)[icloud.com]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::82d:from]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[freebsd-drivers]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Mar 2021 07:35:44 -0000 On Wed, Mar 24, 2021 at 12:23 AM Andrew Mitchell via freebsd-drivers < freebsd-drivers@freebsd.org> wrote: > Hello, > I haven=E2=80=99t been able for the last few weeks to understand why my f= ile.c > won=E2=80=99t compile into a file.ko. > I include in Makefile, but make returns an error which I > can=E2=80=99t explain. In all the documentation I have come across nothin= g is said > of SYSDIR, which is reported in the error message. > If you have met with this problem and found a practical solution, please > send me an answer so that I can unearth this arcana. > To build a kernel module, you need a copy of the kernel source. You can get it from the 'src' git repo under sys. so if you cloned a work tree to /foo/bar/FreeBSD/src/sys, you'd set SYSDIR to /foo/bar/FreeSBD/src/sys in your shell environment, or type it each time on the make command line. Alternatively, you can put your kernel sources in /usr/src/sys and it will pick them up automatically. This should be documented in the build(7) man page, but is conspicuous by its absence. I'll fix that shortly, but this should get you to the next step. Warner > Cheers, > Andy > > > > Envoy=C3=A9 de mon iPhone > _______________________________________________ > freebsd-drivers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-drivers > To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@freebsd.org= " >