summaryrefslogtreecommitdiffstats
path: root/arch/cris/boot
diff options
context:
space:
mode:
authorJesper Nilsson <jesper@jni.nu>2018-03-11 11:05:23 +0100
committerArnd Bergmann <arnd@arndb.de>2018-03-16 10:56:05 +0100
commitc690eddc2f3b44b24520f4a77cc3a4c9bde7d571 (patch)
treeb7ba2caa6ebb2e36a529f9bf7182c9e0a73d53c4 /arch/cris/boot
parentbb9d812643d8a121df7d614a2b9c60193a92deb0 (diff)
downloadlinux-c690eddc2f3b44b24520f4a77cc3a4c9bde7d571.tar.gz
linux-c690eddc2f3b44b24520f4a77cc3a4c9bde7d571.tar.bz2
linux-c690eddc2f3b44b24520f4a77cc3a4c9bde7d571.zip
CRIS: Drop support for the CRIS port
The port was added back in 2000 so it's no longer even a good source of inspiration for newer ports (if it ever was) The last SoC (ARTPEC-3) with a CRIS main CPU was launched in 2008. Coupled with time and working developer board hardware being in low supply, it's time to drop the port from Linux. So long and thanks for all the fish! Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/cris/boot')
-rw-r--r--arch/cris/boot/.gitignore2
-rw-r--r--arch/cris/boot/Makefile25
-rw-r--r--arch/cris/boot/compressed/Makefile36
-rw-r--r--arch/cris/boot/compressed/README24
-rw-r--r--arch/cris/boot/compressed/decompress_v10.lds31
-rw-r--r--arch/cris/boot/compressed/decompress_v32.lds31
-rw-r--r--arch/cris/boot/compressed/head_v10.S127
-rw-r--r--arch/cris/boot/compressed/head_v32.S146
-rw-r--r--arch/cris/boot/compressed/misc.c377
-rw-r--r--arch/cris/boot/dts/Makefile5
-rw-r--r--arch/cris/boot/dts/artpec3.dtsi47
-rw-r--r--arch/cris/boot/dts/dev88.dts68
-rw-r--r--arch/cris/boot/dts/etraxfs.dtsi47
-rw-r--r--arch/cris/boot/dts/p1343.dts77
-rw-r--r--arch/cris/boot/rescue/Makefile53
-rw-r--r--arch/cris/boot/rescue/head_v10.S358
-rw-r--r--arch/cris/boot/rescue/head_v32.S27
-rw-r--r--arch/cris/boot/rescue/kimagerescue.S142
-rw-r--r--arch/cris/boot/rescue/rescue_v10.lds21
-rw-r--r--arch/cris/boot/rescue/rescue_v32.lds44
-rw-r--r--arch/cris/boot/rescue/testrescue.S25
-rw-r--r--arch/cris/boot/tools/build.c288
22 files changed, 0 insertions, 2001 deletions
diff --git a/arch/cris/boot/.gitignore b/arch/cris/boot/.gitignore
deleted file mode 100644
index 171a0853caf8..000000000000
--- a/arch/cris/boot/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Image
-zImage
diff --git a/arch/cris/boot/Makefile b/arch/cris/boot/Makefile
deleted file mode 100644
index 859d275f862b..000000000000
--- a/arch/cris/boot/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# arch/cris/boot/Makefile
-#
-
-objcopyflags-$(CONFIG_ETRAX_ARCH_V10) += -R .note -R .comment
-objcopyflags-$(CONFIG_ETRAX_ARCH_V32) += --remove-section=.bss --remove-section=.note.gnu.build-id
-
-OBJCOPYFLAGS = -O binary $(objcopyflags-y)
-
-
-subdir- := compressed rescue
-targets := Image
-
-$(obj)/Image: vmlinux FORCE
- $(call if_changed,objcopy)
- @echo ' Kernel: $@ is ready'
-
-$(obj)/compressed/vmlinux: $(obj)/Image FORCE
- $(Q)$(MAKE) $(build)=$(obj)/compressed $@
- $(Q)$(MAKE) $(build)=$(obj)/rescue $(obj)/rescue/rescue.bin
-
-$(obj)/zImage: $(obj)/compressed/vmlinux
- @cp $< $@
- @echo ' Kernel: $@ is ready'
diff --git a/arch/cris/boot/compressed/Makefile b/arch/cris/boot/compressed/Makefile
deleted file mode 100644
index e149c3467c93..000000000000
--- a/arch/cris/boot/compressed/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# arch/cris/boot/compressed/Makefile
-#
-
-# asflags-$(CONFIG_ETRAX_ARCH_V32) += -I$(srctree)/include/asm/mach \
-# -I$(srctree)/include/asm/arch
-# ccflags-$(CONFIG_ETRAX_ARCH_V32) += -O2 -I$(srctree)/include/asm/mach
-# -I$(srctree)/include/asm/arch
-
-arch-$(CONFIG_ETRAX_ARCH_V10) = v10
-arch-$(CONFIG_ETRAX_ARCH_V32) = v32
-
-ldflags-y += -T $(srctree)/$(src)/decompress_$(arch-y).lds
-
-OBJECTS-$(CONFIG_ETRAX_ARCH_V32) = $(obj)/head_v32.o
-OBJECTS-$(CONFIG_ETRAX_ARCH_V10) = $(obj)/head_v10.o
-OBJECTS= $(OBJECTS-y) $(obj)/misc.o
-OBJCOPYFLAGS = -O binary --remove-section=.bss
-
-quiet_cmd_image = BUILD $@
-cmd_image = cat $(obj)/decompress.bin $(obj)/piggy.gz > $@
-
-targets := vmlinux piggy.gz decompress.o decompress.bin
-
-$(obj)/decompress.o: $(OBJECTS) FORCE
- $(call if_changed,ld)
-
-$(obj)/decompress.bin: $(obj)/decompress.o FORCE
- $(call if_changed,objcopy)
-
-$(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE
- $(call if_changed,image)
-
-$(obj)/piggy.gz: $(obj)/../Image FORCE
- $(call if_changed,gzip)
diff --git a/arch/cris/boot/compressed/README b/arch/cris/boot/compressed/README
deleted file mode 100644
index 182c5d75784b..000000000000
--- a/arch/cris/boot/compressed/README
+++ /dev/null
@@ -1,24 +0,0 @@
-Creation of the self-extracting compressed kernel image (vmlinuz)
------------------------------------------------------------------
-
-This can be slightly confusing because it's a process with many steps.
-
-The kernel object built by the arch/etrax100/Makefile, vmlinux, is split
-by that makefile into text and data binary files, vmlinux.text and
-vmlinux.data.
-
-Those files together with a ROM filesystem can be catted together and
-burned into a flash or executed directly at the DRAM origin.
-
-They can also be catted together and compressed with gzip, which is what
-happens in this makefile. Together they make up piggy.img.
-
-The decompressor is built into the file decompress.o. It is turned into
-the binary file decompress.bin, which is catted together with piggy.img
-into the file vmlinuz. It can be executed in an arbitrary place in flash.
-
-Be careful - it assumes some things about free locations in DRAM. It
-assumes the DRAM starts at 0x40000000 and that it is at least 8 MB,
-so it puts its code at 0x40700000, and initial stack at 0x40800000.
-
--Bjorn
diff --git a/arch/cris/boot/compressed/decompress_v10.lds b/arch/cris/boot/compressed/decompress_v10.lds
deleted file mode 100644
index d8326779dda2..000000000000
--- a/arch/cris/boot/compressed/decompress_v10.lds
+++ /dev/null
@@ -1,31 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* OUTPUT_FORMAT(elf32-us-cris) */
-OUTPUT_FORMAT(elf32-cris)
-
-MEMORY
- {
- dram : ORIGIN = 0x40700000,
- LENGTH = 0x00100000
- }
-
-SECTIONS
-{
- .text :
- {
- _stext = . ;
- *(.text)
- *(.rodata)
- *(.rodata.*)
- _etext = . ;
- } > dram
- .data :
- {
- *(.data)
- _edata = . ;
- } > dram
- .bss :
- {
- *(.bss)
- _end = ALIGN( 0x10 ) ;
- } > dram
-}
diff --git a/arch/cris/boot/compressed/decompress_v32.lds b/arch/cris/boot/compressed/decompress_v32.lds
deleted file mode 100644
index 91d311c243ed..000000000000
--- a/arch/cris/boot/compressed/decompress_v32.lds
+++ /dev/null
@@ -1,31 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*#OUTPUT_FORMAT(elf32-us-cris) */
-OUTPUT_ARCH (crisv32)
-
-MEMORY
- {
- dram : ORIGIN = 0x40700000,
- LENGTH = 0x00100000
- }
-
-SECTIONS
-{
- .text :
- {
- _stext = . ;
- *(.text)
- *(.rodata)
- *(.rodata.*)
- _etext = . ;
- } > dram
- .data :
- {
- *(.data)
- _edata = . ;
- } > dram
- .bss :
- {
- *(.bss)
- _end = ALIGN( 0x10 ) ;
- } > dram
-}
diff --git a/arch/cris/boot/compressed/head_v10.S b/arch/cris/boot/compressed/head_v10.S
deleted file mode 100644
index 08198d8cd37f..000000000000
--- a/arch/cris/boot/compressed/head_v10.S
+++ /dev/null
@@ -1,127 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * arch/cris/boot/compressed/head.S
- *
- * Copyright (C) 1999, 2001 Axis Communications AB
- *
- * Code that sets up the DRAM registers, calls the
- * decompressor to unpack the piggybacked kernel, and jumps.
- *
- */
-
-#define ASSEMBLER_MACROS_ONLY
-#include <arch/sv_addr_ag.h>
-
-#define RAM_INIT_MAGIC 0x56902387
-#define COMMAND_LINE_MAGIC 0x87109563
-
- ;; Exported symbols
-
- .globl input_data
-
-
- .text
-
- nop
- di
-
-;; We need to initialze DRAM registers before we start using the DRAM
-
- cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized?
- beq dram_init_finished
- nop
-
-#include "../../arch-v10/lib/dram_init.S"
-
-dram_init_finished:
-
- ;; Initiate the PA and PB ports
-
- move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
- move.b $r0, [R_PORT_PA_DATA]
-
- move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
- move.b $r0, [R_PORT_PA_DIR]
-
- move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0
- move.b $r0, [R_PORT_PB_DATA]
-
- move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0
- move.b $r0, [R_PORT_PB_DIR]
-
- ;; Setup the stack to a suitably high address.
- ;; We assume 8 MB is the minimum DRAM in an eLinux
- ;; product and put the sp at the top for now.
-
- move.d 0x40800000, $sp
-
- ;; Figure out where the compressed piggyback image is
- ;; in the flash (since we wont try to copy it to DRAM
- ;; before unpacking). It is at _edata, but in flash.
- ;; Use (_edata - basse) as offset to the current PC.
-
-basse: move.d $pc, $r5
- and.d 0x7fffffff, $r5 ; strip any non-cache bit
- subq 2, $r5 ; compensate for the move.d $pc instr
- move.d $r5, $r0 ; save for later - flash address of 'basse'
- add.d _edata, $r5
- sub.d basse, $r5 ; $r5 = flash address of '_edata'
-
- ;; Copy text+data to DRAM
-
- move.d basse, $r1 ; destination
- move.d _edata, $r2 ; end destination
-1: move.w [$r0+], $r3
- move.w $r3, [$r1+]
- cmp.d $r2, $r1
- bcs 1b
- nop
-
- move.d $r5, [input_data] ; for the decompressor
-
-
- ;; Clear the decompressors BSS (between _edata and _end)
-
- moveq 0, $r0
- move.d _edata, $r1
- move.d _end, $r2
-1: move.w $r0, [$r1+]
- cmp.d $r2, $r1
- bcs 1b
- nop
-
- ;; Save command line magic and address.
- move.d _cmd_line_magic, $r12
- move.d $r10, [$r12]
- move.d _cmd_line_addr, $r12
- move.d $r11, [$r12]
-
- ;; Do the decompression and save compressed size in inptr
-
- jsr decompress_kernel
-
- ;; Put start address of root partition in $r9 so the kernel can use it
- ;; when mounting from flash
-
- move.d [input_data], $r9 ; flash address of compressed kernel
- add.d [inptr], $r9 ; size of compressed kernel
-
- ;; Restore command line magic and address.
- move.d _cmd_line_magic, $r10
- move.d [$r10], $r10
- move.d _cmd_line_addr, $r11
- move.d [$r11], $r11
-
- ;; Enter the decompressed kernel
- move.d RAM_INIT_MAGIC, $r8 ; Tell kernel that DRAM is initialized
- jump 0x40004000 ; kernel is linked to this address
-
- .data
-
-input_data:
- .dword 0 ; used by the decompressor
-_cmd_line_magic:
- .dword 0
-_cmd_line_addr:
- .dword 0
-#include "../../arch-v10/lib/hw_settings.S"
diff --git a/arch/cris/boot/compressed/head_v32.S b/arch/cris/boot/compressed/head_v32.S
deleted file mode 100644
index a997947d31e3..000000000000
--- a/arch/cris/boot/compressed/head_v32.S
+++ /dev/null
@@ -1,146 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Code that sets up the DRAM registers, calls the
- * decompressor to unpack the piggybacked kernel, and jumps.
- *
- * Copyright (C) 1999 - 2006, Axis Communications AB
- */
-
-#define ASSEMBLER_MACROS_ONLY
-#include <hwregs/asm/reg_map_asm.h>
-#include <mach/startup.inc>
-
-#define RAM_INIT_MAGIC 0x56902387
-#define COMMAND_LINE_MAGIC 0x87109563
-
- ;; Exported symbols
-
- .globl input_data
-
- .text
-start:
- di
-
- ;; Start clocks for used blocks.
- START_CLOCKS
-
- ;; Initialize the DRAM registers.
- cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized?
- beq dram_init_finished
- nop
-
-#if defined CONFIG_ETRAXFS
-#include "../../arch-v32/mach-fs/dram_init.S"
-#elif defined CONFIG_CRIS_MACH_ARTPEC3
-#include "../../arch-v32/mach-a3/dram_init.S"
-#else
-#error Only ETRAXFS and ARTPEC-3 supported!
-#endif
-
-dram_init_finished:
-
- GIO_INIT
- ;; Setup the stack to a suitably high address.
- ;; We assume 8 MB is the minimum DRAM and put
- ;; the SP at the top for now.
-
- move.d 0x40800000, $sp
-
- ;; Figure out where the compressed piggyback image is.
- ;; It is either in [NOR] flash (we don't want to copy it
- ;; to DRAM before unpacking), or copied to DRAM
- ;; by the [NAND] flash boot loader.
- ;; The piggyback image is at _edata, but relative to where the
- ;; image is actually located in memory, not where it is linked
- ;; (the decompressor is linked at 0x40700000+ and runs there).
- ;; Use (_edata - herami) as offset to the current PC.
-
-hereami:
- lapcq ., $r5 ; get PC
- and.d 0x7fffffff, $r5 ; strip any non-cache bit
- move.d $r5, $r0 ; source address of 'herami'
- add.d _edata, $r5
- sub.d hereami, $r5 ; r5 = flash address of '_edata'
- move.d hereami, $r1 ; destination
-
- ;; Copy text+data to DRAM
-
- move.d _edata, $r2 ; end destination
-1: move.w [$r0+], $r3 ; from herami+ source
- move.w $r3, [$r1+] ; to hereami+ destination (linked address)
- cmp.d $r2, $r1 ; finish when destination == _edata
- bcs 1b
- nop
- move.d input_data, $r0 ; for the decompressor
- move.d $r5, [$r0] ; for the decompressor
-
- ;; Clear the decompressors BSS (between _edata and _end)
-
- moveq 0, $r0
- move.d _edata, $r1
- move.d _end, $r2
-1: move.w $r0, [$r1+]
- cmp.d $r2, $r1
- bcs 1b
- nop
-
- ;; Save command line magic and address.
- move.d _cmd_line_magic, $r0
- move.d $r10, [$r0]
- move.d _cmd_line_addr, $r0
- move.d $r11, [$r0]
-
- ;; Save boot source indicator
- move.d _boot_source, $r0
- move.d $r12, [$r0]
-
- ;; Do the decompression and save compressed size in _inptr
-
- jsr decompress_kernel
- nop
-
- ;; Restore boot source indicator
- move.d _boot_source, $r12
- move.d [$r12], $r12
-
- ;; Restore command line magic and address.
- move.d _cmd_line_magic, $r10
- move.d [$r10], $r10
- move.d _cmd_line_addr, $r11
- move.d [$r11], $r11
-
- ;; Put start address of root partition in r9 so the kernel can use it
- ;; when mounting from flash
- move.d input_data, $r0
- move.d [$r0], $r9 ; flash address of compressed kernel
- move.d inptr, $r0
- add.d [$r0], $r9 ; size of compressed kernel
- cmp.d 0x40000000, $r9 ; image in DRAM ?
- blo enter_kernel ; no, must be [NOR] flash, jump
- nop ; delay slot
- and.d 0x001fffff, $r9 ; assume compressed kernel was < 2M
-
-enter_kernel:
- ;; Enter the decompressed kernel
- move.d RAM_INIT_MAGIC, $r8 ; Tell kernel that DRAM is initialized
- jump 0x40004000 ; kernel is linked to this address
- nop
-
- .data
-
-input_data:
- .dword 0 ; used by the decompressor
-_cmd_line_magic:
- .dword 0
-_cmd_line_addr:
- .dword 0
-_boot_source:
- .dword 0
-
-#if defined CONFIG_ETRAXFS
-#include "../../arch-v32/mach-fs/hw_settings.S"
-#elif defined CONFIG_CRIS_MACH_ARTPEC3
-#include "../../arch-v32/mach-a3/hw_settings.S"
-#else
-#error Only ETRAXFS and ARTPEC-3 supported!
-#endif
diff --git a/arch/cris/boot/compressed/misc.c b/arch/cris/boot/compressed/misc.c
deleted file mode 100644
index 1ad464a117b8..000000000000
--- a/arch/cris/boot/compressed/misc.c
+++ /dev/null
@@ -1,377 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * misc.c
- *
- * This is a collection of several routines from gzip-1.0.3
- * adapted for Linux.
- *
- * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
- * puts by Nick Holloway 1993, better puts by Martin Mares 1995
- * adaptation for Linux/CRIS Axis Communications AB, 1999
- *
- */
-
-/* where the piggybacked kernel image expects itself to live.
- * it is the same address we use when we network load an uncompressed
- * image into DRAM, and it is the address the kernel is linked to live
- * at by vmlinux.lds.S
- */
-
-#define KERNEL_LOAD_ADR 0x40004000
-
-#include <linux/types.h>
-
-#ifdef CONFIG_ETRAX_ARCH_V32
-#include <hwregs/reg_rdwr.h>
-#include <hwregs/reg_map.h>
-#include <hwregs/ser_defs.h>
-#include <hwregs/pinmux_defs.h>
-#ifdef CONFIG_CRIS_MACH_ARTPEC3
-#include <hwregs/clkgen_defs.h>
-#endif
-#else
-#include <arch/svinto.h>
-#endif
-
-/*
- * gzip declarations
- */
-
-#define OF(args) args
-#define STATIC static
-
-void *memset(void *s, int c, size_t n);
-void *memcpy(void *__dest, __const void *__src, size_t __n);
-
-#define memzero(s, n) memset((s), 0, (n))
-
-typedef unsigned char uch;
-typedef unsigned short ush;
-typedef unsigned long ulg;
-
-#define WSIZE 0x8000 /* Window size must be at least 32k, */
- /* and a power of two */
-
-static uch *inbuf; /* input buffer */
-static uch window[WSIZE]; /* Sliding window buffer */
-
-unsigned inptr = 0; /* index of next byte to be processed in inbuf
- * After decompression it will contain the
- * compressed size, and head.S will read it.
- */
-
-static unsigned outcnt = 0; /* bytes in output buffer */
-
-/* gzip flag byte */
-#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
-#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
-#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
-#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
-#define COMMENT 0x10 /* bit 4 set: file comment present */
-#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
-#define RESERVED 0xC0 /* bit 6,7: reserved */
-
-#define get_byte() (inbuf[inptr++])
-
-/* Diagnostic functions */
-#ifdef DEBUG
-# define Assert(cond, msg) do { \
- if (!(cond)) \
- error(msg); \
- } while (0)
-# define Trace(x) fprintf x
-# define Tracev(x) do { \
- if (verbose) \
- fprintf x; \
- } while (0)
-# define Tracevv(x) do { \
- if (verbose > 1) \
- fprintf x; \
- } while (0)
-# define Tracec(c, x) do { \
- if (verbose && (c)) \
- fprintf x; \
- } while (0)
-# define Tracecv(c, x) do { \
- if (verbose > 1 && (c)) \
- fprintf x; \
- } while (0)
-#else
-# define Assert(cond, msg)
-# define Trace(x)
-# define Tracev(x)
-# define Tracevv(x)
-# define Tracec(c, x)
-# define Tracecv(c, x)
-#endif
-
-static void flush_window(void);
-static void error(char *m);
-static void aputs(const char *s);
-
-extern char *input_data; /* lives in head.S */
-
-static long bytes_out;
-static uch *output_data;
-static unsigned long output_ptr;
-
-/* the "heap" is put directly after the BSS ends, at end */
-
-extern int _end;
-static long free_mem_ptr = (long)&_end;
-static long free_mem_end_ptr;
-
-#include "../../../../../lib/inflate.c"
-
-/* decompressor info and error messages to serial console */
-
-#ifdef CONFIG_ETRAX_ARCH_V32
-static inline void serout(const char *s, reg_scope_instances regi_ser)
-{
- reg_ser_rs_stat_din rs;
- reg_ser_rw_dout dout = {.data = *s};
-
- do {
- rs = REG_RD(ser, regi_ser, rs_stat_din);
- }
- while (!rs.tr_rdy);/* Wait for transceiver. */
-
- REG_WR(ser, regi_ser, rw_dout, dout);
-}
-#define SEROUT(S, N) \
- do { \
- serout(S, regi_ser ## N); \
- s++; \
- } while (0)
-#else
-#define SEROUT(S, N) do { \
- while (!(*R_SERIAL ## N ## _STATUS & (1 << 5))) \
- ; \
- *R_SERIAL ## N ## _TR_DATA = *s++; \
- } while (0)
-#endif
-
-static void aputs(const char *s)
-{
-#ifndef CONFIG_ETRAX_DEBUG_PORT_NULL
- while (*s) {
-#ifdef CONFIG_ETRAX_DEBUG_PORT0
- SEROUT(s, 0);
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT1
- SEROUT(s, 1);
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT2
- SEROUT(s, 2);
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT3
- SEROUT(s, 3);
-#endif
- }
-#endif /* CONFIG_ETRAX_DEBUG_PORT_NULL */
-}
-
-void *memset(void *s, int c, size_t n)
-{
- int i;
- char *ss = (char*)s;
-
- for (i=0;i<n;i++) ss[i] = c;
-
- return s;
-}
-
-void *memcpy(void *__dest, __const void *__src, size_t __n)
-{
- int i;
- char *d = (char *)__dest, *s = (char *)__src;
-
- for (i = 0; i < __n; i++)
- d[i] = s[i];
-
- return __dest;
-}
-
-/* ===========================================================================
- * Write the output window window[0..outcnt-1] and update crc and bytes_out.
- * (Used for the decompressed data only.)
- */
-
-static void flush_window(void)
-{
- ulg c = crc; /* temporary variable */
- unsigned n;
- uch *in, *out, ch;
-
- in = window;
- out = &output_data[output_ptr];
- for (n = 0; n < outcnt; n++) {
- ch = *out = *in;
- out++;
- in++;
- c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
- }
- crc = c;
- bytes_out += (ulg)outcnt;
- output_ptr += (ulg)outcnt;
- outcnt = 0;
-}
-
-static void error(char *x)
-{
- aputs("\n\n");
- aputs(x);
- aputs("\n\n -- System halted\n");
-
- while(1); /* Halt */
-}
-
-void setup_normal_output_buffer(void)
-{
- output_data = (char *)KERNEL_LOAD_ADR;
-}
-
-#ifdef CONFIG_ETRAX_ARCH_V32
-static inline void serial_setup(reg_scope_instances regi_ser)
-{
- reg_ser_rw_xoff xoff;
- reg_ser_rw_tr_ctrl tr_ctrl;
- reg_ser_rw_rec_ctrl rec_ctrl;
- reg_ser_rw_tr_baud_div tr_baud;
- reg_ser_rw_rec_baud_div rec_baud;
-
- /* Turn off XOFF. */
- xoff = REG_RD(ser, regi_ser, rw_xoff);
-
- xoff.chr = 0;
- xoff.automatic = regk_ser_no;
-
- REG_WR(ser, regi_ser, rw_xoff, xoff);
-
- /* Set baudrate and stopbits. */
- tr_ctrl = REG_RD(ser, regi_ser, rw_tr_ctrl);
- rec_ctrl = REG_RD(ser, regi_ser, rw_rec_ctrl);
- tr_baud = REG_RD(ser, regi_ser, rw_tr_baud_div);
- rec_baud = REG_RD(ser, regi_ser, rw_rec_baud_div);
-
- tr_ctrl.stop_bits = 1; /* 2 stop bits. */
- tr_ctrl.en = 1; /* enable transmitter */
- rec_ctrl.en = 1; /* enabler receiver */
-
- /*
- * The baudrate setup used to be a bit fishy, but now transmitter and
- * receiver are both set to the intended baud rate, 115200.
- * The magic value is 29.493 MHz.
- */
- tr_ctrl.base_freq = regk_ser_f29_493;
- rec_ctrl.base_freq = regk_ser_f29_493;
- tr_baud.div = (29493000 / 8) / 115200;
- rec_baud.div = (29493000 / 8) / 115200;
-
- REG_WR(ser, regi_ser, rw_tr_ctrl, tr_ctrl);
- REG_WR(ser, regi_ser, rw_tr_baud_div, tr_baud);
- REG_WR(ser, regi_ser, rw_rec_ctrl, rec_ctrl);
- REG_WR(ser, regi_ser, rw_rec_baud_div, rec_baud);
-}
-#endif
-
-void decompress_kernel(void)
-{
- char revision;
- char compile_rev;
-
-#ifdef CONFIG_ETRAX_ARCH_V32
- /* Need at least a CRISv32 to run. */
- compile_rev = 32;
-#if defined(CONFIG_ETRAX_DEBUG_PORT1) || \
- defined(CONFIG_ETRAX_DEBUG_PORT2) || \
- defined(CONFIG_ETRAX_DEBUG_PORT3)
- reg_pinmux_rw_hwprot hwprot;
-
-#ifdef CONFIG_CRIS_MACH_ARTPEC3
- reg_clkgen_rw_clk_ctrl clk_ctrl;
-
- /* Enable corresponding clock region when serial 1..3 selected */
-
- clk_ctrl = REG_RD(clkgen, regi_clkgen, rw_clk_ctrl);
- clk_ctrl.sser_ser_dma6_7 = regk_clkgen_yes;
- REG_WR(clkgen, regi_clkgen, rw_clk_ctrl, clk_ctrl);
-#endif
-
- /* pinmux setup for ports 1..3 */
- hwprot = REG_RD(pinmux, regi_pinmux, rw_hwprot);
-#endif
-
-
-#ifdef CONFIG_ETRAX_DEBUG_PORT0
- serial_setup(regi_ser0);
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT1
- hwprot.ser1 = regk_pinmux_yes;
- serial_setup(regi_ser1);
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT2
- hwprot.ser2 = regk_pinmux_yes;
- serial_setup(regi_ser2);
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT3
- hwprot.ser3 = regk_pinmux_yes;
- serial_setup(regi_ser3);
-#endif
-#if defined(CONFIG_ETRAX_DEBUG_PORT1) || \
- defined(CONFIG_ETRAX_DEBUG_PORT2) || \
- defined(CONFIG_ETRAX_DEBUG_PORT3)
- REG_WR(pinmux, regi_pinmux, rw_hwprot, hwprot);
-#endif
-
- /* input_data is set in head.S */
- inbuf = input_data;
-#else /* CRISv10 */
- /* Need at least a crisv10 to run. */
- compile_rev = 10;
-
- /* input_data is set in head.S */
- inbuf = input_data;
-
-#ifdef CONFIG_ETRAX_DEBUG_PORT0
- *R_SERIAL0_XOFF = 0;
- *R_SERIAL0_BAUD = 0x99;
- *R_SERIAL0_TR_CTRL = 0x40;
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT1
- *R_SERIAL1_XOFF = 0;
- *R_SERIAL1_BAUD = 0x99;
- *R_SERIAL1_TR_CTRL = 0x40;
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT2
- *R_GEN_CONFIG = 0x08;
- *R_SERIAL2_XOFF = 0;
- *R_SERIAL2_BAUD = 0x99;
- *R_SERIAL2_TR_CTRL = 0x40;
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT3
- *R_GEN_CONFIG = 0x100;
- *R_SERIAL3_XOFF = 0;
- *R_SERIAL3_BAUD = 0x99;
- *R_SERIAL3_TR_CTRL = 0x40;
-#endif
-#endif
-
- setup_normal_output_buffer();
-
- makecrc();
-
- __asm__ volatile ("move $vr,%0" : "=rm" (revision));
- if (revision < compile_rev) {
-#ifdef CONFIG_ETRAX_ARCH_V32
- aputs("You need at least ETRAX FS to run Linux 2.6/crisv32\n");
-#else
- aputs("You need an ETRAX 100LX to run linux 2.6/crisv10\n");
-#endif
- while(1);
- }
-
- aputs("Uncompressing Linux...\n");
- gunzip();
- aputs("Done. Now booting the kernel\n");
-}
diff --git a/arch/cris/boot/dts/Makefile b/arch/cris/boot/dts/Makefile
deleted file mode 100644
index 118fe990a173..000000000000
--- a/arch/cris/boot/dts/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB)).dtb.o
-ifneq ($(CONFIG_BUILTIN_DTB),"")
-obj-$(CONFIG_OF) += $(BUILTIN_DTB)
-endif
diff --git a/arch/cris/boot/dts/artpec3.dtsi b/arch/cris/boot/dts/artpec3.dtsi
deleted file mode 100644
index f857300f4edd..000000000000
--- a/arch/cris/boot/dts/artpec3.dtsi
+++ /dev/null
@@ -1,47 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/ {
- #address-cells = <1>;
- #size-cells = <1>;
- interrupt-parent = <&intc>;
-
- cpus {
- #address-cells = <1>;
- #size-cells = <0>;
-
- cpu@0 {
- device_type = "cpu";
- model = "axis,crisv32";
- reg = <0>;
- };
- };
-
- soc {
- compatible = "simple-bus";
- model = "artpec3";
- #address-cells = <1>;
- #size-cells = <1>;
- ranges;
-
- intc: interrupt-controller {
- compatible = "axis,crisv32-intc";
- reg = <0xb002a000 0x1000>;
- interrupt-controller;
- #interrupt-cells = <1>;
- };
-
- gio: gpio@b0020000 {
- compatible = "axis,artpec3-gio";
- reg = <0xb0020000 0x1000>;
- interrupts = <61>;
- gpio-controller;
- #gpio-cells = <3>;
- };
-
- serial@b003e000 {
- compatible = "axis,etraxfs-uart";
- reg = <0xb003e000 0x1000>;
- interrupts = <64>;
- status = "disabled";
- };
- };
-};
diff --git a/arch/cris/boot/dts/dev88.dts b/arch/cris/boot/dts/dev88.dts
deleted file mode 100644
index 415270ea5309..000000000000
--- a/arch/cris/boot/dts/dev88.dts
+++ /dev/null
@@ -1,68 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/dts-v1/;
-
-#include <dt-bindings/gpio/gpio.h>
-
-/include/ "etraxfs.dtsi"
-
-/ {
- model = "Axis 88 Developer Board";
- compatible = "axis,dev88";
-
- aliases {
- serial0 = &uart0;
- };
-
- soc {
- uart0: serial@b00260000 {
- status = "okay";
- };
- };
-
- spi {
- compatible = "spi-gpio";
- #address-cells = <1>;
- #size-cells = <0>;
-
- gpio-sck = <&gio 1 0 0xd>;
- gpio-miso = <&gio 4 0 0xd>;
- gpio-mosi = <&gio 0 0 0xd>;
- cs-gpios = <&gio 3 0 0xd>;
- num-chipselects = <1>;
-
- temp-sensor@0 {
- compatible = "ti,lm70";
- reg = <0>;
-
- spi-max-frequency = <100000>;
- };
- };
-
- i2c {
- compatible = "i2c-gpio";
- gpios = <&gio 5 0 0xd>, <&gio 6 0 0xd>;
- i2c-gpio,delay-us = <2>;
- #address-cells = <1>;
- #size-cells = <0>;
-
- rtc@51 {
- compatible = "nxp,pcf8563";
- reg = <0x51>;
- };
- };
-
- leds {
- compatible = "gpio-leds";
-
- network {
- label = "network";
- gpios = <&gio 2 GPIO_ACTIVE_LOW 0xa>;
- };
-
- status {
- label = "status";
- gpios = <&gio 3 GPIO_ACTIVE_LOW 0xa>;
- linux,default-trigger = "heartbeat";
- };
- };
-};
diff --git a/arch/cris/boot/dts/etraxfs.dtsi b/arch/cris/boot/dts/etraxfs.dtsi
deleted file mode 100644
index 4513edf72545..000000000000
--- a/arch/cris/boot/dts/etraxfs.dtsi
+++ /dev/null
@@ -1,47 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/ {
- #address-cells = <1>;
- #size-cells = <1>;
- interrupt-parent = <&intc>;
-
- cpus {
- #address-cells = <1>;
- #size-cells = <0>;
-
- cpu@0 {
- device_type = "cpu";
- model = "axis,crisv32";
- reg = <0>;
- };
- };
-
- soc {
- compatible = "simple-bus";
- model = "etraxfs";
- #address-cells = <1>;
- #size-cells = <1>;
- ranges;
-
- intc: interrupt-controller {
- compatible = "axis,crisv32-intc";
- reg = <0xb001c000 0x1000>;
- interrupt-controller;
- #interrupt-cells = <1>;
- };
-
- gio: gpio@b001a000 {
- compatible = "axis,etraxfs-gio";
- reg = <0xb001a000 0x1000>;
- interrupts = <50>;
- gpio-controller;
- #gpio-cells = <3>;
- };
-
- serial@b00260000 {
- compatible = "axis,etraxfs-uart";
- reg = <0xb0026000 0x1000>;
- interrupts = <68>;
- status = "disabled";
- };
- };
-};
diff --git a/arch/cris/boot/dts/p1343.dts b/arch/cris/boot/dts/p1343.dts
deleted file mode 100644
index 6030561d4574..000000000000
--- a/arch/cris/boot/dts/p1343.dts
+++ /dev/null
@@ -1,77 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/dts-v1/;
-
-#include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/input/input.h>
-
-/include/ "artpec3.dtsi"
-
-/ {
- model = "Axis P1343 Network Camera";
- compatible = "axis,p1343";
-
- aliases {
- serial0 = &uart0;
- };
-
- soc {
- uart0: serial@b003e000 {
- status = "okay";
- };
- };
-
- i2c {
- compatible = "i2c-gpio";
- gpios = <&gio 3 0 0xa>, <&gio 2 0 0xa>;
- i2c-gpio,delay-us = <2>;
- #address-cells = <1>;
- #size-cells = <0>;
-
- rtc@51 {
- compatible = "nxp,pcf8563";
- reg = <0x51>;
- };
- };
-
- leds {
- compatible = "gpio-leds";
-
- status_green {
- label = "status:green";
- gpios = <&gio 0 GPIO_ACTIVE_LOW 0xc>;
- linux,default-trigger = "heartbeat";
- };
-
- status_red {
- label = "status:red";
- gpios = <&gio 1 GPIO_ACTIVE_LOW 0xc>;
- };
-
- network_green {
- label = "network:green";
- gpios = <&gio 2 GPIO_ACTIVE_LOW 0xc>;
- };
-
- network_red {
- label = "network:red";
- gpios = <&gio 3 GPIO_ACTIVE_LOW 0xc>;
- };
-
- power_red {
- label = "power:red";
- gpios = <&gio 4 GPIO_ACTIVE_LOW 0xc>;
- };
- };
-
- gpio_keys {
- compatible = "gpio-keys";
- #address-cells = <1>;
- #size-cells = <0>;
-
- activity-button@0 {
- label = "Activity Button";
- linux,code = <KEY_FN>;
- gpios = <&gio 13 GPIO_ACTIVE_LOW 0xd>;
- };
- };
-};
diff --git a/arch/cris/boot/rescue/Makefile b/arch/cris/boot/rescue/Makefile
deleted file mode 100644
index f73ac4c83b96..000000000000
--- a/arch/cris/boot/rescue/Makefile
+++ /dev/null
@@ -1,53 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Makefile for rescue (bootstrap) code
-#
-
-# CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
-# ccflags-$(CONFIG_ETRAX_ARCH_V32) += -I$(srctree)/include/asm/arch/mach/ \
-# -I$(srctree)/include/asm/arch
-# asflags-y += -I $(srctree)/include/asm/arch/mach/ -I $(srctree)/include/asm/arch
-# LD = gcc-cris -mlinux -march=v32 -nostdlib
-
-ifdef CONFIG_ETRAX_AXISFLASHMAP
-
-arch-$(CONFIG_ETRAX_ARCH_V10) = v10
-arch-$(CONFIG_ETRAX_ARCH_V32) = v32
-
-ldflags-y += -T $(srctree)/$(src)/rescue_$(arch-y).lds
-OBJCOPYFLAGS = -O binary --remove-section=.bss
-obj-$(CONFIG_ETRAX_ARCH_V32) = $(obj)/head_v32.o
-obj-$(CONFIG_ETRAX_ARCH_V10) = $(obj)/head_v10.o
-OBJECTS := $(obj-y)
-
-targets := rescue.o rescue.bin
-
-$(obj)/rescue.o: $(OBJECTS) FORCE
- $(call if_changed,ld)
-
-$(obj)/rescue.bin: $(obj)/rescue.o FORCE
- $(call if_changed,objcopy)
- cp -p $(obj)/rescue.bin $(objtree)
-
-else
-$(obj)/rescue.bin:
-
-endif
-
-$(obj)/testrescue.bin: $(obj)/testrescue.o
- $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/testrescue.o tr.bin
-# Pad it to 784 bytes
- dd if=/dev/zero of=tmp2423 bs=1 count=784
- cat tr.bin tmp2423 >testrescue_tmp.bin
- dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784
- rm tr.bin tmp2423 testrescue_tmp.bin
-
-
-$(obj)/kimagerescue.bin: $(obj)/kimagerescue.o
- $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin
-# Pad it to 784 bytes, that's what the rescue loader expects
- dd if=/dev/zero of=tmp2423 bs=1 count=784
- cat ktr.bin tmp2423 >kimagerescue_tmp.bin
- dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784
- rm ktr.bin tmp2423 kimagerescue_tmp.bin
-
diff --git a/arch/cris/boot/rescue/head_v10.S b/arch/cris/boot/rescue/head_v10.S
deleted file mode 100644
index 11eedb1bf31a..000000000000
--- a/arch/cris/boot/rescue/head_v10.S
+++ /dev/null
@@ -1,358 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Rescue code, made to reside at the beginning of the
- * flash-memory. when it starts, it checks a partition
- * table at the first sector after the rescue sector.
- * the partition table was generated by the product builder
- * script and contains offsets, lengths, types and checksums
- * for each partition that this code should check.
- *
- * If any of the checksums fail, we assume the flash is so
- * corrupt that we can't use it to boot into the ftp flash
- * loader, and instead we initialize the serial port to
- * receive a flash-loader and new flash image. we dont include
- * any flash code here, but just accept a certain amount of
- * bytes from the serial port and jump into it. the downloaded
- * code is put in the cache.
- *
- * The partitiontable is designed so that it is transparent to
- * code execution - it has a relative branch opcode in the
- * beginning that jumps over it. each entry contains extra
- * data so we can add stuff later.
- *
- * Partition table format:
- *
- * Code transparency:
- *
- * 2 bytes [opcode 'nop']
- * 2 bytes [opcode 'di']
- * 4 bytes [opcode 'ba <offset>', 8-bit or 16-bit version]
- * 2 bytes [opcode 'nop', delay slot]
- *
- * Table validation (at +10):
- *
- * 2 bytes [magic/version word for partitiontable - 0xef, 0xbe]
- * 2 bytes [length of all entries plus the end marker]
- * 4 bytes [checksum for the partitiontable itself]
- *
- * Entries, each with the following format, last has offset -1:
- *
- * 4 bytes [offset in bytes, from start of flash]
- * 4 bytes [length in bytes of partition]
- * 4 bytes [checksum, simple longword sum]
- * 2 bytes [partition type]
- * 2 bytes [flags, only bit 0 used, ro/rw = 1/0]
- * 16 bytes [reserved for future use]
- *
- * End marker
- *
- * 4 bytes [-1]
- *
- * 10 bytes [0, padding]
- *
- * Bit 0 in flags signifies RW or RO. The rescue code only bothers
- * to check the checksum for RO partitions, since the others will
- * change their data without updating the checksums. A 1 in bit 0
- * means RO, 0 means RW. That way, it is possible to set a partition
- * in RO mode initially, and later mark it as RW, since you can always
- * write 0's to the flash.
- *
- * During the wait for serial input, the status LED will flash so the
- * user knows something went wrong.
- *
- * Copyright (C) 1999-2007 Axis Communications AB
- */
-
-#ifdef CONFIG_ETRAX_AXISFLASHMAP
-
-#define ASSEMBLER_MACROS_ONLY
-#include <arch/sv_addr_ag.h>
-
- ;; The partitiontable is looked for at the first sector after the boot
- ;; sector. Sector size is 65536 bytes in all flashes we use.
-
-#define PTABLE_START CONFIG_ETRAX_PTABLE_SECTOR
-#define PTABLE_MAGIC 0xbeef
-
- ;; The normal Etrax100 on-chip boot ROM does serial boot at 0x380000f0.
- ;; That is not where we put our downloaded serial boot-code.
- ;; The length is enough for downloading code that loads the rest
- ;; of itself (after having setup the DRAM etc).
- ;; It is the same length as the on-chip ROM loads, so the same
- ;; host loader can be used to load a rescued product as well as
- ;; one booted through the Etrax serial boot code.
-
-#define CODE_START 0x40000000
-#define CODE_LENGTH 784
-
-#ifdef CONFIG_ETRAX_RESCUE_SER0
-#define SERXOFF R_SERIAL0_XOFF
-#define SERBAUD R_SERIAL0_BAUD
-#define SERRECC R_SERIAL0_REC_CTRL
-#define SERRDAT R_SERIAL0_REC_DATA
-#define SERSTAT R_SERIAL0_STATUS
-#endif
-#ifdef CONFIG_ETRAX_RESCUE_SER1
-#define SERXOFF R_SERIAL1_XOFF
-#define SERBAUD R_SERIAL1_BAUD
-#define SERRECC R_SERIAL1_REC_CTRL
-#define SERRDAT R_SERIAL1_REC_DATA
-#define SERSTAT R_SERIAL1_STATUS
-#endif
-#ifdef CONFIG_ETRAX_RESCUE_SER2
-#define SERXOFF R_SERIAL2_XOFF
-#define SERBAUD R_SERIAL2_BAUD
-#define SERRECC R_SERIAL2_REC_CTRL
-#define SERRDAT R_SERIAL2_REC_DATA
-#define SERSTAT R_SERIAL2_STATUS
-#endif
-#ifdef CONFIG_ETRAX_RESCUE_SER3
-#define SERXOFF R_SERIAL3_XOFF
-#define SERBAUD R_SERIAL3_BAUD
-#define SERRECC R_SERIAL3_REC_CTRL
-#define SERRDAT R_SERIAL3_REC_DATA
-#define SERSTAT R_SERIAL3_STATUS
-#endif
-
-#define NOP_DI 0xf025050f
-#define RAM_INIT_MAGIC 0x56902387
-
- .text
-
- ;; This is the entry point of the rescue code
- ;; 0x80000000 if loaded in flash (as it should be)
- ;; Since etrax actually starts at address 2 when booting from flash, we
- ;; put a nop (2 bytes) here first so we dont accidentally skip the di
-
- nop
- di
-
- jump in_cache ; enter cached area instead
-in_cache:
-
-
- ;; First put a jump test to give a possibility of upgrading the
- ;; rescue code without erasing/reflashing the sector.
- ;; We put a longword of -1 here and if it is not -1, we jump using
- ;; the value as jump target. Since we can always change 1's to 0's
- ;; without erasing the sector, it is possible to add new
- ;; code after this and altering the jumptarget in an upgrade.
-
-jtcd: move.d [jumptarget], $r0
- cmp.d 0xffffffff, $r0
- beq no_newjump
- nop
-
- jump [$r0]
-
-jumptarget:
- .dword 0xffffffff ; can be overwritten later to insert new code
-
-no_newjump:
-#ifdef CONFIG_ETRAX_ETHERNET
- ;; Start MII clock to make sure it is running when tranceiver is reset
- move.d 0x3, $r0 ; enable = on, phy = mii_clk
- move.d $r0, [R_NETWORK_GEN_CONFIG]
-#endif
-
- ;; We need to setup the bus registers before we start using the DRAM
-#include "../../../arch-v10/lib/dram_init.S"
-
- ;; we now should go through the checksum-table and check the listed
- ;; partitions for errors.
-
- move.d PTABLE_START, $r3
- move.d [$r3], $r0
- cmp.d NOP_DI, $r0 ; make sure the nop/di is there...
- bne do_rescue
- nop
-
- ;; skip the code transparency block (10 bytes).
-
- addq 10, $r3
-
- ;; check for correct magic
-
- move.w [$r3+], $r0
- cmp.w PTABLE_MAGIC, $r0
- bne do_rescue ; didn't recognize - trig rescue
- nop
-
- ;; check for correct ptable checksum
-
- movu.w [$r3+], $r2 ; ptable length
- move.d $r2, $r8 ; save for later, length of total ptable
- addq 28, $r8 ; account for the rest
- move.d [$r3+], $r4 ; ptable checksum
- move.d $r3, $r1
- jsr checksum ; r1 source, r2 length, returns in r0
-
- cmp.d $r0, $r4
- bne do_rescue ; didn't match - trig rescue
- nop
-
- ;; ptable is ok. validate each entry.
-
- moveq -1, $r7
-
-ploop: move.d [$r3+], $r1 ; partition offset (from ptable start)
- bne notfirst ; check if it is the partition containing ptable
- nop ; yes..
- move.d $r8, $r1 ; for its checksum check, skip the ptable
- move.d [$r3+], $r2 ; partition length
- sub.d $r8, $r2 ; minus the ptable length
- ba bosse
- nop
-notfirst:
- cmp.d -1, $r1 ; the end of the ptable ?
- beq flash_ok ; if so, the flash is validated
- move.d [$r3+], $r2 ; partition length
-bosse: move.d [$r3+], $r5 ; checksum
- move.d [$r3+], $r4 ; type and flags
- addq 16, $r3 ; skip the reserved bytes
- btstq 16, $r4 ; check ro flag
- bpl ploop ; rw partition, skip validation
- nop
- btstq 17, $r4 ; check bootable flag
- bpl 1f
- nop
- move.d $r1, $r7 ; remember boot partition offset
-1:
- add.d PTABLE_START, $r1
-
- jsr checksum ; checksum the partition
-
- cmp.d $r0, $r5
- beq ploop ; checksums matched, go to next entry
- nop
-
- ;; otherwise fall through to the rescue code.
-
-do_rescue:
- ;; setup port PA and PB default initial directions and data
- ;; (so we can flash LEDs, and so that DTR and others are set)
-
- move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
- move.b $r0, [R_PORT_PA_DIR]
- move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
- move.b $r0, [R_PORT_PA_DATA]
-
- move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0
- move.b $r0, [R_PORT_PB_DIR]
- move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0
- move.b $r0, [R_PORT_PB_DATA]
-
- ;; setup the serial port at 115200 baud
-
- moveq 0, $r0
- move.d $r0, [SERXOFF]
-
- move.b 0x99, $r0
- move.b $r0, [SERBAUD] ; 115.2kbaud for both transmit and receive
-
- move.b 0x40, $r0 ; rec enable
- move.b $r0, [SERRECC]
-
- moveq 0, $r1 ; "timer" to clock out a LED red flash
- move.d CODE_START, $r3 ; destination counter
- movu.w CODE_LENGTH, $r4; length
-
-wait_ser:
- addq 1, $r1
-#ifndef CONFIG_ETRAX_NO_LEDS
-#ifdef CONFIG_ETRAX_PA_LEDS
- move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r2
-#endif
-#ifdef CONFIG_ETRAX_PB_LEDS
- move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r2
-#endif
- move.d (1 << CONFIG_ETRAX_LED1R) | (1 << CONFIG_ETRAX_LED2R), $r0
- btstq 16, $r1
- bpl 1f
- nop
- or.d $r0, $r2 ; set bit
- ba 2f
- nop
-1: not $r0 ; clear bit
- and.d $r0, $r2
-2:
-#ifdef CONFIG_ETRAX_PA_LEDS
- move.b $r2, [R_PORT_PA_DATA]
-#endif
-#ifdef CONFIG_ETRAX_PB_LEDS
- move.b $r2, [R_PORT_PB_DATA]
-#endif
-#endif
-
- ;; check if we got something on the serial port
-
- move.b [SERSTAT], $r0
- btstq 0, $r0 ; data_avail
- bpl wait_ser
- nop
-
- ;; got something - copy the byte and loop
-
- move.b [SERRDAT], $r0
- move.b $r0, [$r3+]
-
- subq 1, $r4 ; decrease length
- bne wait_ser
- nop
-
- ;; jump into downloaded code
-
- move.d RAM_INIT_MAGIC, $r8 ; Tell next product that DRAM is
- ; initialized
- jump CODE_START
-
-flash_ok:
- ;; check r7, which contains either -1 or the partition to boot from
-
- cmp.d -1, $r7
- bne 1f
- nop
- move.d PTABLE_START, $r7; otherwise use the ptable start
-1:
- move.d RAM_INIT_MAGIC, $r8 ; Tell next product that DRAM is
- ; initialized
- jump $r7 ; boot!
-
-
- ;; Helper subroutines
-
- ;; Will checksum by simple addition
- ;; r1 - source
- ;; r2 - length in bytes
- ;; result will be in r0
-checksum:
- moveq 0, $r0
- moveq CONFIG_ETRAX_FLASH1_SIZE, $r6
-
- ;; If the first physical flash memory is exceeded wrap to the
- ;; second one
- btstq 26, $r1 ; Are we addressing first flash?
- bpl 1f
- nop
- clear.d $r6
-
-1: test.d $r6 ; 0 = no wrapping
- beq 2f
- nop
- lslq 20, $r6 ; Convert MB to bytes
- sub.d $r1, $r6
-
-2: addu.b [$r1+], $r0
- subq 1, $r6 ; Flash memory left
- beq 3f
- subq 1, $r2 ; Length left
- bne 2b
- nop
- ret
- nop
-
-3: move.d MEM_CSE1_START, $r1 ; wrap to second flash
- ba 2b
- nop
-
-#endif
diff --git a/arch/cris/boot/rescue/head_v32.S b/arch/cris/boot/rescue/head_v32.S
deleted file mode 100644
index 9eb04abaa0c0..000000000000
--- a/arch/cris/boot/rescue/head_v32.S
+++ /dev/null
@@ -1,27 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Just get started by jumping to CONFIG_ETRAX_PTABLE_SECTOR to start
- * kernel decompressor.
- *
- * In practice, this only works for NOR flash (or some convoluted RAM boot)
- * and hence is not really useful for Artpec-3, so it's Etrax FS / NOR only.
- *
- */
-
-#include <mach/startup.inc>
-
-#ifdef CONFIG_ETRAX_AXISFLASHMAP
-
-;; Code
-
- .text
-start:
-
- ;; Start clocks for used blocks.
- START_CLOCKS
-
- move.d CONFIG_ETRAX_PTABLE_SECTOR, $r10
- jump $r10 ; Jump to decompressor
- nop
-
-#endif
diff --git a/arch/cris/boot/rescue/kimagerescue.S b/arch/cris/boot/rescue/kimagerescue.S
deleted file mode 100644
index 3306098dee15..000000000000
--- a/arch/cris/boot/rescue/kimagerescue.S
+++ /dev/null
@@ -1,142 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Rescue code to be prepended on a kimage and copied to the
- * rescue serial port.
- * This is called from the rescue code, it will copy received data to
- * 4004000 and after a timeout jump to it.
- */
-
-#define ASSEMBLER_MACROS_ONLY
-#include <arch/sv_addr_ag.h>
-
-#define CODE_START 0x40004000
-#define CODE_LENGTH 784
-#define TIMEOUT_VALUE 1000
-
-
-#ifdef CONFIG_ETRAX_RESCUE_SER0
-#define SERXOFF R_SERIAL0_XOFF
-#define SERBAUD R_SERIAL0_BAUD
-#define SERRECC R_SERIAL0_REC_CTRL
-#define SERRDAT R_SERIAL0_REC_DATA
-#define SERSTAT R_SERIAL0_STATUS
-#endif
-#ifdef CONFIG_ETRAX_RESCUE_SER1
-#define SERXOFF R_SERIAL1_XOFF
-#define SERBAUD R_SERIAL1_BAUD
-#define SERRECC R_SERIAL1_REC_CTRL
-#define SERRDAT R_SERIAL1_REC_DATA
-#define SERSTAT R_SERIAL1_STATUS
-#endif
-#ifdef CONFIG_ETRAX_RESCUE_SER2
-#define SERXOFF R_SERIAL2_XOFF
-#define SERBAUD R_SERIAL2_BAUD
-#define SERRECC R_SERIAL2_REC_CTRL
-#define SERRDAT R_SERIAL2_REC_DATA
-#define SERSTAT R_SERIAL2_STATUS
-#endif
-#ifdef CONFIG_ETRAX_RESCUE_SER3
-#define SERXOFF R_SERIAL3_XOFF
-#define SERBAUD R_SERIAL3_BAUD
-#define SERRECC R_SERIAL3_REC_CTRL
-#define SERRDAT R_SERIAL3_REC_DATA
-#define SERSTAT R_SERIAL3_STATUS
-#endif
-
- .text
- ;; This is the entry point of the rescue code
- ;; 0x80000000 if loaded in flash (as it should be)
- ;; since etrax actually starts at address 2 when booting from flash, we
- ;; put a nop (2 bytes) here first so we dont accidentally skip the di
-
- nop
- di
- ;; setup port PA and PB default initial directions and data
- ;; (so we can flash LEDs, and so that DTR and others are set)
-
- move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
- move.b $r0, [R_PORT_PA_DIR]
- move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
- move.b $r0, [R_PORT_PA_DATA]
-
- move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0
- move.b $r0, [R_PORT_PB_DIR]
- move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0
- move.b $r0, [R_PORT_PB_DATA]
-
- ;; We need to setup the bus registers before we start using the DRAM
-#include "../../lib/dram_init.S"
-
- ;; Setup the stack to a suitably high address.
- ;; We assume 8 MB is the minimum DRAM in an eLinux
- ;; product and put the sp at the top for now.
-
- move.d 0x40800000, $sp
-
- ;; setup the serial port at 115200 baud
-
- moveq 0, $r0
- move.d $r0, [SERXOFF]
-
- move.b 0x99, $r0
- move.b $r0, [SERBAUD] ; 115.2kbaud for both transmit
- ; and receive
-
- move.b 0x40, $r0 ; rec enable
- move.b $r0, [SERRECC]
-
-
- moveq 0, $r1 ; "timer" to clock out a LED red flash
- move.d CODE_START, $r3 ; destination counter
- move.d CODE_LENGTH, $r4 ; length
- move.d TIMEOUT_VALUE, $r5 ; "timeout" until jump
-
-wait_ser:
- addq 1, $r1
- subq 1, $r5 ; decrease timeout
- beq jump_start ; timed out
- nop
-#ifndef CONFIG_ETRAX_NO_LEDS
-#ifdef CONFIG_ETRAX_PA_LEDS
- move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r2
-#endif
-#ifdef CONFIG_ETRAX_PB_LEDS
- move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r2
-#endif
- move.d (1 << CONFIG_ETRAX_LED1R) | (1 << CONFIG_ETRAX_LED2R), $r0
- btstq 16, $r1
- bpl 1f
- nop
- or.d $r0, $r2 ; set bit
- ba 2f
- nop
-1: not $r0 ; clear bit
- and.d $r0, $r2
-2:
-#ifdef CONFIG_ETRAX_PA_LEDS
- move.b $r2, [R_PORT_PA_DATA]
-#endif
-#ifdef CONFIG_ETRAX_PB_LEDS
- move.b $r2, [R_PORT_PB_DATA]
-#endif
-#endif
-
- ;; check if we got something on the serial port
-
- move.b [SERSTAT], $r0
- btstq 0, $r0 ; data_avail
- bpl wait_ser
- nop
-
- ;; got something - copy the byte and loop
-
- move.b [SERRDAT], $r0
- move.b $r0, [$r3+]
- move.d TIMEOUT_VALUE, $r5 ; reset "timeout"
- subq 1, $r4 ; decrease length
- bne wait_ser
- nop
-jump_start:
- ;; jump into downloaded code
-
- jump CODE_START
diff --git a/arch/cris/boot/rescue/rescue_v10.lds b/arch/cris/boot/rescue/rescue_v10.lds
deleted file mode 100644
index e58a53f91728..000000000000
--- a/arch/cris/boot/rescue/rescue_v10.lds
+++ /dev/null
@@ -1,21 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-MEMORY
- {
- flash : ORIGIN = 0x00000000,
- LENGTH = 0x00100000
- }
-
-SECTIONS
-{
- .text :
- {
- stext = . ;
- *(.text)
- etext = . ;
- } > flash
- .data :
- {
- *(.data)
- edata = . ;
- } > flash
-}
diff --git a/arch/cris/boot/rescue/rescue_v32.lds b/arch/cris/boot/rescue/rescue_v32.lds
deleted file mode 100644
index f1542183f263..000000000000
--- a/arch/cris/boot/rescue/rescue_v32.lds
+++ /dev/null
@@ -1,44 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*#OUTPUT_FORMAT(elf32-us-cris) */
-OUTPUT_ARCH (crisv32)
-/* Now that NAND support has been stripped, this file could be simplified,
- * but it doesn't do any harm on the other hand so why bother. */
-
-MEMORY
- {
- bootblk : ORIGIN = 0x38000000,
- LENGTH = 0x00004000
- intmem : ORIGIN = 0x38004000,
- LENGTH = 0x00005000
- }
-
-SECTIONS
-{
- .text :
- {
- _stext = . ;
- *(.text)
- *(.init.text)
- *(.rodata)
- *(.rodata.*)
- _etext = . ;
- } > bootblk
- .data :
- {
- *(.data)
- _edata = . ;
- } > bootblk
- .bss :
- {
- _bss = . ;
- *(.bss)
- _end = ALIGN( 0x10 ) ;
- } > intmem
-
- /* Get rid of stuff from EXPORT_SYMBOL(foo). */
- /DISCARD/ :
- {
- *(__ksymtab_strings)
- *(__ksymtab)
- }
-}
diff --git a/arch/cris/boot/rescue/testrescue.S b/arch/cris/boot/rescue/testrescue.S
deleted file mode 100644
index 06f78a0b0622..000000000000
--- a/arch/cris/boot/rescue/testrescue.S
+++ /dev/null
@@ -1,25 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Simple testcode to download by the rescue block.
- * Just lights some LEDs to show it was downloaded correctly.
- *
- * Copyright (C) 1999 Axis Communications AB
- */
-
-#define ASSEMBLER_MACROS_ONLY
-#include <arch/sv_addr_ag.h>
-
- .text
-
- nop
- nop
- moveq -1, $r2
- move.b $r2, [R_PORT_PA_DIR]
- moveq 0, $r2
- move.b $r2, [R_PORT_PA_DATA]
-
-endless:
- nop
- ba endless
- nop
-
diff --git a/arch/cris/boot/tools/build.c b/arch/cris/boot/tools/build.c
deleted file mode 100644
index 3ae485049779..000000000000
--- a/arch/cris/boot/tools/build.c
+++ /dev/null
@@ -1,288 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * linux/tools/build.c
- *
- * Copyright (C) 1991, 1992 Linus Torvalds
- */
-
-/*
- * This file builds a disk-image from three different files:
- *
- * - bootsect: exactly 512 bytes of 8086 machine code, loads the rest
- * - setup: 8086 machine code, sets up system parm
- * - system: 80386 code for actual system
- *
- * It does some checking that all files are of the correct type, and
- * just writes the result to stdout, removing headers and padding to
- * the right amount. It also writes some system data to stderr.
- */
-
-/*
- * Changes by tytso to allow root device specification
- * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
- * Cross compiling fixes by Gertjan van Wingerde, July 1996
- */
-
-#include <stdio.h> /* fprintf */
-#include <string.h>
-#include <stdlib.h> /* contains exit */
-#include <sys/types.h> /* unistd.h needs this */
-#include <sys/stat.h>
-#include <sys/sysmacros.h>
-#include <unistd.h> /* contains read/write */
-#include <fcntl.h>
-#include <errno.h>
-
-#define MINIX_HEADER 32
-
-#define N_MAGIC_OFFSET 1024
-#ifndef __BFD__
-static int GCC_HEADER = sizeof(struct exec);
-#endif
-
-#ifdef __BIG_KERNEL__
-#define SYS_SIZE 0xffff
-#else
-#define SYS_SIZE DEF_SYSSIZE
-#endif
-
-#define DEFAULT_MAJOR_ROOT 0
-#define DEFAULT_MINOR_ROOT 0
-
-/* max nr of sectors of setup: don't change unless you also change
- * bootsect etc */
-#define SETUP_SECTS 4
-
-#define STRINGIFY(x) #x
-
-typedef union {
- int i;
- long l;
- short s[2];
- char b[4];
-} conv;
-
-long intel_long(long l)
-{
- conv t;
-
- t.b[0] = l & 0xff; l >>= 8;
- t.b[1] = l & 0xff; l >>= 8;
- t.b[2] = l & 0xff; l >>= 8;
- t.b[3] = l & 0xff; l >>= 8;
- return t.l;
-}
-
-int intel_int(int i)
-{
- conv t;
-
- t.b[0] = i & 0xff; i >>= 8;
- t.b[1] = i & 0xff; i >>= 8;
- t.b[2] = i & 0xff; i >>= 8;
- t.b[3] = i & 0xff; i >>= 8;
- return t.i;
-}
-
-short intel_short(short l)
-{
- conv t;
-
- t.b[0] = l & 0xff; l >>= 8;
- t.b[1] = l & 0xff; l >>= 8;
- return t.s[0];
-}
-
-void die(const char * str)
-{
- fprintf(stderr,"%s\n",str);
- exit(1);
-}
-
-void usage(void)
-{
- die("Usage: build bootsect setup system [rootdev] [> image]");
-}
-
-int main(int argc, char ** argv)
-{
- int i,c,id,sz,tmp_int;
- unsigned long sys_size, tmp_long;
- char buf[1024];
-#ifndef __BFD__
- struct exec *ex = (struct exec *)buf;
-#endif
- char major_root, minor_root;
- struct stat sb;
- unsigned char setup_sectors;
-
- if ((argc < 4) || (argc > 5))
- usage();
- if (argc > 4) {
- if (!strcmp(argv[4], "CURRENT")) {
- if (stat("/", &sb)) {
- perror("/");
- die("Couldn't stat /");
- }
- major_root = major(sb.st_dev);
- minor_root = minor(sb.st_dev);
- } else if (strcmp(argv[4], "FLOPPY")) {
- if (stat(argv[4], &sb)) {
- perror(argv[4]);
- die("Couldn't stat root device.");
- }
- major_root = major(sb.st_rdev);
- minor_root = minor(sb.st_rdev);
- } else {
- major_root = 0;
- minor_root = 0;
- }
- } else {
- major_root = DEFAULT_MAJOR_ROOT;
- minor_root = DEFAULT_MINOR_ROOT;
- }
- fprintf(stderr, "Root device is (%d, %d)\n", major_root, minor_root);
- for (i=0;i<sizeof buf; i++) buf[i]=0;
- if ((id=open(argv[1],O_RDONLY,0))<0)
- die("Unable to open 'boot'");
- if (read(id,buf,MINIX_HEADER) != MINIX_HEADER)
- die("Unable to read header of 'boot'");
- if (((long *) buf)[0]!=intel_long(0x04100301))
- die("Non-Minix header of 'boot'");
- if (((long *) buf)[1]!=intel_long(MINIX_HEADER))
- die("Non-Minix header of 'boot'");
- if (((long *) buf)[3] != 0)
- die("Illegal data segment in 'boot'");
- if (((long *) buf)[4] != 0)
- die("Illegal bss in 'boot'");
- if (((long *) buf)[5] != 0)
- die("Non-Minix header of 'boot'");
- if (((long *) buf)[7] != 0)
- die("Illegal symbol table in 'boot'");
- i=read(id,buf,sizeof buf);
- fprintf(stderr,"Boot sector %d bytes.\n",i);
- if (i != 512)
- die("Boot block must be exactly 512 bytes");
- if ((*(unsigned short *)(buf+510)) != (unsigned short)intel_short(0xAA55))
- die("Boot block hasn't got boot flag (0xAA55)");
- buf[508] = (char) minor_root;
- buf[509] = (char) major_root;
- i=write(1,buf,512);
- if (i!=512)
- die("Write call failed");
- close (id);
-
- if ((id=open(argv[2],O_RDONLY,0))<0)
- die("Unable to open 'setup'");
- if (read(id,buf,MINIX_HEADER) != MINIX_HEADER)
- die("Unable to read header of 'setup'");
- if (((long *) buf)[0]!=intel_long(0x04100301))
- die("Non-Minix header of 'setup'");
- if (((long *) buf)[1]!=intel_long(MINIX_HEADER))
- die("Non-Minix header of 'setup'");
- if (((long *) buf)[3] != 0)
- die("Illegal data segment in 'setup'");
- if (((long *) buf)[4] != 0)
- die("Illegal bss in 'setup'");
- if (((long *) buf)[5] != 0)
- die("Non-Minix header of 'setup'");
- if (((long *) buf)[7] != 0)
- die("Illegal symbol table in 'setup'");
- for (i=0 ; (c=read(id,buf,sizeof buf))>0 ; i+=c )
-#ifdef __BIG_KERNEL__
- {
- if (!i) {
- /* Working with memcpy because of alignment constraints
- on Sparc - Gertjan */
- memcpy(&tmp_long, &buf[2], sizeof(long));
- if (tmp_long != intel_long(0x53726448) )
- die("Wrong magic in loader header of 'setup'");
- memcpy(&tmp_int, &buf[6], sizeof(int));
- if (tmp_int < intel_int(0x200))
- die("Wrong version of loader header of 'setup'");
- buf[0x11] = 1; /* LOADED_HIGH */
- tmp_long = intel_long(0x100000);
- memcpy(&buf[0x14], &tmp_long, sizeof(long)); /* code32_start */
- }
-#endif
- if (write(1,buf,c)!=c)
- die("Write call failed");
-#ifdef __BIG_KERNEL__
- }
-#endif
- if (c != 0)
- die("read-error on 'setup'");
- close (id);
- setup_sectors = (unsigned char)((i + 511) / 512);
- /* for compatibility with LILO */
- if (setup_sectors < SETUP_SECTS)
- setup_sectors = SETUP_SECTS;
- fprintf(stderr,"Setup is %d bytes.\n",i);
- for (c=0 ; c<sizeof(buf) ; c++)
- buf[c] = '\0';
- while (i < setup_sectors * 512) {
- c = setup_sectors * 512 - i;
- if (c > sizeof(buf))
- c = sizeof(buf);
- if (write(1,buf,c) != c)
- die("Write call failed");
- i += c;
- }
-
- if ((id=open(argv[3],O_RDONLY,0))<0)
- die("Unable to open 'system'");
-#ifndef __BFD__
- if (read(id,buf,GCC_HEADER) != GCC_HEADER)
- die("Unable to read header of 'system'");
- if (N_MAGIC(*ex) == ZMAGIC) {
- GCC_HEADER = N_MAGIC_OFFSET;
- lseek(id, GCC_HEADER, SEEK_SET);
- } else if (N_MAGIC(*ex) != QMAGIC)
- die("Non-GCC header of 'system'");
- fprintf(stderr,"System is %d kB (%d kB code, %d kB data and %d kB bss)\n",
- (ex->a_text+ex->a_data+ex->a_bss)/1024,
- ex->a_text /1024,
- ex->a_data /1024,
- ex->a_bss /1024);
- sz = N_SYMOFF(*ex) - GCC_HEADER + 4;
-#else
- if (fstat (id, &sb)) {
- perror ("fstat");
- die ("Unable to stat 'system'");
- }
- sz = sb.st_size;
- fprintf (stderr, "System is %d kB\n", sz/1024);
-#endif
- sys_size = (sz + 15) / 16;
- if (sys_size > SYS_SIZE)
- die("System is too big");
- while (sz > 0) {
- int l, n;
-
- l = sz;
- if (l > sizeof(buf))
- l = sizeof(buf);
- if ((n=read(id, buf, l)) != l) {
- if (n == -1)
- perror(argv[1]);
- else
- fprintf(stderr, "Unexpected EOF\n");
- die("Can't read 'system'");
- }
- if (write(1, buf, l) != l)
- die("Write failed");
- sz -= l;
- }
- close(id);
- if (lseek(1, 497, 0) == 497) {
- if (write(1, &setup_sectors, 1) != 1)
- die("Write of setup sectors failed");
- }
- if (lseek(1,500,0) == 500) {
- buf[0] = (sys_size & 0xff);
- buf[1] = ((sys_size >> 8) & 0xff);
- if (write(1, buf, 2) != 2)
- die("Write failed");
- }
- return(0);
-}