From owner-freebsd-questions@freebsd.org Mon Mar 11 05:32:11 2019 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 219231530ACE for ; Mon, 11 Mar 2019 05:32:11 +0000 (UTC) (envelope-from kudzu@tenebras.com) Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8278C82F23 for ; Mon, 11 Mar 2019 05:32:09 +0000 (UTC) (envelope-from kudzu@tenebras.com) Received: by mail-qt1-x841.google.com with SMTP id b16so2661283qtt.2 for ; Sun, 10 Mar 2019 22:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tenebras-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yA3XXJ7Xjr3i4XeTUZ9/Plud/h1K/gWw54QPDwi3MEI=; b=gBb7/RYSnc97Blgb3AeBDRH9uClnmISCazkRXmVwYm/RuHNo/pgdsFbiudy9Wpcs4v C7bUk5T+5N7d9CKBl1ORrqQ0xyNWLjQNjc0UccEzsLFVFAtfdJwkXYL3mSqYBGzT8F+u dkR0gqC11+MjVuudD49tB8m+Wz8YqdEPmv8bZQ58psBZQhPIwDBrSoD59MnjXaWJmQro U7BBh6UW9eWyJASCCW5lVwlY4ezKIvrTejpDYjQ/EW7sYKe38Wlho8ptpWF7jBmXvxLm GCho2vrrgOXXZpXbtT81LOyo+J80RdCe2ywwKhjGlBfSlGwZB89uDJbvCff0Z2lLS28t IAQg== 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=yA3XXJ7Xjr3i4XeTUZ9/Plud/h1K/gWw54QPDwi3MEI=; b=PdIrF3Yo8u0/LxqCVO/qWlvuvHZvECGJXBhkuD4v1I9wf6RwnkwcHauSRttWPEwX6m Y0z2vLAJX2WWl3cK49dwJwd0sl5jvGXuAdmq+3KRCSN+zcNJS4d4lL2Yl9iA8TpgYYei tiOEAKkXZZav436MElyOwsZDUcPj8+OOUKTjtk+CANB5ToqLBRvy5nI0P66D7SE5hLz9 gENwwBjLW0fIJNHsu188KN1kE7mA59/qBEDZVYiP7QnWZHU+4UAh5Lf3/L+RMdCYIH07 W607CXCTAWXfaib+9K+ICV4QN2u82SrLj+RZVZUQwRB++lEx5UTKr8IUPOp4Jos5D/08 EXKw== X-Gm-Message-State: APjAAAX00O1Ftg24XMSwvx+HX/udHa7mMeWtwr6gqUQMDuT+PY5pTucc fk1Af8ZcCA3MkO0l46pyHtwdSgswFTdjYmDPwrSCmw== X-Google-Smtp-Source: APXvYqwgoRVGfa3mWoKBXkSARmPFd0+hyiSoxPQ+okNIad9B9F4hc4OOeB3cwaqe+VeUcv3MkyoLR0XkOTs5wEW/IwM= X-Received: by 2002:a0c:c707:: with SMTP id w7mr791111qvi.42.1552282328259; Sun, 10 Mar 2019 22:32:08 -0700 (PDT) MIME-Version: 1.0 References: <20190311023130.GA3936@neutralgood.org> In-Reply-To: <20190311023130.GA3936@neutralgood.org> From: Michael Sierchio Date: Sun, 10 Mar 2019 22:31:31 -0700 Message-ID: Subject: Re: Barebone kernel options request To: "Kevin P. Neal" Cc: samir.otmane@numericable.fr, FreeBSD Questions X-Rspamd-Queue-Id: 8278C82F23 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=tenebras-com.20150623.gappssmtp.com header.s=20150623 header.b=gBb7/RYS X-Spamd-Result: default: False [-2.24 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.92)[-0.916,0]; R_DKIM_ALLOW(-0.20)[tenebras-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; DMARC_NA(0.00)[tenebras.com]; NEURAL_SPAM_SHORT(0.51)[0.509,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[tenebras-com.20150623.gappssmtp.com:+]; MX_GOOD(-0.01)[alt1.aspmx.l.google.com,aspmx.l.google.com,aspmx2.googlemail.com,alt2.aspmx.l.google.com,aspmx3.googlemail.com]; RCVD_IN_DNSWL_NONE(0.00)[1.4.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; IP_SCORE(-0.52)[ip: (2.26), ipnet: 2607:f8b0::/32(-2.74), asn: 15169(-2.07), country: US(-0.07)] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2019 05:32:11 -0000 My preference for doing this is as follows: Boot from GENERIC w/kernel modules present Record /var/run/dmesg.boot Add all the devices you wish to support (as probed above) in the kernconf. Make sure you include the disk and network drivers for your hardware. Things tend not to work without them. The custom kernconf goes in /usr/src/sys/{arch}/conf, in my case /usr/src/sys/amd64/conf then # cd /usr/src # make kernel # shutdown -r now Just as an example... this is for my pcengines boxen... my /etc/make.conf has KERNCONF=3DMAMELON_NO_IPV6 NO_MODULES=3DTRUE WITHOUT_KERNEL_SYMBOLS=3Dyes And my kernconf has cpu HAMMER ident MAMELON # /etc/make.conf should have: # KERNCONF=3DMAMELON # NO_MODULES=3DTRUE options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking ###########################################################################= ##### # no ipv6 here #options INET6 # IPv6 communications protocols ###########################################################################= ##### options IPSEC # IP (v4/v6) security options TCP_OFFLOAD # TCP offload options SCTP # Stream Control Transmission Protocol options FFS # Berkeley Fast Filesystem options SOFTUPDATES # Enable FFS soft updates support options UFS_DIRHASH # Improve performance on big directories options QUOTA # Enable disk quotas for UFS options MD_ROOT # MD is a potential root device options PROCFS # Process filesystem (requires PSEUDOFS) options PSEUDOFS # Pseudo-filesystem framework options TMPFS options GEOM_PART_GPT # GUID Partition Tables. options GEOM_ELI options GEOM_LABEL # Provides labelization options SCSI_DELAY=3D5000 # Delay (in ms) before probing SC= SI options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options PRINTF_BUFR_SIZE=3D128 # Prevent printf output being interspersed. options KBD_INSTALL_CDEV # install a CDEV entry in /dev options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options CAPABILITY_MODE # Capsicum capability mode options CAPABILITIES # Capsicum capabilities options INCLUDE_CONFIG_FILE # Include this file in kernel options RCTL # Resource limits options RACCT options COMPAT_LINUX32 options COMPAT_FREEBSD32 # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel options DEVICE_NUMA # I/O Device Affinity options EARLY_AP_STARTUP device ahci # AHCI-compatible SATA controllers device uart # Generic UART driver options IPFIREWALL options IPFIREWALL_VERBOSE options IPFIREWALL_VERBOSE_LIMIT=3D100 options IPFIREWALL_DEFAULT_TO_ACCEPT options IPFIREWALL_NAT options LIBALIAS options DUMMYNET options ROUTETABLES=3D16 device cpufreq device coretemp device amdtemp # Bus support. device acpi options ACPI_DMAR device pci device scbus # SCSI bus (required for ATA/SCSI) device da # Direct Access (disks) device pass # Passthrough device (direct ATA/SCSI access) device ses # Enclosure Services (SES and SAF-TE) device ctl # CAM Target Layer # crypto support device crypto device cryptodev device igb # atkbdc0 controls both the keyboard and the PS/2 mouse device atkbdc # AT keyboard controller device atkbd # AT keyboard device psm # PS/2 mouse device kbdmux # keyboard multiplexer # vt is the new video console driver device vt device vt_vga device vt_efifb # MMC/SD device mmc # MMC/SD bus device mmcsd # MMC/SD memory card device sdhci # Generic PCI SD Host Controller # USB support options USB_DEBUG # enable debug msgs device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) device xhci # XHCI PCI->USB interface (USB 3.0) device usb # USB Bus (required) device ukbd # Keyboard device umass # Disks/Mass storage - Requires scbus and da device uhid # Pseudo devices. device loop # Network loopback device random # Entropy device device padlock_rng # VIA Padlock RNG device rdrand_rng # Intel Bull Mountain RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. device md # Memory "disks" device gif # IPv6 and IPv4 tunneling device firmware # firmware assist module device bpf # Berkeley packet filter On Sun, Mar 10, 2019 at 10:06 PM Kevin P. Neal wrote: > On Sun, Mar 10, 2019 at 02:09:37PM +0100, samir.otmane@numericable.fr > wrote: > > Hello everyone, > > > > For my purpose, i would like to get a very barebone FreeBSD kernel ( Fo= r > instance i don't want jaling, i'll want to get rid of unwanted overhead )= , > but i don't know how to do so. > > > > IRC chatters told me that it would be very challenging to do so. > > > > I found that page ( https://www.freebsd.org/cgi/man.cgi?query=3Dsrc.con= f > ) but it only disables user-land program building, not kernel-land code. > > Three emails to the same list is two email too many. Just one email would > be sufficient, and if you get no response another single email a reasonab= le > period of time later. I don't know if this community has a definition of > "reasonable period of time", though. The LLVM community's is roughly "a > week or so". > > Anyway. On to business: > > What you want is to build a custom kernel. The GENERIC kernel config file > is, for the 64-bit amd64 host, located at: > /usr/src/sys/amd64/conf/GENERIC > > You didn't say what host, but the other hosts are at guessable locations > based on that path, and the filename to look for is "GENERIC". > > You'll need to copy that file and edit out the stuff you don't want. This > will probably take some research and trial and error. > > Note that this may not be granular enough. I don't know if you can remove > jailing, for example. But I don't know that jailing actually increases th= e > overhead in a measureable way if you aren't using it. So it may not be > worth your time to bother with it. This goes double if it requires specia= l > patches to the kernel that you have to maintain forever and incur the > cost forever. You'll need to do the cost/benefit analysis yourself. > > I don't know the current correct method of building custom kernels. It's > no doubt docuemented, and maybe someone will chime in here. > > -- > "A method for inducing cats to exercise consists of directing a beam of > invisible light produced by a hand-held laser apparatus onto the floor ..= . > in the vicinity of the cat, then moving the laser ... in an irregular way > fascinating to cats,..." -- US patent 5443036, "Method of exercising a ca= t" > _______________________________________________ > freebsd-questions@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to " > freebsd-questions-unsubscribe@freebsd.org" > --=20 "Well," Brahma said, "even after ten thousand explanations, a fool is no wiser, but an intelligent person requires only two thousand five hundred." - The Mah=C4=81bh=C4=81rata