diff -ur bootstream-1.0-stock/Makefile bootstream-1.0/Makefile --- bootstream-1.0-stock/Makefile 2010-08-18 13:43:44.386637400 -0700 +++ bootstream-1.0/Makefile 2010-08-18 13:43:27.870626729 -0700 @@ -1,64 +1,16 @@ # $Id: Makefile 7554 2009-04-30 19:44:17Z scross $ # source build makefile for bootstream bootloader -include ../config/config.mk +CFLAGS += -DCHUMBY_CONFIGNAME=\"falconwing\" -DCHUMBY_CONFIGNAME_falconwing -ELFTOSB2_DIR=elftosb2 -ELFTOSB2_BINARIES=elftosb2 -ELFTOSB2_SRC_BINARIES=$(addprefix $(ELFTOSB2_DIR)/,$(ELFTOSB2_BINARIES)) -ELFTOSB2_SOURCES=$(wildcard $(ELFTOSB2_DIR)/*.c $(ELFTOSB2_DIR)/*.h) - -SRC_BINARIES=$(ELFTOSB2_SRC_BINARIES) -HOST_BINARIES=$(ELFTOSB2_BINARIES) - -CFLAGS += -DCHUMBY_CONFIGNAME=\"$(CONFIGNAME)\" -DCHUMBY_CONFIGNAME_$(CONFIGNAME) - -all: $(SRC_BINARIES) $(HOST_BINARIES) \ - chumby_factory/chumby_factory chumby_stub/chumby_stub chumby_boot/chumby_boot - - -install: $(SRC_BINARIES) $(HOST_BINARIES) \ - .src_binaries .chumby-boot .factory-image .chumby-stub - #.u-boot-image - -chumby_boot/chumby_boot: - $(MAKE) -C chumby_boot CROSS_COMPILE=$(TARGET)- LINUX_DIR=$(LINUX_DIR) - -chumby_stub/chumby_stub: - $(MAKE) -C chumby_stub CROSS_COMPILE=$(TARGET)- LINUX_DIR=$(LINUX_DIR) - -chumby_factory/chumby_factory: - $(MAKE) -C chumby_factory CROSS_COMPILE=$(TARGET)- LINUX_DIR=$(LINUX_DIR) - - -.factory-image: $(SRC_BINARIES) - elftosb2/elftosb2 -z -c ../config/falconwing_factory_sb.db \ - -o $(INSTALL_DIR)/bootstream-factory.bin - -.chumby-boot: $(SRC_BINARIES) - cp images/chumby_boot.rom $(INSTALL_DIR)/chumby_boot.bin - -.chumby-stub: $(SRC_BINARIES) - elftosb2/elftosb2 -c ../config/falconwing_chumby_sb.db \ - -o $(INSTALL_DIR)/bootstream-chumby.bin - -.u-boot-image: $(SRC_BINARIES) - elftosb2/elftosb2 -c ../config/falconwing_uboot_sb.db \ - -o $(INSTALL_DIR)/falconwing_uboot.sb - - -.src_binaries: - @echo "Copying src bianries" - mkdir -p $(INSTALL_DIR)/host - cp --preserve --no-dereference $(SRC_BINARIES) $(INSTALL_DIR)/host/ +all: + $(MAKE) -C chumby_factory + $(MAKE) -C chumby_stub + $(MAKE) -C chumby_boot + gcc config_util.cpp -o config_util -lstdc++ clean: - -rm -f $(HOST_BINARIES) $(SRC_BINARIES) - $(MAKE) -C $(ELFTOSB2_DIR) clean - -$(ELFTOSB2_SRC_BINARIES): - $(MAKE) -C $(ELFTOSB2_DIR) - -../output/$(TARGET)-$(CNPLATFORM): - @echo "Creating directory: $@" - -mkdir -p $@ + $(MAKE) -C chumby_factory clean + $(MAKE) -C chumby_stub clean + $(MAKE) -C chumby_boot clean + rm -f config_util diff -ur bootstream-1.0-stock/chumby_boot/Makefile bootstream-1.0/chumby_boot/Makefile --- bootstream-1.0-stock/chumby_boot/Makefile 2010-08-18 13:43:44.386637400 -0700 +++ bootstream-1.0/chumby_boot/Makefile 2010-08-18 13:43:27.874670886 -0700 @@ -7,24 +7,14 @@ # Linker script BASE_ADDR ?= 0x00002000 BOOT_LAYOUT_IN = $(SRCDIR)/chumby_boot.ld.in -BOOT_LAYOUT_OUT = $(OUTPUTDIR)/chumby_boot.ld +BOOT_LAYOUT_OUT = ../output/chumby_boot.ld # Output ELF image -CHUMBY_BOOT = $(OUTPUTDIR)/../../images/chumby_boot +CHUMBY_BOOT = ../output/chumby_boot # Output binary image -CHUMBY_BOOT_ROM = $(OUTPUTDIR)/../../images/chumby_boot.rom - -CROSS_COMPILE ?= arm-linux- - -AS = $(CROSS_COMPILE)as -CC = $(CROSS_COMPILE)gcc -LD = $(CROSS_COMPILE)ld -CPP = $(CROSS_COMPILE)cpp -STRIP = $(CROSS_COMPILE)strip -OBJCOPY = $(CROSS_COMPILE)objcopy -OBJDUMP = $(CROSS_COMPILE)objdump +CHUMBY_BOOT_ROM = ../output/chumby_boot.rom LIBGCCDIR = $(dir $(shell $(CC) -print-libgcc-file-name)) CFLAGS = -Wall -I$(INCLUDEDIR) -I$(LINUX_DIR)/include -fno-builtin -O0 -nostdinc @@ -91,5 +81,5 @@ @nm -n $@ > $@.map $(BOOT_LAYOUT_OUT): $(BOOT_LAYOUT_IN) - $(CPP) -P -DBASE_ADDR=$(BASE_ADDR) -o $@ $< + cpp -P -DBASE_ADDR=$(BASE_ADDR) -o $@ $< diff -ur bootstream-1.0-stock/chumby_boot/src/serial.c bootstream-1.0/chumby_boot/src/serial.c --- bootstream-1.0-stock/chumby_boot/src/serial.c 2010-08-18 13:43:44.386637400 -0700 +++ bootstream-1.0/chumby_boot/src/serial.c 2010-08-18 13:43:27.874670886 -0700 @@ -171,10 +171,10 @@ return data; } -static char hex[] = "0123456789abcdef"; void serial_puthex(u32 c) { int i; + char hex[] = "0123456789abcdef"; serial_puts("0x"); for(i=7; i>=0; i--) serial_putc(hex[(c>>(4*i))&0x0f]); diff -ur bootstream-1.0-stock/chumby_boot/src/shell.c bootstream-1.0/chumby_boot/src/shell.c --- bootstream-1.0-stock/chumby_boot/src/shell.c 2010-08-18 13:43:44.386637400 -0700 +++ bootstream-1.0/chumby_boot/src/shell.c 2010-08-18 15:12:45.138607841 -0700 @@ -48,8 +48,8 @@ "shell\n" // Run the watchdogtimer, set to reboot the device in 20 seconds. - "regutil -w HW_RTC_WATCHDOG 0x00004e20\n" - "regutil -w HW_RTC_CTRL_SET 0x00000010\n" + //"regutil -w HW_RTC_WATCHDOG 0x00004e20\n" + //"regutil -w HW_RTC_CTRL_SET 0x00000010\n" // Prioritize screen DMA over other DMA. This fixes video tearing issues. // Priority is: AXI0, AHB2, AHB1, AHB3 @@ -84,7 +84,7 @@ // Set up the Linux tags, pass the command-line arguments, and run the // Linux kernel, located at address 0x40008000. - "linux 0x40008000 \"console=ttyAM0,115200 init=/linuxrc root=/dev/mmcblk0p2 rootfstype=ext3 ro rootwait chumbyrev=** ssp1=mmc sysrq_always_enabled logo.brand=" BRAND_PLACEHOLDER "\"\n", + "linux 0x40008000 \"console=ttyAM0,115200 root=/dev/mmcblk0p2 rw rootwait chumbyrev=** ssp1=mmc sysrq_always_enabled logo.brand=" BRAND_PLACEHOLDER "\"\n", //////////////////////////////////////////////// @@ -97,7 +97,7 @@ // Set up the Linux tags, pass the command-line arguments, and run the // Linux kernel, located at address 0x40008000. - "linux 0x40008000 \"console=ttyAM0,115200 init=/linuxrc root=/dev/mmcblk0p2 rootfstype=ext3 ro rootwait chumbyrev=** ssp1=mmc sysrq_always_enabled partition=recovery logo.brand=" BRAND_PLACEHOLDER "\"\n", + "linux 0x40008000 \"console=ttyAM0,115200 root=/dev/mmcblk0p2 rw rootwait chumbyrev=** ssp1=mmc sysrq_always_enabled partition=recovery logo.brand=" BRAND_PLACEHOLDER "\"\n", //////////////////////////////////////////////// @@ -350,8 +350,8 @@ } char **shell_line_to_argv(int argc, char *line) { - static char *argv[80]; int i; + static char *argv[10]; for(i=0; i<=argc; i++) { argv[i] = line; while(*line) diff -ur bootstream-1.0-stock/chumby_boot/src/shell_funcs.c bootstream-1.0/chumby_boot/src/shell_funcs.c --- bootstream-1.0-stock/chumby_boot/src/shell_funcs.c 2010-08-18 13:43:44.386637400 -0700 +++ bootstream-1.0/chumby_boot/src/shell_funcs.c 2010-08-18 15:11:45.984011892 -0700 @@ -42,6 +42,7 @@ value = eeprom_read(addr, reg); STR("Value: "), HEX(value), STR("\n"); + return 0; } @@ -244,7 +245,7 @@ -static int sd_initted = 0; +int sd_initted; char *sd_pmem; static int my_sd_stop() { @@ -256,27 +257,28 @@ static int my_sd_init() { - static rom_BootInit_t init;// = (rom_BootInit_t *)0x40A10000; + rom_BootInit_t init; + if(sd_initted) { int result; result = my_sd_stop(); if(result) { - STR("Error! Couldn't reset SD.\n"); - return 0; + STR("Error! Couldn't reset SD: "), HEX(result), STR("\n"); + return 1; } + sd_initted = 0; } + if(!sd_initted) { int result; mdelay(10); init.size = PMEM_SIZE; - init.pMem = sd_pmem; // Allocated on stack in main(). + init.pMem = 16384; init.mode = 9; // Set to SSP_PORT_1. memset(sd_pmem, 0, PMEM_SIZE); - result = sd_init(&init); - if(!result) - sd_initted = 1; - else + if((result = sd_init(&init))) return result; + sd_initted = 1; } return 0; } @@ -318,17 +320,18 @@ while(bytes > 0) { int chunks_to_read, chunk; int read_tries = 0; + chunks_to_read = bytes/sizeof(chunk_t); // Perform the read. -// STR("Going to try to read "), INT(chunks_to_read), STR(" chunks\n"); +// STR("Going to try to read "), INT(chunks_to_read), STR(" chunks\n"); while(read_tries < 1000) { read_tries++; chunks_to_read = bytes/sizeof(chunk_t); chunks = sd_next(&chunks_to_read); if(!chunks_to_read) { -// STR("Read 0 chunks. Trying again...\n"); -// mdelay(1000*read_tries); // XXX need to tune this! + STR("Read 0 chunks. Trying again...\n"); + mdelay(10*read_tries); // XXX need to tune this! continue; } else @@ -339,15 +342,15 @@ STR(" Aborting read.\n"); return 0; } -// else if(read_tries) -// STR("Delayed "), INT(read_tries), STR(" times.\n"); +// else if(read_tries) +// STR("Delayed "), INT(read_tries), STR(" times.\n"); if(chunks_to_read < 0) { STR("Error while reading bytes: "), HEX(chunks_to_read), STR("\n"); return 0; } -// else -// STR("Successfully read "), INT(chunks_to_read), STR(" chunks.\n"); +// else +// STR("Successfully read "), INT(chunks_to_read), STR(" chunks.\n"); // Copy over each of the chunks that was read. for(chunk=0; chunk=0; i--, j++) - str[2+j] = hex[(c>>(4*i))&0x0f]; + str[2+j] = hex[(c>>(4*i))&0x0f]; str[10] = '\n'; str[11] = '\0'; @@ -1058,6 +1065,7 @@ struct shell_command *shell_funcs_init() { struct shell_command *cmd_fixup = cmds; + sd_initted = 0; // Fixup the cmd array by adding the base_address value to each pointer. while(cmd_fixup->name) { diff -ur bootstream-1.0-stock/chumby_factory/Makefile bootstream-1.0/chumby_factory/Makefile --- bootstream-1.0-stock/chumby_factory/Makefile 2010-08-18 13:43:44.386637400 -0700 +++ bootstream-1.0/chumby_factory/Makefile 2010-08-18 13:43:27.874670886 -0700 @@ -1,30 +1,20 @@ CURRENTDIR = . SRCDIR = $(CURRENTDIR)/src -OUTPUTDIR = $(CURRENTDIR)/output +OUTPUTDIR = ../output INCLUDEDIR = $(CURRENTDIR)/include # Linker script BASE_ADDR ?= 0x00002000 BOOT_LAYOUT_IN = $(SRCDIR)/chumby_factory.ld.in -BOOT_LAYOUT_OUT = $(OUTPUTDIR)/chumby_factory.ld +BOOT_LAYOUT_OUT = ../output/chumby_factory.ld # Output ELF image -CHUMBY_FACTORY = $(OUTPUTDIR)/../../images/chumby_factory +CHUMBY_FACTORY = ../output/chumby_factory # Output binary image -CHUMBY_FACTORY_ROM = $(OUTPUTDIR)/../../images/chumby_factory.rom - -CROSS_COMPILE ?= arm-linux- - -AS = $(CROSS_COMPILE)as -CC = $(CROSS_COMPILE)gcc -LD = $(CROSS_COMPILE)ld -CPP = $(CROSS_COMPILE)cpp -STRIP = $(CROSS_COMPILE)strip -OBJCOPY = $(CROSS_COMPILE)objcopy -OBJDUMP = $(CROSS_COMPILE)objdump +CHUMBY_FACTORY_ROM = ../output/chumby_factory.rom LIBGCCDIR = $(dir $(shell $(CC) -print-libgcc-file-name)) CFLAGS = -Wall -I$(INCLUDEDIR) -I$(LINUX_DIR)/include -nostdinc -fno-builtin -O @@ -90,5 +80,5 @@ @nm -n $@ > $@.map $(BOOT_LAYOUT_OUT): $(BOOT_LAYOUT_IN) - $(CPP) -P -DBASE_ADDR=$(BASE_ADDR) -o $@ $< + cpp -P -DBASE_ADDR=$(BASE_ADDR) -o $@ $< diff -ur bootstream-1.0-stock/chumby_stub/Makefile bootstream-1.0/chumby_stub/Makefile --- bootstream-1.0-stock/chumby_stub/Makefile 2010-08-18 13:43:44.386637400 -0700 +++ bootstream-1.0/chumby_stub/Makefile 2010-08-18 13:43:27.874670886 -0700 @@ -1,30 +1,20 @@ CURRENTDIR = . SRCDIR = $(CURRENTDIR)/src -OUTPUTDIR = $(CURRENTDIR)/output +OUTPUTDIR = ../output INCLUDEDIR = $(CURRENTDIR)/include # Linker script BASE_ADDR ?= 0x00002000 BOOT_LAYOUT_IN = $(SRCDIR)/chumby_stub.ld.in -BOOT_LAYOUT_OUT = $(OUTPUTDIR)/chumby_stub.ld +BOOT_LAYOUT_OUT = ../output/chumby_stub.ld # Output ELF image -CHUMBY_STUB = $(OUTPUTDIR)/../../images/chumby_stub +CHUMBY_STUB = ../images/chumby_stub # Output binary image -CHUMBY_STUB_ROM = $(OUTPUTDIR)/../../images/chumby_stub.rom - -CROSS_COMPILE ?= arm-linux- - -AS = $(CROSS_COMPILE)as -CC = $(CROSS_COMPILE)gcc -LD = $(CROSS_COMPILE)ld -CPP = $(CROSS_COMPILE)cpp -STRIP = $(CROSS_COMPILE)strip -OBJCOPY = $(CROSS_COMPILE)objcopy -OBJDUMP = $(CROSS_COMPILE)objdump +CHUMBY_STUB_ROM = ../images/chumby_stub.rom LIBGCCDIR = $(dir $(shell $(CC) -print-libgcc-file-name)) CFLAGS = -Wall -I$(INCLUDEDIR) -I$(LINUX_DIR)/include -nostdinc -fno-builtin -Os @@ -90,5 +80,5 @@ @nm -n $@ > $@.map $(BOOT_LAYOUT_OUT): $(BOOT_LAYOUT_IN) - $(CPP) -P -DBASE_ADDR=$(BASE_ADDR) -o $@ $< + cpp -P -DBASE_ADDR=$(BASE_ADDR) -o $@ $<