Messages in this thread Patch in this message | | | Date | Sun, 1 Mar 1998 17:27:45 -0800 | From | The Chazman <> | Subject | 2.1.88 no CONFIG_NET: compile problem, fix, and question of size |
| |
Hello, all. I was looking into the possibility of using Linux in a fairly large and sophisticated embedded system, and first wanted to see how small of a kernel image I could get with a minimal compile. So I got the 2.1.88 source tree, configured it as I wanted, an compiled, to have the process end in this:
ld -m elf_i386 -T /usr/src/kernel-2.1.88/arch/i386/vmlinux.lds -e stext arch/i386/kernel/head.o arch/i386/kernel/init_task.o init/main.o init/version.o \ arch/i386/kernel/kernel.o arch/i386/mm/mm.o kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o \ fs/filesystems.a \ net/network.a \ drivers/block/block.a drivers/char/char.a drivers/misc/misc.a drivers/net/net.a \ /usr/src/kernel-2.1.88/arch/i386/lib/lib.a /usr/src/kernel-2.1.88/lib/lib.a /usr/src/kernel-2.1.88/arch/i386/lib/lib.a \ -o vmlinux net/network.a(core.o): In function `sock_setsockopt': core.o(.text+0x312): undefined reference to `dev_get' core.o(.text+0x349): undefined reference to `ip_route_output' net/network.a(core.o): In function `neigh_compat_output': core.o(.text+0x3792): undefined reference to `dev_queue_xmit' make: *** [vmlinux] Error 1 Exit 2
This seemed simple enough to fix, so I did. The patch is included at the end of this message. Feel free to use it however you see fit. I fear the patch to neighbour.c will need some modification -- it didn't feel quite right to me, but I didn't understand the code well enough to come up with anything better, and it was good enough to let me finish the compile and start evaluating the kernel in my odd platform.
Which leads to my question. After the compile, I looked at the size of the resulting kernel, and a few selected files:
-rw-r--r-- 1 root root 35042 Feb 28 23:45 drivers/block/block.a -rw-r--r-- 1 root root 103558 Feb 28 23:48 drivers/char/char.a -rw-r--r-- 1 root root 23850 Feb 28 23:49 drivers/misc/misc.a -rw-r--r-- 1 root root 1166 Feb 28 23:48 drivers/net/net.a -rw-r--r-- 1 root root 51764 Mar 1 00:55 net/network.a -rwxr-xr-x 1 root root 514208 Mar 1 00:56 vmlinux*
A 512k kernel seems awfully large for having almost nothing turned on. In particular, I wonder about 51k of network support code when I have networking completely turned off (CONFIG_NET=N), 35k of block device driver code when my only block device is the RAMdisk (no floppy, no IDE, no SCSI, no CDROMs, etc.), and 102k of character device driver code when I will only be using standard PC-style serial ports and parallel ports. I even turned normal console support (keyboard/VGA) off, as I won't need it. I was very pleasantly surprised to find that option given to me, BTW.
I have always been impressed with the space efficiency of the full- featured Linux kernels I run on my workstation, servers, and laptop. But it just seems like a lot more code bulk should disappear in such a minimal configuration. Am I expecting too much? Or is it just that with embedded platforms only recently being fully addressed, not a lot of work has been done to #ifdef-out more code that isn't needed when options that nearly everyone wants (VGA console, networking, hard disk support) are turned off?
Also, could I burn a kernel image into ROM and run it directly, without copying the code to RAM first? I specifically made a non-compressed image hoping this was the case....
Thanks for listening to my concerns. Replies to me also, as I'm not on the linux-kernel mailing list.
------ Carl N Miller Software / Firmware Engineer System Design Group, Inc. San Diego, CA USA (619) 536-2920 x234
Here's that patch that got the compile working: It's meant to be run in the net subdirectory of the 2.1.88 source tree.
diff -u origcore/dev.c core/dev.c --- origcore/dev.c Sun Mar 1 14:20:28 1998 +++ core/dev.c Sun Mar 1 00:47:30 1998 @@ -607,7 +607,7 @@ /*======================================================================= - Receiver rotutines + Receiver routines =======================================================================*/ int netdev_dropping = 0; diff -u origcore/neighbour.c core/neighbour.c --- origcore/neighbour.c Sun Mar 1 14:20:28 1998 +++ core/neighbour.c Sun Mar 1 00:54:39 1998 @@ -734,7 +734,11 @@ dev->rebuild_header(skb)) return 0; +#ifdef CONFIG_NET return dev_queue_xmit(skb); +#else + return 0; +#endif } /* Slow and careful. */ diff -u origcore/sock.c core/sock.c --- origcore/sock.c Sun Mar 1 14:20:28 1998 +++ core/sock.c Sun Mar 1 00:36:44 1998 @@ -311,9 +311,12 @@ sk->bound_dev_if = 0; } else { +#ifdef CONFIG_NET struct device *dev = dev_get(req.ifr_ifrn.ifrn_name); if (!dev) +#endif return -EINVAL; +#ifdef CONFIG_NET sk->bound_dev_if = dev->ifindex; if (sk->daddr) { int ret; @@ -323,6 +326,7 @@ if (ret) return ret; } +#endif } } return 0; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |