Flameman/dht-walnut

Flameman

= DHT-Walnut-Flameman =

Note
please note this page is actively being updated, it is merged from the old version of wiki. so keep patient, i will rewrite this documentation as soon as possible

in case you need a pdf copy of the old doc, or if you need attachments feel free to ask me for them ( flameman, email speeder@alice.it, msn mr.ddc@hotmail.com)

about the jtag software: the one provided with the url will not work 'cause they remove the support for amcc44x. In case you need this software i stored the old version here, so feel free to ask me about.

Introduction
The Target-goal of this page is
 * install gentoo-ppc32 into harddisk
 * make the board able to boot from it
 * describe how to build a jtag cable (to debug and recover from "Brickage")
 * describe something useful with you can do with the board
 * describe other Operating System avalaible for the board

logical steps about installing gentoo
 * add the JTAG connector at J10 (you could skip it, it is suggested)
 * build the JTAG cable (you could skip it, it is suggested))
 * replace the bootloader with ppcboot 1.1.6/U-boot 1.1.4
 * make partitions on the Hard Disk
 * populate them
 * set the bootloader environment to boot from the Hard Disk

People you could contact if you need help

 * flameman, i'm currently use this board for a project, email
 * msn daredevil-coder@hotmail.it
 * email flamemaniii@gmail.com
 * irc.nick flameman (channel #edev, #gentoo-ppc)
 * you ... if you want ;-)

About the board
DHT-Walnut is a shortened name for the Digital Home Technologies PCB 01070201 Rev. 1.1.

The DHT-Walnut board is based on the AMCC-Walnut (still available, and still expensive :P). It is a more improved board described at www.amcc.com.

A "walnut" searching will inform about schematic and software.

Also keep attention @ DENX: they  have developed a lot for the AMCC-Walnut board, and you could find a linux patch for your problem, prettier documentation, developer suit, and much more: in case, you are suggested to have a look to their web pages.

you could find it on ebay, search for "walnut", or "powerpc"

MIND UP the differences between "DHT WALNUT" and "AMCC WALNUT" (ALSO CALLED "IBM WALNUT")

Where to find/buy the board
ebay, the seller "knktechequipment" can provide it

his auctions look like this:

Auction title: PowerPC 405 GP 266MHZ, with Linux, 32MB RAM Item number: 380085056864 Seller:	knktechequipment( 935Feedback score is 500 to 999) Member is a PowerSeller Feedback:	100 % Positive Member:	since Jan-19-04 in United States

Starting bid:	US $35.00 Standard Flat Rate Shipping Service Service to United States Ships to:	Worldwide Item location:	Dallas, Texas, United States Payment methods: PayPal (preferred) Tested, In Good  Working Order. Please check our store for more items Interfaces: * Ethernet * IEEE 1394 “Firewire” * RS-232 * IDE * PCI

Operating System : Embedded Open Source Linux on 4Mbit Flash chip Comes with a copy of the Boot Loader

...
 * other place where to find this board ?

Overview
The board consists of:


 * CPU PowerPC 405GP running at 266mhz
 * RAM PC133 SDRAM slot, currently, only supports single sidded DIMMs
 * LAN On-chip 405GP ethernet, board doesn't have an ethernet MAC address (the monitor/bootloader is able to fix it)
 * UART DCE serial port, speeds up to 230k, only tested to 115200bps
 * PCI two pci slots, keyed for 5V only cards
 * IDE Promise Technologies PDC20265 IDE
 * ROM 512k of boot flash, AMD 29LV040B (amd29lv040b.pdf), soldered on the PCB, if you like to use a socket you have to consider the bootloader will check for the flash manufactor ID, so or you replace the 29LV040B with an other socked-29LV040B, or you have to modify the bootloader
 * POWER the board need to be 12v dc powered 2A max, it is able to feed the hard disk
 * System PCB 6.00" x 7.5" board size
 * RTC the real time clock chip is missing
 * RAM 32M PC133 SDRAM DIMM, the board has issues with more than 128M: if you inspect the pcb, you will see that the DIMM connector has same pin missing, this is the reason why you can't use DIMM bigger than 128M
 * PCI IEEE-1394 card supported by OHCI driver
 * PCI additional ethernet board needed cause the on board ethernet is implemented by the IBM-ppc-405GP, for example netbsd is not able to drive it, so in case you need an additional board, the one provided with DHT is good enough
 * FIRMWARE PPCBoot v.1.1.2 in flash (it has issues with environment, it need to be replaced with a gooder one)

Memory Locations
memory map of the board will be added as soon as possible

Memory Area   Address Range Mapped   Size  Number of Level 2 pages ---    Local Memory   0 - Ram size           32MB  8 PCI Memory    0x80000000-0x83FFFFFF  64MB  16 PCI IO Regn 1 0xE8000000-0xE800FFFF  64K   1 PCI IO Regn 2 0xE8800000-0xE88FFFFF  1MB   1 PCI CFG       0xEEC00000-0xEEC00FFF  4K    1 PCI IACK      0xEED00000-0xEED00FFF  4K    0 * PP Bridge     0xEF400000-0xEF400FFF  4K    1 UART IO Space 0xEF600000-0xEF600FFF  4K    0 * NVRAM Space   0xF0000000-0xF0001FFF  8K    1 (only on ibm-walnut) Flash         0xFFF80000-0xFFFFFFFF  512K  1

the u-boot image "sits" at the end of the flash, the 4xx PPC's boot from location 0xfffffffc, so the bootloader needs to be located at the end, so if u-boot is 256kbyte then it is located 0xfffc0000 ... 0xffffffff

the dht-walnut flash memory mapped, it's mapped via the 405gp EBC (external bus controller)

...

about the memory & the MMU
PowerPC Architecture - Memory Management Unit (MMU)

The PowerPC 405 supports 4 GB of flat (non-segmented) address space. The Memory Management Unit (MMU) provides Address Translation, Protection Functions, and Storage Attribute Control for this address space. The MMU supports demand-paged virtual memory using multiple page sizes of 1 KB up to16 MB. When supported by system software, the MMU provides the following functions:


 * Translation of the 4 GB logical address space into a physical address space
 * Independent enabling of instruction translation and protection from that of data translation and protection
 * Page-level access control using the translation mechanism
 * Software control over the page replacement strategy
 * Additional protection control using zones
 * Storage attributes for cache policy and speculative memory access control

The Translation Look-aside Buffer (TLB) is used to control memory translation and protection. Each one of its 64 entries specifies a page translation. It is fully associative and can simultaneously hold translations for any combination of page sizes. To prevent TLB contention between data and instruction accesses, a 4-entry instruction and an 8-entry data shadow TLB are maintained by the processor transparently to the software. Software manages the initialization and replacement of TLB entries.

The PowerPC 405 includes instructions for managing TLB entries by software running in privileged mode. This capability gives significant control to system software over the implementation of a page replacement strategy. Storage attributes are provided to control access of memory regions. When memory translation is enabled, storage attributes are maintained on a page basis and read from the TLB when a memory access occurs. When memory translation is disabled, storage attributes are maintained in storage attribute control registers. A zone protection register (ZPR) is provided to allow system software to override the TLB access controls without requiring the manipulation of individual TLB entries.

Problems
hi, i found a problem using a pci sound card in the DHT-WALNUT. It has been correctly recognized by the kernel, the DMA feature (ppc405-dma) is setted, but the card is not working.
 * uboot (tested on 1.1.4) has issues in PCI/DMA initialization. More will be post in the future

somebody says it is a bug, somebody says ppcboot solves the problem inizializing the pci in the correct way. I don't know, i'm using the uboot v1.1.4 and it is not working

also have a look to this

<> but i already thought so when i saw the "pci long" output <> no BAR was assigned with an address <> this was different some time ago <> could be something changed in the last few months in the common pci support <> i'll check with an ex-kollegue and let you know <> this will take till beginning of next week though <> hey, i just checked the source (sometimes helpful) <> you just need to enable the host bridge configuration via an env variable <> => setenv pciconfighost yes <> then <> => saveenv <> => reset <> after this reset the BAR1 will be configured: <> => pci long <> Scanning PCI devices on bus 0 <> Found PCI device 00.00.00: <>  vendor ID =                   0x1014 <>  device ID =                   0x0156 <>  command register =            0x0006 <>  status register =             0x2210 <>  revision ID =                 0x01 <>  class code =                  0x0b (Processor) <>  sub class code =              0x20 <>  programming interface =       0x00 <>  cache line =                  0x00 <>  latency time =                0x87 <>  header type =                 0x00 <>  BIST =                        0x00 <>  base address 0 =              0x00000000 <>  base address 1 =              0x80000008

could you help me to understand how to plug a soundcard ?

Images of the board


see more detailed photo dht-walnut-ppc405-top

= JTAG =

The BEST solution is to equip your lab with the bdi2000. This hardware is expensive a lot, 'cause it is not a simple download cable, it's a professional debugger

For this dht-walnut project it has been used "OCD Commander is macraigor's free debugger software", that i'm going to illustrate

JTAG & OCD Commander
The OCD Commander is macraigor's free debugger software, which allows you to connect to your supported target type chip via the On-Chip Debug port (BDM or JTAG) using a Macraigor hardware device. You will be able to test the connection, memory access, modify memory and registers, run code and more using this product. This debugger is not designed to be used to program flash devices connected to your target. The OCD Commander software is supported under Windows 98/ME, NT, 2000, 2003, XP operating systems

supported devices


 * mpDemon
 * Raven
 * wiggle <--- it will be illustrated
 * usb2demon
 * usb2sprite
 * usbwiggler

See How To build the JTAG Wiggle interface & add the JTAG connector at J10, Just in case you make a brick, you could fix the jam, using this procedure: JTAG Bootloader Installation

J10
To add the J10 to the board suck or wick the solder out of the holes and solder it in, but be minded a common header has pins larger than holes, so ... be careful about what you do: you could damage the PCB



pinout
NOTE


 * DHT-Walnut: JTAG Pin Out Connector Specifications for DHT-walnut-PPC405GP
 * AMCC-PPC4xx: JTAG Pin Out Connector Specifications for AMCC PPC 44X, 40X (4XX) Processors: 405EP, 405GP, 405GPR, 440GP, 440EP, 440GX, 440GR, 440EPX, 440GRX, 440SP, 440SPE

Pin Out description


 * TDO=JTAG Test Data Out
 * TDI=JTAG Test Data In
 * TRST=JTAG Test Reset
 * TCK=JTAG Test Clock
 * TMS=JTAG Test Mode Select
 * *NC*=not connected, used as cable reference
 * nc=simply not connected
 * SRESET=Soft-Reset
 * HRESET=Hard-Reset
 * KSTP_OUT=?
 * CKSTP_IN=?
 * Vcc=board ref voltage, 3V

About the software for the jtag cable
from http://www.macraigor.com/cpus.htm and you can download the OCD-commander, but it will not work with the wiggle you need to download this old version, that i tested with success under windows2000 OCD-Commander-for-wiggle.zip (i can't include it for download cause of the copyright, if you need it, please email me)
 * 'cause in the new OCD-commander AMCC PowerPC PPC405 wiggler is NOT supported
 * 'cause in the new OCD-commander IBM PowerPC PPC 405 wiggler is NOT supported

get started
OCD-commander packets is composed by
 * OCD-cmd
 * jtag-chain-scan

jtag-chain-scan does not reset the target board, so if you want to run it you need to invoke OCD-cmd and hardly force "reset", then you could use the jtag-chain-scan

OCD-* has been tested on
 * windows 2000: success, it is my reference working env
 * windows NT (it needs service pack6): a bit of issues ... not suggested

what about *nix ? maybe sooner or later you will be interested about implementing a jtag tap machine on microchip PIC (usb, ethernet, serial) and porting a ppv405gp bdl scan ? if so, let me know (see how to contact me)

JTAG build the Wiggle Cable
the the "Wiggler Buffered JTAG Programmer" is compatible with the old OCD. This schematic has been tested and it is working.





OCD, Experimental hack
Experimental hack to set a hardware breakpoint inside OCD Commander [media:hardbreak.tgz]


 * OCD Commander macro file to dump the CPU configuration (all but PCI) [media:dump_config.mac]
 * OCD Commander macro file to configure the system for recovery attachment:recovery_config.mac]
 * CPU configuration of the system after a warm reset [media:warm_reset.config]
 * CPU configuration of the system once ppcboot v1.1.2 is up and running [media:ppcboot.config]
 * CPU configuration of the system once ppcboot v1.1.6 is up and running [media:ppcboot_116.config]
 * Example OCD logfile of the using the recovery macro to load ppcboot [media:ocd_recovery_log.txt]
 * Example console log from ppcboot v.1.1.6 running from ram after recovery macro [media:ocd_recovery_console_log.txt]

OCD, Recovering a bricked board
Using OCD Commander, a JTAG adapter, and GPSFan's ram resident ppcboot, it is possible to reprogram the flash. In short, use OCD Commander to turn on the sdram, download the ram targeted ppcboot, and install a new bootloader.

You'll need this [[Media:dht-walnut-firmware-recovery-kit.tgz|dht-walnut-firmware-recovery-kit.tgz]]

It contains an OCD macro and an experimental ram-resident version of u-boot-1.1.4 that can be downloaded to 0x400000 (and executed at 0x400100). Expect to see much more output at boot, as this version has debug output turned on.

changes:
 * debug enabled
 * ram entry point in the linker script
 * output file u-boot.s19 and u-boot.elf
 * sdram config disabled
 * added debug info on code relocation
 * modified default environment

bug:
 * it doesn't work if you have more than 32Mb of ram

