diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile index 5501b10..57fac20 100644 --- a/arch/sandbox/Makefile +++ b/arch/sandbox/Makefile @@ -1,7 +1,7 @@ CPPFLAGS += -fno-strict-aliasing -machine-y := sandbox +machine-y := sandbox board-y := sandbox lds-y := board/sandbox/u-boot.lds @@ -22,10 +22,13 @@ -Dglob=u_boot_glob -Dglobfree=u_boot_globfree \ -Dioctl=u_boot_ioctl -ifeq ($(incdir-y),) -incdir-y := $(machine-y) +machdirs := $(patsubst %,arch/sandbox/mach-%/,$(machine-y)) + +ifeq ($(KBUILD_SRC),) +CPPFLAGS += $(patsubst %,-I%include,$(machdirs)) +else +CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs)) endif -INCDIR := arch-$(incdir-y) SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ -e s/arm.*/arm/ -e s/sa110/arm/ \ @@ -50,24 +53,10 @@ CPPFLAGS += -DELF_CLASS="$(ELF_CLASS)" export ELF_FORMAT ELF_ARCH SUBARCH ELF_CLASS -# Update machine arch and proc symlinks if something which affects -# them changed. We use .arch to indicate when they were updated -# last, otherwise make uses the target directory mtime. - -include/asm-sandbox/.arch: $(wildcard include/config/arch/*.h) include/config/auto.conf - @echo ' SYMLINK include/asm-sandbox/arch -> include/asm-sandbox/$(INCDIR)' -ifneq ($(KBUILD_SRC),) - $(Q)mkdir -p include/asm-sandbox - $(Q)ln -fsn $(srctree)/include/asm-sandbox/$(INCDIR) include/asm-sandbox/arch -else - $(Q)ln -fsn $(INCDIR) include/asm-sandbox/arch -endif - @touch $@ archprepare: maketools PHONY += maketools -maketools: include/asm-sandbox/.arch cmd_uboot__ = $(CC) -o $@ -Wl,-T,$(uboot-lds) \ -Wl,--start-group $(uboot-common) -Wl,--end-group \ @@ -76,4 +65,3 @@ common-y += board/sandbox/ arch/sandbox/os/ CLEAN_FILES += board/sandbox/u-boot.lds -MRPROPER_FILES += include/asm-sandbox/arch diff --git a/arch/sandbox/mach-sandbox/include/mach/hostfile.h b/arch/sandbox/mach-sandbox/include/mach/hostfile.h new file mode 100644 index 0000000..30f9499 --- /dev/null +++ b/arch/sandbox/mach-sandbox/include/mach/hostfile.h @@ -0,0 +1,15 @@ +#ifndef __ASM_ARCH_HOSTFILE_H +#define __ASM_ARCH_HOSTFILE_H + +struct hf_platform_data { + int fd; + size_t size; + unsigned long map_base; + char *filename; + char *name; +}; + +int u_boot_register_filedev(struct hf_platform_data *hf); + +#endif /* __ASM_ARCH_HOSTFILE_H */ + diff --git a/arch/sandbox/mach-sandbox/include/mach/linux.h b/arch/sandbox/mach-sandbox/include/mach/linux.h new file mode 100644 index 0000000..0937641 --- /dev/null +++ b/arch/sandbox/mach-sandbox/include/mach/linux.h @@ -0,0 +1,23 @@ +#ifndef __ASM_ARCH_LINUX_H +#define __ASM_ARCH_LINUX_H + +int linux_register_device(const char *name, void *start, void *end); +int tap_alloc(char *dev); +uint64_t linux_get_time(void); +int linux_read(int fd, void *buf, size_t count); +int linux_read_nonblock(int fd, void *buf, size_t count); +ssize_t linux_write(int fd, const void *buf, size_t count); +off_t linux_lseek(int fildes, off_t offset); +int linux_getc (void); +void linux_putc (const char c); +int linux_tstc(int fd); + +int u_boot_register_console(char *name_template, int stdinfd, int stdoutfd); + +struct linux_console_data { + int stdinfd; + int stdoutfd; + unsigned int flags; +}; + +#endif /* __ASM_ARCH_LINUX_H */ diff --git a/arch/sandbox/os/Makefile b/arch/sandbox/os/Makefile index 117f05e..2980301 100644 --- a/arch/sandbox/os/Makefile +++ b/arch/sandbox/os/Makefile @@ -1,4 +1,14 @@ -CPPFLAGS := -Iinclude/asm/arch -P +machine-y := sandbox + +machdirs := $(patsubst %,arch/sandbox/mach-%/,$(machine-y)) + +ifeq ($(KBUILD_SRC),) +CPPFLAGS := $(patsubst %,-I%include,$(machdirs)) +else +CPPFLAGS = $(patsubst %,-I$(srctree)/%include,$(machdirs)) +endif + +CPPFLAGS += -P CFLAGS := -Wall NOSTDINC_FLAGS := diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c index 72e4c8d..e89d8a6 100644 --- a/arch/sandbox/os/common.c +++ b/arch/sandbox/os/common.c @@ -47,8 +47,8 @@ /* * ...except the ones needed to connect with U-Boot */ -#include -#include +#include +#include static struct termios term_orig, term_vi; static char erase_char; /* the users erase character */ diff --git a/board/sandbox/board.c b/board/sandbox/board.c index a3f6498..84017eb 100644 --- a/board/sandbox/board.c +++ b/board/sandbox/board.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include diff --git a/board/sandbox/clock.c b/board/sandbox/clock.c index 27ae7e2..7ad1f53 100644 --- a/board/sandbox/clock.c +++ b/board/sandbox/clock.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include static uint64_t linux_clocksource_read(void) { diff --git a/board/sandbox/console.c b/board/sandbox/console.c index 7b429df..0945216 100644 --- a/board/sandbox/console.c +++ b/board/sandbox/console.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include int u_boot_register_console(char *name, int stdinfd, int stdoutfd) diff --git a/board/sandbox/hostfile.c b/board/sandbox/hostfile.c index eb3b08f..f91601f 100644 --- a/board/sandbox/hostfile.c +++ b/board/sandbox/hostfile.c @@ -23,10 +23,10 @@ #include #include #include -#include +#include #include #include -#include +#include #include struct hf_priv { diff --git a/drivers/net/tap.c b/drivers/net/tap.c index e09c136..7070cc6 100644 --- a/drivers/net/tap.c +++ b/drivers/net/tap.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include struct tap_priv { int fd; diff --git a/drivers/serial/linux_console.c b/drivers/serial/linux_console.c index 39ff862..c792b50 100644 --- a/drivers/serial/linux_console.c +++ b/drivers/serial/linux_console.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/asm-sandbox/arch-sandbox/hostfile.h b/include/asm-sandbox/arch-sandbox/hostfile.h deleted file mode 100644 index 30f9499..0000000 --- a/include/asm-sandbox/arch-sandbox/hostfile.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __ASM_ARCH_HOSTFILE_H -#define __ASM_ARCH_HOSTFILE_H - -struct hf_platform_data { - int fd; - size_t size; - unsigned long map_base; - char *filename; - char *name; -}; - -int u_boot_register_filedev(struct hf_platform_data *hf); - -#endif /* __ASM_ARCH_HOSTFILE_H */ - diff --git a/include/asm-sandbox/arch-sandbox/linux.h b/include/asm-sandbox/arch-sandbox/linux.h deleted file mode 100644 index 0937641..0000000 --- a/include/asm-sandbox/arch-sandbox/linux.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __ASM_ARCH_LINUX_H -#define __ASM_ARCH_LINUX_H - -int linux_register_device(const char *name, void *start, void *end); -int tap_alloc(char *dev); -uint64_t linux_get_time(void); -int linux_read(int fd, void *buf, size_t count); -int linux_read_nonblock(int fd, void *buf, size_t count); -ssize_t linux_write(int fd, const void *buf, size_t count); -off_t linux_lseek(int fildes, off_t offset); -int linux_getc (void); -void linux_putc (const char c); -int linux_tstc(int fd); - -int u_boot_register_console(char *name_template, int stdinfd, int stdoutfd); - -struct linux_console_data { - int stdinfd; - int stdoutfd; - unsigned int flags; -}; - -#endif /* __ASM_ARCH_LINUX_H */