From c9ebae77482f5e53e935f1570a3905a2517ffe19 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Sat, 11 Sep 2010 05:45:33 +0000 Subject: bootstream: Add falconwing bootloader definition This adds the "bootstream" recipe, which can be used to boot i.MX233 chips. It specifically adds the chumby falconwing bootstream recipe. Signed-off-by: Sean Cross Signed-off-by: Tom Rini --- .../bootstream/bootstream-chumby-falconwing_1.bb | 65 ++++ recipes/bootstream/fix-oe-build.patch | 405 +++++++++++++++++++++ 2 files changed, 470 insertions(+) create mode 100644 recipes/bootstream/bootstream-chumby-falconwing_1.bb create mode 100644 recipes/bootstream/fix-oe-build.patch (limited to 'recipes/bootstream') diff --git a/recipes/bootstream/bootstream-chumby-falconwing_1.bb b/recipes/bootstream/bootstream-chumby-falconwing_1.bb new file mode 100644 index 0000000000..c154963778 --- /dev/null +++ b/recipes/bootstream/bootstream-chumby-falconwing_1.bb @@ -0,0 +1,65 @@ +# Builds the boot partition for a chumby Falconwing-based platform. +# Note that bootstream-chumby.bin is a binary-blob combination of +# chumby_stub, and the Freescale-provided bootlets that set up power, +# clocks, and RAM. It is provided as a blob because Freescale provides +# elftosb2 as a blob. If you would like to recreate these from scratch and +# are on an x86 Linux machine, you'll need the following files: +# http://files.chumby.com/source/falconwing/bootloader/elftosb2;name=elftosb2 +# http://files.chumby.com/source/falconwing/bootloader/falconwing_chumby_sb.db;name=chumbyconfig +# http://files.chumby.com/source/falconwing/bootloader/falconwing_factory_sb.db;name=factoryconfig +SECTION = "bootloaders" +PRIORITY = "optional" +LICENSE = "GPLv2" +DEPENDS = "virtual/kernel" +PROVIDES = "virtual/bootloader" +RPROVIDES = "virtual/bootloader" +PR = "r4" + +SRC_URI = "http://files.chumby.com/source/falconwing/build2913/bootstream-1.0.tgz;name=archive \ + http://files.chumby.com/source/falconwing/build2913/bootstream-chumby.bin;name=bootstream \ + file://fix-oe-build.patch \ +" +SRC_URI[archive.md5sum] = "de87fbc40f0466d5f3d3f083537f9559" +SRC_URI[archive.sha256sum] = "532101f5721eb9540fcac37bf6feb79449c4d5d66dbb7331dd1d3560c68abad9" +SRC_URI[bootstream.md5sum] = "8aa29fc431f349b22d147b5cec52927b" +SRC_URI[bootstream.sha256sum] = "8dcf12cb6f749de2e373a780b8bbcee099ec23aad212d58131750caa7360c0eb" + +S = "${WORKDIR}/bootstream-1.0" + +do_compile () { + oe_runmake 'LINUX_DIR=${STAGING_KERNEL_DIR}' +} + +FILES_${PN} = "/boot" + +addtask deploy before do_build after do_compile + +do_deploy () { + ./config_util --cmd=create \ + --mbr=/dev/zero \ + --configname=falconwing \ + --build_ver=1000 --force --pad \ + --blockdef=${S}/output/chumby_boot.rom,215040,boot,1,0,0,0 \ + --blockdef=${S}/images/4_1.bin,153600,img1,1,0,0,0 \ + --blockdef=${S}/images/4_2.bin,153600,img2,1,0,0,0 \ + --blockdef=${S}/images/5_1.bin,153600,img3,1,0,0,0 \ + --blockdef=${S}/images/5_2.bin,153600,img4,1,0,0,0 \ + --blockdef=${S}/images/5_3.bin,153600,img5,1,0,0,0 \ + --blockdef=${DEPLOY_DIR_IMAGE}/zImage-${MACHINE}.bin,4194304,krnA,1,0,0,0 \ + --blockdef=${DEPLOY_DIR_IMAGE}/zImage-${MACHINE}.bin,4194304,krnB,1,0,0,0 \ + > ${S}/output/config_block.bin + install -d ${DEPLOY_DIR_IMAGE} + rm -f ${DEPLOY_DIR_IMAGE}/boot.bin + touch ${DEPLOY_DIR_IMAGE}/boot.bin + dd if=../bootstream-chumby.bin of=${DEPLOY_DIR_IMAGE}/boot.bin seek=0 count=64 + dd if=${S}/output/config_block.bin of=${DEPLOY_DIR_IMAGE}/boot.bin seek=96 count=32 + dd if=${S}/output/chumby_boot.rom of=${DEPLOY_DIR_IMAGE}/boot.bin seek=128 count=420 + dd if=${S}/images/4_1.bin of=${DEPLOY_DIR_IMAGE}/boot.bin seek=548 count=300 + dd if=${S}/images/4_2.bin of=${DEPLOY_DIR_IMAGE}/boot.bin seek=848 count=300 + dd if=${S}/images/5_1.bin of=${DEPLOY_DIR_IMAGE}/boot.bin seek=1148 count=300 + dd if=${S}/images/5_2.bin of=${DEPLOY_DIR_IMAGE}/boot.bin seek=1448 count=300 + dd if=${S}/images/5_3.bin of=${DEPLOY_DIR_IMAGE}/boot.bin seek=1748 count=300 + dd if=${DEPLOY_DIR_IMAGE}/zImage-${MACHINE}.bin of=${DEPLOY_DIR_IMAGE}/boot.bin seek=2048 count=8192 + dd if=${DEPLOY_DIR_IMAGE}/zImage-${MACHINE}.bin of=${DEPLOY_DIR_IMAGE}/boot.bin seek=10240 count=8192 + package_stagefile_shell ${DEPLOY_DIR_IMAGE}/boot.bin +} diff --git a/recipes/bootstream/fix-oe-build.patch b/recipes/bootstream/fix-oe-build.patch new file mode 100644 index 0000000000..c06756daaf --- /dev/null +++ b/recipes/bootstream/fix-oe-build.patch @@ -0,0 +1,405 @@ +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 $@ $< + -- cgit 1.2.3-korg