From patchwork Mon Dec 23 19:43:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaro Koskinen X-Patchwork-Id: 304843 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B783E2C00A8 for ; Tue, 24 Dec 2013 06:44:03 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757721Ab3LWTn7 (ORCPT ); Mon, 23 Dec 2013 14:43:59 -0500 Received: from filtteri5.pp.htv.fi ([213.243.153.188]:47490 "EHLO filtteri5.pp.htv.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757468Ab3LWTnx (ORCPT ); Mon, 23 Dec 2013 14:43:53 -0500 Received: from localhost (localhost [127.0.0.1]) by filtteri5.pp.htv.fi (Postfix) with ESMTP id 77B015A70BE; Mon, 23 Dec 2013 21:43:51 +0200 (EET) X-Virus-Scanned: Debian amavisd-new at pp.htv.fi Received: from smtp5.welho.com ([213.243.153.39]) by localhost (filtteri5.pp.htv.fi [213.243.153.188]) (amavisd-new, port 10024) with ESMTP id iFLpD11O1sSJ; Mon, 23 Dec 2013 21:43:46 +0200 (EET) Received: from blackmetal.bb.dnainternet.fi (91-145-91-118.bb.dnainternet.fi [91.145.91.118]) by smtp5.welho.com (Postfix) with ESMTP id 922CF5BC00D; Mon, 23 Dec 2013 21:43:47 +0200 (EET) From: Aaro Koskinen To: sparclinux@vger.kernel.org Cc: Aaro Koskinen Subject: [PATCH v2 07/11] tilo: support super large images Date: Mon, 23 Dec 2013 21:43:29 +0200 Message-Id: <1387827813-8279-8-git-send-email-aaro.koskinen@iki.fi> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: <1387827813-8279-1-git-send-email-aaro.koskinen@iki.fi> References: <1387827813-8279-1-git-send-email-aaro.koskinen@iki.fi> Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org Support images bigger than 4 MB. At least Sun Ultra 5/10 PROM maps 10 MB, so make that a new limit. Signed-off-by: Aaro Koskinen --- tilo/Makefile | 22 ++++++++++++++++++++-- tilo/crt0.S | 4 ++++ tilo/maketilo.c | 12 ++++++++++-- tilo/tilo.c | 4 ++++ 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/tilo/Makefile b/tilo/Makefile index 800e65f02767..bcc5806bed4f 100644 --- a/tilo/Makefile +++ b/tilo/Makefile @@ -10,6 +10,8 @@ include ../Rules.make LDFLAGS_SMALL=-N -Ttext 0x3c0000 # This is even more, but will be used only for extra large images. LDFLAGS_LARGE=-N -Ttext 0x4c0000 +# This is even more, but will be used only for super large images. +LDFLAGS_SUPER=-N -Ttext 0x9c0000 all: maketilo @@ -25,8 +27,9 @@ OBJS_COMMON = ../common/printf.o ../common/jmp.o ../common/prom.o \ ../common/divdi3.o ../common/udivdi3.o OBJS = crt0.o tilo.o $(OBJS_COMMON) malloc.o OBJS2 = crt0l.o tilol.o $(OBJS_COMMON) mallocl.o +OBJS3 = crt0sup.o tilosup.o $(OBJS_COMMON) mallocsup.o -maketilo: maketilo.c b.h b2.h +maketilo: maketilo.c b.h b2.h b3.h $(HOSTCC) $(HOSTCFLAGS) -g maketilo.c -o maketilo b.h : b.out $(BIN2H) @@ -35,6 +38,9 @@ b.h : b.out $(BIN2H) b2.h : b2.out $(BIN2H) $(BIN2H) -l LARGE_BOOT_LEN large_boot_loader $< > $@ || ($(RM) $@; exit 1) +b3.h : b3.out $(BIN2H) + $(BIN2H) -l SUPER_BOOT_LEN super_boot_loader $< > $@ || ($(RM) $@; exit 1) + b.out: $(OBJS) $(LD) $(LDFLAGS_SMALL) -Bstatic -o boot $(OBJS) $(ELFTOAOUT) boot -o b.out @@ -43,6 +49,12 @@ b2.out: $(OBJS2) $(LD) $(LDFLAGS_LARGE) -Bstatic -o boot2 $(OBJS2) $(ELFTOAOUT) boot2 -o b2.out +b3.out: $(OBJS3) + $(LD) $(LDFLAGS_SUPER) -Bstatic -o boot3 $(OBJS3) + $(ELFTOAOUT) boot3 -o b3.out + +mallocsup.o: ../common/malloc.c + $(CC) $(CFLAGS) -DMALLOC_BASE=0x9D0000 -c -o $@ $< mallocl.o: ../common/malloc.c $(CC) $(CFLAGS) -DMALLOC_BASE=0x4D0000 -c -o $@ $< @@ -50,6 +62,9 @@ mallocl.o: ../common/malloc.c malloc.o: ../common/malloc.c $(CC) $(CFLAGS) -DMALLOC_BASE=0x3D0000 -c -o $@ $< +tilosup.o: tilo.c + $(CC) $(CFLAGS) -DSUPERTILO -c -o $@ $< + tilol.o: tilo.c $(CC) $(CFLAGS) -DLARGETILO -c -o $@ $< @@ -59,5 +74,8 @@ crt0.o: crt0.S crt0l.o: crt0.S $(CC) $(CFLAGS) -c -Wa,-Av9 -DLARGETILO -o $@ $< +crt0sup.o: crt0.S + $(CC) $(CFLAGS) -c -Wa,-Av9 -DSUPERTILO -o $@ $< + clean: - $(RM) *.o boot boot2 *.out b.h b2.h maketilo + $(RM) *.o boot boot2 boot3 *.out b.h b2.h b3.h maketilo diff --git a/tilo/crt0.S b/tilo/crt0.S index 3e24a77f104b..82db19a666e3 100644 --- a/tilo/crt0.S +++ b/tilo/crt0.S @@ -23,11 +23,15 @@ #define COPY jmpl %o7 + (copy - _start), %l7 +#ifdef SUPERTILO +#define STACK_BASE 0xa00000 +#else #ifndef LARGETILO #define STACK_BASE 0x400000 #else #define STACK_BASE 0x500000 #endif +#endif .text .global _start diff --git a/tilo/maketilo.c b/tilo/maketilo.c index 6bc2f767fcb6..bf088b91f149 100644 --- a/tilo/maketilo.c +++ b/tilo/maketilo.c @@ -33,8 +33,9 @@ #include #include "b.h" #include "b2.h" +#include "b3.h" -#define MAX_BOOT_LEN 0x400000 +#define MAX_BOOT_LEN 0x900000 char output_buffer[MAX_BOOT_LEN]; @@ -162,7 +163,14 @@ int main (int argc, char **argv) rootlen = 0; } - if (rootlen + sun4_size + 0x4000 + 0x10000 >= 0x330000 || + if (rootlen + sun4_size + 0x4000 + 0x10000 >= 0x430000 || + rootlen + sun4c_size + 0x4000 + 0x10000 >= 0x430000 || + rootlen + sun4u_size + 0x4000 + 0x10000 >= 0x430000) { + printf("Images are super large. Will load on machines with at least 10M mapped by PROM only\n"); + + for (i=0; i= 0x330000 || rootlen + sun4c_size + 0x4000 + 0x10000 >= 0x330000 || rootlen + sun4u_size + 0x4000 + 0x10000 >= 0x330000) { printf("Images are large. Will load on machines with at least 5M mapped by PROM only\n"); diff --git a/tilo/tilo.c b/tilo/tilo.c index d9a749de6eea..afbd848d9814 100644 --- a/tilo/tilo.c +++ b/tilo/tilo.c @@ -24,11 +24,15 @@ #define NULL (void *)0 #endif +#ifdef SUPERTILO +#define MOVED_BASE 0x9c0000 +#else #ifndef LARGETILO #define MOVED_BASE 0x3c0000 #else #define MOVED_BASE 0x4c0000 #endif +#endif /* * gzip declarations