lkml.org 
[lkml]   [2003]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [uClinux-dev] Kernel 2.6 size increase (PATCH)
Date
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


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.059 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site