Commit 51b9cfe9 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[PATCH] Make UML build and run

This patch includes the following -
	updated defconfig
	move uml.lds.S and main.c from arch/um to arch/um/kernel per Sam's suggestions
	steal bitops.c from arch/i386
	convert all calls to open_private_file to dentry_open
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7420e97c
...@@ -86,8 +86,6 @@ prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) ...@@ -86,8 +86,6 @@ prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS)
LDFLAGS_vmlinux = -r LDFLAGS_vmlinux = -r
vmlinux: $(ARCH_DIR)/main.o
# These aren't in Makefile-tt because they are needed in the !CONFIG_MODE_TT + # These aren't in Makefile-tt because they are needed in the !CONFIG_MODE_TT +
# CONFIG_MODE_SKAS + CONFIG_STATIC_LINK case. # CONFIG_MODE_SKAS + CONFIG_STATIC_LINK case.
...@@ -120,14 +118,11 @@ CPPFLAGS_vmlinux.lds = $(shell echo -U$(SUBARCH) \ ...@@ -120,14 +118,11 @@ CPPFLAGS_vmlinux.lds = $(shell echo -U$(SUBARCH) \
export CPPFLAGS_$(LD_SCRIPT-y) = $(CPPFLAGS_vmlinux.lds) -P -C -Uum export CPPFLAGS_$(LD_SCRIPT-y) = $(CPPFLAGS_vmlinux.lds) -P -C -Uum
LD_SCRIPT-y := $(ARCH_DIR)/$(LD_SCRIPT-y) LD_SCRIPT-y := $(ARCH_DIR)/kernel/$(LD_SCRIPT-y)
#$(LD_SCRIPT-y) : $(LD_SCRIPT-y:.s=.S) scripts FORCE
# $(call if_changed_dep,as_s_S)
linux: vmlinux $(LD_SCRIPT-y) linux: vmlinux $(LD_SCRIPT-y)
$(CC) -Wl,-T,$(LD_SCRIPT-y) $(LINK-y) $(LINK_WRAPS) \ $(CC) -Wl,-T,$(LD_SCRIPT-y) $(LINK-y) $(LINK_WRAPS) \
-o linux $(ARCH_DIR)/main.o vmlinux -L/usr/lib -lutil -o linux vmlinux -L/usr/lib -lutil
USER_CFLAGS := $(patsubst -I%,,$(CFLAGS)) USER_CFLAGS := $(patsubst -I%,,$(CFLAGS))
USER_CFLAGS := $(patsubst -Derrno=kernel_errno,,$(USER_CFLAGS)) USER_CFLAGS := $(patsubst -Derrno=kernel_errno,,$(USER_CFLAGS))
...@@ -162,10 +157,6 @@ CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/uml.lds \ ...@@ -162,10 +157,6 @@ CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/uml.lds \
MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \ MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \
$(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) $(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS))
$(ARCH_DIR)/main.o: $(ARCH_DIR)/main.c sys_prepare
@ echo ' MAIN $@'
@ $(CC) $(USER_CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
archmrproper: archmrproper:
@: @:
......
# #
# Automatically generated make config: don't edit # Automatically generated make config: don't edit
# Linux kernel version: 2.6.8.1-mm1 # Linux kernel version: 2.6.8.1-mm3
# Mon Aug 16 22:34:07 2004 # Fri Aug 20 13:03:03 2004
# #
CONFIG_USERMODE=y CONFIG_USERMODE=y
CONFIG_MMU=y CONFIG_MMU=y
...@@ -43,7 +43,6 @@ CONFIG_SYSVIPC=y ...@@ -43,7 +43,6 @@ CONFIG_SYSVIPC=y
# CONFIG_POSIX_MQUEUE is not set # CONFIG_POSIX_MQUEUE is not set
CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT=y
# CONFIG_BSD_PROCESS_ACCT_V3 is not set # CONFIG_BSD_PROCESS_ACCT_V3 is not set
# CONFIG_PAGG is not set
CONFIG_SYSCTL=y CONFIG_SYSCTL=y
# CONFIG_AUDIT is not set # CONFIG_AUDIT is not set
CONFIG_LOG_BUF_SHIFT=14 CONFIG_LOG_BUF_SHIFT=14
...@@ -55,6 +54,7 @@ CONFIG_KALLSYMS=y ...@@ -55,6 +54,7 @@ CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_EXTRA_PASS is not set # CONFIG_KALLSYMS_EXTRA_PASS is not set
CONFIG_FUTEX=y CONFIG_FUTEX=y
CONFIG_EPOLL=y CONFIG_EPOLL=y
# CONFIG_CPUSETS is not set
CONFIG_IOSCHED_NOOP=y CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_DEADLINE=y
...@@ -236,6 +236,9 @@ CONFIG_EXT2_FS=y ...@@ -236,6 +236,9 @@ CONFIG_EXT2_FS=y
# CONFIG_EXT2_FS_XATTR is not set # CONFIG_EXT2_FS_XATTR is not set
# CONFIG_EXT3_FS is not set # CONFIG_EXT3_FS is not set
# CONFIG_JBD is not set # CONFIG_JBD is not set
CONFIG_REISER4_FS=y
CONFIG_REISER4_LARGE_KEY=y
# CONFIG_REISER4_CHECK is not set
CONFIG_REISERFS_FS=y CONFIG_REISERFS_FS=y
# CONFIG_REISERFS_CHECK is not set # CONFIG_REISERFS_CHECK is not set
# CONFIG_REISERFS_PROC_INFO is not set # CONFIG_REISERFS_PROC_INFO is not set
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
# Licensed under the GPL # Licensed under the GPL
# #
extra-y := vmlinux.lds extra-y := vmlinux.lds uml.lds
obj-y = checksum.o config.o exec_kern.o exitcode.o frame_kern.o frame.o \ obj-y = checksum.o config.o exec_kern.o exitcode.o frame_kern.o frame.o \
helper.o init_task.o irq.o irq_user.o ksyms.o mem.o mem_user.o \ helper.o init_task.o irq.o irq_user.o ksyms.o main.o mem.o mem_user.o \
physmem.o process.o process_kern.o ptrace.o reboot.o resource.o \ physmem.o process.o process_kern.o ptrace.o reboot.o resource.o \
sigio_user.o sigio_kern.o signal_kern.o signal_user.o smp.o \ sigio_user.o sigio_kern.o signal_kern.o signal_user.o smp.o \
syscall_kern.o syscall_user.o sysrq.o sys_call_table.o tempfile.o \ syscall_kern.o syscall_user.o sysrq.o sys_call_table.o tempfile.o \
...@@ -24,7 +24,7 @@ obj-$(CONFIG_MODE_SKAS) += skas/ ...@@ -24,7 +24,7 @@ obj-$(CONFIG_MODE_SKAS) += skas/
user-objs-$(CONFIG_TTY_LOG) += tty_log.o user-objs-$(CONFIG_TTY_LOG) += tty_log.o
USER_OBJS := $(filter %_user.o,$(obj-y)) $(user-objs-y) config.o helper.o \ USER_OBJS := $(filter %_user.o,$(obj-y)) $(user-objs-y) config.o helper.o \
process.o tempfile.o time.o tty_log.o umid.o user_util.o main.o process.o tempfile.o time.o tty_log.o umid.o user_util.o
USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
CFLAGS_frame.o := $(patsubst -fomit-frame-pointer,,$(USER_CFLAGS)) CFLAGS_frame.o := $(patsubst -fomit-frame-pointer,,$(USER_CFLAGS))
......
obj-y = bugs.o checksum.o fault.o ksyms.o ldt.o ptrace.o ptrace_user.o \ obj-y = bitops.o bugs.o checksum.o fault.o ksyms.o ldt.o ptrace.o \
semaphore.o sigcontext.o syscalls.o sysrq.o time.o ptrace_user.o semaphore.o sigcontext.o syscalls.o sysrq.o time.o
obj-$(CONFIG_HIGHMEM) += highmem.o obj-$(CONFIG_HIGHMEM) += highmem.o
obj-$(CONFIG_MODULES) += module.o obj-$(CONFIG_MODULES) += module.o
...@@ -7,11 +7,12 @@ obj-$(CONFIG_MODULES) += module.o ...@@ -7,11 +7,12 @@ obj-$(CONFIG_MODULES) += module.o
USER_OBJS := bugs.o ptrace_user.o sigcontext.o fault.o USER_OBJS := bugs.o ptrace_user.o sigcontext.o fault.o
USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
SYMLINKS = semaphore.c highmem.c module.c SYMLINKS = bitops.c semaphore.c highmem.c module.c
SYMLINKS := $(foreach f,$(SYMLINKS),$(src)/$f) SYMLINKS := $(foreach f,$(SYMLINKS),$(src)/$f)
clean-files := $(SYMLINKS) clean-files := $(SYMLINKS)
bitops.c-dir = lib
semaphore.c-dir = kernel semaphore.c-dir = kernel
highmem.c-dir = mm highmem.c-dir = mm
module.c-dir = kernel module.c-dir = kernel
......
...@@ -24,7 +24,7 @@ struct hppfs_data { ...@@ -24,7 +24,7 @@ struct hppfs_data {
}; };
struct hppfs_private { struct hppfs_private {
struct file proc_file; struct file *proc_file;
int host_fd; int host_fd;
loff_t len; loff_t len;
struct hppfs_data *contents; struct hppfs_data *contents;
...@@ -307,7 +307,7 @@ static ssize_t hppfs_read(struct file *file, char *buf, size_t count, ...@@ -307,7 +307,7 @@ static ssize_t hppfs_read(struct file *file, char *buf, size_t count,
if(count > 0) if(count > 0)
*ppos += count; *ppos += count;
} }
else count = read_proc(&hppfs->proc_file, buf, count, ppos, 1); else count = read_proc(hppfs->proc_file, buf, count, ppos, 1);
return(count); return(count);
} }
...@@ -316,7 +316,7 @@ static ssize_t hppfs_write(struct file *file, const char *buf, size_t len, ...@@ -316,7 +316,7 @@ static ssize_t hppfs_write(struct file *file, const char *buf, size_t len,
loff_t *ppos) loff_t *ppos)
{ {
struct hppfs_private *data = file->private_data; struct hppfs_private *data = file->private_data;
struct file *proc_file = &data->proc_file; struct file *proc_file = data->proc_file;
ssize_t (*write)(struct file *, const char *, size_t, loff_t *); ssize_t (*write)(struct file *, const char *, size_t, loff_t *);
int err; int err;
...@@ -471,9 +471,10 @@ static int hppfs_open(struct inode *inode, struct file *file) ...@@ -471,9 +471,10 @@ static int hppfs_open(struct inode *inode, struct file *file)
proc_dentry = HPPFS_I(inode)->proc_dentry; proc_dentry = HPPFS_I(inode)->proc_dentry;
/* XXX This isn't closed anywhere */ /* XXX This isn't closed anywhere */
err = open_private_file(&data->proc_file, proc_dentry, data->proc_file = dentry_open(dget(proc_dentry), NULL,
file_mode(file->f_mode)); file_mode(file->f_mode));
if(err) err = PTR_ERR(data->proc_file);
if(IS_ERR(data->proc_file))
goto out_free1; goto out_free1;
type = os_file_type(host_file); type = os_file_type(host_file);
...@@ -524,9 +525,10 @@ static int hppfs_dir_open(struct inode *inode, struct file *file) ...@@ -524,9 +525,10 @@ static int hppfs_dir_open(struct inode *inode, struct file *file)
goto out; goto out;
proc_dentry = HPPFS_I(inode)->proc_dentry; proc_dentry = HPPFS_I(inode)->proc_dentry;
err = open_private_file(&data->proc_file, proc_dentry, data->proc_file = dentry_open(dget(proc_dentry), NULL,
file_mode(file->f_mode)); file_mode(file->f_mode));
if(err) err = PTR_ERR(data->proc_file);
if(IS_ERR(data->proc_file))
goto out_free; goto out_free;
file->private_data = data; file->private_data = data;
...@@ -657,40 +659,42 @@ static struct super_operations hppfs_sbops = { ...@@ -657,40 +659,42 @@ static struct super_operations hppfs_sbops = {
static int hppfs_readlink(struct dentry *dentry, char *buffer, int buflen) static int hppfs_readlink(struct dentry *dentry, char *buffer, int buflen)
{ {
struct file proc_file; struct file *proc_file;
struct dentry *proc_dentry; struct dentry *proc_dentry;
int (*readlink)(struct dentry *, char *, int); int (*readlink)(struct dentry *, char *, int);
int err, n; int err, n;
proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
err = open_private_file(&proc_file, proc_dentry, O_RDONLY); proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
if(err) err = PTR_ERR(proc_dentry);
if(IS_ERR(proc_dentry))
return(err); return(err);
readlink = proc_dentry->d_inode->i_op->readlink; readlink = proc_dentry->d_inode->i_op->readlink;
n = (*readlink)(proc_dentry, buffer, buflen); n = (*readlink)(proc_dentry, buffer, buflen);
close_private_file(&proc_file); fput(proc_file);
return(n); return(n);
} }
static int hppfs_follow_link(struct dentry *dentry, struct nameidata *nd) static int hppfs_follow_link(struct dentry *dentry, struct nameidata *nd)
{ {
struct file proc_file; struct file *proc_file;
struct dentry *proc_dentry; struct dentry *proc_dentry;
int (*follow_link)(struct dentry *, struct nameidata *); int (*follow_link)(struct dentry *, struct nameidata *);
int err, n; int err, n;
proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
err = open_private_file(&proc_file, proc_dentry, O_RDONLY); proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
if(err) err = PTR_ERR(proc_dentry);
if(IS_ERR(proc_dentry))
return(err); return(err);
follow_link = proc_dentry->d_inode->i_op->follow_link; follow_link = proc_dentry->d_inode->i_op->follow_link;
n = (*follow_link)(proc_dentry, nd); n = (*follow_link)(proc_dentry, nd);
close_private_file(&proc_file); fput(proc_file);
return(n); return(n);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment