Index: apps/fastboot/SOURCES |
— | — | @@ -0,0 +1 @@ |
| 2 | +main.c
|
Index: apps/fastboot/ls.x |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +ENTRY(__emcore_entrypoint)
|
| 3 | +OUTPUT_FORMAT(elf32-littlearm)
|
| 4 | +OUTPUT_ARCH(arm)
|
| 5 | +
|
| 6 | +MEMORY
|
| 7 | +{
|
| 8 | + VIRTUAL : ORIGIN = 0x00000000, LENGTH = 0x10000000
|
| 9 | +}
|
| 10 | +
|
| 11 | +SECTIONS
|
| 12 | +{
|
| 13 | + .text :
|
| 14 | + {
|
| 15 | + __emcore_app_base = .;
|
| 16 | + KEEP(.emcoreentrypoint*)
|
| 17 | + *(.emcoreentrypoint*)
|
| 18 | + *(.text*)
|
| 19 | + *(.glue_7)
|
| 20 | + *(.glue_7t)
|
| 21 | + . = ALIGN(0x10);
|
| 22 | + } > VIRTUAL
|
| 23 | +
|
| 24 | + .data :
|
| 25 | + {
|
| 26 | + *(.rodata*)
|
| 27 | + . = ALIGN(0x4);
|
| 28 | + *(.data*)
|
| 29 | + . = ALIGN(0x4);
|
| 30 | + } > VIRTUAL
|
| 31 | +
|
| 32 | + .bss (NOLOAD) :
|
| 33 | + {
|
| 34 | + *(.bss*)
|
| 35 | + *(COMMON)
|
| 36 | + } > VIRTUAL
|
| 37 | +
|
| 38 | + /DISCARD/ :
|
| 39 | + {
|
| 40 | + *(.eh_frame)
|
| 41 | + }
|
| 42 | +
|
| 43 | +}
|
Index: apps/fastboot/main.c |
— | — | @@ -0,0 +1,59 @@ |
| 2 | +#include "emcoreapp.h"
|
| 3 | +#include "libboot.h"
|
| 4 | +
|
| 5 | +
|
| 6 | +static void main()
|
| 7 | +{
|
| 8 | + void* firmware = NULL;
|
| 9 | + int size;
|
| 10 | + if (!(clickwheel_get_state() & 0x1f))
|
| 11 | + {
|
| 12 | + struct emcorelib_header* libboot = get_library(0x4c424365, LIBBOOT_API_VERSION, LIBSOURCE_BOOTFLASH, "libboot ");
|
| 13 | + if (!libboot) panicf(PANIC_KILLTHREAD, "Could not load booting library!");
|
| 14 | + struct libboot_api* boot = (struct libboot_api*)libboot->api;
|
| 15 | + int fd = file_open("/.rockbox/rockbox.ipod", O_RDONLY);
|
| 16 | + if (fd > 0)
|
| 17 | + {
|
| 18 | + size = filesize(fd);
|
| 19 | + if (size > 0)
|
| 20 | + {
|
| 21 | + void* buf = memalign(0x10, size);
|
| 22 | + if (buf)
|
| 23 | + {
|
| 24 | + if (read(fd, buf, size) == size)
|
| 25 | + if (!boot->verify_rockbox_checksum(buf, size))
|
| 26 | + firmware = buf;
|
| 27 | + if (!firmware) free(buf);
|
| 28 | + }
|
| 29 | + }
|
| 30 | + close(fd);
|
| 31 | + }
|
| 32 | + release_library(libboot);
|
| 33 | + library_unload(libboot);
|
| 34 | + }
|
| 35 | + if (firmware)
|
| 36 | + {
|
| 37 | + shutdown(false);
|
| 38 | + execfirmware((void*)0x08000000, firmware, size);
|
| 39 | + }
|
| 40 | + else
|
| 41 | + {
|
| 42 | + int size = bootflash_filesize("bootmenu");
|
| 43 | + if (size > 0)
|
| 44 | + {
|
| 45 | + void* buffer = memalign(0x10, size);
|
| 46 | + if (buffer)
|
| 47 | + {
|
| 48 | + if (bootflash_read("bootmenu", buffer, 0, size) == size)
|
| 49 | + {
|
| 50 | + if (execimage(buffer, false) != NULL) return;
|
| 51 | + }
|
| 52 | + else free(buffer);
|
| 53 | + }
|
| 54 | + }
|
| 55 | + panic(PANIC_KILLTHREAD, "Failed to launch boot menu");
|
| 56 | + }
|
| 57 | +}
|
| 58 | +
|
| 59 | +
|
| 60 | +EMCORE_APP_HEADER("Fastboot launcher", main, 127)
|
Index: apps/fastboot/version.h |
— | — | @@ -0,0 +1,36 @@ |
| 2 | +//
|
| 3 | +//
|
| 4 | +// Copyright 2010 TheSeven
|
| 5 | +//
|
| 6 | +//
|
| 7 | +// This file is part of emBIOS.
|
| 8 | +//
|
| 9 | +// emBIOS is free software: you can redistribute it and/or
|
| 10 | +// modify it under the terms of the GNU General Public License as
|
| 11 | +// published by the Free Software Foundation, either version 2 of the
|
| 12 | +// License, or (at your option) any later version.
|
| 13 | +//
|
| 14 | +// emBIOS is distributed in the hope that it will be useful,
|
| 15 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
| 17 | +// See the GNU General Public License for more details.
|
| 18 | +//
|
| 19 | +// You should have received a copy of the GNU General Public License along
|
| 20 | +// with emBIOS. If not, see <http://www.gnu.org/licenses/>.
|
| 21 | +//
|
| 22 | +//
|
| 23 | +
|
| 24 | +
|
| 25 | +#ifndef __VERSION_H__
|
| 26 | +#define __VERSION_H__
|
| 27 | +
|
| 28 | +
|
| 29 | +#define VERSION "0.0.1pre"
|
| 30 | +#define VERSION_MAJOR 0
|
| 31 | +#define VERSION_MINOR 0
|
| 32 | +#define VERSION_PATCH 1
|
| 33 | +#define VERSION_SVN "$REVISION$"
|
| 34 | +#define VERSION_SVN_INT $REVISIONINT$
|
| 35 | +
|
| 36 | +
|
| 37 | +#endif |
\ No newline at end of file |
Index: apps/fastboot/Makefile |
— | — | @@ -0,0 +1,121 @@ |
| 2 | +NAME := fastboot
|
| 3 | +STACKSIZE := 4096
|
| 4 | +COMPRESS := true
|
| 5 | +
|
| 6 | +EMCOREDIR ?= ../../emcore/trunk/
|
| 7 | +LIBBOOTDIR ?= ../../libs/boot/
|
| 8 | +
|
| 9 | +ifeq ($(shell uname),WindowsNT)
|
| 10 | +CCACHE :=
|
| 11 | +else
|
| 12 | +CCACHE := $(shell which ccache)
|
| 13 | +endif
|
| 14 | +
|
| 15 | +CROSS ?= arm-elf-eabi-
|
| 16 | +CC := $(CCACHE) $(CROSS)gcc
|
| 17 | +AS := $(CROSS)as
|
| 18 | +LD := $(CROSS)ld
|
| 19 | +OBJCOPY := $(CROSS)objcopy
|
| 20 | +ELF2ECA := $(CROSS)elf2emcoreapp
|
| 21 | +
|
| 22 | +LIBINCLUDES := -I$(LIBBOOTDIR)/export
|
| 23 | +
|
| 24 | +CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMCOREDIR)/export $(LIBINCLUDES) -ffunction-sections -fdata-sections -mcpu=arm940t -DARM_ARCH=4
|
| 25 | +LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --emit-relocs --gc-sections
|
| 26 | +
|
| 27 | +preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
|
| 28 | +preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")
|
| 29 | +
|
| 30 | +REVISION := $(shell svnversion .)
|
| 31 | +REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
|
| 32 | +
|
| 33 | +HELPERS := build/__emcore_armhelpers.o
|
| 34 | +
|
| 35 | +SRC := $(call preprocesspaths,SOURCES,-I. -I..)
|
| 36 | +OBJ := $(SRC:%.c=build/%.o)
|
| 37 | +OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
|
| 38 | +
|
| 39 | +all: $(NAME)
|
| 40 | +
|
| 41 | +-include $(OBJ:%=%.dep)
|
| 42 | +
|
| 43 | +$(NAME): build/$(NAME).emcoreapp
|
| 44 | +
|
| 45 | +build/$(NAME).emcoreapp: build/$(NAME).elf
|
| 46 | + @echo [EMCAPP] $<
|
| 47 | +ifeq ($(COMPRESS),true)
|
| 48 | + @$(ELF2ECA) -z -s $(STACKSIZE) -o $@ $^
|
| 49 | +else
|
| 50 | + @$(ELF2ECA) -s $(STACKSIZE) -o $@ $^
|
| 51 | +endif
|
| 52 | +
|
| 53 | +build/$(NAME).elf: ls.x $(OBJ)
|
| 54 | + @echo [LD] $@
|
| 55 | + @$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ)
|
| 56 | +
|
| 57 | +build/%.o: %.c build/version.h
|
| 58 | + @echo [CC] $<
|
| 59 | +ifeq ($(shell uname),WindowsNT)
|
| 60 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| 61 | +else
|
| 62 | + @-mkdir -p $(dir $@)
|
| 63 | +endif
|
| 64 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| 65 | + @$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
|
| 66 | + @sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
|
| 67 | +ifeq ($(shell uname),WindowsNT)
|
| 68 | + @sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
|
| 69 | +else
|
| 70 | + @sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
|
| 71 | +endif
|
| 72 | + @rm -f $@.dep.tmp
|
| 73 | +
|
| 74 | +build/%.o: %.S build/version.h
|
| 75 | + @echo [CC] $<
|
| 76 | +ifeq ($(shell uname),WindowsNT)
|
| 77 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| 78 | +else
|
| 79 | + @-mkdir -p $(dir $@)
|
| 80 | +endif
|
| 81 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| 82 | + @$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
|
| 83 | + @sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
|
| 84 | +ifeq ($(shell uname),WindowsNT)
|
| 85 | + @sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
|
| 86 | +else
|
| 87 | + @sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
|
| 88 | +endif
|
| 89 | + @rm -f $@.dep.tmp
|
| 90 | +
|
| 91 | +build/__emcore_%.o: $(EMCOREDIR)/export/%.c
|
| 92 | + @echo [CC] $<
|
| 93 | +ifeq ($(shell uname),WindowsNT)
|
| 94 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| 95 | +else
|
| 96 | + @-mkdir -p $(dir $@)
|
| 97 | +endif
|
| 98 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| 99 | +
|
| 100 | +build/__emcore_%.o: $(EMCOREDIR)/export/%.S
|
| 101 | + @echo [CC] $<
|
| 102 | +ifeq ($(shell uname),WindowsNT)
|
| 103 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| 104 | +else
|
| 105 | + @-mkdir -p $(dir $@)
|
| 106 | +endif
|
| 107 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| 108 | +
|
| 109 | +build/version.h: version.h .svn/entries
|
| 110 | + @echo [PP] $<
|
| 111 | +ifeq ($(shell uname),WindowsNT)
|
| 112 | + @-if not exist build md build
|
| 113 | + @sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
|
| 114 | +else
|
| 115 | + @-mkdir -p build
|
| 116 | + @sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
|
| 117 | +endif
|
| 118 | +
|
| 119 | +clean:
|
| 120 | + @rm -rf build
|
| 121 | +
|
| 122 | +.PHONY: all clean $(NAME)
|
Index: apps/fastboot |
Property changes on: apps/fastboot |
___________________________________________________________________ |
Added: svn:ignore |
## -0,0 +1 ## |
| 123 | +build |