Okay, this patch will probably make Ron cry, but in the end, I think
its better for the health of buildrom and the project (the patch, not
Ron crying).
The OLPC code we had in here before was for revision B2 and earlier,
which will never see the light of day to the public, and only myself,
Ron and Segher have even seen them, let alone used them (and
I'm not even sure if my B2 works).
Even if we were to revive LinuxBIOS for the B3 for the upcoming G1G1
effort, the existing code would be too bitrotten and too old to be of
any use. The only use we had for it was as a decent example of how
to do LAB, but Ward has upped the stakes with his LAB code that is way
better, and if we have our way, eventually all the LAB code will go away
in favor of something like buildroot. And finally, the OLPC buildrom
code that last worked for B2 is still active over at dev.laptop.org, so
the code will be accessible if need be.
So, with all that said, I am proposing this patch to remove OLPC support
completely from buildrom, except for OFW, which I will discuss in the next
patch. Flame on!
--
Jordan Crouse
Systems Software Development Engineer
Advanced Micro Devices, Inc.
[BUILDROM] Remove bitrotten OLPC support
OLPC support is bitrotten, and will never really be useful for the general
public, so eliminate it.
Signed-off-by: Jordan Crouse
jordan.crouse@amd.com
Index: buildrom-devel/config/payloads/Config.in
===================================================================
--- buildrom-devel.orig/config/payloads/Config.in 2007-10-03 13:22:59.000000000 -0600
+++ buildrom-devel/config/payloads/Config.in 2007-10-03 13:23:14.000000000 -0600
@@ -89,19 +89,6 @@
help
Say 'Y' here to include the busybox tools
-config BOOTMENU
- bool "Bootmenu"
- default y
- help
- Say 'Y' here to include the bootmenu selector
-
-config OLPCFLASH
- bool "OLPC flash utility"
- depends PLATFORM_OLPC
- default y
- help
- Say 'Y' here to include the OLPC flash utility
-
endmenu
menu "Memtest86 Configuration"
Index: buildrom-devel/config/payloads/ofw.conf
===================================================================
--- buildrom-devel.orig/config/payloads/ofw.conf 2007-10-03 13:22:59.000000000 -0600
+++ buildrom-devel/config/payloads/ofw.conf 2007-10-03 13:23:14.000000000 -0600
@@ -12,4 +12,4 @@
# target
PAYLOAD-y=ofw
-HOSTTOOLS-y=crc32sum
+#HOSTTOOLS-y=crc32sum
Index: buildrom-devel/config/platforms/Config.in
===================================================================
--- buildrom-devel.orig/config/platforms/Config.in 2007-10-03 13:22:59.000000000 -0600
+++ buildrom-devel/config/platforms/Config.in 2007-10-03 13:23:14.000000000 -0600
@@ -10,10 +10,6 @@
bool "AMD Geode LX 'Norwich'"
select PLATFORM
-config PLATFORM_OLPC
- bool "OLPC Laptop"
- select PLATFORM
-
config PLATFORM_DBE61
bool "Artec Group dbe61"
select PLATFORM
Index: buildrom-devel/config/platforms/olpc.conf
===================================================================
--- buildrom-devel.orig/config/platforms/olpc.conf 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,86 +0,0 @@
-# Configuration file for the OLPC platform
-
-# Basic platform configuration
-
-CC=gcc
-STRIP=strip
-AS=as
-
-MACHINE_ARCH=i586
-CFLAGS_platform = -fpic -m32
-ASFLAGS_platform = -32
-
-# Targets
-LINUXBIOS_MK=$(PACKAGE_DIR)/linuxbios/olpc-linuxbios.mk
-KERNEL_MK=$(PACKAGE_DIR)/linuxbios/olpc-kernel.mk
-
-#### Kernel configuration
-
-KERNEL_VERSION=2.6.18-rc4-olpc1
-KERNEL_TAG=1d386c71d46aed41683be5644f397c4fbfbc4d3f
-KERNEL_CONFIG=$(PACKAGE_DIR)/kernel/conf/defconfig-olpc
-
-# The following components are used to create the firmware signature in
-# the ROM. see README.signature for information about how this is
-# constructed.
-
-# The firmware model is a 6 byte string that identifies the model
-# This should stay static for the entire CL1 run.
-
-FIRMWARE_MODEL=CL1
-
-# The firmware revision is a 7 byte string that identifies the current
-# version. The first three bytes of this will be repeated at the end of
-# the string, but that will be pulled out automatically
-# I set this now from a script that calls make
-# I wanted the default to be something non-offical but the boot scripts
-# in the build system look for the Q2A to determine that we are on an
-# OLPC (opposed to QEmu) So I have to have the Q2A.
-
-FIRMWARE_REVISION = Q2B43
-
-# This is the version number for the embedded controller code pulled
-# in during the LinuxBIOS bulid
-
-EC_VER=B43
-
-# These are LinuxBIOS flags that may be useful
-
-LINUXBIOS_CAS25=y
-LINUXBIOS_ENABLE_FS2=y
-
-# If you uncomment and fill this in then it will override the firmware thats
-# # pulled from dev.laptop.org
-#
-#EC_FIRMWARE_OVERRIDE=PQ2B11T.bin
-
-#### You probably shouldn't change anything under this point
-
-LINUXBIOS_VENDOR=olpc
-LINUXBIOS_BOARD=rev_a
-LINUXBIOS_CONFIG=Config.SPI.lb
-LINUXBIOS_TDIR=rev_a_1M
-LINUXBIOS_ROM_NAME=linuxbios.rom
-
-LINUXBIOS_TAG=f6ec588df29f39a9b3db7fcbde2181d79ff7c5bd
-
-EC_FIRMWARE_URL=
http://dev.laptop.org/pub/ec
-
-ifeq ($(PAYLOAD_LAB),y)
-LINUXBIOS_PATCHES += $(PACKAGE_DIR)/linuxbios/dcon-detect.patch
-endif
-
-ifeq ($(LINUXBIOS_CAS25),y)
-LINUXBIOS_PATCHES += $(PACKAGE_DIR)/linuxbios/CL2.5.patch
-LINUXBIOS_CL2_MARKER=_CL2.5
-endif
-
-ifeq ($(LINUXBIOS_ENABLE_FS2),y)
-LINUXBIOS_PATCHES += $(PACKAGE_DIR)/linuxbios/disable_swapsifs.patch
-endif
-
-ifeq ($(EC_FIRMWARE_OVERRIDE),)
-EC_FIRMWARE_REV=ec_v$(EC_VER).img
-else
-EC_FIRMWARE_REV=$(EC_FIRMWARE_OVERRIDE)
-endif
Index: buildrom-devel/config/platforms/platforms.conf
===================================================================
--- buildrom-devel.orig/config/platforms/platforms.conf 2007-10-03 13:22:59.000000000 -0600
+++ buildrom-devel/config/platforms/platforms.conf 2007-10-03 13:23:14.000000000 -0600
@@ -7,7 +7,6 @@
PLATFORM-y=
PLATFORM-$(CONFIG_PLATFORM_NORWICH) = norwich.conf
-PLATFORM-$(CONFIG_PLATFORM_OLPC) = olpc.conf
PLATFORM-$(CONFIG_PLATFORM_MSM800SEV) = msm800sev.conf
PLATFORM-$(CONFIG_PLATFORM_ALIX1C) = alix1c.conf
PLATFORM-$(CONFIG_PLATFORM_DB800) = db800.conf
Index: buildrom-devel/packages/bootmenu/bootmenu.mk
===================================================================
--- buildrom-devel.orig/packages/bootmenu/bootmenu.mk 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,52 +0,0 @@
-BOOTMENU_URL=
http://dev.laptop.org/~jcrouse/bootmenu
-BOOTMENU_SOURCE=bootmenu-0.3.tar.gz
-BOOTMENU_DIR=$(BUILD_DIR)/bootmenu
-BOOTMENU_SRC_DIR=$(BOOTMENU_DIR)/bootmenu-0.3
-BOOTMENU_STAMP_DIR=$(BOOTMENU_DIR)/stamps
-BOOTMENU_LOG_DIR=$(BOOTMENU_DIR)/logs
-
-ifeq ($(CONFIG_VERBOSE),y)
-BOOTMENU_BUILD_LOG=/dev/stdout
-BOOTMENU_INSTALL_LOG=/dev/stdout
-else
-BOOTMENU_BUILD_LOG=$(BOOTMENU_LOG_DIR)/build.log
-BOOTMENU_INSTALL_LOG=$(BOOTMENU_LOG_DIR)/install.log
-endif
-
-$(SOURCE_DIR)/$(BOOTMENU_SOURCE):
- @ mkdir -p $(SOURCE_DIR)
- @ wget -P $(SOURCE_DIR) $(BOOTMENU_URL)/$(BOOTMENU_SOURCE)
-
-$(BOOTMENU_STAMP_DIR)/.unpacked: $(SOURCE_DIR)/$(BOOTMENU_SOURCE)
- @ echo "Unpacking bootmenu..."
- @ tar -C $(BOOTMENU_DIR) -zxf $(SOURCE_DIR)/$(BOOTMENU_SOURCE)
- @ touch $@
-
-$(BOOTMENU_SRC_DIR)/bootmenu: $(BOOTMENU_STAMP_DIR)/.unpacked
- @ echo "Building bootmenu..."
- $(MAKE) LDFLAGS="$(CROSS_CFLAGS) $(LDFLAGS)" -C $(BOOTMENU_SRC_DIR) > $(BOOTMENU_BUILD_LOG) 2>&1
-
-$(INITRD_DIR)/bin/bootmenu: $(BOOTMENU_SRC_DIR)/bootmenu
- @ install -d $(INITRD_DIR)/bin
- @ install -m 0755 $(BOOTMENU_SRC_DIR)/bootmenu \
- $(INITRD_DIR)/bin/bootmenu
- @ $(STRIPCMD) $(INITRD_DIR)/bin/bootmenu
- @ install -d $(INITRD_DIR)/images
- @ install -m 0644 $(BOOTMENU_SRC_DIR)/images/*.ppm $(INITRD_DIR)/images
-
-$(BOOTMENU_STAMP_DIR) $(BOOTMENU_LOG_DIR):
- @ mkdir -p $@
-
-bootmenu: $(BOOTMENU_STAMP_DIR) $(BOOTMENU_LOG_DIR) $(INITRD_DIR)/bin/bootmenu
-
-bootmenu-clean:
- @ echo "Cleaning bootmenu..."
- @ $(MAKE) -C $(BOOTMENU_SRC_DIR) clean > /dev/null 2>&1
-
-bootmenu-distclean:
- @ rm -rf $(BOOTMENU_DIR)/*
-
-bootmenu-bom:
- @ echo "Package: bootmenu"
- @ echo "Source: $(BOOTMENU_URL)/$(BOOTMENU_SOURCE)"
- @ echo ""
Index: buildrom-devel/packages/crc32sum/crc32sum.mk
===================================================================
--- buildrom-devel.orig/packages/crc32sum/crc32sum.mk 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,49 +0,0 @@
-CRC32SUM_URL=
http://dev.laptop.org/~rsmith
-CRC32SUM_SOURCE=crc32sum_0.1.0.tar.gz
-CRC32SUM_DIR=$(BUILD_DIR)/crc32sum
-CRC32SUM_SRC_DIR=$(CRC32SUM_DIR)/crc32sum_0.1.0
-CRC32SUM_STAMP_DIR=$(CRC32SUM_DIR)/stamps
-CRC32SUM_LOG_DIR=$(CRC32SUM_DIR)/logs
-
-ifeq ($(CONFIG_VERBOSE),y)
-CRC32SUM_BUILD_LOG=/dev/stdout
-CRC32SUM_CONFIG_LOG=/dev/stdout
-else
-CRC32SUM_BUILD_LOG=$(CRC32SUM_LOG_DIR)/build.log
-CRC32SUM_CONFIG_LOG=$(CRC32SUM_LOG_DIR)/config.log
-endif
-
-$(SOURCE_DIR)/$(CRC32SUM_SOURCE):
- @ mkdir -p $(SOURCE_DIR)
- @ wget -P $(SOURCE_DIR) $(CRC32SUM_URL)/$(CRC32SUM_SOURCE)
-
-$(CRC32SUM_STAMP_DIR)/.unpacked: $(SOURCE_DIR)/$(CRC32SUM_SOURCE)
- @ echo "Unpacking crc32sum..."
- @ tar -C $(CRC32SUM_DIR) -zxf $(SOURCE_DIR)/$(CRC32SUM_SOURCE)
- @ touch $@
-
-$(CRC32SUM_SRC_DIR)/crc32sum: $(CRC32SUM_STAMP_DIR)/.unpacked
- @ echo "Building crc32sum..."
- @ ( export CC=$(HOST_CC); export CFLAGS=$(HOST_CFLAGS); \
- export LDFLAGS=$(HOST_LDFLAGS); unset LIBS; \
- $(MAKE) -C $(CRC32SUM_SRC_DIR) all > $(CRC32SUM_BUILD_LOG) 2>&1)
-
-$(STAGING_DIR)/bin/crc32sum: $(CRC32SUM_SRC_DIR)/crc32sum
- @ install -d $(STAGING_DIR)/bin
- @ install -m 0755 $< $@
-
-$(CRC32SUM_STAMP_DIR) $(CRC32SUM_LOG_DIR):
- @ mkdir -p $@
-
-crc32sum: $(CRC32SUM_STAMP_DIR) $(CRC32SUM_LOG_DIR) $(STAGING_DIR)/bin/crc32sum
-
-crc32sum-clean:
- @ $(MAKE) -C $(CRC32SUM_SRC_DIR) clean > /dev/null 2>&1
-
-crc32sum-distclean:
- @ rm -rf $(CRC32SUM_DIR)/*
-
-crc32sum-bom:
- echo "Package: crc32sum"
- echo "Source: $(CRC32SUM_URL)/$(CRC32SUM_SOURCE)"
- echo ""
Index: buildrom-devel/packages/fwsig/fwsig.c
===================================================================
--- buildrom-devel.orig/packages/fwsig/fwsig.c 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,133 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#define FIRMWARE_SIG_OFFSET 0xffc0
-#define FIRMWARE_SIG_SIZE 16
-
-void usage(void) {
- printf("usage: <file> [sig]\n");
- printf("- Read or write the firmware signature of the file.\n");
- printf("- if no signature is provided, then read it from the file.\n");
- printf("- otherwise, write it into the file.\n");
-}
-
-int openfile(const char *filename, int flags) {
-
- int fd = open(filename, O_RDONLY);
- struct stat s;
-
- if (fd == -1) {
- printf("Couldn't open %s for reading.\n", filename);
- return -1;
- }
-
- if (fstat(fd, &s)) {
- printf("Couldn't stat %s\n", filename);
- goto error;
- }
-
- if (s.st_size < (FIRMWARE_SIG_OFFSET + FIRMWARE_SIG_SIZE)) {
- printf("Oops - %s is too small for this operation.\n", filename);
- goto error;
- }
-
- return fd;
-
- error:
- close(fd);
- return -1;
-}
-
-int read_sig(const char *filename) {
-
- int ret;
- int fd = openfile(filename, O_RDONLY);
- char sig[FIRMWARE_SIG_SIZE + 1];
-
- if (fd == -1)
- return -1;
-
- ret = lseek(fd, FIRMWARE_SIG_OFFSET, SEEK_SET);
-
- if (ret == -1) {
- printf("Couldn't seek to %d in %s\n", FIRMWARE_SIG_OFFSET, filename);
- goto error;
- }
-
- memset(sig, 0, FIRMWARE_SIG_SIZE + 1);
- ret = read(fd, sig, FIRMWARE_SIG_SIZE);
-
- if (ret == 0)
- printf("%s: "%16s"\n", filename, sig);
- else
- printf("Error while reading the signature.\n");
-
- error:
- close(fd);
- return ret;
-}
-
-int write_sig(const char *filename, const char *sig) {
-
- int ret;
- char temp[FIRMWARE_SIG_SIZE + 1];
- int fd = openfile(filename, O_RDONLY);
- int i;
-
- if (fd == -1)
- return -1;
-
- ret = lseek(fd, FIRMWARE_SIG_OFFSET, SEEK_SET);
-
- if (ret == -1) {
- printf("Couldn't seek to %d in %s\n", FIRMWARE_SIG_OFFSET, filename);
- goto error;
- }
-
- strncpy(temp, sig, FIRMWARE_SIG_SIZE);
-
- if (strlen(sig) < FIRMWARE_SIG_SIZE) {
- printf("*** WARNING - the firmware signature is less then %d bytes.\n", FIRMWARE_SIG_SIZE);
- printf(" It will be padded - this may not have the inteded effect you want.\n");
-
-
- for(i = strlen(sig); i < FIRMWARE_SIG_SIZE; i++)
- temp[i] = ' ';
-
- temp[i] = 0;
- }
- else if (strlen(sig) > FIRMWARE_SIG_SIZE) {
- printf("*** WARNING - the firmware signature is less then %d bytes.\n", FIRMWARE_SIG_SIZE);
- printf(" It will be truncated - this may not have the inteded effect you want.\n");
- temp[FIRMWARE_SIG_SIZE] = 0;
- }
-
- ret = write(fd, sig, FIRMWARE_SIG_SIZE);
-
- if (ret)
- printf("Error while writing the signature.\n");
-
- error:
- close(fd);
- return ret;
-}
-
-int main(int argc, char **argv) {
-
- int ret = 1;
-
- if (argc < 2)
- usage();
- else if (argc == 2)
- ret = read_sig(argv[1]);
- else
- ret = write_sig(argv[1], argv[2]);
-
- return ret;
-}
-
-
Index: buildrom-devel/packages/linuxbios/cache.patch
===================================================================
--- buildrom-devel.orig/packages/linuxbios/cache.patch 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,14 +0,0 @@
-Index: LinuxBIOSv2/src/arch/i386/init/crt0.S.lb
-===================================================================
---- LinuxBIOSv2.orig/src/arch/i386/init/crt0.S.lb 2006-08-28 11:24:58.000000000 -0600
-+++ LinuxBIOSv2/src/arch/i386/init/crt0.S.lb 2006-08-28 15:18:04.000000000 -0600
-@@ -65,6 +65,9 @@
-
- cld /* clear direction flag */
-
-+ /* Invalidate the cache (if they are enabled) */
-+ wbinvd
-+
- /* copy linuxBIOS from it's initial load location to
- * the location it is compiled to run at.
- * Normally this is copying from FLASH ROM to RAM.
Index: buildrom-devel/packages/linuxbios/dcon-detect.patch
===================================================================
--- buildrom-devel.orig/packages/linuxbios/dcon-detect.patch 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,80 +0,0 @@
-diff --git a/src/mainboard/olpc/rev_a/mainboard.c b/src/mainboard/olpc/rev_a/mainboard.c
-index d23255b..05abbfa 100755
---- a/src/mainboard/olpc/rev_a/mainboard.c
-+++ b/src/mainboard/olpc/rev_a/mainboard.c
-@@ -6,6 +6,67 @@ #include <device/pci_ops.h>
- #include <arch/io.h>
- #include <pc80/mc146818rtc.h>
- #include "chip.h"
-+#include "../southbridge/amd/cs5536/cs5536_smbus2.h"
-+
-+/* Borrowed from mc146818rtc.c */
-+
-+#define CMOS_READ(addr) ({ \
-+ outb((addr),RTC_PORT(0)); \
-+ inb(RTC_PORT(1)); \
-+ })
-+
-+#define CMOS_WRITE(val, addr) ({ \
-+ outb((addr),RTC_PORT(0)); \
-+ outb((val),RTC_PORT(1)); \
-+ })
-+
-+static void write_bit(unsigned char val) {
-+
-+ unsigned char byte = CMOS_READ(440 / 8);
-+
-+ /* Don't change it if its already set */
-+
-+ if ((byte & 1) == (val & 1))
-+ return;
-+
-+ byte &= ~1;
-+ byte |= val & 1;
-+ CMOS_WRITE(val, 440/8);
-+}
-+
-+static unsigned short _getsmbusbase(void) {
-+ unsigned devfn = PCI_DEVFN(0xf, 0);
-+ device_t dev = dev_find_slot(0x0, devfn);
-+ unsigned long addr = pci_read_config32(dev, PCI_BASE_ADDRESS_0);
-+
-+ return (unsigned short) (addr & ~1);
-+}
-+
-+static void init_dcon(void) {
-+
-+ int ret = 1;
-+ unsigned short rev = 0;
-+ unsigned short iobase = _getsmbusbase();
-+
-+ printk_debug("CHECKING FOR DCON (%x)\n", iobase);
-+
-+ /* Get the IO base for the SMBUS */
-+
-+ rev = do_smbus_read_word(iobase, 0x0D << 1, 0x00);
-+
-+ if (rev & 0xDC00) {
-+ printk_debug("DCON FOUND - REV %x\n", rev);
-+
-+ /* Enable the DCON */
-+ ret = do_smbus_write_word(iobase, 0x0D << 1, 0x01, 0x0069);
-+ if (ret != 0)
-+ printk_debug("DCON ENABLE FAILED\n", ret);
-+ }
-+ else
-+ printk_debug("DCON NOT FOUND (%x)\n", rev);
-+
-+ write_bit(rev > 0 ? 1 : 0);
-+}
-
- // indexed access to EC registers
- #define EC_INDEX(n) (0x380 + (n))
-@@ -98,6 +159,7 @@ #define EC_3700_SIGNATURE 0xa0
- }
- #endif
-
-+ init_dcon();
- printk_debug("OLPC REVA EXIT %s\n", __FUNCTION__);
- }
-
Index: buildrom-devel/packages/linuxbios/fix.patch
===================================================================
--- buildrom-devel.orig/packages/linuxbios/fix.patch 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,56 +0,0 @@
-diff --git a/src/southbridge/amd/cs5536/cs5536.c b/src/southbridge/amd/cs5536/cs5536.c
-index 3e6f96b..6c0c8c0 100755
---- a/src/southbridge/amd/cs5536/cs5536.c
-+++ b/src/southbridge/amd/cs5536/cs5536.c
-@@ -90,6 +90,29 @@ static unsigned char ec_inb(unsigned sho
- return inb(EC_INDEX(3));
- }
-
-+#define EC_3920_SIGNATURE 0x09
-+
-+static unsigned char eccmd(unsigned char command) {
-+
-+ unsigned char ret;
-+
-+ if ((ret = inb(0x6c)) & 1)
-+ ret = inb(0x68);
-+
-+ /* Write the command */
-+ outb(command, 0x6C);
-+
-+ /* Wait for the EC response */
-+ while((inb(0x6C) & 3) != 1);
-+
-+ /* get the response */
-+ ret = inb(0x68);
-+
-+ /* Clear the "ownership flag" */
-+ outb(0xFF, 0x6C);
-+ return ret;
-+}
-+
- static void southbridge_init(struct device *dev)
- {
- struct southbridge_amd_cs5536_config *sb = (struct southbridge_amd_cs5536_config *)dev->chip_info;
-@@ -107,13 +130,15 @@ static void southbridge_init(struct devi
- setup_i8259();
-
- if (sb->lpc_serirq_enable) {
-+ int ret;
- msr.lo = sb->lpc_serirq_enable;
--#if 0 // Not Yet
--#define EC_3700_SIGNATURE 0xa0
-- if (ec_inb(0xff00) == EC_3700_SIGNATURE) {
-- msr.lo |= 0x40; // Set quiet mode bit
-- }
--#endif
-+
-+ /* Get the HW version */
-+ ret = eccmd(0x09);
-+
-+ if (ret != EC_3920_SIGNATURE)
-+ msr.lo |= 0x40;
-+
- msr.hi = 0;
- wrmsr(MDD_LPC_SIRQ, msr);
- }
Index: buildrom-devel/packages/linuxbios/linuxbios-olpc.mk
===================================================================
--- buildrom-devel.orig/packages/linuxbios/linuxbios-olpc.mk 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,64 +0,0 @@
-# This is the OLPC LinuxBIOS target
-
-ifeq ($(CONFIG_PLATFORM),y)
-ifeq ($(LINUXBIOS_TAG),)
-$(error You need to specify a version to pull in your platform config)
-endif
-endif
-
-LINUXBIOS_ROM_FILENAME=olpc-$(FIRMWARE_REVISION)$(LINUXBIOS_CL2_MARKER).rom
-LINUXBIOS_FETCHSH=$(BIN_DIR)/fetchgit.sh
-LINUXBIOS_BASE_DIR=git
-LINUXBIOS_URL=git://dev.laptop.org/projects/linuxbios
-LINUXBIOS_TARBALL=linuxbios-git-$(LINUXBIOS_TAG).tar.gz
-LINUXBIOS_PAYLOAD_TARGET = /tmp/olpcpayload.elf
-LINUXBIOS_VSA=$(PACKAGE_DIR)/bin/olpc_vsa.64k.bin
-
-MANUFACTURER_STRING = `printf "%-6s%-7s%-3s" $(FIRMWARE_MODEL) $(FIRMWARE_REVISION) $(FIRMWARE_REV2)`
-
-ifeq ($(_LINUXBIOS_INC_),)
-include $(PACKAGE_DIR)/linuxbios/linuxbios.inc
-endif
-
-$(SOURCE_DIR)/$(LINUXBIOS_TARBALL):
- @ echo "Fetching the LinuxBIOS code..."
- @ mkdir -p $(SOURCE_DIR)/linuxbios
- @ $(BIN_DIR)/fetchgit.sh $(LINUXBIOS_URL) $(SOURCE_DIR)/linuxbios \
- $(LINUXBIOS_TAG) $(SOURCE_DIR)/$(LINUXBIOS_TARBALL) \
- > $(LINUXBIOS_FETCH_LOG) 2>&1
-
-ifeq ($(EC_FIRMWARE_OVERRIDE),)
-$(LINUXBIOS_STAMP_DIR)/.pull_ecf_$(EC_FIRMWARE_REV):
- @ echo "Fetching the EC bits..."
- @ wget -N -P $(LINUXBIOS_BUILD_DIR) $(EC_FIRMWARE_URL)/$(EC_FIRMWARE_REV)
- @ wget -N -P $(LINUXBIOS_BUILD_DIR) $(EC_FIRMWARE_URL)/MD5SUMS
- @ if [ "`md5sum $(LINUXBIOS_BUILD_DIR)/$(EC_FIRMWARE_REV) |cut -d' ' -f1`" != "`grep $(EC_FIRMWARE_REV) $(LINUXBIOS_BUILD_DIR)/MD5SUMS | cut -d' ' -f1`" ]; then echo "ERROR! EC firmware hash does not match"; exit 1; fi
- @ echo "EC Bits fetched and verified"
- @ touch $@
-else
-$(LINUXBIOS_STAMP_DIR)/.pull_ecf_$(EC_FIRMWARE_REV):
- @ echo "EC_FIRMWARE_OVERRIDE active so using custom EC bits from $(EC_FIRMWARE_OVERRIDE)"
- @ cp -f $(PACKAGE_DIR)/bin/$(EC_FIRMWARE_OVERRIDE) $(LINUXBIOS_BUILD_DIR)/$(EC_FIRMWARE_REV)
- @ touch $@
-endif
-
-
-$(OUTPUT_DIR)/$(OLPC_ROM_FILENAME).nosig: $(LINUXBIOS_OUTPUT) $(LINUXBIOS_STAMP_DIR)/.pull_ecf_$(EC_FIRMWARE_REV)
- @ echo "Creating FIRMWARE_REVISON = $(FIRMWARE_REVISION) ROM and md5 files"
- @ cat $(LINUXBIOS_BUILD_DIR)/$(EC_FIRMWARE_REV) $(LINUXBIOS_VSA) \
- $(LINUXBIOS_BUILD_DIR)/$(LINUXBIOS_OUTPUT) > $@
-
-$(OUTPUT_DIR)/$(LINUXBIOS_ROM_FILENAME): $(OUTPUT_DIR)/$(OLPC_ROM_FILENAME).nosig
- @ $(BIN_DIR)/setsig.sh $< "$(MANUFACTURER_STRING)" $@
- @ $(STAGING_DIR)/bin/crc32sum -a $@ > $(LINUXBIOS_BUILD_LOG)
- @ md5sum $@ | cut -d ' ' -f 1 > $(OUTPUT_DIR)/$(LINUXBIOS_ROM_FILENAME).md5
-
-
-olpc-linuxbios: $(OUTPUT_DIR)/$(LINUXBIOS_ROM_FILENAME)
-olpc-linuxbios-clean: generic-linuxbios-clean
- @ rm -f $(LINUXBIOS_STAMP_DIR)/.pull_ecf_$(EC_FIRMWARE_REV)
- @ rm -f $(LINUXBIOS_BUILD_DIR)/$(EC_FIRMWARE_REV) \
- $(LINUXBIOS_BUILD_DIR)/MD5SUMS
-
-olpc-linuxbios-distclean: generic-linuxbios-distclean
-
Index: buildrom-devel/packages/linuxbios/linuxbios.mk
===================================================================
--- buildrom-devel.orig/packages/linuxbios/linuxbios.mk 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,171 +0,0 @@
-# LinuxBIOS build script
-
-ifeq ($(LINUXBIOS_VENDOR),)
-LINUXBIOS_VENDOR=olpc
-endif
-ifeq ($(LINUXBIOS_BOARD),)
-LINUXBIOS_BOARD=rev_a
-endif
-ifeq ($(LINUXBIOS_CONFIG),)
-LINUXBIOS_CONFIG=Config.SPI.lb
-endif
-ifeq ($(LINUXBIOS_TDIR),)
-LINUXBIOS_TDIR=rev_a_1M
-endif
-ifeq ($(LINUXBIOS_FETCH),)
-LINUXBIOS_FETCH=git
-endif
-
-LINUXBIOS_PATCHES =
-
-ifeq ($(PAYLOAD_LAB),y)
-LINUXBIOS_PATCHES += $(PACKAGE_DIR)/linuxbios/dcon-detect.patch
-endif
-
-ifeq ($(LINUXBIOS_ENABLE_LZMA),y)
-LINUXBIOS_PATCHES += $(PACKAGE_DIR)/linuxbios/lzma-config.patch
-endif
-
-ifeq ($(LINUXBIOS_CAS25),y)
-LINUXBIOS_PATCHES += $(PACKAGE_DIR)/linuxbios/CL2.5.patch
-LINUXBIOS_CL2_MARKER=_CL2.5
-endif
-
-EC_FIRMWARE_URL=
http://dev.laptop.org/pub/ec
-
-ifeq ($(EC_FIRMWARE_OVERRIDE),)
-EC_FIRMWARE_REV=ec_v$(EC_VER).img
-else
-EC_FIRMWARE_REV=$(EC_FIRMWARE_OVERRIDE)
-endif
-
-LINUXBIOS_ROM_FILENAME=olpc-$(FIRMWARE_REVISION)$(LINUXBIOS_CL2_MARKER).rom
-
-LINUXBIOS_DIR=$(BUILD_DIR)/linuxbios
-
-LINUXBIOS_TARGET_DIR=$(LINUXBIOS_SRC_DIR)/targets/
-LINUXBIOS_TARGET_NAME=$(LINUXBIOS_VENDOR)/$(LINUXBIOS_BOARD)
-LINUXBIOS_CONFIG_NAME=$(LINUXBIOS_TARGET_NAME)/$(LINUXBIOS_CONFIG)
-LINUXBIOS_BUILD_DIR=$(LINUXBIOS_TARGET_DIR)/$(LINUXBIOS_TARGET_NAME)/$(LINUXBIOS_TDIR)
-
-# Choose the right variables to use based on our fetch method
-
-ifeq ($(LINUXBIOS_FETCH),git)
-LINUXBIOS_FETCHSH=$(BIN_DIR)/fetchgit.sh
-LINUXBIOS_SRC_DIR=$(LINUXBIOS_DIR)/git
-LINUXBIOS_TAG=$(LINUXBIOS_GIT_TAG)
-LINUXBIOS_URL=$(LINUXBIOS_GIT_URL)
-else
-LINUXBIOS_FETCHSH=$(BIN_DIR)/fetchsvn.sh
-LINUXBIOS_SRC_DIR=$(LINUXBIOS_DIR)/svn
-LINUXBIOS_TAG=$(LINUXBIOS_SVN_TAG)
-LINUXBIOS_URL=$(LINUXBIOS_SVN_URL)
-endif
-
-ifeq ($(LINUXBIOS_TAG),)
-$(error LINUXBIOS_TAG was not defined. Check your Config.mk)
-endif
-
-ifeq ($(LINUXBIOS_URL),)
-$(error LINUXBIOS_URL was not defined. Check your Config.mk)
-endif
-
-LINUXBIOS_TARBALL=linuxbios-$(LINUXBIOS_FETCH)-$(LINUXBIOS_TAG).tar.gz
-
-LINUXBIOS_STAMP_DIR=$(LINUXBIOS_DIR)/stamps
-LINUXBIOS_LOG_DIR=$(LINUXBIOS_DIR)/logs
-
-ifeq ($(VERBOSE),y)
-LINUXBIOS_FETCH_LOG=/dev/stdout
-LINUXBIOS_CONFIG_LOG=/dev/stdout
-LINUXBIOS_BUILD_LOG=/dev/stdout
-LINUXBIOS_INSTALL_LOG=/dev/stdout
-else
-LINUXBIOS_FETCH_LOG=$(LINUXBIOS_LOG_DIR)/fetch.log
-LINUXBIOS_BUILD_LOG=$(LINUXBIOS_LOG_DIR)/build.log
-LINUXBIOS_CONFIG_LOG=$(LINUXBIOS_LOG_DIR)/config.log
-LINUXBIOS_INSTALL_LOG=$(LINUXBIOS_LOG_DIR)/install.log
-endif
-
-# Build the manufacturer string from the firmware model and revision
-
-FIRMWARE_REV2 = $(shell echo $(FIRMWARE_REVISION) | awk '{print substr($$1,0,3)}')
-MANUFACTURER_STRING = `printf "%-6s%-7s%-3s" $(FIRMWARE_MODEL) $(FIRMWARE_REVISION) $(FIRMWARE_REV2)`
-
-# fix me sooner or later!
-/tmp/olpcpayload.elf: $(PAYLOAD_TARGET)
- @ cp $< $@
-
-$(SOURCE_DIR)/$(LINUXBIOS_TARBALL):
- @ echo "Fetching the LinuxBIOS code..."
- @ mkdir -p $(SOURCE_DIR)/linuxbios
- @ $(LINUXBIOS_FETCHSH) $(LINUXBIOS_URL) $(SOURCE_DIR)/linuxbios \
- $(LINUXBIOS_TAG) $(SOURCE_DIR)/$(LINUXBIOS_TARBALL) \
- > $(LINUXBIOS_FETCH_LOG) 2>&1
-
-$(LINUXBIOS_STAMP_DIR)/.unpacked: $(SOURCE_DIR)/$(LINUXBIOS_TARBALL)
- @ echo "Unpacking LinuxBIOS..."
- @ tar -C $(LINUXBIOS_DIR) -zxf $(SOURCE_DIR)/$(LINUXBIOS_TARBALL)
- @ touch $@
-
-$(LINUXBIOS_STAMP_DIR)/.patched: $(LINUXBIOS_STAMP_DIR)/.unpacked
- @ echo "Patching LinuxBIOS..."
- @ $(BIN_DIR)/doquilt.sh $(LINUXBIOS_SRC_DIR) $(LINUXBIOS_PATCHES)
- @ touch $@
-
-$(LINUXBIOS_STAMP_DIR)/.configured: $(LINUXBIOS_STAMP_DIR)/.patched
- @ echo "Building target config file..."
- @( cd $(LINUXBIOS_TARGET_DIR); \
- ./buildtarget $(LINUXBIOS_CONFIG_NAME) > $(LINUXBIOS_CONFIG_LOG) 2>&1)
- @ touch $@
-
-ifeq ($(EC_FIRMWARE_OVERRIDE),)
-$(LINUXBIOS_STAMP_DIR)/.pull_ecf_$(EC_FIRMWARE_REV):
- @ echo "Fetching the EC bits..."
- @ wget -N -P $(LINUXBIOS_BUILD_DIR) $(EC_FIRMWARE_URL)/$(EC_FIRMWARE_REV)
- @ wget -N -P $(LINUXBIOS_BUILD_DIR) $(EC_FIRMWARE_URL)/MD5SUMS
- @ if [ "`md5sum $(LINUXBIOS_BUILD_DIR)/$(EC_FIRMWARE_REV) |cut -d' ' -f1`" != "`grep $(EC_FIRMWARE_REV) $(LINUXBIOS_BUILD_DIR)/MD5SUMS | cut -d' ' -f1`" ]; then echo "ERROR! EC firmware hash does not match"; exit 1; fi
- @ echo "EC Bits fetched and verified"
- @ touch $@
-else
-$(LINUXBIOS_STAMP_DIR)/.pull_ecf_$(EC_FIRMWARE_REV):
- @ echo "EC_FIRMWARE_OVERRIDE active so using custom EC bits from $(EC_FIRMWARE_OVERRIDE)"
- @ cp -f $(PACKAGE_DIR)/bin/$(EC_FIRMWARE_OVERRIDE) $(LINUXBIOS_BUILD_DIR)/$(EC_FIRMWARE_REV)
- @ touch $@
-endif
-
-$(LINUXBIOS_BUILD_DIR)/$(LINUXBIOS_ROM_FILENAME): $(LINUXBIOS_STAMP_DIR)/.configured /tmp/olpcpayload.elf
- @ echo "Building linuxbios..."
- @ make -C $(LINUXBIOS_BUILD_DIR) > $(LINUXBIOS_BUILD_LOG) 2>&1
-
-$(LINUXBIOS_BUILD_DIR)/$(LINUXBIOS_ROM_FILENAME).nosig: $(LINUXBIOS_BUILD_DIR)/$(LINUXBIOS_ROM_FILENAME) $(LINUXBIOS_STAMP_DIR)/.pull_ecf_$(EC_FIRMWARE_REV)
- @ echo "Creating FIRMWARE_REVISON = $(FIRMWARE_REVISION) ROM and md5 files"
- @ cat $(LINUXBIOS_BUILD_DIR)/$(EC_FIRMWARE_REV) $(PACKAGE_DIR)/bin/olpc_vsa.64k.bin $(LINUXBIOS_BUILD_DIR)/linuxbios.rom > $@
-
-$(OUTPUT_DIR)/$(LINUXBIOS_ROM_FILENAME): $(LINUXBIOS_BUILD_DIR)/$(LINUXBIOS_ROM_FILENAME).nosig
- @ $(BIN_DIR)/setsig.sh $< "$(MANUFACTURER_STRING)" $@
- @ $(STAGING_DIR)/bin/crc32sum -a $@ > $(LINUXBIOS_BUILD_LOG)
- @ md5sum $@ | cut -d ' ' -f 1 > $(OUTPUT_DIR)/$(LINUXBIOS_ROM_FILENAME).md5
-
-$(LINUXBIOS_STAMP_DIR) $(LINUXBIOS_LOG_DIR):
- @ mkdir -p $@
-
-linuxbios: $(LINUXBIOS_STAMP_DIR) $(LINUXBIOS_LOG_DIR) $(OUTPUT_DIR)/$(LINUXBIOS_ROM_FILENAME)
-
-linuxbios-clean:
- @ echo "Cleaning linuxbios..."
- @ $(MAKE) -C $(LINUXBIOS_BUILD_DIR) clean > /dev/null 2>&1
- @ rm -f $(LINUXBIOS_STAMP_DIR)/.pull_ecf_$(EC_FIRMWARE_REV)
- @ rm -f $(LINUXBIOS_BUILD_DIR)/$(EC_FIRMWARE_REV) \
- $(LINUXBIOS_BUILD_DIR)/MD5SUMS
-
-linuxbios-distclean:
- @ rm -rf $(LINUXBIOS_DIR)/*
-
-linuxbios-bom:
- @ echo "Package: linuxbios"
- @ echo "Source: $(LINUXBIOS_URL)"
- @ echo "Revison: $(LINUXBIOS_TAG)"
- @ echo "Tarball: `basename $(LINUXBIOS_TARBALL)"
- @ echo ""
-
Index: buildrom-devel/packages/linuxbios/lzma-config.patch
===================================================================
--- buildrom-devel.orig/packages/linuxbios/lzma-config.patch 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,15 +0,0 @@
-Index: LinuxBIOSv2/targets/olpc/rev_a/Config.SPI.lb
-===================================================================
---- LinuxBIOSv2.orig/targets/olpc/rev_a/Config.SPI.lb 2006-09-15 11:54:44.000000000 -0600
-+++ LinuxBIOSv2/targets/olpc/rev_a/Config.SPI.lb 2006-09-15 11:55:04.000000000 -0600
-@@ -5,8 +5,8 @@
-
- # Don't let LinuxBIOS compress the payload
- #option CONFIG_COMPRESSED_ROM_STREAM_NRV2B=0
--#option CONFIG_COMPRESSED_ROM_STREAM_LZMA=1
--#option CONFIG_PRECOMPRESSED_ROM_STREAM=0
-+option CONFIG_COMPRESSED_ROM_STREAM_LZMA=1
-+option CONFIG_PRECOMPRESSED_ROM_STREAM=1
-
- # leave 64k for vsa and 64k for EC code
- option ROM_SIZE=(1024*1024)-(64*1024)-(64*1024)
Index: buildrom-devel/packages/linuxbios/olpc-linuxbios.mk
===================================================================
--- buildrom-devel.orig/packages/linuxbios/olpc-linuxbios.mk 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,65 +0,0 @@
-# This is the OLPC LinuxBIOS target
-
-ifeq ($(CONFIG_PLATFORM),y)
-ifeq ($(LINUXBIOS_TAG),)
-$(error You need to specify a version to pull in your platform config)
-endif
-endif
-
-TARGET_ROM=olpc-$(FIRMWARE_REVISION)$(LINUXBIOS_CL2_MARKER).rom
-LINUXBIOS_FETCHSH=$(BIN_DIR)/fetchgit.sh
-LINUXBIOS_BASE_DIR=git
-LINUXBIOS_URL=git://dev.laptop.org/projects/linuxbios
-LINUXBIOS_TARBALL=linuxbios-git-$(LINUXBIOS_TAG).tar.gz
-LINUXBIOS_PAYLOAD_TARGET = /tmp/olpcpayload.elf
-LINUXBIOS_VSA=$(PACKAGE_DIR)/bin/olpc_vsa.64k.bin
-
-MANUFACTURER_STRING = `printf "%-6s%-7s%-3s" $(FIRMWARE_MODEL) $(FIRMWARE_REVISION) $(FIRMWARE_REV2)`
-
-ifeq ($(CONFIG_USE_LZMA),y)
-LINUXBIOS_PATCHES += $(PACKAGE_DIR)/linuxbios/patches/lzma-config.patch
-endif
-
-include $(PACKAGE_DIR)/linuxbios/linuxbios.inc
-
-$(SOURCE_DIR)/$(LINUXBIOS_TARBALL):
- @ echo "Fetching the LinuxBIOS code..."
- @ mkdir -p $(SOURCE_DIR)/linuxbios
- @ $(BIN_DIR)/fetchgit.sh $(LINUXBIOS_URL) $(SOURCE_DIR)/linuxbios \
- $(LINUXBIOS_TAG) $(SOURCE_DIR)/$(LINUXBIOS_TARBALL) \
- > $(LINUXBIOS_FETCH_LOG) 2>&1
-
-ifeq ($(EC_FIRMWARE_OVERRIDE),)
-$(LINUXBIOS_STAMP_DIR)/.pull_ecf_$(EC_FIRMWARE_REV):
- @ echo "Fetching the EC bits..."
- @ wget -N -P $(LINUXBIOS_BUILD_DIR) $(EC_FIRMWARE_URL)/$(EC_FIRMWARE_REV)
- @ wget -N -P $(LINUXBIOS_BUILD_DIR) $(EC_FIRMWARE_URL)/MD5SUMS
- @ if [ "`md5sum $(LINUXBIOS_BUILD_DIR)/$(EC_FIRMWARE_REV) |cut -d' ' -f1`" != "`grep $(EC_FIRMWARE_REV) $(LINUXBIOS_BUILD_DIR)/MD5SUMS | cut -d' ' -f1`" ]; then echo "ERROR! EC firmware hash does not match"; exit 1; fi
- @ echo "EC Bits fetched and verified"
- @ touch $@
-else
-$(LINUXBIOS_STAMP_DIR)/.pull_ecf_$(EC_FIRMWARE_REV):
- @ echo "EC_FIRMWARE_OVERRIDE active so using custom EC bits from $(EC_FIRMWARE_OVERRIDE)"
- @ cp -f $(PACKAGE_DIR)/bin/$(EC_FIRMWARE_OVERRIDE) $(LINUXBIOS_BUILD_DIR)/$(EC_FIRMWARE_REV)
- @ touch $@
-endif
-
-
-$(OUTPUT_DIR)/$(OLPC_ROM_FILENAME).nosig: $(LINUXBIOS_OUTPUT) $(LINUXBIOS_STAMP_DIR)/.pull_ecf_$(EC_FIRMWARE_REV)
- @ echo "Creating FIRMWARE_REVISON = $(FIRMWARE_REVISION) ROM and md5 files"
- @ cat $(LINUXBIOS_BUILD_DIR)/$(EC_FIRMWARE_REV) $(LINUXBIOS_VSA) \
- $(LINUXBIOS_BUILD_DIR)/$(LINUXBIOS_OUTPUT) > $@
-
-$(TARGET_ROM): $(OUTPUT_DIR)/$(OLPC_ROM_FILENAME).nosig
- @ $(BIN_DIR)/setsig.sh $< "$(MANUFACTURER_STRING)" $@
- @ $(STAGING_DIR)/bin/crc32sum -a $@ > $(LINUXBIOS_BUILD_LOG)
- @ md5sum $@ | cut -d ' ' -f 1 > $(OUTPUT_DIR)/$(LINUXBIOS_ROM_FILENAME).md5
-
-linuxbios: $(OUTPUT_DIR)/$(TARGET_ROM)
-linuxbios-clean: generic-linuxbios-clean
- @ rm -f $(LINUXBIOS_STAMP_DIR)/.pull_ecf_$(EC_FIRMWARE_REV)
- @ rm -f $(LINUXBIOS_BUILD_DIR)/$(EC_FIRMWARE_REV) \
- $(LINUXBIOS_BUILD_DIR)/MD5SUMS
-
-linuxbios-distclean: generic-linuxbios-distclean
-
Index: buildrom-devel/packages/linuxbios/patches/cache.patch
===================================================================
--- buildrom-devel.orig/packages/linuxbios/patches/cache.patch 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,14 +0,0 @@
-Index: LinuxBIOSv2/src/arch/i386/init/crt0.S.lb
-===================================================================
---- LinuxBIOSv2.orig/src/arch/i386/init/crt0.S.lb 2006-08-28 11:24:58.000000000 -0600
-+++ LinuxBIOSv2/src/arch/i386/init/crt0.S.lb 2006-08-28 15:18:04.000000000 -0600
-@@ -65,6 +65,9 @@
-
- cld /* clear direction flag */
-
-+ /* Invalidate the cache (if they are enabled) */
-+ wbinvd
-+
- /* copy linuxBIOS from it's initial load location to
- * the location it is compiled to run at.
- * Normally this is copying from FLASH ROM to RAM.
Index: buildrom-devel/packages/linuxbios/patches/dcon-detect.patch
===================================================================
--- buildrom-devel.orig/packages/linuxbios/patches/dcon-detect.patch 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,80 +0,0 @@
-diff --git a/src/mainboard/olpc/rev_a/mainboard.c b/src/mainboard/olpc/rev_a/mainboard.c
-index d23255b..05abbfa 100755
---- a/src/mainboard/olpc/rev_a/mainboard.c
-+++ b/src/mainboard/olpc/rev_a/mainboard.c
-@@ -6,6 +6,67 @@ #include <device/pci_ops.h>
- #include <arch/io.h>
- #include <pc80/mc146818rtc.h>
- #include "chip.h"
-+#include "../southbridge/amd/cs5536/cs5536_smbus2.h"
-+
-+/* Borrowed from mc146818rtc.c */
-+
-+#define CMOS_READ(addr) ({ \
-+ outb((addr),RTC_PORT(0)); \
-+ inb(RTC_PORT(1)); \
-+ })
-+
-+#define CMOS_WRITE(val, addr) ({ \
-+ outb((addr),RTC_PORT(0)); \
-+ outb((val),RTC_PORT(1)); \
-+ })
-+
-+static void write_bit(unsigned char val) {
-+
-+ unsigned char byte = CMOS_READ(440 / 8);
-+
-+ /* Don't change it if its already set */
-+
-+ if ((byte & 1) == (val & 1))
-+ return;
-+
-+ byte &= ~1;
-+ byte |= val & 1;
-+ CMOS_WRITE(val, 440/8);
-+}
-+
-+static unsigned short _getsmbusbase(void) {
-+ unsigned devfn = PCI_DEVFN(0xf, 0);
-+ device_t dev = dev_find_slot(0x0, devfn);
-+ unsigned long addr = pci_read_config32(dev, PCI_BASE_ADDRESS_0);
-+
-+ return (unsigned short) (addr & ~1);
-+}
-+
-+static void init_dcon(void) {
-+
-+ int ret = 1;
-+ unsigned short rev = 0;
-+ unsigned short iobase = _getsmbusbase();
-+
-+ printk_debug("CHECKING FOR DCON (%x)\n", iobase);
-+
-+ /* Get the IO base for the SMBUS */
-+
-+ rev = do_smbus_read_word(iobase, 0x0D << 1, 0x00);
-+
-+ if (rev & 0xDC00) {
-+ printk_debug("DCON FOUND - REV %x\n", rev);
-+
-+ /* Enable the DCON */
-+ ret = do_smbus_write_word(iobase, 0x0D << 1, 0x01, 0x0069);
-+ if (ret != 0)
-+ printk_debug("DCON ENABLE FAILED\n", ret);
-+ }
-+ else
-+ printk_debug("DCON NOT FOUND (%x)\n", rev);
-+
-+ write_bit(rev > 0 ? 1 : 0);
-+}
-
- // indexed access to EC registers
- #define EC_INDEX(n) (0x380 + (n))
-@@ -98,6 +159,7 @@ #define EC_3700_SIGNATURE 0xa0
- }
- #endif
-
-+ init_dcon();
- printk_debug("OLPC REVA EXIT %s\n", __FUNCTION__);
- }
-
Index: buildrom-devel/packages/linuxbios/patches/disable_swapsifs.patch
===================================================================
--- buildrom-devel.orig/packages/linuxbios/patches/disable_swapsifs.patch 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,23 +0,0 @@
-Index: LinuxBIOSv2/src/cpu/amd/model_gx2/cpubug.c
-===================================================================
---- LinuxBIOSv2.orig/src/cpu/amd/model_gx2/cpubug.c 2006-08-29 08:44:01.000000000 -0600
-+++ LinuxBIOSv2/src/cpu/amd/model_gx2/cpubug.c 2006-08-29 08:45:21.000000000 -0600
-@@ -176,7 +176,7 @@
- wrmsr(0x3003, msr);
-
- /* change this value to zero if you need to disable this BTB SWAPSiF. */
-- if (1) {
-+ if (0) {
-
- /* Disable enable_actions in DIAGCTL while setting up GLCP */
- msr.hi = 0;
-@@ -373,7 +373,8 @@
- pcideadlock();
- eng1398();
- eng2900();
-- bug118339();
-+ /* Disabled because it freaks out FS2 */
-+ //bug118339();
- break;
- case 0x22:
- case 0x30:
Index: buildrom-devel/packages/linuxbios/patches/fix.patch
===================================================================
--- buildrom-devel.orig/packages/linuxbios/patches/fix.patch 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,56 +0,0 @@
-diff --git a/src/southbridge/amd/cs5536/cs5536.c b/src/southbridge/amd/cs5536/cs5536.c
-index 3e6f96b..6c0c8c0 100755
---- a/src/southbridge/amd/cs5536/cs5536.c
-+++ b/src/southbridge/amd/cs5536/cs5536.c
-@@ -90,6 +90,29 @@ static unsigned char ec_inb(unsigned sho
- return inb(EC_INDEX(3));
- }
-
-+#define EC_3920_SIGNATURE 0x09
-+
-+static unsigned char eccmd(unsigned char command) {
-+
-+ unsigned char ret;
-+
-+ if ((ret = inb(0x6c)) & 1)
-+ ret = inb(0x68);
-+
-+ /* Write the command */
-+ outb(command, 0x6C);
-+
-+ /* Wait for the EC response */
-+ while((inb(0x6C) & 3) != 1);
-+
-+ /* get the response */
-+ ret = inb(0x68);
-+
-+ /* Clear the "ownership flag" */
-+ outb(0xFF, 0x6C);
-+ return ret;
-+}
-+
- static void southbridge_init(struct device *dev)
- {
- struct southbridge_amd_cs5536_config *sb = (struct southbridge_amd_cs5536_config *)dev->chip_info;
-@@ -107,13 +130,15 @@ static void southbridge_init(struct devi
- setup_i8259();
-
- if (sb->lpc_serirq_enable) {
-+ int ret;
- msr.lo = sb->lpc_serirq_enable;
--#if 0 // Not Yet
--#define EC_3700_SIGNATURE 0xa0
-- if (ec_inb(0xff00) == EC_3700_SIGNATURE) {
-- msr.lo |= 0x40; // Set quiet mode bit
-- }
--#endif
-+
-+ /* Get the HW version */
-+ ret = eccmd(0x09);
-+
-+ if (ret != EC_3920_SIGNATURE)
-+ msr.lo |= 0x40;
-+
- msr.hi = 0;
- wrmsr(MDD_LPC_SIRQ, msr);
- }
Index: buildrom-devel/packages/linuxbios/patches/lzma-config.patch
===================================================================
--- buildrom-devel.orig/packages/linuxbios/patches/lzma-config.patch 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,15 +0,0 @@
-Index: LinuxBIOSv2/targets/olpc/rev_a/Config.SPI.lb
-===================================================================
---- LinuxBIOSv2.orig/targets/olpc/rev_a/Config.SPI.lb 2006-09-15 11:54:44.000000000 -0600
-+++ LinuxBIOSv2/targets/olpc/rev_a/Config.SPI.lb 2006-09-15 11:55:04.000000000 -0600
-@@ -5,8 +5,8 @@
-
- # Don't let LinuxBIOS compress the payload
- #option CONFIG_COMPRESSED_ROM_STREAM_NRV2B=0
--#option CONFIG_COMPRESSED_ROM_STREAM_LZMA=1
--#option CONFIG_PRECOMPRESSED_ROM_STREAM=0
-+option CONFIG_COMPRESSED_ROM_STREAM_LZMA=1
-+option CONFIG_PRECOMPRESSED_ROM_STREAM=1
-
- # leave 64k for vsa and 64k for EC code
- option ROM_SIZE=(1024*1024)-(64*1024)-(64*1024)
Index: buildrom-devel/packages/olpcflash/Makefile
===================================================================
--- buildrom-devel.orig/packages/olpcflash/Makefile 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,9 +0,0 @@
-CC=gcc
-CFLAGS_extra= -Wall
-LDFLAGS_extra=
-
-olpcflash: olpcflash.c
- $(CC) $(CFLAGS) $(CFLAGS_extra) $(LDFLAGS) $(LDFLAGS_extra) -o $@ olpcflash.c $(LIBS)
-
-clean:
- rm -f olpcflash
Index: buildrom-devel/packages/olpcflash/olpcflash.c
===================================================================
--- buildrom-devel.orig/packages/olpcflash/olpcflash.c 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,937 +0,0 @@
-/*
- * olpcflash.c: SPI Flash programming utility for OLPC.
- *
- * Copyright 2000 Silicon Integrated System Corporation
- * Copyright 2004 Tyan Corp
- * yhlu yhlu@tyan.com add exclude start and end option
- * Copyright 2005-2006 coresystems GmbH
- * Stefan Reinauer
stepan@coresystems.de added rom layout
- * support, and checking for suitable rom image, various fixes
- * support for flashing the Technologic Systems 5300.
- * Copyright 2006 Ron Minniich
rminnich@lanl.gov
- * Initial support for EnE KB3920 EC and the spansion
- * 25FL008A 8Mibit SPI part on the OLPC
- * Copyright 2006 Richard A. Smith
smithbone@gmail.com
- * Added lots of additional stuff to make writing to spansion part
- * work correctly with the OLPC EnE EC.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <sys/io.h>
-#include <sys/time.h>
-#include <time.h>
-
-#define printf_debug(x...) { if(verbose) printf(x); }
-#define printf_super_debug(x...) { if(verbose > 1) printf(x); }
-
-#define VER_MAJOR 0
-#define VER_MINOR 3
-#define VER_RELEASE 0
-
-#define LINUXBIOS_START 0x10000
-#define PAGE_SIZE 256
-#define EC_CODE_SIZE (64*1024)
-#define ROM_SIZE (1024*1024)
-#define IOBASE_DEFAULT (0x381)
-
-enum {
- GPIO5 = 0xfc2a,
- SPIA0 = 0xfea8,
- SPIA1,
- SPIA2,
- SPIDAT,
- SPICMD,
- SPICFG,
- SPIDATR
-};
-
-enum {
- DUMMY,
- WRITESTATUS = 1,
- BYTEPROGRAM,
- READ,
- WRITEDISABLE,
- READSTATUS,
- WRITEENABLE,
- HIGHSPEEDREAD = 0xb,
- SECTORERASESST = 0x20,
- ENABLEWRITESTATUSSST = 0x50,
- BLOCKERASESST = 0x52, /* 32k block */
- CHIPERASESST = 0x60,
- READJDECID = 0x9f,
- AUTOINCPROGSST = 0xad,
- CHIPERASEPCM = 0xc7, /* also nexflash */
- SECTORERASEPCM = 0xd7,
- BLOCKERASEPCM = 0xd8, /* also nexflash, and spansion, SST (64k) */
-};
-
-enum {
- SPIBUSY = 2,
- SPIFIRMWAREMODE = 1 << 4,
- SPICMDWE = 8,
- SPIFLASHREADCE = 1 << 6
-};
-
-enum {
- WIP = 1 << 0
-};
-
-enum {
- SPANSION = 0x01,
- SST = 0xbf,
- WINBOND = 0xef
-};
-
-struct flashchip {
- int manufacture_id;
- int model_type;
- int model_id;
-
- int total_size;
- int page_size;
-
- int (*write_page) (unsigned char *buf, unsigned long addr, unsigned long size);
-
-};
-
-char *chip_to_probe = NULL;
-
-int exclude_start_page, exclude_end_page;
-int force=0, verbose=0; int noop=0;
-
-/* this is the defaut index and data IO base address for
- * EC register access.
- * setup by the EC code.
- */
-
-unsigned short iobase = IOBASE_DEFAULT;
-
-// count to a billion. Time it. If it's < 1 sec, count to 10B, etc.
-unsigned long micro = 1;
-
-
-void myusec_delay(int time)
-{
- volatile unsigned long i;
- for (i = 0; i < time * micro; i++);
-}
-
-void myusec_calibrate_delay()
-{
- int count = 1000;
- unsigned long timeusec;
- struct timeval start, end;
- int ok = 0;
-
- printf_debug("Setting up microsecond timing loop\n");
- while (!ok) {
- gettimeofday(&start, 0);
- myusec_delay(count);
- gettimeofday(&end, 0);
- timeusec = 1000000 * (end.tv_sec - start.tv_sec) +
- (end.tv_usec - start.tv_usec);
- count *= 2;
- if (timeusec < 1000000 / 4)
- continue;
- ok = 1;
- }
-
- // compute one microsecond. That will be count / time
- micro = count / timeusec;
-
- printf_debug("%ldM loops per second\n", (unsigned long) micro);
-}
-
-
-void setecindex(unsigned short index)
-{
- unsigned char hi = index>>8;
- unsigned char lo = index;
-
- if (noop) return;
-
- outb(hi, iobase);
- outb(lo, iobase+1);
- printf_super_debug("%s: set 0x%x to 0x%x, 0x%x to 0x%x\n", __FUNCTION__,
- iobase, hi, iobase+1, lo);
-}
-
-unsigned char getecdata(void)
-{
- unsigned char data;
-
- if (noop) return 0;
-
- data = inb(iobase+2);
- printf_super_debug("%s: read 0x%x from 0x%x\n", __FUNCTION__, data, iobase+2);
- return data;
-}
-
-void putecdata(unsigned char data)
-{
-
- if (noop) return;
-
- outb(data, iobase+2);
- printf_super_debug("%s: wrote 0x%x to 0x%x\n", __FUNCTION__, data, iobase+2);
-}
-
-unsigned char readecdata(unsigned short index)
-{
- setecindex(index);
- return getecdata();
-}
-
-void writeecdata(unsigned short index, unsigned char data)
-{
- setecindex(index);
- putecdata(data);
-}
-
-void setaddr(unsigned long addr){
- unsigned char data;
- data = addr;
- writeecdata(SPIA0, data);
- data = addr >> 8;
- writeecdata(SPIA1, data);
- data = addr >> 16;
- writeecdata(SPIA2, data);
-}
-
-unsigned char rdata(void)
-{
- unsigned char data;
- data = readecdata(SPIDAT);
- return data;
-}
-
-void wdata(unsigned char data)
-{
- writeecdata(SPIDAT, data);
-}
-
-unsigned char cmd(void)
-{
- return readecdata(SPICMD);
-}
-
-void docmd(unsigned char cmd)
-{
- printf_super_debug("docmd: cmd 0x%x\n", cmd);
- writeecdata(SPICMD, cmd);
- printf_super_debug("docmd: cmd 0x%x\n", cmd);
-}
-
-void wait_cmd_sent(void)
-{
- int trycount = 0;
- myusec_delay(10);
-
- if (noop) return;
-
- while (readecdata(SPICFG) & SPIBUSY){
- trycount++;
- myusec_delay(10);
- if (trycount > 100000){ /* 1 second! */
- printf("wait_sent: Err: waited for > 1 second\n");
- trycount = 0;
- }
- }
-}
-
-/*
- * The EnE code has lots of small delays inbetween
- * many of the actions. Route all this through
- * one function so I can play with how long they
- * need to be.
- */
-void short_delay(void)
-{
- // EnE code did 4 pci reads of the base address
- // which should be around 800nS
- // 2 uS should cover it in case I'm wrong
- myusec_delay(2);
-}
-
-/*
- * Firmware mode allows you raw control over the SPI bus
- * the spansion part is not supported by the EC in
- * "hardware" mode.
- * in this mode bytes written to the SPICMD register
- * are clocked out the bus.
- * This also asserts SPICS#
- */
-void start_SPI_firmware_mode_access(void)
-{
- writeecdata(SPICFG,0x18);
-}
-
-void end_SPI_firmware_mode_access(void)
-{
- writeecdata(SPICFG,0x08);
-}
-
-/*
- * You must do this prior to _every_ command that
- * writes data to the part. The write enable
- * latch resets after write commands complete.
- */
-void send_write_enable(void) {
- start_SPI_firmware_mode_access();
- short_delay();
- docmd(WRITEENABLE);
- wait_cmd_sent();
- end_SPI_firmware_mode_access();
-}
-
-void send_addr(unsigned long addr)
-{
- unsigned char data;
-
- data = addr >> 16 & 0xff;
- docmd(data);
- wait_cmd_sent();
-
- data = addr >> 8 & 0xff;
- docmd(data);
- wait_cmd_sent();
-
- data = addr & 0xff;
- docmd(data);
-}
-
-void enable_flash_cmd(void)
-{
- writeecdata(SPICFG, SPICMDWE|readecdata(SPICFG));
-}
-
-void enable_flash_write_protect(void)
-{
- unsigned char val;
- val = readecdata(GPIO5);
- val &= ~0x80;
- writeecdata(GPIO5,val);
-}
-
-void disable_flash_write_protect(void)
-{
- unsigned char val;
- val = readecdata(GPIO5);
- val |= 0x80;
- writeecdata(GPIO5,val);
-}
-
-/*
- * This appears to be necessary. If you watch the lines with
- * scope you will see that there is constant activity on the SPI
- * bus to the part. Trying to write to the port while all that
- * is going on is sure to muck things up.
- * Putting this into reset stops all that
- * activity.
-
- * Plus Ray Tseng said so.
- *
- */
-void put_kbc_in_reset(void)
-{
- unsigned char val;
- unsigned long timeout = 500000;
-
- if (noop) return;
-
- outb(0xd8,0x66);
- while((inb(0x66) & 0x02) && (timeout>0)) {
- timeout--;
- }
- val = readecdata(0xff14);
- val |= 0x01;
- writeecdata(0xff14,val);
-}
-
-void restore_kbc_run_mode(void)
-{
- unsigned char val;
-
- val = readecdata(0xff14);
- val &= ~0x01;
- writeecdata(0xff14,val);
-}
-
-unsigned char read_status_register(void)
-{
- unsigned char data=0;
- start_SPI_firmware_mode_access();
- short_delay();
- docmd(READSTATUS);
- wait_cmd_sent();
- docmd(DUMMY);
- wait_cmd_sent();
- data = rdata();
- end_SPI_firmware_mode_access();
- return data;
-}
-
-// Staus reg writes; erases and programs all need to
-// check this status bit.
-int wait_write_done(void)
-{
- int trycount = 0;
-
- if (noop) return 0;
-
- while (read_status_register() & WIP){
- trycount++;
- myusec_delay(10);
- // For the spansion part datasheet claims that
- // the only thing that takes longer than 500mS is
- // bulk erase and we don't ever want to use that
- // command
- if (trycount > 100000){ /* 1 second! */
- printf("wait_write_done: Err: waited for > 1 second\n");
- trycount = 0;
- return -1;
- }
- }
-
- return 0;
-}
-
-int erase_sector(unsigned long addr)
-{
- send_write_enable();
- short_delay();
-
- start_SPI_firmware_mode_access();
- short_delay();
-
- docmd(BLOCKERASEPCM);
- wait_cmd_sent();
-
- send_addr(addr);
- wait_cmd_sent();
-
- end_SPI_firmware_mode_access();
-
- return wait_write_done();
-}
-
-/*
- Erase from sectors 0x10000 to 0xf0000
-*/
-int erase_linuxbios_area(void)
-{
- unsigned long addr;
-
- for (addr = 0x10000;addr < 0xfffff;addr+=0x10000) {
- printf("Erasing Sector: 0x%08lx\r\n",addr);
- erase_sector(addr);
- }
- return 0;
-}
-
-int erase_EC_area(void)
-{
- unsigned long addr = 0;
- printf("Erasing Sector: 0x%08lx\r\n",addr);
- erase_sector(addr);
- return 0;
-}
-
-int erase_flash(int mode)
-{
- if (mode == 1) {
- erase_EC_area();
- }
- erase_linuxbios_area();
- return 0;
-}
-
-
-unsigned char read_flash_byte(unsigned long addr)
-{
- unsigned char data;
-
- setaddr(addr);
- docmd(READ);
- wait_cmd_sent();
- data = rdata();
- printf_debug("read 0x%x@0x%lx\n", data, addr);
- return data;
-}
-
-int read_flash(unsigned char *buf, unsigned long start, unsigned long size)
-{
- unsigned long i;
-
- printf("Reading %ld bytes from %lx\r\n",size,start);
- for (i = start; i < start+size; i++) {
- if ((i % 0x10000) == 0) printf("Sector 0x%08lx\r\n", i);
- *buf = read_flash_byte(i);
- buf++;
- }
- return 0;
-}
-
-int read_jdec_id(struct flashchip *flash)
-{
- unsigned char data;
-
- start_SPI_firmware_mode_access();
- short_delay();
-
- docmd(READJDECID);
- wait_cmd_sent();
- docmd(DUMMY);
- wait_cmd_sent();
- data = rdata();
- flash->manufacture_id = data;
- docmd(DUMMY);
- wait_cmd_sent();
- data = rdata();
- flash->model_type = data;
- docmd(DUMMY);
- wait_cmd_sent();
- data = rdata();
- flash->model_id = data;
-
- end_SPI_firmware_mode_access();
-
- return 0;
-}
-
-int write_flash_byte(unsigned long addr, unsigned char data) {
-
- send_write_enable();
- short_delay();
-
- start_SPI_firmware_mode_access();
- short_delay();
-
- docmd(BYTEPROGRAM);
- wait_cmd_sent();
-
- send_addr(addr);
- wait_cmd_sent();
-
- docmd(data);
- wait_cmd_sent();
-
- end_SPI_firmware_mode_access();
-
- wait_write_done();
-/*
- unsigned char verify;
- verify = read_flash_byte(addr);
- if (verify != data) {
- printf("addr 0x%x, want 0x%x, got 0x%x\n",
- addr, data, verify);
- return -1;
- }
-*/
- return 0;
-}
-
-int write_flash_page(unsigned char *buf, unsigned long addr, unsigned long size)
-{
-
- send_write_enable();
- short_delay();
-
- start_SPI_firmware_mode_access();
- short_delay();
-
- docmd(BYTEPROGRAM);
- wait_cmd_sent();
-
- send_addr(addr);
- wait_cmd_sent();
-
- while (size > 0) {
- docmd(*buf);
- wait_cmd_sent();
- size--;
- buf++;
- }
-
- end_SPI_firmware_mode_access();
-
- wait_write_done();
-/*
- unsigned char verify;
- verify = read_flash_byte(addr);
- if (verify != data) {
- printf("addr 0x%x, want 0x%x, got 0x%x\n",
- addr, data, verify);
- return -1;
- }
-*/
- return 0;
-}
-
-int
-write_flash(unsigned char *buf, unsigned long start, unsigned long size){
- unsigned long p=0;
- unsigned long pages=0;
- unsigned long short_page=0;
-
- pages = (size+(PAGE_SIZE-1))/PAGE_SIZE;
- short_page = size-(pages*PAGE_SIZE);
-
- printf("Writing %ld bytes starting at address 0x%lx\r\n",size,start);
-
- for (p=0;p<pages;p++) {
- if ((start % 0x10000) == 0) printf("Sector 0x%08lx\r\n", start);
- printf_debug("Page %ld/%ld\r",p+1,pages);
-
- if (write_flash_page(buf,start,PAGE_SIZE)) {
- return -1;
- }
-
- buf+=PAGE_SIZE;
- start+=PAGE_SIZE;
- }
- printf_debug("\r\n");
-
- if (short_page) {
- printf_debug("Short Page of %ld bytes\r\n",short_page);
- printf_debug("Address %ld\r\n",start);
-
- if (write_flash_page(buf,start,short_page)) {
- return -1;
- }
- }
-
- return 0;
-}
-
-int verify_flash(unsigned char *buf, unsigned long start, unsigned long size)
-{
- unsigned long idx;
- unsigned char r_val;
-
- printf("Verifying flash\n");
-
- if(verbose) printf("address: 0x00000000\b\b\b\b\b\b\b\b\b\b");
-
- for (idx = start; idx < start+size; idx++) {
- if (verbose && ( (idx & 0xfff) == 0xfff ))
- printf("0x%08lx", idx);
-
- if ((idx % 0x10000) == 0)
- printf("Sector 0x%08lx\r\n", idx);
-
- r_val = read_flash_byte(idx);
-
- if ( r_val != *buf ) {
- printf("0x%08lx: ", idx);
- printf("Expected 0x%02x Got 0x%02x\n",*buf,r_val);
- printf("Verify FAILED\n");
- return 1;
- }
- buf++;
-
- if (verbose && ( (idx & 0xfff) == 0xfff ))
- printf("\b\b\b\b\b\b\b\b\b\b");
- }
- if (verbose)
- printf("\b\b\b\b\b\b\b\b\b\b ");
-
- printf("- VERIFIED \n");
- return 0;
-}
-
-
-void usage(const char *name)
-{
- printf("%s Ver: %d.%d.%d\n",name,VER_MAJOR,VER_MINOR,VER_RELEASE);
- printf("usage: %s [-rwv] [-V] [file]\n", name);
- printf(" -r | --read read flash and save into file\n"
- " -w | --write write file into flash\n"
- " -v | --verify verify flash against file\n"
- " -E | --erase erase LinuxBIOS area (0x10000-0xfffff)\n"
- " -V | --verbose more verbose output\n"
- " -n | --noop Noop mode. Do the motions but no io\n"
- " -h | --help This message\n"
- " --no-verify skip the autoverify on write\n"
- " -P | --nobrick: Partial mode. Writes start @ 64Kib\n"
- " -I | --id print out part JDEC ID values\n"
- " -f | --force-id <id> Force a specific ID\n"
- "\n\n");
- exit(1);
-}
-
-int main(int argc, char *argv[])
-{
- unsigned long size;
- unsigned long start_addr=LINUXBIOS_START;
- FILE *image;
- int opt;
- int option_index = 0;
- int read_it = 0,
- write_it = 0,
- erase_it = 0,
- verify_it = 0,
- show_id =0;
- int auto_verify = 1;
- int force_id = 0;
- int brick_mode = 1;
- int ret = 0;
- int i=0;
- int forced_id=0;
- unsigned char buf[ROM_SIZE];
- unsigned char* buf_start=NULL;
-
- struct flashchip flash;
-
- static struct option long_options[]= {
- { "read", 0, 0, 'r' },
- { "write", 0, 0, 'w' },
- { "erase", 0, 0, 'E' },
- { "verify", 0, 0, 'v' },
- { "iobase", 1, 0, 'i' },
- { "verbose", 0, 0, 'V' },
- { "help", 0, 0, 'h' },
- { "brick", 0, 0, 'B' },
- { "nobrick", 0, 0, 'P' },
- { "noop", 0, 0, 'n' },
- { "no-verify", 0, 0, 'a' },
- { "id", 0, 0, 'I' },
- { "force-id", 1, 0, 'f' },
- { 0, 0, 0, 0 }
- };
-
- char *filename = NULL;
-
- setbuf(stdout, NULL);
- while ((opt = getopt_long(argc, argv, "rwvVEnIhPi:f:", long_options,
- &option_index)) != EOF) {
- switch (opt) {
- case 'r':
- read_it = 1;
- break;
- case 'w':
- write_it = 1;
- break;
- case 'v':
- verify_it = 1;
- break;
- case 'V':
- verbose++;
- break;
- case 'E':
- erase_it = 1;
- break;
- case 'i':
- errno = 0;
- iobase = (unsigned short) strtol(optarg,0,0);
- if (errno || (iobase == 0)) {
- printf("Invalid IO base\n");
- exit(1);
- }
- break;
- case 'B':
- brick_mode = 1;
- break;
- case 'P':
- brick_mode = 0;
- break;
- case 'n':
- noop = 1;
- break;
- case 'a':
- auto_verify = 0;
- break;
- case 'I':
- show_id = 1;
- break;
-
- case 'f':
- force_id = 1;
- errno = 0;
- forced_id = (int) strtol(optarg,0,0);
- if (errno || (forced_id == 0)) {
- printf("Invalid Mfg ID\n");
- exit(1);
- }
- break;
-
- case 'h':
- default:
- usage(argv[0]);
- break;
- }
- }
-
- if (argc > 1) {
- /* Yes, print them. */
- int i;
- printf_debug ("The arguments are:\n");
- for (i = 1; i < argc; ++i)
- printf_debug ("%s\n", argv[i]);
- }
-
- if (!noop) {
- if (iopl(3) < 0){
- perror("iop(3)");
- exit(1);
- }
- }
-
- if (iobase != IOBASE_DEFAULT) {
- printf("Useing IO base of 0x%x\n",(unsigned int)iobase);
- }
-
- if (read_it && write_it) {
- printf("-r and -w are mutually exclusive\n");
- usage(argv[0]);
- }
-
- if (optind < argc)
- filename = argv[optind++];
-
- if (!erase_it && !write_it && !read_it && !verify_it && !show_id) {
- printf("No command specified so no operations performed\n");
- printf("Use -h for details\n");
- exit(2);
- }
-
- printf("Calibrating delay loop... ");
- myusec_calibrate_delay();
- printf("ok\n");
-
- enable_flash_cmd();
- /*
- * This is required prior to _all_ commands. Otherwise the kbc can steal your data
- */
- put_kbc_in_reset();
-
- read_jdec_id(&flash);
-
- if (show_id) {
- printf("Manufacture ID = 0x%x\n",flash.manufacture_id);
- printf("Model Type = 0x%x\n",flash.model_type);
- printf("Model ID = 0x%x\n",flash.model_id);
- }
-
- if (force_id) {
- flash.manufacture_id = forced_id;
- }
-
- switch (flash.manufacture_id) {
-
- case SST:
-// flash.write_page = write_flash_page_sst;
- printf("SST part found\n");
- break;
-
- case WINBOND:
- flash.write_page = write_flash_page;
- printf("Windbond part found\n");
- break;
- case SPANSION:
- flash.write_page = write_flash_page;
- printf("Spansion part found\n");
- break;
-
- default:
- printf("Unable to determine flash type\n");
- printf("use the -f option to force\n");
- exit(1);
- }
-
- size = ROM_SIZE;
- start_addr = 0;
- buf_start = buf;
-
- for (i=0;i<size;i++) {
- buf[i] = 0xff;
- }
-
- if (brick_mode != 1) {
- // Normal image
- // Skip the 1st 64k of the part and the
- // file we loaded
- size -= EC_CODE_SIZE;
- start_addr = LINUXBIOS_START;
- buf_start+= EC_CODE_SIZE;
-
- printf("Partial modei. Skipping first 64Kib\n");
- }
- else {
- printf("Brick mode. Will operate on the first 64Kib\n");
- }
-
- if (erase_it) {
- put_kbc_in_reset();
- disable_flash_write_protect();
- erase_flash(brick_mode);
- enable_flash_write_protect();
- exit(0);
- } else if (read_it) {
- if ((image = fopen(filename, "w")) == NULL) {
- perror(filename);
- exit(1);
- }
-
- put_kbc_in_reset();
-
- // Reading allways read the entire part
- read_flash(buf,0,ROM_SIZE);
-
- fwrite(buf, sizeof(char),ROM_SIZE, image);
- fclose(image);
- printf("done\n");
-
- } else {
- if ((image = fopen(filename, "r")) == NULL) {
- perror(filename);
- exit(1);
- }
- printf("Loading 0x%x bytes from %s\r\n",ROM_SIZE,filename);
- fread(buf, sizeof(char), ROM_SIZE, image);
- fclose(image);
- }
-
- if (write_it) {
- put_kbc_in_reset();
- disable_flash_write_protect();
- erase_flash(brick_mode);
- write_flash(buf_start,start_addr, size);
- enable_flash_write_protect();
- if (auto_verify) {
- ret |= verify_flash(buf_start,start_addr,size);
- }
- }
-
- if (verify_it) {
- put_kbc_in_reset();
- ret |= verify_flash(buf_start,start_addr,size);
- }
-
- printf("IMPORTANT! The kbc has been left in reset. You keyboard and mouse WILL NOT WORK until you POWER CYCLE.\n");
- printf("A warm reboot is NOT good enough.\n");
- return ret;
-}
-
Index: buildrom-devel/packages/olpcflash/olpcflash.mk
===================================================================
--- buildrom-devel.orig/packages/olpcflash/olpcflash.mk 2007-10-03 13:22:59.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,43 +0,0 @@
-OLPCFLASH_DIR=$(BUILD_DIR)/olpcflash
-OLPCFLASH_SRC_DIR=$(OLPCFLASH_DIR)/olpcflash
-OLPCFLASH_STAMP_DIR=$(OLPCFLASH_DIR)/stamps
-OLPCFLASH_LOG_DIR=$(OLPCFLASH_DIR)/logs
-
-ifeq ($(CONFIG_VERBOSE),y)
-OLPCFLASH_BUILD_LOG=/dev/stdout
-OLPCFLASH_INSTALL_LOG=/dev/stdout
-else
-OLPCFLASH_BUILD_LOG=$(OLPCFLASH_LOG_DIR)/build.log
-OLPCFLASH_INSTALL_LOG=$(OLPCFLASH_LOG_DIR)/install.log
-endif
-
-$(OLPCFLASH_SRC_DIR)/olpcflash.c: $(PACKAGE_DIR)/olpcflash/Makefile $(PACKAGE_DIR)/olpcflash/olpcflash.c
- @ mkdir -p $(OLPCFLASH_SRC_DIR)
- @ cp $(PACKAGE_DIR)/olpcflash/Makefile $(OLPCFLASH_SRC_DIR)
- @ cp $(PACKAGE_DIR)/olpcflash/olpcflash.c $(OLPCFLASH_SRC_DIR)
-
-$(OLPCFLASH_SRC_DIR)/olpcflash: $(OLPCFLASH_SRC_DIR)/olpcflash.c
- @ echo "Building olpcflash..."
- @ $(MAKE) -C $(OLPCFLASH_SRC_DIR) > $(OLPCFLASH_BUILD_LOG) 2>&1
-
-$(INITRD_DIR)/bin/olpcflash: $(OLPCFLASH_SRC_DIR)/olpcflash
- @ install -d $(INITRD_DIR)/bin
- @ install -m 0755 $(OLPCFLASH_SRC_DIR)/olpcflash $@
- @ $(STRIP) $(INITRD_DIR)/bin/olpcflash
-
-$(OLPCFLASH_STAMP_DIR) $(OLPCFLASH_LOG_DIR):
- @ mkdir -p $@
-
-olpcflash: $(OLPCFLASH_STAMP_DIR) $(OLPCFLASH_LOG_DIR) $(INITRD_DIR)/bin/olpcflash
-
-olpcflash-clean:
- @ echo "Cleaning olpcflash..."
- @ $(MAKE) -C $(OLPCFLASH_SRC_DIR) clean > /dev/null 2>&1
-
-olpcflash-distclean:
- @ rm -rf $(OLPCFLASH_DIR)/*
-
-olpcflash-bom:
- @ echo "Package: olpcflash"
- @ echo "Source: (local) buildrom/packages/olpcflash/olpcflash.c"
- @ echo ""
Index: buildrom-devel/README
===================================================================
--- buildrom-devel.orig/README 2007-10-03 13:22:59.000000000 -0600
+++ buildrom-devel/README 2007-10-03 13:23:14.000000000 -0600
@@ -48,8 +48,6 @@
CONFIG_KBL_KEXEC_ONLY - Build only the Kexec part of the KBL
CONFIG_KBL - Build Marcelo Toscatti's kernel boot loader
CONFIG_BUSYBOX - Build busybox
- CONFIG_BOOTMENU - Build the OLPC bootmenu
- CONFIG_OLPCFLASH - Build the 'olpcflash' utility
memtest:
CONFIG_MEMTEST_SERIAL - say 'y' here to enable serial output for memtest
Index: buildrom-devel/README.signature
===================================================================
--- buildrom-devel.orig/README.signature 2007-10-03 13:23:19.000000000 -0600
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,35 +0,0 @@
-Description of the fimrware signature
-
-Pulled from
http://dev.laptop.org/ticket/153.
-
-Here's the format:
-
-At offset f.ffc0 in FLASH:
-BW2 Q1A82 Q1A
-------..... ---
- | | |
- | | |---First 3 characters of revision
- | |
- | |---Revision
- |
- |--- Model
-
-Revision is:
-
-Q - Manufacturer, i.e. Quanta
-1 - board revision number
-A - Major firmware revision
-82- Minor firmware revision
-
-------- Quanta describes their release sequence:
-
-Let me explain our ISO sequence: Qxxxx First x: 1 for A test, 2 for B test, 3 for C test Second x: A~Z: milestone Third x: 1~9: change when test team release to customer, manufacture (outside R&D) Forth x: 1~9: change when sw team release to test team.(inside R&D)
-
-Take EC as example: Q1A11 when sw team release to test team. Test team find some problems, can not relase out Q1A12 when sw team fix the problem and release to test team again Test team test OK, and release out
-
-Next version sw team release will be Q1A21
-
-As I mentioned we will use file name to distinguish the release.
-
-EC release will be PQ1A21.bin (Leading by P) BIOS release will be BQ2A11.bin (leading by B)
-