linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bernardo Innocenti <bernie@develer.com>
To: Tom Rini <trini@kernel.crashing.org>
Cc: Willy Tarreau <willy@w.ods.org>, Christoph Hellwig <hch@lst.de>,
	uClinux development list <uclinux-dev@uclinux.org>,
	linux-kernel@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [uClinux-dev] Kernel 2.6 size increase (PATCH)
Date: Wed, 30 Jul 2003 18:45:27 +0200	[thread overview]
Message-ID: <200307301845.27401.bernie@develer.com> (raw)
In-Reply-To: <20030730153527.GB27214@ip68-0-152-218.tc.ph.cox.net>

On Wednesday 30 July 2003 17:35, Tom Rini wrote:

> > I tried stripping sysfs away. I just saved 7KB and got a kernel that
> > couldn't boot because root device translation depends on sysfs ;-)
>
> Now that someone has gone down the path (and, thanks for doing it), we
> know how much is saved and what needs to be done to get it to work.
> Lets just hope it doesn't grow that much more.

Here's the patch, in case someone cares trying it.
Please DON'T apply as-is to shipping kernels: as I was saying,
removing sysfs like this makes the system unable to boot.

---------------------------------------------------------------------------

Make sysfs optional for embedded systems.

Applies as-is to 2.6.0-test1.

diff -Nru linux-2.6.0-test1-with_elevator_patch/init/Kconfig linux-2.6.0-test1/init/Kconfig
--- linux-2.6.0-test1-with_elevator_patch/init/Kconfig	2003-07-26 14:25:48.000000000 +0200
+++ linux-2.6.0-test1/init/Kconfig	2003-07-26 16:02:01.000000000 +0200
@@ -141,6 +141,13 @@
 	  Disabling this option will cause the kernel to be built without
 	  support for epoll family of system calls.
 
+config SYS_FS
+	bool "/sys file system support" if EMBEDDED
+	default y
+	help
+	  Disabling this option will cause the kernel to be built without
+	  sysfs, which is mostly needed for power management and hot-plug support.
+
 source "drivers/block/Kconfig.iosched"
 
 endmenu		# General setup
diff -Nru linux-2.6.0-test1-with_elevator_patch/fs/Makefile linux-2.6.0-test1/fs/Makefile
--- linux-2.6.0-test1-with_elevator_patch/fs/Makefile	2003-07-14 05:34:42.000000000 +0200
+++ linux-2.6.0-test1/fs/Makefile	2003-07-26 01:03:59.000000000 +0200
@@ -43,7 +43,7 @@
 
 obj-$(CONFIG_PROC_FS)		+= proc/
 obj-y				+= partitions/
-obj-y				+= sysfs/
+obj-$(CONFIG_SYS_FS)		+= sysfs/
 obj-y				+= devpts/
 
 obj-$(CONFIG_PROFILING)		+= dcookies.o
@@ -74,7 +74,7 @@
 obj-$(CONFIG_NLS)		+= nls/
 obj-$(CONFIG_SYSV_FS)		+= sysv/
 obj-$(CONFIG_SMB_FS)		+= smbfs/
-obj-$(CONFIG_CIFS)             += cifs/
+obj-$(CONFIG_CIFS)              += cifs/
 obj-$(CONFIG_NCP_FS)		+= ncpfs/
 obj-$(CONFIG_HPFS_FS)		+= hpfs/
 obj-$(CONFIG_NTFS_FS)		+= ntfs/
diff -Nru linux-2.6.0-test1-with_elevator_patch/fs/namespace.c linux-2.6.0-test1/fs/namespace.c
--- linux-2.6.0-test1-with_elevator_patch/fs/namespace.c	2003-07-14 05:35:52.000000000 +0200
+++ linux-2.6.0-test1/fs/namespace.c	2003-07-26 15:39:05.000000000 +0200
@@ -1154,7 +1154,11 @@
 		d++;
 		i--;
 	} while (i);
+
+#ifdef CONFIG_SYSFS
 	sysfs_init();
+#endif /* CONFIG_SYSFS */
+
 	init_rootfs();
 	init_mount_tree();
 }
diff -Nru linux-2.6.0-test1-with_elevator_patch/include/linux/sysfs.h linux-2.6.0-test1/include/linux/sysfs.h
--- linux-2.6.0-test1-with_elevator_patch/include/linux/sysfs.h	2003-07-14 05:32:44.000000000 +0200
+++ linux-2.6.0-test1/include/linux/sysfs.h	2003-07-26 15:28:12.000000000 +0200
@@ -25,36 +25,101 @@
 	ssize_t (*write)(struct kobject *, char *, loff_t, size_t);
 };
 
-int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr);
-int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr);
-
 struct sysfs_ops {
 	ssize_t	(*show)(struct kobject *, struct attribute *,char *);
 	ssize_t	(*store)(struct kobject *,struct attribute *,const char *, size_t);
 };
 
+#ifdef CONFIG_SYS_FS
+
 extern int
-sysfs_create_dir(struct kobject *);
+sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr);
+
+extern int
+sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr);
+
+extern int
+sysfs_create_dir(struct kobject * kobj);
 
 extern void
-sysfs_remove_dir(struct kobject *);
+sysfs_remove_dir(struct kobject * kobj);
 
 extern void
-sysfs_rename_dir(struct kobject *, char *new_name);
+sysfs_rename_dir(struct kobject * kobj, char *new_name);
 
 extern int
-sysfs_create_file(struct kobject *, struct attribute *);
+sysfs_create_file(struct kobject * kobj, struct attribute * attr);
 
 extern int
