r914 - developers/werner

werner at sita.openmoko.org werner at sita.openmoko.org
Thu Feb 8 16:51:17 CET 2007


Author: werner
Date: 2007-02-08 16:51:14 +0100 (Thu, 08 Feb 2007)
New Revision: 914

Added:
   developers/werner/BBT-MIGRATION
Log:
Very early and incomplete draft version, to get things started.



Added: developers/werner/BBT-MIGRATION
===================================================================
--- developers/werner/BBT-MIGRATION	2007-02-08 14:19:09 UTC (rev 913)
+++ developers/werner/BBT-MIGRATION	2007-02-08 15:51:14 UTC (rev 914)
@@ -0,0 +1,334 @@
+###############################################################################
+#
+# Migration of u-boot and the kernel to a version with bad block table (BBT)
+# support
+#
+#
+
+###  Get the right repository version (BUILD)  ################################
+#
+# The badblock handling code is only in comparably recent versions of the
+# repository and have not been merged into openmoko-devel-image.
+#
+# We will first describe how to build u-boot and the kernel from scratch.
+# If you don't want to do this, please skip ahead to section "Upgrading the
+# boot loader".
+#
+
+
+###  Before we start  #########################################################
+#
+# We'll use the same terminology and environment as described in the file
+# WALK-THROUGH in this directory. Please read the sections "Roles", "Directory
+# layout", "Environment variables", "Permissions", and "Assumptions".
+#
+# Please also have a look at the "Prerequisites" sections. We need "git",
+# "subversion", "quilt", and a communications program like "xc" or "minicom".
+# 
+
+
+###  Environment (BUILD)  #####################################################
+#
+# To build kernel and u-boot, we need the arm-linux toolchain (binutils, gcc,
+# etc.) This toolchain is built when you do the WALK-THROUGH.
+#
+# If you don't have the WALK-THROUGH toolchain, you can either copy it from
+# buildhost.openmoko.org (directory /space/fic/openmoko/gta01/tmp/cross), or
+# you can skip this step, and use a pre-built binaries for u-boot and kernel.
+#
+# (TBD)
+# * https://buildhost.openmoko.org/tmp/gta01/deploy/images/
+# * may have suitable images
+#
+
+# If the toolchain was built according to WALK-THROUGH:
+export PATH=$OMDIR/build/tmp/cross/bin:$PATH
+
+# If you copied the toolchain from buildhost, use:
+export PATH=/space/fic/openmoko/gta01/tmp/cross:$PATH
+
+
+###  Checking out the OpenMoko tree  ##########################################
+#
+# Revision 906 of the OpenMoko tree contains all the features we need for bad
+# block handling, yet is still compatible with the "stable" builds described in
+# WALK-THROUGH.
+#
+
+# If this is a new tree (then proceed with WALK-THROUGH):
+cd $OMDIR
+svn co -r 906 https://svn.openmoko.org:2342 openmoko
+
+# If you already have checked out a tree:
+cd $OMDIR/openmoko
+svn update -r 906
+
+
+###  Building u-boot (BUILD)  #################################################
+#
+# The u-boot build process is complicated by the upstream use of git. Until
+# we've figured out how to handle this properly, we'll use the following tar
+# ball as "upstream" source:
+#
+# https://people.openmoko.org/
+#   laforge/tmp/bbt-20070206/u-boot.git.laforge-20070207.tar.bz2
+#
+
+cd $OMDIR
+
+tar xfj u-boot.git.laforge-20070207.tar.bz2
+cd u-boot.git
+QUILT_PATCHES=$OMDIR/om/trunk/src/target/u-boot/patches \
+  quilt push -a
+patch -p1 -s <uboot-strtoul.patch
+chmod +x board/neo1973/split_by_variant.sh
+
+# Choose the name of your platform. Possible choices are gta01bv2_config,
+# gta01v3_config, and gta01v4_config.
+
+make ARCH=arm gta01bv2_config
+
+# Run the build. The result is called "u-boot.bin"
+
+make ARCH=arm
+
+
+###  Building the kernel (BUILD)  #############################################
+#
+# We use the kernel.org 2.6.17.14 kernel as our basis. After applying all the
+# Neo-specific patches, we add brand-new Bad Block Table support. 
+#
+# Note that you need "mkimage" from the u-boot build.
+#
+
+cd $OMDIR
+
+# Get the upstream source
+
+wget http://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.17.14.tar.bz2
+tar xfj linux-2.6.17.14.tar.bz2
+
+# Apply the OpenMoko patches
+
+cd linux-2.6.17.14
+QUILT_PATCHES=$OMDIR/openmoko/trunk/src/target/kernel/patches \
+  quilt push -a
+
+# Configuration, with a few last-minute updates.
+
+cp $OMDIR/openmoko/trunk/oe/packages/linux/linux-gta01/defconfig-fic-gta01 \
+  .config
+echo CONFIG_MTD_NAND_S3C2410_BBT=y >>.config
+echo CONFIG_SND_S3C24XX_SOC_NEO1973_WM8753=y >>.config
+make ARCH=arm CROSS_COMPILE=arm-linux- oldconfig
+
+# Build
+
+make ARCH=arm CROSS_COMPILE=arm-linux-
+
+# We use a special image format for u-boot.
+
+arm-linux-objcopy -O binary -R .note -R .comment -S vmlinux linux.bin
+gzip -9 linux.bin
+$OMDIR/u-boot.git/tools/mkimage -A arm -O linux -T kernel -C gzip \
+  -a 30008000 -e 30008000 -n "Kernel Image QT2410" -d linux.bin.gz uImage
+
+
+###  Preparing the microSD card (CARD)  #######################################
+#
+# Since (V)FAT support in u-boot is marginal, we want to use an ext2 file
+# system on the microSD card. If you have not yet converted your card, please
+# have a look at WALK-THROUGH. (Search for "sfdisk".)
+#
+
+cd $OMDIR
+
+mount /dev/uba1 /mnt/tmp
+cp u-boot.git/u-boot.bin /mnt/tmp
+cp linux-2.6.17.14/uImage /mnt/tmp
+umount /mnt/tmp
+
+
+###  Upgrading the boot loader (LAB)  #########################################
+#
+# As a first step in making the upgrades, we replace the u-boot boot loader.
+# There are three possible approaches for doing this:
+#
+# 1) from an already installed, operational u-boot
+# 2) over JTAG, while properly handling bad blocks
+# 3) over JTAG, without handling bad blocks
+#
+# 1) is preferred, but is only available if we already have a boot loader, and
+# if we don't suffer any problems while making the upgrade. 2) is currently
+# under investigation. 3) works, as long as the few blocks occupied by the boot
+# loader are intact.
+#
+
+
+###  Flashing a boot loader into a bricked device (LAB)  ######################
+#
+# We start by flashing a new boot loader via JTAG. If you already have a good
+# boot loader, you can skip this step.
+#
+# First, obtain a u-boot binary. It can be old (no BBT support) or new (with
+# BBT support). The latter is preferred. We assume the u-boot binary in
+# $OMDIR/u-boot.git/u-boot.bin
+#
+# Furthermore, you need sjf2410, which was built during the process described
+# in WALK-THROUGH.
+
+cd $OMDIR
+( echo 0; echo 0; echo 0; echo 2; ) |
+  build/tmp/deploy/images/sjf2410 \
+    /f:u-boot.git/u-boot.bin
+
+# This takes about 12 minutes.
+
+
+###  Going from old (non-BBT) to new (with BBT) u-boot (LAB)  #################
+#
+# Next, we upgrade from an old boot loader (without BBT support) to a new one,
+# which has BBT support.
+#
+# If you are already running a sufficiently new boot loader, you can skip this
+# step. If in doubt, there is no harm in doing this "upgrade". You can find out
+# whether your boot loader is new enough with the "nand createbbt" command.
+# If the command is recognized, you already have a "new" boot loader. (Press
+# [N] to abort the command now.)
+#
+# WARNING: If you lose power from now on, or enter any commands incorrectly,
+# you may brick your Neo, in which case you have to go back to the previous
+# section, and flash the boot loader again through JTAG.
+#
+# Everything from now on is through the serial console.
+#
+
+# Connect to the target
+
+xc -l /dev/ttyS0 -t
+
+# Reset the Neo by power-cycling it (see also WALK-THROUGH)
+#
+# Then press a button to enter the u-boot prompt. If you can't get a prompt,
+# your machine may be bricked. See above for recovery from that state.
+
+#
+# ---------- First, we load the new u-boot from microSD into RAM
+#
+# GTA01Bv2 # mmc
+# GTA01Bv2 # ext2load mmc 0 0x32000000 u-boot.bin
+#
+# ---------- We now erase the NAND Flash region occupied by u-boot, and write
+# ---------- the new u-boot binary to it.
+#
+# GTA01Bv2 # nand erase
+#
+# ---------- Press [Y] [Enter] to confirm the operation.
+#
+# GTA01Bv2 # nand write.e 0x32000000 0 0x30000
+#
+
+
+###  Creating the Bad Block Table (LAB)  ######################################
+#
+# We now boot our BBT-capable u-boot and create the bad block table. This will
+# erase all NAND Flash content, so we will have to write u-boot to Flash a
+# second time.
+#
+
+#
+# ---------- Reset the Neo, either by power cycling, or, if you're already in
+# ---------- u-boot, with:
+#
+# GTA01Bv2 # reset
+#
+# ---------- Press any key on the serial console to enter the prompt. Note that
+# ---------- the startup messages of u-boot should have said something like
+# ---------- this:
+#
+# U-Boot 1.1.6 (Feb  7 2007 - 21:49:14)
+#
+# DRAM:  128 MB
+# NAND:  Bad block table not found for chip 0
+# Bad block table not found for chip 0
+# 64 MiB
+# *** Warning - bad CRC or NAND, using default environment
+#
+# ---------- All these warnings tell us that the NAND is nice and clean, just
+# ---------- how we want it. There are two bad block table messages, because
+# ---------- the bad block table is mirrored.
+#
+# ---------- Like before, we load the new u-boot binary (so that, if there are
+# ---------- problems loading that one, we won't find out about them after just
+# ---------- having erased our NAND Flash).
+#
+# GTA01Bv2 # mmc
+# GTA01Bv2 # ext2load mmc 0 0x32000000 u-boot.bin
+#
+# ---------- We now generate the bad block table. The NAND Flash is erased when
+# ---------- doing this.
+#
+# GTA01Bv2 # nand createbbt
+#
+# ---------- This takes about one minute. The output will look like this:
+#
+# Create BBT and erase everything ? <y/N>
+# Skipping bad block at  0x03ff0000                                            
+# Skipping bad block at  0x03ff4000                                            
+# Skipping bad block at  0x03ff8000                                            
+# Skipping bad block at  0x03ffc000                                            
+#
+# Creating BBT. Please wait ...Bad block table not found for chip 0
+# Bad block table not found for chip 0
+# Bad block table written to 0x03ffc000, version 0x01
+# Bad block table written to 0x03ff8000, version 0x01
+#
+# ---------- "Skipping bad block" refers to the area reserved for the BBT,
+# ---------- which is protected by marking it as bad blocks. Then we look again
+# ---------- for the bad block table, and then finally create the table.
+#
+# ---------- If "nand createbbt" fails with a message like "No space left to
+# ---------- write bad block table", you may have data in the bad block table
+# ---------- area, which needs to be removed first. See section "Removing the
+# ---------- bad block table" below. You may still wish to write back u-boot
+# ---------- now (the next step), to avoid having to restore it though JTAG.
+#
+# ---------- u-boot was erased in the process. Write it back again.
+#
+# GTA01Bv2 # nand write.e 0x32000000 0 0x30000
+#
+
+
+###  Removing the bad block table (LAB)  ######################################
+#
+# You norma
+###  Updating the environment (LAB)  ##########################################
+#
+# The environment 
+#
+# * location ?
+# dynpart
+# saveenv
+
+*******************************************************************************
+
+Random notes, please ignore:
+
+nand erase
+
+mmc
+ext2load mmc 0 0x32000000 u-boot.bin
+nand erase 0 0x30000
+nand write 0x32000000 0 0x30000
+reset
+
+
+Skipping bad block at  0x03ff0000                                            
+Skipping bad block at  0x03ff4000                                            
+Skipping bad block at  0x03ff8000                                            
+Skipping bad block at  0x03ffc000
+
+dd if=/dev/zero bs=1k count=64 of=64k
+( echo 0; echo 0; echo 4092; echo 2; ) |
+  build/tmp/deploy/images/sjf2410 \
+    /f:64k





More information about the commitlog mailing list