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)
LDFLAGS_vmlinux = -r
vmlinux: $(ARCH_DIR)/main.o
# These aren't in Makefile-tt because they are needed in the !CONFIG_MODE_TT +
# CONFIG_MODE_SKAS + CONFIG_STATIC_LINK case.
......@@ -120,14 +118,11 @@ CPPFLAGS_vmlinux.lds = $(shell echo -U$(SUBARCH) \
export CPPFLAGS_$(LD_SCRIPT-y) = $(CPPFLAGS_vmlinux.lds) -P -C -Uum
LD_SCRIPT-y := $(ARCH_DIR)/$(LD_SCRIPT-y)
#$(LD_SCRIPT-y) : $(LD_SCRIPT-y:.s=.S) scripts FORCE
# $(call if_changed_dep,as_s_S)
LD_SCRIPT-y := $(ARCH_DIR)/kernel/$(LD_SCRIPT-y)
linux: vmlinux $(LD_SCRIPT-y)
$(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 -Derrno=kernel_errno,,$(USER_CFLAGS))
......@@ -162,10 +157,6 @@ CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/uml.lds \
MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_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:
@:
......
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.8.1-mm1
# Mon Aug 16 22:34:07 2004
# Linux kernel version: 2.6.8.1-mm3
# Fri Aug 20 13:03:03 2004
#
CONFIG_USERMODE=y
CONFIG_MMU=y
......@@ -43,7 +43,6 @@ CONFIG_SYSVIPC=y
# CONFIG_POSIX_MQUEUE is not set
CONFIG_BSD_PROCESS_ACCT=y
# CONFIG_BSD_PROCESS_ACCT_V3 is not set
# CONFIG_PAGG is not set
CONFIG_SYSCTL=y
# CONFIG_AUDIT is not set
CONFIG_LOG_BUF_SHIFT=14
......@@ -55,6 +54,7 @@ CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_EXTRA_PASS is not set
CONFIG_FUTEX=y
CONFIG_EPOLL=y
# CONFIG_CPUSETS is not set
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
......@@ -236,6 +236,9 @@ CONFIG_EXT2_FS=y
# CONFIG_EXT2_FS_XATTR is not set
# CONFIG_EXT3_FS 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_CHECK is not set
# CONFIG_REISERFS_PROC_INFO is not set
......
......@@ -3,10 +3,10 @@
# 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 \
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 \
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 \
......@@ -24,7 +24,7 @@ obj-$(CONFIG_MODE_SKAS) += skas/
user-objs-$(CONFIG_TTY_LOG) += tty_log.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))
CFLAGS_frame.o := $(patsubst -fomit-frame-pointer,,$(USER_CFLAGS))
......
/*
/*
* Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#include <unistd.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
......@@ -23,7 +23,7 @@
#include "choose-mode.h"
#include "uml-config.h"
/* Set in set_stklim, which is called from main and __wrap_malloc.
/* Set in set_stklim, which is called from main and __wrap_malloc.
* __wrap_malloc only calls it if main hasn't started.
*/
unsigned long stacksizelim;
......@@ -82,7 +82,7 @@ int main(int argc, char **argv, char **envp)
sigset_t mask;
int ret, i;
/* Enable all signals except SIGIO - in some environments, we can
/* Enable all signals except SIGIO - in some environments, we can
* enter with some signals blocked
*/
......@@ -97,27 +97,27 @@ int main(int argc, char **argv, char **envp)
/* Allocate memory for thread command lines */
if(argc < 2 || strlen(argv[1]) < THREAD_NAME_LEN - 1){
char padding[THREAD_NAME_LEN] = {
[ 0 ... THREAD_NAME_LEN - 2] = ' ', '\0'
char padding[THREAD_NAME_LEN] = {
[ 0 ... THREAD_NAME_LEN - 2] = ' ', '\0'
};
new_argv = malloc((argc + 2) * sizeof(char*));
if(!new_argv) {
perror("Allocating extended argv");
exit(1);
}
}
new_argv[0] = argv[0];
new_argv[1] = padding;
for(i = 2; i <= argc; i++)
new_argv[i] = argv[i - 1];
new_argv[argc + 1] = NULL;
execvp(new_argv[0], new_argv);
perror("execing with extended args");
exit(1);
}
}
#endif
linux_prog = argv[0];
......@@ -144,7 +144,7 @@ int main(int argc, char **argv, char **envp)
do_uml_initcalls();
ret = linux_main(argc, argv);
/* Reboot */
if(ret){
printf("\n");
......
#include <asm-generic/vmlinux.lds.h>
OUTPUT_FORMAT(ELF_FORMAT)
OUTPUT_ARCH(ELF_ARCH)
ENTRY(_start)
......@@ -70,12 +70,12 @@ SECTIONS
_edata = .;
PROVIDE (edata = .);
. = ALIGN(0x1000);
.sbss :
.sbss :
{
__bss_start = .;
PROVIDE(_bss_start = .);
*(.sbss)
*(.scommon)
*(.sbss)
*(.scommon)
}
.bss :
{
......
obj-y = bugs.o checksum.o fault.o ksyms.o ldt.o ptrace.o ptrace_user.o \
semaphore.o sigcontext.o syscalls.o sysrq.o time.o
obj-y = bitops.o bugs.o checksum.o fault.o ksyms.o ldt.o ptrace.o \
ptrace_user.o semaphore.o sigcontext.o syscalls.o sysrq.o time.o
obj-$(CONFIG_HIGHMEM) += highmem.o
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 := $(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)
clean-files := $(SYMLINKS)
bitops.c-dir = lib
semaphore.c-dir = kernel
highmem.c-dir = mm
module.c-dir = kernel
......
......@@ -24,7 +24,7 @@ struct hppfs_data {
};
struct hppfs_private {
struct file proc_file;
struct file *proc_file;
int host_fd;
loff_t len;
struct hppfs_data *contents;
......@@ -307,7 +307,7 @@ static ssize_t hppfs_read(struct file *file, char *buf, size_t count,
if(count > 0)
*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);
}
......@@ -316,7 +316,7 @@ static ssize_t hppfs_write(struct file *file, const char *buf, size_t len,
loff_t *ppos)
{
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 *);
int err;
......@@ -471,9 +471,10 @@ static int hppfs_open(struct inode *inode, struct file *file)
proc_dentry = HPPFS_I(inode)->proc_dentry;
/* XXX This isn't closed anywhere */
err = open_private_file(&data->proc_file, proc_dentry,
file_mode(file->f_mode));
if(err)
data->proc_file = dentry_open(dget(proc_dentry), NULL,
file_mode(file->f_mode));
err = PTR_ERR(data->proc_file);
if(IS_ERR(data->proc_file))
goto out_free1;
type = os_file_type(host_file);
......@@ -524,9 +525,10 @@ static int hppfs_dir_open(struct inode *inode, struct file *file)
goto out;
proc_dentry = HPPFS_I(inode)->proc_dentry;
err = open_private_file(&data->proc_file, proc_dentry,
file_mode(file->f_mode));
if(err)
data->proc_file = dentry_open(dget(proc_dentry), NULL,
file_mode(file->f_mode));
err = PTR_ERR(data->proc_file);
if(IS_ERR(data->proc_file))
goto out_free;
file->private_data = data;
......@@ -657,40 +659,42 @@ static struct super_operations hppfs_sbops = {
static int hppfs_readlink(struct dentry *dentry, char *buffer, int buflen)
{
struct file proc_file;
struct file *proc_file;
struct dentry *proc_dentry;
int (*readlink)(struct dentry *, char *, int);
int err, n;
proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
err = open_private_file(&proc_file, proc_dentry, O_RDONLY);
if(err)
proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
err = PTR_ERR(proc_dentry);
if(IS_ERR(proc_dentry))
return(err);
readlink = proc_dentry->d_inode->i_op->readlink;
n = (*readlink)(proc_dentry, buffer, buflen);
close_private_file(&proc_file);
fput(proc_file);
return(n);
}
static int hppfs_follow_link(struct dentry *dentry, struct nameidata *nd)
{
struct file proc_file;
struct file *proc_file;
struct dentry *proc_dentry;
int (*follow_link)(struct dentry *, struct nameidata *);
int err, n;
proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
err = open_private_file(&proc_file, proc_dentry, O_RDONLY);
if(err)
proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
err = PTR_ERR(proc_dentry);
if(IS_ERR(proc_dentry))
return(err);
follow_link = proc_dentry->d_inode->i_op->follow_link;
n = (*follow_link)(proc_dentry, nd);
close_private_file(&proc_file);
fput(proc_file);
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