install: PC: FFFFFFFC   CR: 00000000  MSR: 00000000  LR: 01FD327C uboot_ram.s19: downloaded 163100 bytes in 0 minutes, 22.785 seconds PC set to starting address 0x00400000
 * Start OCD Commander, connect to the board, reset, and halt.
 * type "reset"
 * The CPU should be ready to fetch the first instruction:
 * type "cpu"
 * Configure the system:
 * recovery_config (Or hit the macro button and navigate to the recovery_config.mac file.)
 * type "endian big" #(BIG Endian set for WORD and DASM commands)
 * Download the uboot-ram-image (srec format) to ram
 * Jump to the startup (which isn't the same as the download address)
 * type "go 0x400100"

At this point, you should have a running bboot v1.1.4. Install a new flash resident bootloader using the bootloader update procedure

= Bootloaders =

* ppcboot * U-Boot

U-Boot 1.1.4
!!!NOTE!!! uboot-v1.1.4 has an issue with tftp-boot ramrootfs, but it works well with disk-boot, see Flameman/dht-walnut for a good firmware replacement

uboot is a significantly updated replacement for ppcboot. U-Boot for the DHT-Walnut DENX U-Boot and Linux Guide for Walnut


 * Information on U-Boot can be found at
 * The source for U-Boot 1.1.4 is downloadable from ftp://ftp.denx.de/pub/u-boot/u-boot-1.1.4.tar.bz2
 * Here is a patch that makes it work on the DHT-Walnut: u-boot-dht-walnut-df2.patch.
 * A binary that can be copied to the DHT-Walnut flash at 0xfffc0000 is available here: u-boot-1.1.4-df2.bin

Changes since u-boot-1.1.4-df1.bin:
 * A default ethaddr is now set: de:ad:be:ef:00:00
 * The ethaddr can be changed as often as you like. Use: setenv ethaddr be:ef:be:ef:be:ef ; saveenv
 * Only the first two memory banks of a DIMM are used. This allows us to use (half of) double-sided DIMMS.

Some things to note when changing from ppcboot to U-Boot:
 * Default baudrate is 115200.
 * Occupies flash addresses 0xfffc0000-0xffffffff
 * Maintains two copies of environment data, primary copy at 0xfffb0000, backup copy at 0xfffa0000.

Installing

 * Boot the board and bring it to the ppcboot (or U-Boot) console prompt.
 * Download the new bootloader u-boot-1.1.4-df2.bin into RAM:

(1) Using Kermit (you'll need a terminal emulator that supports the kermit file transfer mode): loadb 800000 115200''
 * Switch baudrate to 115200 bps and press ENTER ...
 * Ready for binary (kermit) download ...
 * Start Addr=0x00800000
 * Switch baudrate to 9600 bps and press ESC ...

(2) Using tftpboot (requires a tftp server and setting the environment variables ethaddr, ipaddr and serverip) * TFTP from server 192.168.1.1; our IP address is 192.168.1.2 * Filename 'u-boot.bin'. * Load address: 0x800000 * Loading: done * Bytes transferred = 262144 (40000 hex)
 * tftpboot 800000 u-boot-1.1.4-df2.bin Using ppc_4xx_eth0 device
 * Verify that the download was received correctly (crc should be 0xd3cef189):
 * crc 800000 40000
 * CRC32 for 00800000 ... 0083ffff ==> d3cef189
 * Unprotect the last 4 sectors:
 * protect off fffc0000 ffffffff
 * Un-Protected 4 sectors

'''From this point on, do *not* power down the board, and type *very* carefully. This is the critical section.'''

* Erase Flash from 0xfffc0000 to 0xffffffff * Erasing sector fffc0000 * Erasing sector fffd0000 * Erasing sector fffe0000 * Erasing sector ffff0000 * done * Erased 4 sectors * Copy to Flash... done * CRC32 for fffc0000 ... ffffffff ==> d3cef189
 * Erase the last four sectors:
 * erase fffc0000 ffffffff
 * Copy the new bootloader into flash:
 * cp.b 800000 fffc0000 40000
 * Verify that the image is correct (crc of u-boot-1.1.4-df2.bin is 0xd3cef189).
 * crc fffc0000 40000

'''End of critical section. Congratulations!'''


 * Reset the board and see that the new version booted!
 * Don't forget to change your baud rate to 115200!
 * reset

You will see a message like : *** Warning - bad CRC, using default environment. That's normal. It will go away after you issue a saveenv command.

ppcboot 1.1.6
the latest ported ppcboot is 1.1.6, it need a patch and it will build for flashing at 0xfff80000 as a replacement for the pcboot-1.1.2 that comes with the board.


 * sources ftp://ftp.denx.de/pub/ppcboot/ppcboot-1.1.6.tar.bz2
 * patch [[Media:patch-ppcboot-1.1.6-km2|patch-ppcboot-1.1.6-km2]]
 * binary [[Media:ppcboot1.1.6.1.bin|ppcboot1.1.6.1.bin]] crc = 083fb0a3

Installing
Quick notes on installing ppcboot v1.1.6.1


 * Boot the board and bring it to the ppcboot console prompt.
 * Check current flash configuration:

=> flinfo

Bank # 1: AMD AM29F040 (512 Kbit, uniform sector size) Size: 512 KB in 8 Sectors Sector Start Addresses: FFF80000 RO  FFF90000  RO  FFFA0000  RO  FFFB0000      FFFC0000 FFFD0000     FFFE0000      FFFF0000

Note that the bottom three sectors, containing the existing 1.1.2 bootloader, are protected. We also want to protect the last sector, which contains the initial jump instruction, so:

=> protect on ffff0000 ffffffff

Protected 1 sectors


 * Zero out a section of ram before the download:

=> mw.b 400000 0 30000
 * Now download the new bootloader ppcboot1.1.6.1.bin into ram (you'll need a terminal emulator that supports the kermit file transfer mode):

=> loadb 400000 115200


 * 1) Switch baudrate to 115200 bps and press ENTER ...
 * 2) Ready for binary (kermit) download ...
 * 3) Start Addr      = 0x00400000
 * 4) Switch baudrate to 9600 bps and press ESC ...


 * Verify that the download was received correctly (crc should be 0x083fb0a3):

=> crc 400000 30000

CRC32 for 00400000 ... 0042ffff ==> 083fb0a3


 * Erase the three spare sectors, which we'll use to backup the 1.1.2 bootloader:

=> erase fffc0000 fffeffff

Erase Flash from 0xfffc0000 to 0xfffeffff Erasing sector fffc0000 .Erasing sector fffd0000 .Erasing sector fffe0000 . done Erased 3 sectors


 * (Optional: erase the 0xfffb0000 sector, which will be used for non-volatile environment storage.)

=> erase fffb0000 fffbffff

Erase Flash from 0xfffb0000 to 0xfffbffff Erasing sector fffb0000 . done Erased 1 sectors


 * Check that sectors 0xfffc0000 to 0xfffe0000 are erased, and sector 0xffff0000 is protected:

=> flinfo

Bank # 1: AMD AM29F040 (512 Kbit, uniform sector size) Size: 512 KB in 8 Sectors Sector Start Addresses: FFF80000 RO  FFF90000  RO  FFFA0000  RO  FFFB0000 E    FFFC0000 E    FFFD0000 E    FFFE0000 E    FFFF0000  RO


 * Now we're ready to backup the 1.1.2 bootloader. Copy three sectors from 0xfff80000 to 0xfffc0000:

=> cp.b fff80000 fffc0000 30000

Copy to Flash... done


 * Easy enough, right? Compare just to be sure it went ok:

=> cmp.b fff80000 fffc0000 30000

Total of 196608 bytes were the same


 * Now we're ready to modify the bootsectors. We'll turn off protection, erase the three bottom sectors, and copy the new 1.1.6.1 bootloader from ram.

=> protect off fff80000 fffaffff
 * Unprotect the bottom three sectors:

Un-Protected 3 sectors

'''From this point on, do *not* power down the board. This is the critical section.'''
 * Erase the bottom three sectors with the original 1.1.2 bootloader:

=> erase fff80000 fffaffff

Erase Flash from 0xfff80000 to 0xfffaffff Erasing sector fff80000 .Erasing sector fff90000 .Erasing sector fffa0000 . done Erased 3 sectors

