From owner-freebsd-arm@freebsd.org Wed Oct 4 14:17:53 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 29F7DE3A858 for ; Wed, 4 Oct 2017 14:17:53 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x242.google.com (mail-io0-x242.google.com [IPv6:2607:f8b0:4001:c06::242]) (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 DB94863B97 for ; Wed, 4 Oct 2017 14:17:52 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x242.google.com with SMTP id m16so778876iod.5 for ; Wed, 04 Oct 2017 07:17:52 -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=NkkcXG6FovgNIsWLE7JrblusAh8J7SUZeWND8Hktu9s=; b=czAEV8pzRagGRsh+D+EtfK9FLA2MjjO2rQgAvr+FJ9sKM7v972jLkvvCJ9KwuVOIXu x/Z+IEBe5+RGozSDiEMdA2NK+8x4aWsdcQREAtd5gnkdCDRGGdKygg/beOlORIOv7okZ 7NibK0UjAAscJ8KOxsayFq/vf7dDRpg1CNOUc3Bf6lf1xquDFJKctneQ/bXmzx4b5Jjo Qo5qj8GuyyUCHao4J9DV+3PdrPnd3zDufkyf0+rLvYdM2tcSo8ulAEQXLQIBlmPi/uzM 5+e2Bp/ZdsJ59ZK7O8n5wzxq5Z0kzuZXKX49brC6tTV/EqnWzINcf8dLwWdcZEmEjy1g gCFw== 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=NkkcXG6FovgNIsWLE7JrblusAh8J7SUZeWND8Hktu9s=; b=s2Xhd+NWPpLBVTm8/sW9NcWKDrNUP7MpdtKTD6VY/QgU25QfcSUIQfC1Y09Bplc4CV BXwfHOyAgww6yGAuRfjiYD/iqGihyoSF657/F+AnKhOHLNbXrM3tB0hQI90TxhQ/Ji/v q42DTcZ75vSGvC2rdxoZcL21dhyFcfglVmCT8FWMU7CgONWZQvo76aVaZhY46XYL6HvJ CWLk8o0SIH6Z8DqGOvUQHXcncjnk9QGQOjENwhdc2NoJQ1hni1XLn1AMsqZMaspIC5NE aLX6ucTUF5ZQ/eFU0DqzGq83bphmwVAHZ0tctvrN3eljT84gKuKXuJbUgw/OJ11Pwwkq Ljsg== X-Gm-Message-State: AMCzsaWfT0o22iDxQXlVGijb0cKVE4p2IOemfeTMmt04e/NQqLRIt8Kw mIcROfJWydpIN7d9LKoiXYDOyORu0iKHEsAzE1XiCA== X-Google-Smtp-Source: AOwi7QCeGqD/KA2DetJ7fKMTiW72DqO79aM58fvoDCsuWkIGKaveklDPEFrFAe1KDABr5m9JGOKA+UvYuEnG3880a2Y= X-Received: by 10.107.68.6 with SMTP id r6mr3808554ioa.282.1507126666323; Wed, 04 Oct 2017 07:17:46 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.2.194 with HTTP; Wed, 4 Oct 2017 07:17:45 -0700 (PDT) X-Originating-IP: [192.173.66.162] In-Reply-To: References: <176dbdd5-1a32-06b2-7dd8-0647cc0fbe20@acm.org> <1506954050.22078.55.camel@freebsd.org> <1506962766.22078.69.camel@freebsd.org> <20171003170053.GB2918@lonesome.com> <8eb57091-0b6f-3f0a-8c80-997b951a383f@acm.org> <1507068609.86205.81.camel@freebsd.org> From: Warner Losh Date: Wed, 4 Oct 2017 08:17:45 -0600 X-Google-Sender-Auth: 1OHr4eN-8bVVH6ZT8b07nAoFI8w Message-ID: Subject: Re: GENERIC kernel (was Re: BeagleBone Crochet Build Problem) To: Russell Haley Cc: Ian Lepore , freebsd-arm Content-Type: text/plain; charset="UTF-8" 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: Wed, 04 Oct 2017 14:17:53 -0000 On Tue, Oct 3, 2017 at 11:52 PM, Russell Haley wrote: > On Tue, Oct 3, 2017 at 10:12 PM, Warner Losh wrote: > > > > > > On Oct 3, 2017 9:50 PM, "Russell Haley" wrote: > > > > On Tue, Oct 3, 2017 at 3:55 PM, Warner Losh wrote: > >> On Tue, Oct 3, 2017 at 4:10 PM, Ian Lepore wrote: > >> > >>> On Tue, 2017-10-03 at 14:55 -0600, Warner Losh wrote: > >>> > On Tue, Oct 3, 2017 at 2:03 PM, Thomas Laus wrote: > >>> > > >>> > > > >>> > > On 10/03/17 13:00, Mark Linimon wrote: > >>> > > > > >>> > > > On Mon, Oct 02, 2017 at 10:46:06AM -0600, Ian Lepore wrote: > >>> > > > > > >>> > > > > Why are we working towards a GENERIC kernel for arm? > >>> > > > My intuition would be: > >>> > > > > >>> > > > - easier to tell new FreeBSD users how to start > >>> > > > - less work for Release Engineering to make targets > >>> > > > > >>> > > > OTOH I'm not doing the work so I don't get to set the > >>> > > > direction :-) > >>> > > > > >>> > > > My _opinion_ is that we still seem to have a steeper > >>> > > > curve for our new users than is necessary. I intend to > >>> > > > think about that more this fall. > >>> > > > > >>> > > That is probably 'wishful thinking' for the very distant future. > >>> > > Most > >>> > > of the common ARM SOC's have very different capabilities between > each > >>> > > other. Each also requires a unique U-Boot partition that gets read > >>> > > before the FreeBSD kernel is loaded. > >>> > > > >>> > While this is true, how to create them can be described generically. > >>> > You > >>> > put these bits in this physical location, or on that partition and > away > >>> you > >>> > go. The pre-boot environment is indeed different, but it's highly > >>> desirable > >>> > to have everything after that identical. It ensures uniformity in a > >>> highly > >>> > fragmented segment of our user base. Different kernels, even > generated > >>> from > >>> > the same sources, run the risk of being subtly different from each > >>> > other, > >>> > leading to less coverage between the boards. We've had issues related > >>> > to > >>> > this in the past from time to time. > >>> > > >>> > I'm working on a program I'm calling "spin" which will take a > >>> > description > >>> > of what to use (eg, u-boot for the banana ramma board plus FreeBSD > >>> > 12.3R) > >>> > and it will create a bootable image knowing nothing more. If it also > >>> > has > >>> to > >>> > know which of a bazillion kernels to use, that makes things more > >>> > complicated. > >>> > > >>> > We want more uniformity, not less. Much of the differences we have > >>> > today > >>> > are arbitrary (and often wrong). > >>> > > >>> > > >>> > > > >>> > > I strongly favor the current approach that has a custom kernel > >>> > > configuration file and U-Boot for each SOC. All of the common ARM > >>> > > systems have a limited amount of real estate to store FreeBSD > kernel > >>> and > >>> > > base system because it all must fit on a SD memory card. Having a > >>> > > GENERIC kernel that covers all SOC variants would consume flash > space > >>> > > that will never be used. > >>> > > >>> > Nobody is saying that you can't do this. Just that GENERIC will be > the > >>> > union of all these kernel and be what you get by default. Since > nobody > >>> has > >>> > quantified the differences, I'm having trouble getting worked up over > >>> > the > >>> > somewhat trivial difference in size (especially compared to most SD > >>> > cards > >>> > today). > >>> > > >>> > Warner > >>> > >>> Well, I guess I'll stop pretending there's any chance this freight > >>> train can be stopped. I find the advantages mentioned so far dubious > >>> at best, specious at worst, except for the single item "packaged base". > >>> I don't know much about how that stuff is structured, but I can see > >>> how having lots of different kernels might be difficult for packaging. > >>> > >>> But we absolutely have to solve the problem of making it easy for > >>> people to create custom kernel configs. "Include GENERIC and add some > >>> nodevice/nooption lines" is just not going to work. Right now I use > >>> "include IMX6" and then some nodevice/nooption lines, and that works > >>> fine. > >>> > >>> So if IMX6 goes away as a standalone buildable config, there needs to > >>> be some other thing like it that can be included. The idea that keeps > >>> nudging me is that our GENERIC should look like: > >>> > >>> include std.armv6 > >>> include std.armdebug > >>> include std.a10 > >>> include std.a20 > >>> include std.bcm2835 > >>> include std.imx6 > >>> ... > >>> > >>> Now anybody can create a custom config by including std.armv6, > >>> std.armdebug if they want it, and their soc's std file. (The > >>> std.armdebug is also for re@, so that it's easy for them to adjust > when > >>> making releases.) > >>> > >>> The problem is that I'm so backed up with other obbligations and > >>> problem reports not getting dealt with and of course $work, so I never > >>> find any time to give a scheme like this a try. > >>> > >> > >> I welcome others to try to do this. You'll find it is a bit like peeling > >> an > >> onion. You don't have orthogonal classes so much as a venn diagram. I > want > >> to support ALL SoCs for the bcm2835 family? Or I just want to support > one > >> specific one. Allwinner makes this especially noticeable since it has a > >> large family of things. And then do you slice the supported devices up > via > >> busses (only include those devices on PCI bus) vs device type (only > >> include > >> network devices). But then you get people wanting to have just wireless > >> devices, or just USB wireless devices. You quickly discover a > combinatoric > >> explosion if you want to do this generically. > >> > >> I'll see if I can find some time take a shot at doing it just at the SoC > >> level, but doing it generically gets really ugly really quickly.... > >> Solving > >> that specific problem doesn't look too awful. > >> > >> Warner > > > > My ignorance on this subject allows me to ask an obtuse question: Is > > there no way to do something more dynamic and maintainable with > > kldload and ubldr using scripts? As Warner has pointed out, there are > > more arm variants, more manufacturers/SOM makers and more board > > variants every year. Stuffing everything in and then "un-including" > > everything doesn't sound maintainable. Even Ians suggestion may get > > cumbersome in a short time. What if we actually do get good support > > for Qualcom chips? Think of how many phone makers are there? > > > > > > Someone would need to tag all the Fdt > > > > Drivers with PNP info first. > > > > Warner > Can you point me to an example of the PNP tags or where to get more > info? Would that mean modifying the DTS files (which I believe are now > replicated from GNU libraries)? > Sure. Look for SIMPLEBUS_PNP_INFO. Usually, you can point it at the compat table. See sys/arm/ti/aintc.c: ... /* List of compatible strings for FDT tree */ static struct ofw_compat_data compat_data[] = { {"ti,am33xx-intc", 1}, {"ti,omap2-intc", 1}, {NULL, 0}, }; ... SIMPLEBUS_PNP_INFO(compat_data); Without that data, you can't have a minimal kernel that then loads the minimum modules. There's some things that can't be kld-loaded, though. The biggest one that's likely to be a hassle is console drivers. They have to exist before the kld modules are linked into the kernel. Warner