From 28846998b342691eed492a2c008f13550d12da93 Mon Sep 17 00:00:00 2001 From: nonaka Date: Thu, 5 May 2011 09:07:59 +0000 Subject: [PATCH] Reduce kernel size. Tested on SL-C1000. Fix PR/44898. --- distrib/zaurus/ramdisk/Makefile | 4 +-- distrib/zaurus/ramdisk/list | 4 +-- sys/arch/zaurus/conf/GENERIC | 11 ++++-- sys/arch/zaurus/conf/INSTALL | 43 +++++++++++++++++++++--- sys/arch/zaurus/conf/Makefile.zaurus.inc | 13 ++++++- sys/arch/zaurus/stand/zbsdmod/zbsdmod.c | 6 ++-- 6 files changed, 66 insertions(+), 15 deletions(-) diff --git a/distrib/zaurus/ramdisk/Makefile b/distrib/zaurus/ramdisk/Makefile index 768f97cbdf3e..c230f42e34a7 100644 --- a/distrib/zaurus/ramdisk/Makefile +++ b/distrib/zaurus/ramdisk/Makefile @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.11 2010/02/11 09:06:51 roy Exp $ +# $NetBSD: Makefile,v 1.12 2011/05/05 09:07:59 nonaka Exp $ .include .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib" IMAGE= ramdisk.fs -IMAGESIZE= 2560k +IMAGESIZE= 2144k MAKEFS_FLAGS= -f 14 WARNS= 1 diff --git a/distrib/zaurus/ramdisk/list b/distrib/zaurus/ramdisk/list index 9397a1f02d0b..8c7ad9e1d902 100644 --- a/distrib/zaurus/ramdisk/list +++ b/distrib/zaurus/ramdisk/list @@ -1,4 +1,4 @@ -# $NetBSD: list,v 1.14 2011/01/14 10:26:37 tsutsui Exp $ +# $NetBSD: list,v 1.15 2011/05/05 09:07:59 nonaka Exp $ # usr.bin/less has to be first, otherwise the ramdisk.mk generation fails SRCDIRS usr.bin/less bin sbin usr.bin usr.sbin gnu/usr.bin @@ -31,9 +31,7 @@ PROG sbin/ifconfig PROG sbin/init PROG sbin/mknod PROG sbin/mount -PROG sbin/mount_cd9660 PROG sbin/mount_ffs -PROG sbin/mount_filecore PROG sbin/mount_kernfs PROG sbin/mount_msdos PROG sbin/mount_nfs diff --git a/sys/arch/zaurus/conf/GENERIC b/sys/arch/zaurus/conf/GENERIC index 7bfd42dda662..6070f8f695f6 100644 --- a/sys/arch/zaurus/conf/GENERIC +++ b/sys/arch/zaurus/conf/GENERIC @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.34 2011/03/06 17:08:33 bouyer Exp $ +# $NetBSD: GENERIC,v 1.35 2011/05/05 09:07:59 nonaka Exp $ # # GENERIC machine description file # @@ -50,7 +50,7 @@ options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT # File systems file-system FFS # UFS #file-system EXT2FS # second extended file system (linux) -file-system LFS # log-structured file system +#file-system LFS # log-structured file system file-system MFS # memory file system file-system NFS # Network File System client #file-system NTFS # Windows/NT file system (experimental) @@ -103,6 +103,13 @@ options COMPAT_43 # and 4.3BSD options COMPAT_OSSAUDIO # OSS (Voxware) audio driver compatibility options COMPAT_BSDPTY # /dev/[pt]ty?? ptys. +# Wedge support +options DKWEDGE_AUTODISCOVER # Automatically add dk(4) instances +#options DKWEDGE_METHOD_GPT # Supports GPT partitions as wedges +# The following two options can break /etc/fstab, so handle with care +#options DKWEDGE_METHOD_BSDLABEL # Support disklabel entries as wedges +#options DKWEDGE_METHOD_MBR # Support MBR partitions as wedges + # Shared memory options options SYSVMSG # System V-like message queues diff --git a/sys/arch/zaurus/conf/INSTALL b/sys/arch/zaurus/conf/INSTALL index 51a2f2f31a99..1a0451d0777e 100644 --- a/sys/arch/zaurus/conf/INSTALL +++ b/sys/arch/zaurus/conf/INSTALL @@ -1,15 +1,50 @@ -# $NetBSD: INSTALL,v 1.6 2009/12/21 11:20:07 nonaka Exp $ +# $NetBSD: INSTALL,v 1.7 2011/05/05 09:07:59 nonaka Exp $ # # INSTALL config file (GENERIC with memory disk root) # include "arch/zaurus/conf/GENERIC" -#no options KLOADER - # Enable the hooks used for initializing the root memory-disk. options MEMORY_DISK_HOOKS options MEMORY_DISK_IS_ROOT # force root on memory disk options MEMORY_DISK_SERVER=0 # no userspace memory disk support -options MEMORY_DISK_ROOT_SIZE=5120 # size of memory disk, in blocks +options MEMORY_DISK_ROOT_SIZE=4288 # size of memory disk, in blocks options MEMORY_DISK_RBFLAGS=RB_SINGLE # boot in single-user mode + +# for reduce kernel size. +# kernei size must be less than 5MB. +# - see src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c:bsdimage[] + +makeoptions COPTS="-Os" + +no options INSECURE + +no file-system NULLFS +no file-system PROCFS +no file-system PTYFS +no file-system TMPFS + +no options COMPAT_OSSAUDIO + +no options SYSVMSG +no options SYSVSEM +no options SYSVSHM +no options P1003_1B_SEMAPHORE + +options PIPE_SOCKETPAIR + +no options WSDISPLAY_COMPAT_PCVT +no options WSDISPLAY_COMPAT_USL +no options WSDISPLAY_COMPAT_RAWKBD + +no options DIAGNOSTIC +no options DDB +no options DDB_HISTORY_SIZE +no options SYMTAB_SPACE + +no pseudo-device vnd +no options VND_COMPRESSION +no pseudo-device accf_data +no pseudo-device accf_http +no pseudo-device ksyms diff --git a/sys/arch/zaurus/conf/Makefile.zaurus.inc b/sys/arch/zaurus/conf/Makefile.zaurus.inc index 7b367f7033af..c6f11040403d 100644 --- a/sys/arch/zaurus/conf/Makefile.zaurus.inc +++ b/sys/arch/zaurus/conf/Makefile.zaurus.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.zaurus.inc,v 1.2 2006/12/17 16:07:11 peter Exp $ +# $NetBSD: Makefile.zaurus.inc,v 1.3 2011/05/05 09:07:59 nonaka Exp $ MACHINE_ARCH= arm CPPFLAGS+= -D${MACHINE} @@ -9,3 +9,14 @@ SYSTEM_FIRST_SFILE= ${THISARM}/zaurus/zaurus_start.S LINKFLAGS= -T ${THISARM}/conf/ldscript EXTRA_CLEAN+= netbsd.map assym.d + +SYSTEM_LD_TAIL_EXTRA+=; \ + echo "Checking kernel size..."; \ + size=`wc -c "$@" | ${TOOL_AWK} '{ print $$1 }'`; \ + maxsize=5242880; \ + if [ $$size -gt $$maxsize ]; \ + then \ + echo "Fatal: kernel size must be less than 5MB."; \ + echo "Fatal: kernel size: $$size, max kernel size: $$maxsize"; \ + false; \ + fi diff --git a/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c b/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c index fe612fc0818b..edb33551ca31 100644 --- a/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c +++ b/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c @@ -1,4 +1,4 @@ -/* $NetBSD: zbsdmod.c,v 1.5 2010/12/26 09:03:56 nonaka Exp $ */ +/* $NetBSD: zbsdmod.c,v 1.6 2011/05/05 09:07:59 nonaka Exp $ */ /* $OpenBSD: zbsdmod.c,v 1.7 2005/05/02 02:45:29 uwe Exp $ */ /* @@ -74,8 +74,8 @@ static Elf_Shdr *shp; static Elf_Off off; static int havesyms; -/* The maximum size of a kernel image is restricted to 10MB. */ -static u_int bsdimage[10485760/sizeof(u_int)]; /* XXX use kmalloc() */ +/* The maximum size of a kernel image is restricted to 5MB. */ +static u_int bsdimage[5242880/sizeof(u_int)]; /* XXX use kmalloc() */ static char bootargs[BOOTARGS_BUFSIZ]; /*