=> cp.b 400000 fff80000 30000
 * Copy the new bootloader into flash:

Copy to Flash... done

=> cmp.b 400000 fff80000 30000
 * Verify the copy:

Total of 196608 bytes were the same

=> crc fff80000 30000
 * Verify that the image is correct (crc of ppcboot1.1.6.1.bin is 0x083fb0a3).

CRC32 for fff80000 ... fffaffff ==> 083fb0a3

'''End of critical section. Congratulations

=> protect on fff80000 fffaffff
 * We've finished modifying flash, so turn the write protection back on:

Protected 3 sectors


 * Reset the board and see that the new version booted

=> reset

PPCBoot 1.1.6 (Feb 5 2006 - 21:38:51)

CPU:  IBM PowerPC 405GP Rev. E at 266.640 MHz (PLB=66, OPB=33, EBC=33 MHz) PCI async ext clock used, internal PCI arbiter enabled 16 kB I-Cache 8 kB D-Cache

To sum up, you'll end up executing these commands:

=> protect on ffff0000 ffffffff

=> mw.b 400000 0 30000

=> loadb 400000 115200

=> crc 400000 30000

=> erase fffc0000 fffeffff

=> cp.b fff80000 fffc0000 30000

=> cmp.b fff80000 fffc0000 30000

=> protect off fff80000 fffaffff

=> erase fff80000 fffaffff

=> cp.b 400000 fff80000 30000

=> cmp.b 400000 fff80000 30000

=> crc fff80000 30000

=> protect on fff80000 fffaffff

new firmware, uboot-2009
it's under development, it will released soon

how to install it on flash
coming soon

how to test it without installing it on flash
coming soon

environment
coming soon

download
coming soon

dht-walnut-uboot-2009.tgz

the wiki environment is under development, too

so, in case of download issues, please email me (flamemaniii@gmail.com) and i will send you the firmware by email

boot from the tftp
It's relative easy if you have a tftp server setup

Have a kernel Image and Userland Image in the /tftpboot/ directory on your server =>tftpboot 400000 Working Kernel Image =>tftpboot c00000 Working Userland Image bootm 400000 c00000 < kernel boots and loads userland image >

= storage device: HardDisk, microdrive or Compact Flash, put a rootfs on it =

what you need
you need
 * a PC running a tftpboot server
 * the new ramrootfs ( see Flameman/dht-walnut )
 * for an empty 2..4Gbyte storage for the full gentoo rootfs
 * for an empty 512Mb..1Gbyte storage for the embedded gentoo rootfs

idea

 * put the dht-walnut harddisk into PC ide slot
 * partition the storage device
 * install all the gentoo portages
 * remove the harddisk and put it into dht-walnut ide slot

partition
coming soon

install
coming soon

= OS = Operating System available for this board

NetBSD

 * Netbsd has a port for "IBM PowerPC 405GP based Walnut evaluation board", this is not the DHT-Walnut, this is an other way to call the AMCC-Walnut (yes just to be confusing). Ok, it is not for DHT-Walnut, but this port could be (easealy / hardly) adapted to the DHT-Walnut with some work / over work

Hardware that is known to work with

 * see netbsd web, the hw could be (easealy / hardly) adapted to the DHT-Walnut with some work / over work

.

Gentoo-PPC/32

 * Version 2.4 (Mostly) working kernel binary and config from jbevren with matrox fbcon and usb input support. Current issues: USB keyboard input doesnt seem to work, but events reach /dev/input/event0
 * Version 2.6 working ... tested vanilla kernel 2.6.16.3, 2.6.24 (actually running)

boot from HD
Work In Progress

ppcboot/U-Boot provides only basic functionality to access Hard disks: you can print the partition table and read and write blocks (addressed by absolute block number), but there is no support to create new partitions or to read files from any type of filesystem. The current version of ppcboot-1.1.6 has a problem with writing to hdd, however, once the Linux kernel is loaded and the userland initialized, the hdd can be accesses normally through PIO and DMA modes. This may or may-not be fixed in the future.

As usual, you can get some information about the available IDE commands using the help command in ppcboot:

=> help ide ide reset - reset IDE controller ide info - show available IDE devices ide device [dev] - show or set current device ide part [dev] - print partition table of one or all IDE devices ide read addr blk# cnt ide write addr blk# cnt - read/write `cnt' blocks starting at block `blk#' to/from memory address `addr'

You may create the needed partitions by tftpbooting Linux and an appropriate userland, then use fdisk to partition the disk. Then reboot back to ppcboot.

ppcboot can be configured for DOS and Mac OS? type partition tables. Since ppcboot cannot read files from a filesystem you should create one (or more) small partitions (maybe 1 or 2 MB) if you want to boot from the "disk". (The size of these partitions will depend on how large your kernel and userland images are)

You should create the following partiton table:

hde: hdx1 hdx2 hdx3 hdx4
 * 1) fdisk /dev/hdx

/dev/hde1 ID=83   Linux < 2Mb, boot kernel, dd if=kernel of=here /dev/hde2 ID=83   Linux /dev/hde3 ID=83   Linux <  root & usr /dev/hde4 ID=82   Swap  < 32Mb, swap

You should also initialized /dev/hdx4 as swap space. Setting up swapspace
 * 1) mkswap /dev/hdx4

check how ppcboot/U-Boot will recognize this partition table: => ide part


 * dd if=kernel.img of=/dev/hdx1

To boot from a disk you can use the diskboot command:

=> help diskboot diskboot loadAddr dev:part

The diskboot command expects a load address in RAM, and a combination of device and partition numbers, separated by a colon. It then reads the image from disk and stores it in memory. We can now boot it using the bootm command [to automatically boot the image define the ppcboot environment autostart with the value =yes=].

=> diskboot 400000 0:1 ide_read dev 0 start 0, blocks 1 buffer at 3F9F8C0
 * 1) Valid DOS partition found ##

Loading from IDE device 0, partition 1: Name: hda1 Type: PPCBoot First Block: 63, # of blocks: 8001, Block Size: 512 ide_read dev 0 start 3F, blocks 1 buffer at 400000 Image Name:  DHT Kernel ..

=> bootm 400000 c00000 Image Name:  DHT Walnut Kernel Image Type:  PowerPC Linux Kernel Image (gzip compressed) ...
 * 1) Booting image at 00400000 ...

=> setenv bootargs root=/dev/ram0 => setenv autostart yes => disk 400000 0:1 \;\ diskboot c00000 0:2 \;\ bootm 400000 c00000 => bootd (i will post all my setenv)

The above procedure puts the userland image from the second partition into a ramdisk. If you would like the userland to be an ext2/3/rieser/xfs partition on the hdd do the following:


 * make the partiton table as above
 * put the kernel and small userland onto the first partitions as above
 * populate the root&usr partition with the appropriate files (gentoo-ppc32 distro)
 * change bootargs to "bootargs root=/def/hda3"
 * bootd to try out the new root, if it works ok, reboot back to ppcboot, change the bootargs again and saveenv
 * bootd and enjoy your new system.

Hardware that is known to work with
There is a list of the Hardware that is known to work (and not to work) with this board. Feel free to add, comment, feedback about it.


 * matrox millennium I/II
 * 3com-netcard
 * adaptec 2940

Compile from sources
Linux 2.6 has issues in the source's tree: the dht-Walnut has been originally ported to arch=ppc, while the new kernel tree is around arch=powerpcc, for this reason you need to specify the right arch or your compiler will have issues. Developers will port everything to arch=powerppc in the future. Kernel 2.6.12 is free of this problem, newer than .12 have it.

Warning
The GPIO registers are quite fickle things. Not only are they for the Media LED and J5 header, they also manage the IRQs and Peripheral Chip selects. Hitting a wrong bit in Linux will cause problems, kernel panics, total lockups, bad things, 'plagues of locusts', you get the idea. When using the PPC405 _gpio driver below(or the 405_ocp_gpio driver in DENX Linux PPC 2.4, use a mask of 0xFFC00000, that way you don't manage to hit something you really don't want to.

Playing with the Media LED
The Media LED on the DHT-Walnut is wired to the processor by the GPIO pins. However its behind a 74VHC14 Schmitt Inverter. So you have to send it low in order to turn it on. This top section only covers the Media LED and the U-Boot/PPCBoot ROM Monitor.

Memory Locations
0xef600700 is the memory location of the GPIO output register. It's 4 bytes wide. It turns on and off the GPIO pins on the PPC405GP.

0xef600704 is the location of the Tri-State register. Also 4 bytes wide. Controls if the GPIO pin is active when high.

0xef600718 is the location of the Open Drain register. Also 4 bytes wide. Controls if the GPIO pin is an open drain or active output.

0xef60071c is the location of the GPIO Input register. Also 4 bytes wide. The state of each pin is reflected in the correspondig value in this register. (synchronized with OPBClk)

Playing with the LED
By having all the bits in the Tri-State register high and the Output register all low, The pins are driven low. Because the Media LED is behind the inverter it glows when low. Setting it high in the Output register will turn it off.

Example using U-Boot 1.1.4
Setting the Tri-State Register to drive all usable GPIOs. => nm 0xef600704 ef600704: 00000000 ? ffc00000 ef600704: ffc00000 ? The LED should be lit now as its pin is driven low.

Turning the LED on and off with the Output Register => nm 0xef600700 ef600700: 00000000 ? 20000000 //LED should be off. ef600700: 20000000 ? 00000000 //LED goes on. ef600700: 00000000 ?

The J5 Header
The J5 header located to the left of the RAM slot actually has 9 GPIO pins wired to it. GPIOs 1 to 9 to be exact. That header also has the Power and Media LEDs wired to it, so using the first 2 pins will look awkward if your bit-banging to say a SD/MMC card or LCD display. The J5 header has the following layout. As things are developed they will be added.



Module for 2.6.16
Using a module from a Monta Vista 2.4 kernel, I did the slight editing so that it will compile with 2.6.16. I have made a patch file that can be applied to a vanilla 2.6.16 kernel.

Also included is a small bit of test code to show how to operate the gpio driver.

Module patch and test code here: [[Media:ppc405_gpio.tar.gz]]

(Version 2 will be up once I clean some little problems out of the test code, possibly tonight)

Any errors or things you want to see, don't hesitate to let me know. I'll be slowly adding little things to the module as helpers.

Once you have your module installed and modprobe/insmoded, just run 'make' to built the test app. If you don't have a /dev/ entry yet just 'make dev' and it'll do it for you. DevFS isn't supported yet, I'm working on that now.

= yet an other rootfs =

Angstrom
In this project i am using gentoo catalyst/ppc to native (host=ppc target=ppc) build up the all rootfs (in gentoo words "that's stage3..4"): that means that you need a native ppc machine in where to compile a lot of stuff. If you don't have a native ppc machine, if you prefer to crosscompile, if you don't the whole process will/could take a long time to make you ready ... well ... you could just try out the "proof of concept online image builder for the Angstrom distribution" ... in where you have just to choose board="dht-walnut", then you have to select all you want to include ... and the whole the process will build automatically in minutes


 * Flameman/dht-walnut/proof
 * see http://tinyurl.com/dfcer3 -> http://amethyst.openembedded.net/~koen/narcissus/

= new ramrootfs, tftp uboot uImage: install/recovery/first-aid =

Image Name:  "ramrootfs" Created:     Fri Jul  3 15:51:20 2009 Image Type:  PowerPC unix Kernel uboot-uImage (gzip compressed) Load Address: 0x00000000 Entry Point: 0x00000000

goal
this is a pretty embedded kit able to bootstrap the dht-walunt with a early ram rootfs populated with the essential you need to


 * mount/nfs mount a disk
 * nano/hexedit configure mounted disk files from disaster
 * badklocks/fsck.{ext2,ext3,minix} a disk
 * fdisk, mac-fdisk a disk
 * scp/wget file from the lan (it's very goot to install gentoo stages from gentoo mirrors)
 * ssh/telnet to/from hostes
 * sync your system date to the internet rdate

about
this rootfs has been build with
 * gcc powerpc-softfloat-linux-uclibc v4.1.2
 * static stripped elf

it is based on the following packages:


 * bash-3.2_p33: ok
 * busybox-1.7.4: ok
 * dropbear-0.49: ok
 * e2fsprogs-1.40.9: ok
 * hexedit-1.2.12: ok
 * mac-fdisk-hacked-for-mips-arm: ok
 * nano-2.1.5: ok
 * nfs-utils-1.1.0: ok
 * openssh-4.7_p1-r6: ok
 * shadow-4.0.18.2: ok
 * sysvinit-2.86: ok
 * my-init: no
 * tty-redirect-openpty: ok

it works

 * locally on the serial console, where it bootstrap
 * remotely on telnet with the ip 192.168.1.2

sorry sshd is not provided yet, you have to telnet

issue
there is an issue if you decide to use ssh/scp on the serial console the problem is related to a redirection of /dev/console to /dev/tty so to avoid you need to invoke openpty (an app i prepared as temporary fixup)

scp is reporting debug1: Next authentication method: password debug1: read_passphrase: can't open /dev/tty: No such device or address

workaround

uc-earlyrootfs ~ # tty /dev/ttyS0 uc-earlyrootfs ~ # echo "hAllo" > /dev/tty /dev/tty no such decice or address uc-earlyrootfs ~ # openpty uc-earlyrootfs ~ # tty /dev/pts/0 uc-earlyrootfs ~ # echo "hAllo" > /dev/tty hAllo

missing

 * /dev/initctl
 * halt/reset/shudown
 * sshd, fptd

download
07-2009: kernel 2.6.15.4+initramfs full tested and working [[Media:kernel-dht-walnut-ramrootfs-uImage.tgz|kernel-dht-walnut-ramrootfs-uImage.tgz]]

file size: 3.97 MB, MIME type, the original was 4.3Mb but this wiki is refusing to upload file greater than 4Mb, so the kernel has been reduced and in features: no scsi and graph console support

contents:

gentoo-2.6.15.4-dht-walnut-uImage -> what you have to tftpboot to dht-walnut

gentoo-2.6.15.4-dht-walnut-uImage.md5 -> the md5sum should be b6c1e725984c665e46c1428d0f953149

tested with

 * U-Boot 1.2.0-g7882751c-dirty (Apr 14 2007 - 16:44:37): working (with ide support, working)
 * U-Boot 2009.06-00273-g59869ca-dirty (Jul 08 2009 - 08:12:46): working (but this version has no ide capabilities, so no disk-boot is possible)
 * U-Boot 1.2-2009 (Jul 24 2009 - still under development): working (with ide support, working, suggest as the final firmware)

download the latest uboot tested firmware
U-Boot 2009.06-00273-g59869ca-dirty is assumed as the last working uboot [[Media:uboot-dht-walnut-install-kit.tgz|uboot-dht-walnut-install-kit.tgz]]

NOTE

working and (minimal-)set-environment session's logs are reported as "updated instructions", also md5sum and CRC are provided inside the tgz file

NOTE2 if the wiki issues in giving you the file that you asked for (or at least of the correct name). you could use this wget trick

wget http://www.elinux.org/images/7/77/Uboot-dht-walnut-install-kit.tgz

.

firmware issues with
reported issues with uboot 1.1.4 and ppcboot 1.1.6


 * host: tftp-boot-image, md5 check passes
 * gentoo-walnut-rammrootfs-uImage has md5 B6C1E725984C665E46C1428D0F953149
 * the image file size is 4161527 bytes, crc32 of the file is 8031f4dc
 * target: tftp
 * set up the ramrootfs boot args and tftp the image into the DHT-walnut
 * full 4161527 bytes were transferred.
 * loaded image, performed a crc32 command, passes
 * bootm, panic, It reports "4161463 Bytes = 4063 kB = 3 MB"

usage
assure you have bootargs console=ttyS0,9600 rdinit=/sbin/init init=/bin/bash in your tftp

here it is my whole environment, in where i simply invoke 2 macro + bootm


 * run ramrootfs
 * run boot-tftp
 * bootm

earlyrootfs login: root Password: (enter, no password)

=> printenv bootdelay=5 loads_echo=1 netdev=eth0 ramargs=setenv bootargs root=/dev/ram rw                     addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off panic=1 addtty=setenv bootargs ${bootargs} console=ttyS0,${baudrate} kernel_addr=fff80000 ramdisk_addr=fff80000 update=protect off fffc0000 ffffffff;era fffc0000 ffffffff;cp.b 100000 fffc0000 40000;setenv filesize;saveenv ethact=ppc_4xx_eth0 hostname=walnut-ppc405 ethaddr=DE:AD:BE:EF:DE:AD preboot=echo "ide.part.1th stores kernel rawimage" myroot=/dev/hda4 myinit=/sbin/init fileaddr=800000 netmask=255.255.255.0 bootcmd=run boot-disk ; bootm myboot_diskpart=0:1 myboot_kernel_addr=800000 baudrate=9600 myuart=ttyS0 setconsole_uart=setenv myconsole ${myuart},${baudrate} setconsole_video=setenv myconsole tty video=${myvideofb} myvideofb=matroxfb:800x600-16@60 setbootargs=setenv bootargs console=${myconsole} root=${myroot} init=${myinit} myconsole=ttyS0,9600 bootargs=console=ttyS0,9600 root=/dev/hda4 init=/sbin/init boot-tftp=tftpboot ${myboot_kernel_addr} ${myboot_file} boot-disk=diskboot ${myboot_kernel_addr} ${myboot_diskpart} ipaddr=192.168.1.5 serverip=192.168.1.14 gatewayip=192.168.1.1 myboot_file=gentoo-walnut-ramrootfs.img ramrootfs=setenv bootargs console=ttyS0,9600 rdinit=/sbin/init init=/bin/bash stdin=serial stdout=serial stderr=serial ver=U-Boot 1.2.0-g7882751c-dirty (Apr 14 2007 - 16:44:37)

Environment size: 1405/16379 bytes => run ramrootfs => run boot-tftp PHY speed read failed, assuming 10bT PHY duplex read failed, assuming half duplex ENET Speed is 10 Mbps - HALF duplex connection (EMAC0) Using ppc_4xx_eth0 device TFTP from server 192.168.1.14; our IP address is 192.168.1.5 Filename 'gentoo-walnut-ramrootfs.img'. Load address: 0x800000 Loading: ################################################################# #################################################################        #################################################################         #################################################################         #################################################################         #################################################################         #################################################################         #################################################################         #################################################################         #################################################################         #################################################################         #################################################################         #################################################################         ############################## done Bytes transferred = 4161527 (3f7ff7 hex) => bootm Image Name:  "ramrootfs" Created:     2009-07-06  11:19:06 UTC Image Type:  PowerPC Linux Kernel Image (gzip compressed) Data Size:   4161463 Bytes =  4 MB           Load Address: 00000000 Entry Point: 00000000 Verifying Checksum ... OK  Uncompressing Kernel Image ... OK kernel 2.6.15.4-sliding-snow-leopard-dht-walnut-ppc405 (root@minerva) (gcc version 4.1.2) #30 Fri Jul 3 15:14:11 CEST 2009 IBM Walnut port (C) 2000-2002 MontaVista Software, Inc. (source@mvista.com) ...
 * 1) Booting image at 00800000 ...

= kernel =

download
2007: kernel 2.6.19 full tested and working [[Media:kernel-dht-walnut.tgz|kernel-dht-walnut.tgz]] (suggested for production)

compiled with gcc-3.4.6, basically it is a vanilla, with a bit of my patches i added in order to avoid myself from the differences between a common "ppc" platform and .. the 405GP/walnut.

14-06-2009: new kernel 2.6.30 needs to be hardly tested (with gcc-4.3.*) and (maybe) patched anyway, advantages about


 * the new supported pci/usb hw
 * the new dynamic tickless
 * the ext4
 * the new networking stack and congestion mechanisms

i2c_over_gpio
15-06-2009: the idea has been stared 3 days ago, the stuff is under development

spi_over_gpio
15-06-2009: the idea has been stared 3 days ago, the stuff is under development

.

= Project: do something useful with the board =

DHT-Walnut as N.A.S.


I turned a DHT-Walnut + 300Gb hard disk into a file server to have my data files connected and shared to the LAN (Local Area Network).

N.A.S. stands for Network Attached Storage. They are storage devices attached to the lan. A NAS should be able to be connected to every kind of network. It should use both the access protocols NFS (Network File System) and CIFS (Common Internet File System)

I only enabled NFS service in the kernel configure because i don't need CIFS. UNIX servers use NFS, while Microsoft systems use CIFS, fortunately i don't have any Microsoft systems here :P Gentoo is installed in the first little partition of the hard disk (it is PC-partition style, so you can only have 4 partitions). It runs openssh, telnet, ftp, tftp, and NFS. As the fact there is no RTC chip installed i added special /etc/init.d/clock-sync to set the local time. The scrips uses rdata to retrieve the current time of an other machine.

In the photo you could see the case i realized: the hard drive is connected to the opened door, the DHT-walnut PCD has been placed inside, the green LED has been used to the frontal case to say "the booting has been completed, the system is ready" (used the gpio hack provided in patches for the 2.6.16-rc3). The black platform is from sony playstation2 and is is only a nice way to have the case vertically seated.

Don't keep about the ALS4000 pci sound board  plugged in the upper PCI bus. It has been plugged just to use the NAS as the giant (300Gb) ipod you have ever seen .... but this is an other story ....

Note: also scsi adaptec-2940 is working !!! i added 3x40Gb sca-scsi stored in a sun box

to be checked: sATA pci controller

please report any other working hardware here, or @ flamemaniii@gmail.com