From owner-freebsd-arm@freebsd.org Mon Oct 23 19:30:56 2017 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7C0FE534F8 for ; Mon, 23 Oct 2017 19:30:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22a.google.com (mail-it0-x22a.google.com [IPv6:2607:f8b0:4001:c0b::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6BDDC8146B for ; Mon, 23 Oct 2017 19:30:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22a.google.com with SMTP id y15so7246854ita.4 for ; Mon, 23 Oct 2017 12:30:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=dbC9DFuPy+Jq05bM4Wyc59ptDK049uRz6An2mf/aQqk=; b=xMbr9XTl8KRBvl6oLVRXAY7eqArQIjBmpgCR4tDwTD8Ojbf/+JtJHDUFS6sMzxBMAt qiOPoUHX96lNpKlBeyouYhil4zFyuTMG2iBp7DSpwOmz04zzgXjMcX6NK78ygxKhT2eN Vdw51kTOFUPP4qCG2b7Uf/xXQD3Gz8Ta9onInFyqT/qSVeIQPon8COjkgb9tlWq9fXu7 XAH8z586UNpawRa+Ct6obZKGpG5ExGm4Kmybw7Ad7ci+ZcyoaIzVcU0Kj6f64KgDWZmn 0jK2C96YHiyY0EdEvA+rOWqHmUf2smuwRgG/pX2c8W+TT5LVUtZChiuyaBq9mWMjMRno Cwvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=dbC9DFuPy+Jq05bM4Wyc59ptDK049uRz6An2mf/aQqk=; b=OCIwKLUOtWGHaPhVZit1hQVpnQX9u7DrbJS/t7+/mANkUjTQkrw90IGOQ308SXc1uB qBfIu8V21P7FHE5eengITi0rs8tmqx0rk1zg/6XanV0mTbRAu6Z7+6/No76LCJ4yZoTa mCbLibjdBft8Ami1i44RIt3JyHnwh5nsp/5SlxbfZquD+N6ioqnos5SM/s2j+hwbJnMQ dSVk5dyT2L2K2ki7RxwYqwEA3nanx1isSc5B/6LfdioVtIyYHcAPuGTloZESqjoEWqMd F18u1E5BKW23DeZpsxnAosheINLoSbUP/1C6E2/78NoU9vtEJJgc/wXB3byajJ4U7W9q tTXw== X-Gm-Message-State: AMCzsaWxTpH/q2Uc7UiBtoru6hTP3Uk5v8uwkjIW1TuuZMk2ehLgUvhs Sdv5wHGwxhxr5DSUe/MwsWF5n7r7gD5GlaPONdJseg== X-Google-Smtp-Source: ABhQp+RmVSBkmaO6JM14Zj0RKbXN11h8DyKKF0zplDGTeV6eK6fpcBIl6McKghAYNIDFT2vUOH6W8oaejD9NN9MF23Q= X-Received: by 10.36.118.81 with SMTP id z78mr10746782itb.97.1508787055766; Mon, 23 Oct 2017 12:30:55 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.57.22 with HTTP; Mon, 23 Oct 2017 12:30:55 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:9c93:1751:a648:919b] In-Reply-To: References: From: Warner Losh Date: Mon, 23 Oct 2017 13:30:55 -0600 X-Google-Sender-Auth: fkVCXJc3PbP4QbEm6PBg5jCtNlc Message-ID: Subject: Re: How does (src)/sys/x86/machine/endian.h get deplyoed as DESTDIR/usr/include/x86/endian.h To: =?UTF-8?Q?Eddy_Petri=C8=99or?= Cc: "freebsd-arm@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 19:30:56 -0000 On Mon, Oct 23, 2017 at 1:26 PM, Eddy Petri=C8=99or wrote: > Hello, > > I am trying to add cross build support of FreeBSD from a Linux build > system and I am taking it one small step at a time. > > I have a wrapper script to consistently set environment variables, to > set the correct bmake and the proper MAKEFLAGS to pass the correct > dirs for the .mk files and made some changes to map the uname -p/uname > -m's reported x86_64 to amd64 for the MACHINE* variables. > > During 'make TARGET=3Damd64 toolchain' the compilation of > contrib/libc-pwcache/pwcache.c fails to find some definitions. Of > course, before implementing the changes in the build system (or my > Linux wrapper script) definitons that might make sense for a build > from Linux, I am trying to compile by hand the offending pwcache.c > file, and, although some of them I was able to resolve either by using > the files from freebsd-glue or by adding -Isys, I am a little puzzled > by the mix of build and freebsd headers/definitions and also got stuck > because in my mind the compilation at this stage needs to generate > binaries for running on a linux system, but some definitions seem to > be freebsd specfic. > > In either case, I saw that on the FreeBSD system I am using as a > reference there are some files (such as endian.h) are in > /usr/include/x86, but in the source tree they were in the source tree > in sys/x86/machine. > > Since at this stage it looks like I need some kind of way to do an > install-headers(?) from sys/$MACHINE/machine (+x86, in case of x86_64) > to a $NON_BSD_WRAPPERSDIR/$MACHINE/usr/include directory: > > 1) does it make sense to try to use the headers from src, or is the > right way (tm) to add definitions which are 100% correct for Linux? > 1.1) I am thinking that since the definitions were originally in the > src tree under sys, they are related to the FreeBSD kernel, so it > makes little sense to try to define something for Linux. Am I wrong? > Does it make sense to continue on this route? > 2) is there such a target/script that I can run to populate my > wrappers dir with the right headers no matter which $MACHINE we're > talking about? In the past, I've walked through the bootstrapping steps to get a full sysroot to do the build of the rest of the system. That's likely the best path forward (so the binaries you are building for FreeBSD/arm are all built with gcc/clang --sysroot /path/to/arm/sysroot). Warner