From owner-freebsd-current@FreeBSD.ORG Mon Jun 16 20:43:11 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4B1EA553; Mon, 16 Jun 2014 20:43:11 +0000 (UTC) Received: from mail-ob0-x22d.google.com (mail-ob0-x22d.google.com [IPv6:2607:f8b0:4003:c01::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F0A242C24; Mon, 16 Jun 2014 20:43:10 +0000 (UTC) Received: by mail-ob0-f173.google.com with SMTP id va2so6413217obc.18 for ; Mon, 16 Jun 2014 13:43:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=UZWRSEo7wZlY+5iFaXRNp5xMzXtHOpsmH0NyknX74IA=; b=KcxRYInbPmMqURM2G+FIF4akKBSmKEg9kW60nkzdeREc+Ye+VTYGxm82s5og5IWJII aD5MqCcpYeA2udc4iWdMZX1scad1qubyfq0Xl1rcBkncV2S/zUqs5SIEnjVUX8IFPsAr 4un/cxoHxMkRq0FSHazgdfgcLGQ95WdMgCiAyx60Um0SlfYTm1rxgxhR6REusQ2tbUuF WYJf/YkFZfU4bTj/XxmO60GMWUi1PgebxDZr79x/+otHa0WG5Qwh0b4uje5kvPY0yFID 4MpQX4TtktrOukwSC4nj37mJhLr8iZL0cQHU3h7fN9dD9I7C5M7QHf4d0Ne+W4SD3Ii8 D/Aw== MIME-Version: 1.0 X-Received: by 10.182.60.65 with SMTP id f1mr4764092obr.78.1402951390176; Mon, 16 Jun 2014 13:43:10 -0700 (PDT) Received: by 10.182.216.197 with HTTP; Mon, 16 Jun 2014 13:43:10 -0700 (PDT) In-Reply-To: <66AD5DED-0B46-4C59-849E-AC84B25F06AB@gmail.com> References: <201406131059.01450.jhb@freebsd.org> <66AD5DED-0B46-4C59-849E-AC84B25F06AB@gmail.com> Date: Mon, 16 Jun 2014 22:43:10 +0200 Message-ID: Subject: Re: building i386 kernel on amd64 host From: Oliver Pinter To: Warner Losh Content-Type: text/plain; charset=ISO-8859-1 Cc: gavin@freebsd.org, freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jun 2014 20:43:11 -0000 On 6/15/14, Warner Losh wrote: > > On Jun 14, 2014, at 3:57 PM, Oliver Pinter wrote: > >> On 6/13/14, John Baldwin wrote: >>> On Friday, June 13, 2014 6:21:28 am Oliver Pinter wrote: >>>> Hi All! >>>> >>>> When I try to build i386 kernel on amd64 host running compile error >>>> due wrong cpufunc.h picked up by build system. >>>> >>>> I used the attached script to build the kernel, and I attached a build >>>> log. >>>> >>>> Any suggestion how can I fix this? >>> >>> To build an i386 kernel on an amd64 host do this: >>> >>> cd /usr/src (or some other tree) >>> make TARGET=i386 kernel-toolchain >>> make TARGET=i386 buildkernel >>> make TARGET=i386 installkernel DESTDIR=/some/place >>> >>> And your i386 kernel will end up in /some/place/boot/kernel/kernel. >>> (You >>> can >>> set things like KERNCONF to pick an alternate kernel config just as with >>> normal 'make buildkernel'.) >>> >>> (Your attachment was size zero for me btw) >>> >>> -- >>> John Baldwin >>> >> >> I used this script to build the kernel: >> http://svnweb.freebsd.org/socsvn/soc2014/op/tools/build_kernel_32bit.csh?view=log >> >> And the error log are there: >> https://gist.github.com/opntr/cf8aa0e404c0c5ed6f90 . >> I get this error, when I first build kernel for amd64 system, and >> after that i386 kernel, and only the kernel. >> >> Now seems like I can build the whole system with buildworld >> buildkernel on vanilla master, I removed the objdir and do a clean >> buildworld. Now I test the modified kernel build, after the >> buildworld. >> >> It is broken too. When I do only make kernel-toolchain buildkernel, >> than this are broken for vanilla freebsd source and for my version to. >> >> summary: >> OK: make buildworld buildkernel >> BROKEN: make kernel-toolchain buildkernel > > On the same line? O?r is that just a summary? > >> Seems like someone in build environment bootstrapping are broken. > > I've not been able to reproduce this. > > rm -rf $OBJDIR > make TARGET=i386 kernel-toolchain > make TARGET=i386 buildkernel > > works just fine on current with a clean tree and an empty/missing make.conf > and src.conf. > > As for your script, don't define MACHINE and MACHINE_ARCH. That's almost > always wrong since that overrides things on the command line, which is what > make buildkernel winds up translating to. You never need to define those > yourself in any supported environment, and likely most unsupported ones. > > Also, I'd strongly recommend doing it as two invocations to make, not one. > kernel-toolchain likely doesn't have all the right guards in place for it > that buildworld likely does. Or you can dive in and figure that out. You > can't really do anything *kernel* related until kernel-toolchain finishes... > > Warner Warner, thanks! Splitting up to two part the build script, working fine! https://github.com/HardenedBSD/tools/blob/f98ec30cbe6f155c9f15c0d4b1ecbf74fc970e32/build_kernel_32bit.csh > > >