From owner-freebsd-arch@FreeBSD.ORG Thu Sep 7 05:47:47 2006 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2D6FE16A4DA for ; Thu, 7 Sep 2006 05:47:47 +0000 (UTC) (envelope-from howard0su@gmail.com) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.178]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9838443D49 for ; Thu, 7 Sep 2006 05:47:46 +0000 (GMT) (envelope-from howard0su@gmail.com) Received: by py-out-1112.google.com with SMTP id o67so147431pye for ; Wed, 06 Sep 2006 22:47:46 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=TDvxnfCt9kU+2KQdYI0vMGuCvrJJZE2kt6ObB0NMuzsmmOs1cBN8LDNCl290Afbgbg7iyIb4WQE71a5KHeYcp3D1VsVDzovuFcBhjWpfTK3u0eMqQCKHj52b+VOgkJEV7m7VFAgmXJhh3vryPEpX0m8E3Tc3lCMuNy4x32FsJBE= Received: by 10.35.127.7 with SMTP id e7mr660723pyn; Wed, 06 Sep 2006 22:47:46 -0700 (PDT) Received: by 10.35.44.12 with HTTP; Wed, 6 Sep 2006 22:47:46 -0700 (PDT) Message-ID: Date: Thu, 7 Sep 2006 13:47:46 +0800 From: "Howard Su" To: arch@freebsd.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: Cc: Subject: Modularize kernel X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Sep 2006 05:47:47 -0000 Modularize kernel In today's FreeBSD, KERNEL image is still the big image that contains a lot core components. Although we support module, however most of users are still using customize big kernel image. advantage: 1. Don't ask user to rebuild the kernel when they want new feature/module/driver. This make it easy to do binary update to improve the supportability and security. 2. Every piece in kernel is regarded as a module except rtld. 3. the kernel options can be centralized 4. enable other enhances in kernel like auto load device driver, on-daemon kernel dependency, binary update for kernel, quick boot 5. We don't need files/files.{ARCH} anymore. the Makefile under the module will be used for this purpose 6. Load different kernel based on different settings. For example, we can provide two kernels (UP and SMP) like Windows do. 7. No more GENERIC. Not all user need rebuild kernel anymore. More productivity due to the fact all the files are pre-compiled in most user machines. 8. Easily maintain the code. Naturally, the code is separated into the modules. disadvantage: 1. Bring complex into the boot procedure. 2. Kernel become a kernel module. We need some way to verify all symbols can be resolved in the compile stage. 3. config(8) need some sorts of changes. implementation details: 1. kernel image still exists. It only contains rtld and it's dependency. 2. a new 'unix' image contains the basic stuffs in today's freebsd. like MM, scheduler, etc. 3. other preload modules can be set in loader.conf acpi, atadisk/scsidisk/nfsclient (the core driver that are depended by boot process.) 4. mapping table from deviceid->devicedriver? (that can offer us new feature to auto load drivers.) 5. loader.conf can be automatically regen after system suecessful reboot. The utility can check the root device driver to decide what is required during boot. New Kenrel Build Process Kernel Config File | | config(1) | Kernel Global Opt file (opt_all.h) Make file contains the module defines only | | below is exact same as current implementations | run make | | make install New Kernel Boot Process Boot0 | Boot1 | Boot2 | rtld startup and try to load kernel and its dependencies | kernel start. Initialize other part by SYSINIT order I am writing this email to get some advice on the direction and implementation. -- -Howard