Commit e7d163f7 authored by Chris Zankel's avatar Chris Zankel Committed by Linus Torvalds

[PATCH] xtensa: Removed local copy of zlib and fixed O= support

Removed an unnecessary local copy of zlib (sorry for the add'l traffic).
Fixed 'O=' support (thanks to Jan Dittmer for pointing it out).  Some minor
clean-ups in the make files.
Signed-off-by: default avatarChris Zankel <chris@zankel.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 82300bf4
...@@ -21,23 +21,17 @@ export CPU ...@@ -21,23 +21,17 @@ export CPU
# Platform configuration # Platform configuration
platform-y := common
platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000 platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000
platform-$(CONFIG_XTENSA_PLATFORM_ISS) := iss platform-$(CONFIG_XTENSA_PLATFORM_ISS) := iss
PLATFORM = $(platform-y) PLATFORM = $(platform-y)
export PLATFORM export PLATFORM
#LDFLAGS_vmlinux := -T$(word 1,$(LINKSCRIPT)) CPPFLAGS += $(if $(KBUILD_SRC),-I$(srctree)/include/asm-xtensa/)
AFLAGS_vmlinux.lds.o := -Uxtensa CPPFLAGS += -Iinclude/asm
CPPFLAGS += -Iarch/xtensa -Iinclude/asm -mlongcalls -g CFLAGS += -pipe -mlongcalls
AFLAGS += -Iarch/xtensa -Iinclude/asm
CPP = $(CC) -E $(CFLAGS)
cflags-y += -Iarch/xtensa -pipe -mlongcalls KBUILD_DEFCONFIG := iss_defconfig
KBUILD_DEFCONFIG := common_defconfig
# ramdisk/initrd support # ramdisk/initrd support
# You need a compressed ramdisk image, named ramdisk.gz in # You need a compressed ramdisk image, named ramdisk.gz in
...@@ -62,30 +56,36 @@ endif ...@@ -62,30 +56,36 @@ endif
LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
head-y := arch/xtensa/kernel/head.o head-y := arch/xtensa/kernel/head.o
core-y += arch/xtensa/kernel/ \ core-y += arch/xtensa/kernel/ arch/xtensa/mm/
arch/xtensa/mm/ arch/xtensa/platform-$(PLATFORM)/ ifneq ($(PLATFORM),)
core-y += arch/xtensa/platform-$(PLATFORM)/
endif
libs-y += arch/xtensa/lib/ $(LIBGCC) libs-y += arch/xtensa/lib/ $(LIBGCC)
boot := arch/xtensa/boot boot := arch/xtensa/boot
archinc := include/asm-xtensa
arch/xtensa/kernel/asm-offsets.s: \ arch/xtensa/kernel/asm-offsets.s: \
arch/xtensa/kernel/asm-offsets.c \ arch/xtensa/kernel/asm-offsets.c $(archinc)/.platform
include/asm-xtensa/.platform
include/asm-xtensa/offsets.h: arch/xtensa/kernel/asm-offsets.s include/asm-xtensa/offsets.h: arch/xtensa/kernel/asm-offsets.s
$(call filechk,gen-asm-offsets) $(call filechk,gen-asm-offsets)
prepare: include/asm-xtensa/.platform include/asm-xtensa/offsets.h prepare: $(archinc)/.platform $(archinc)/offsets.h
# Update machine cpu and platform symlinks if something which affects # Update machine cpu and platform symlinks if something which affects
# them changed. # them changed.
include/asm-xtensa/.platform: $(wildcard include/config/arch/*.h) $(archinc)/.platform: $(wildcard include/config/arch/*.h) include/config/MARKER
@echo ' Setting up cpu ($(CPU)) and platform ($(PLATFORM)) symlinks' @echo ' SYMLINK $(archinc)/xtensa/config -> $(archinc)/xtensa/config-$(CPU)'
$(Q)rm -f include/asm-xtensa/platform $(Q)mkdir -p $(archinc)
$(Q)rm -f include/asm-xtensa/xtensa/config $(Q)mkdir -p $(archinc)/xtensa
$(Q)(cd include/asm-xtensa/; ln -sf platform-$(PLATFORM) platform) $(Q)ln -fsn $(srctree)/$(archinc)/xtensa/config-$(CPU) $(archinc)/xtensa/config
$(Q)(cd include/asm-xtensa/xtensa; ln -sf config-$(CPU) config) @echo ' SYMLINK $(archinc)/platform -> $(archinc)/platform-$(PLATFORM)'
$(Q)ln -fsn $(srctree)/$(archinc)/platform-$(PLATFORM) $(archinc)/platform
@touch $@
all: zImage all: zImage
...@@ -94,7 +94,9 @@ bzImage : zImage ...@@ -94,7 +94,9 @@ bzImage : zImage
zImage zImage.initrd: vmlinux zImage zImage.initrd: vmlinux
$(Q)$(MAKE) $(build)=$(boot) $@ $(Q)$(MAKE) $(build)=$(boot) $@
CLEAN_FILES += arch/xtensa/vmlinux.lds include/asm-xtensa/offset.h CLEAN_FILES += arch/xtensa/vmlinux.lds $(archinc)/offset.h \
$(archinc)/platform $(archinc)/xtensa/config \
$(archinc)/.platform
define archhelp define archhelp
@echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)' @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
......
...@@ -11,21 +11,19 @@ ...@@ -11,21 +11,19 @@
CFLAGS += -fno-builtin -Iarch/$(ARCH)/boot/include CFLAGS += -fno-builtin -Iarch/$(ARCH)/boot/include
HOSTFLAGS += -Iarch/$(ARCH)/boot/include HOSTFLAGS += -Iarch/$(ARCH)/boot/include
BIG_ENDIAN := $(shell echo -e "\#ifdef __XTENSA_EL__\nint little;\n\#else\nint big;\n\#endif" | $(CC) -E -|grep -c big) BIG_ENDIAN := $(shell echo -e __XTENSA_EB__ | $(CC) -E - | grep -v "\#")
export CFLAGS export CFLAGS
export AFLAGS export AFLAGS
export BIG_ENDIAN export BIG_ENDIAN
subdir-y := lib
# Subdirs for the boot loader(s) # Subdirs for the boot loader(s)
bootdir-$(CONFIG_XTENSA_PLATFORM_ISS) += boot-elf bootdir-$(CONFIG_XTENSA_PLATFORM_ISS) += boot-elf
bootdir-$(CONFIG_XTENSA_PLATFORM_XT2000) += boot-redboot boot-elf bootdir-$(CONFIG_XTENSA_PLATFORM_XT2000) += boot-redboot boot-elf
subdir-y := lib/
subdir-y += boot-elf/ boot-redboot/
zImage zImage.initrd Image Image.initrd: $(bootdir-y) zImage zImage.initrd Image Image.initrd: $(bootdir-y)
...@@ -33,5 +31,3 @@ $(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \ ...@@ -33,5 +31,3 @@ $(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
$(addprefix $(obj)/,$(host-progs)) $(addprefix $(obj)/,$(host-progs))
$(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS) $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)
...@@ -27,7 +27,7 @@ Image: vmlinux $(OBJS) ...@@ -27,7 +27,7 @@ Image: vmlinux $(OBJS)
--set-section-flags image=contents,alloc,load,load,data \ --set-section-flags image=contents,alloc,load,load,data \
$(OBJS) $@.tmp $(OBJS) $@.tmp
$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \ $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
-T arch/$(ARCH)/boot/boot-elf/boot.ld \ -T $(srctree)/arch/$(ARCH)/boot/boot-elf/boot.ld \
-o arch/$(ARCH)/boot/$@.elf $@.tmp -o arch/$(ARCH)/boot/$@.elf $@.tmp
rm -f $@.tmp vmlinux.tmp rm -f $@.tmp vmlinux.tmp
...@@ -41,7 +41,7 @@ Image.initrd: vmlinux $(OBJS) ...@@ -41,7 +41,7 @@ Image.initrd: vmlinux $(OBJS)
--set-section-flags image=contents,alloc,load,load,data \ --set-section-flags image=contents,alloc,load,load,data \
$(OBJS) $@.tmp $(OBJS) $@.tmp
$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \ $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
-T arch/$(ARCH)/boot/boot-elf/boot.ld \ -T $(srctree)/arch/$(ARCH)/boot/boot-elf/boot.ld \
-o arch/$(ARCH)/boot/$@.elf $@.tmp -o arch/$(ARCH)/boot/$@.elf $@.tmp
rm -f $@.tmp vmlinux.tmp rm -f $@.tmp vmlinux.tmp
......
...@@ -12,24 +12,24 @@ else ...@@ -12,24 +12,24 @@ else
OBJCOPY_ARGS := -O elf32-xtensa-le OBJCOPY_ARGS := -O elf32-xtensa-le
endif endif
LD_ARGS = -T $(obj)/boot.ld LD_ARGS = -T $(srctree)/$(obj)/boot.ld
boot-y := bootstrap.o boot-y := bootstrap.o
OBJS := $(addprefix $(obj)/,$(boot-y)) OBJS := $(addprefix $(obj)/,$(boot-y))
LIBS := arch/$(ARCH)/boot/lib/lib.a arch/$(ARCH)/lib/lib.a LIBS := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a
LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
zImage: vmlinux $(OBJS) $(LIBS) zImage: vmlinux $(OBJS) $(LIBS)
$(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \ $(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \
$(TOPDIR)/vmlinux vmlinux.tmp vmlinux vmlinux.tmp
gzip -vf9 vmlinux.tmp gzip -vf9 vmlinux.tmp
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \ $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section image=vmlinux.tmp.gz \ --add-section image=vmlinux.tmp.gz \
--set-section-flags image=contents,alloc,load,load,data \ --set-section-flags image=contents,alloc,load,load,data \
$(OBJS) $@.tmp $(OBJS) $@.tmp
$(LD) $(LD_ARGS) -o $@.elf $@.tmp $(LIBS) -L/xtensa-elf/lib $(LIBGCC) $(LD) $(LD_ARGS) -o $@.elf $@.tmp $(LIBS) -L/xtensa-elf/lib $(LIBGCC)
$(OBJCOPY) -S -O binary $@.elf arch/$(ARCH)/boot/images/$@.redboot $(OBJCOPY) -S -O binary $@.elf arch/$(ARCH)/boot/$@.redboot
# rm -f $@.tmp $@.elf vmlinux.tmp.gz rm -f $@.tmp $@.elf vmlinux.tmp.gz
This diff is collapsed.
...@@ -2,5 +2,16 @@ ...@@ -2,5 +2,16 @@
# Makefile for some libs needed by zImage. # Makefile for some libs needed by zImage.
# #
zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c
lib-y := zlib.o zmem.o lib-y += $(zlib:.c=.o) zmem.o
EXTRA_CFLAGS += -Ilib/zlib_inflate
quiet_cmd_copy_zlib = COPY $@
cmd_copy_zlib = cat $< > $@
$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
$(call cmd,copy_zlib)
clean-files := $(zlib)
/*
* arch/xtensa/lib/memcpy.S
*
* ANSI C standard library function memcpy
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file "COPYING" in the main directory of
* this archive for more details.
*
* Copyright (C) 2002 Tensilica Inc.
*/
#define _ASMLANGUAGE
#include <xtensa/config/core.h>
.text
.align 4
.global bcopy
.type bcopy,@function
bcopy:
movi a14, xthal_bcopy // a14 safe to use regardless of whether caller
// used call4 or call8 (can't have used call12)
jx a14 // let the Core HAL do the work
.text
.align 4
.global memcpy
.type memcpy,@function
memcpy:
.global memmove
.type memmove,@function
memmove:
movi a14, xthal_memcpy // a14 safe to use regardless of whether caller
// used call4 or call8 (can't have used call12)
jx a14 // let the Core HAL do the work
This diff is collapsed.
#include "zlib.h" #include <linux/zlib.h>
/* bits taken from ppc */ /* bits taken from ppc */
...@@ -9,11 +9,10 @@ void exit (void) ...@@ -9,11 +9,10 @@ void exit (void)
for (;;); for (;;);
} }
void *zalloc(void *x, unsigned items, unsigned size) void *zalloc(unsigned size)
{ {
void *p = avail_ram; void *p = avail_ram;
size *= items;
size = (size + 7) & -8; size = (size + 7) & -8;
avail_ram += size; avail_ram += size;
if (avail_ram > end_avail) { if (avail_ram > end_avail) {
...@@ -24,11 +23,6 @@ void *zalloc(void *x, unsigned items, unsigned size) ...@@ -24,11 +23,6 @@ void *zalloc(void *x, unsigned items, unsigned size)
return p; return p;
} }
void zfree(void *x, void *addr, unsigned nb)
{
}
#define HEAD_CRC 2 #define HEAD_CRC 2
#define EXTRA_FIELD 4 #define EXTRA_FIELD 4
#define ORIG_NAME 8 #define ORIG_NAME 8
...@@ -43,7 +37,6 @@ void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp) ...@@ -43,7 +37,6 @@ void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp)
int r, i, flags; int r, i, flags;
/* skip header */ /* skip header */
i = 10; i = 10;
flags = src[3]; flags = src[3];
if (src[2] != DEFLATED || (flags & RESERVED) != 0) { if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
...@@ -65,9 +58,8 @@ void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp) ...@@ -65,9 +58,8 @@ void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp)
exit(); exit();
} }
s.zalloc = zalloc; s.workspace = zalloc(zlib_inflate_workspacesize());
s.zfree = zfree; r = zlib_inflateInit2(&s, -MAX_WBITS);
r = inflateInit2(&s, -MAX_WBITS);
if (r != Z_OK) { if (r != Z_OK) {
//puts("inflateInit2 returned "); puthex(r); puts("\n"); //puts("inflateInit2 returned "); puthex(r); puts("\n");
exit(); exit();
...@@ -76,12 +68,12 @@ void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp) ...@@ -76,12 +68,12 @@ void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp)
s.avail_in = *lenp - i; s.avail_in = *lenp - i;
s.next_out = dst; s.next_out = dst;
s.avail_out = dstlen; s.avail_out = dstlen;
r = inflate(&s, Z_FINISH); r = zlib_inflate(&s, Z_FINISH);
if (r != Z_OK && r != Z_STREAM_END) { if (r != Z_OK && r != Z_STREAM_END) {
//puts("inflate returned "); puthex(r); puts("\n"); //puts("inflate returned "); puthex(r); puts("\n");
exit(); exit();
} }
*lenp = s.next_out - (unsigned char *) dst; *lenp = s.next_out - (unsigned char *) dst;
inflateEnd(&s); zlib_inflateEnd(&s);
} }
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