-sysfs_update_file(struct kobject *, struct attribute *);
+sysfs_update_file(struct kobject * kobj, struct attribute * attr);
 
 extern void
-sysfs_remove_file(struct kobject *, struct attribute *);
+sysfs_remove_file(struct kobject * kobj, struct attribute * attr);
 
 extern int 
 sysfs_create_link(struct kobject * kobj, struct kobject * target, char * name);
 
 extern void
-sysfs_remove_link(struct kobject *, char * name);
+sysfs_remove_link(struct kobject * kobj, char * name);
+
+#else /* !CONFIG_SYS_FS */
+
+static inline int
+sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr)
+{
+	return 0;
+}
+
+static inline int
+sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr)
+{
+	return 0;
+}
+
+static inline int
+sysfs_create_dir(struct kobject * kobj)
+{
+	return 0;
+}
+
+static inline void
+sysfs_remove_dir(struct kobject * kobj)
+{
+}
+
+static inline void
+sysfs_rename_dir(struct kobject * kobj, char *new_name)
+{
+}
+
+static inline int
+sysfs_create_file(struct kobject * kobj, struct attribute * attr)
+{
+	return 0;
+}
+
+static inline int
+sysfs_update_file(struct kobject * kobj, struct attribute * attr)
+{
+	return 0;
+}
+
+static inline void
+sysfs_remove_file(struct kobject * kobj, struct attribute * attr)
+{
+}
+
+static inline int 
+sysfs_create_link(struct kobject * kobj, struct kobject * target, char * name)
+{
+	return 0;
+}
+
+static inline void
+sysfs_remove_link(struct kobject * kobj, char * name)
+{
+}
+
+#endif /* !CONFIG_SYS_FS */
 
 #endif /* _SYSFS_H_ */


-- 
  // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/

Please don't send Word attachments - http://www.gnu.org/philosophy/no-word-attachments.html



      reply	other threads:[~2003-07-30 16:45 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-23 18:46 Kernel 2.6 size increase Bernardo Innocenti
2003-07-23 19:14 ` Richard B. Johnson
2003-07-23 20:07   ` David S. Miller
2003-07-23 21:47     ` Randy.Dunlap
2003-07-23 19:32 ` [uClinux-dev] " Christoph Hellwig
2003-07-23 20:11   ` David S. Miller
2003-07-23 20:15     ` Christoph Hellwig
2003-07-23 20:22       ` David S. Miller
2003-07-23 20:27         ` Christoph Hellwig
2003-07-23 22:35           ` [uClinux-dev] Kernel 2.6 size increase - get_current()? Bernardo Innocenti
2003-07-23 22:37             ` Alan Cox
2003-07-23 23:00               ` Bernardo Innocenti
2003-07-24  5:06                 ` David McCullough
2003-07-24 11:28                   ` Alan Cox
2003-07-24 12:04                     ` David McCullough
2003-07-24 14:48                       ` Alan Cox
2003-07-25 18:25                       ` bill davidsen
2003-07-24 15:30                     ` Hollis Blanchard
2003-07-24 19:37                       ` Alan Cox
2003-07-24 19:51                         ` Hollis Blanchard
2003-07-24 21:20                           ` J.A. Magallon
2003-07-25  4:22                             ` Otto Solares
2003-07-25 14:38                               ` Hollis Blanchard
2003-07-28  3:19                                 ` Miles Bader
2003-07-28  8:14                                   ` Ihar "Philips" Filipau
2003-07-28  8:58                                     ` Miles Bader
2003-07-28  9:03                                       ` Ihar "Philips" Filipau
2003-07-23 21:57   ` [uClinux-dev] Kernel 2.6 size increase Bernardo Innocenti
2003-07-23 22:07     ` Bernardo Innocenti
2003-07-23 22:27       ` Willy Tarreau
2003-07-23 22:34         ` Alan Cox
2003-07-24 20:27         ` Bernardo Innocenti
2003-07-25 15:46           ` Christoph Hellwig
2003-07-25 23:55             ` [PATCH] Make I/O schedulers optional (Was: Re: Kernel 2.6 size increase) Bernardo Innocenti
2003-07-26  8:17               ` Andrew Morton
2003-07-26 12:40                 ` Bernardo Innocenti
2003-07-26 14:07                   ` Jens Axboe
2003-07-26 23:42                     ` Bernardo Innocenti
2003-07-26 23:41                       ` Jens Axboe
2003-07-28 17:13             ` [uClinux-dev] Kernel 2.6 size increase Nicolas Pitre
2003-07-28 23:02               ` Bernardo Innocenti
2003-07-29  2:36                 ` Miles Bader
2003-08-08 13:25                 ` [uClinux-dev] " David Woodhouse
2003-08-08 14:37                   ` Bernardo Innocenti
2003-08-08 14:43                     ` David Woodhouse
2003-07-25 18:16           ` bill davidsen
2003-07-29 22:29           ` Tom Rini
2003-07-29 22:48             ` Alan Cox
2003-07-29 23:06               ` Tom Rini
2003-07-30  2:07                 ` Miles Bader
2003-07-30 15:33                   ` Tom Rini
2003-07-31  1:49                     ` Miles Bader
2003-07-31  4:17                       ` Tom Rini
2003-07-31  5:03                         ` Miles Bader
2003-07-31 15:24                           ` Tom Rini
2003-07-30  2:49             ` [uClinux-dev] " Bernardo Innocenti
2003-07-30 15:35               ` Tom Rini
2003-07-30 16:45                 ` Bernardo Innocenti [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200307301845.27401.bernie@develer.com \
    --to=bernie@develer.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trini@kernel.crashing.org \
    --cc=uclinux-dev@uclinux.org \
    --cc=willy@w.ods.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).