INDEX: 1. BUILDING LINUX FOR INTEL PXA27x PROCESSOR DEVELOPER'S KIT 2. BUILDING BLOB FOR INTEL PXA27x PROCESSOR DEVELOPER'S KIT 3. LOADING AND RUNNING LINUX ON INTEL PXA27x PROCESSOR DEVELOPER'S KIT 4. CONFIGURING THE NETWORK 5. MOUNTING A NFS PARTITION 6. MOUNTING A RAMFS PARTITION 7. CREATING A JFFS2 FILE SYSTEM IMAGE 8. CONFIGURING YOUR DEVELOPMENT ENVIRONMENT FOR TFTP FILE DOWNLOAD 9. APM AND DVM/DFM USAGE 10. CAMERA INTERFACE(CI) USAGE 11. LINUX KERNEL AND CRAMFS XIP USAGE 12. KNOWN PROBLEMS 13. UPDATE NOTES +++ NO WARRANTY! USE AT YOUR OWN RISK! +++ -------------------------------------------------------------- 1. BUILDING LINUX FOR PXA27x DVK You need the following files: * linux-2.4.21.tar.gz - kernel sources from ftp://ftp.kernel.org * patch-2.4.21-rmk1.gz - patches by Russell King from ftp://ftp.arm.linux.org.uk/pub/armlinux/kernel/2.4 * diff-2.4.21-rmk1-pxa1.gz - patches by Nicolas Pitre from ftp://source.mvista.com/pub/xscale/pxa * diff-2.4.21-rmk1-pxa1-intc3.gz - patches by Intel ICG CHG Platform Enabling Linux Team Kernel build steps: 1.1) Untar the Linux kernel sources (downloaded from ftp.kernel.org): % tar xvzf linux-2.4.21.tar.gz if the Linux sources were compressed with bzip2, use the following command: % bzip2 -dc linux-2.4.21.tar.bz2 | tar xvf - Enter Linux source directory, % cd linux-2.4.21 1.2) Apply Russell's arm-linux patches: % gzip -dc patch-2.4.21-rmk1.gz | patch -p1 or, % bzip2 -dc patch-2.4.21-rmk1.bz2 | patch -p1 1.3) Apply Nicolas' Linux patches: % gzip -dc diff-2.4.21-rmk1-pxa1.gz | patch -p1 1.4) Apply Intel ICG PCG/SE Linux Team's patches: % gzip -dc diff-2.4.21-rmk1-pxa1-intc3.gz | patch -p1 1.5) Build the kernel (after patching): % make mainstone_config % make oldconfig % make dep % make zImage ------------------------------------------------------------- 2. BUILDING BLOB FOR INTEL PXA27x PROCESSOR DEVELOPER'S KIT Please refer to http://pcgse.hd.intel.com for details -------------------------------------------------------------- 3. LOADING AND RUNNING LINUX ON INTEL PXA27x PROCESSOR DEVELOPER'S KIT: The following files are required: * blob - *NOT* provided with this distribution, Please get it from http://pcgse.hd.intel.com. * rootfs_x32_16M.jffs2 - flash(x32) file system, w/ GPL'ed QT/E * rootfs_x16_16M.jffs2 - flash(x16) file system, w/ GPL'ed QT/E * zImage.vga - Linux kernel for Intel PXA27x Processor Developer's Kit platforms with VGA support * zImage.qvga - Linux kernel for Intel PXA27x Processor Developer's Kit platforms with QVGA support Kernel loading steps: 3.1) Burn 'blob' onto flash starting at 0x0000_0000. You may use the JFlash utility for HCDDBBVA0 or NBMMNSxBVS on windows: c:\jflash\> jflashmm.exe bulverde blob (For A0/A1 stepping) or, c:\jflash\> jflashmm.exe bulvb0 blob (For B0/C0 stepping) Note 1: The flash(K3) on PXA27x DVK board is not available for use. The JFlash utility included in this kit is NOT supported and it may not work with the Insight* JTAG cable. For a supported version of JFlash that works with the Insight JTAG cable currently being shipped with the Intel PXA27x Processor Developer flatform, please use the JFlash utility for Windows* hosts available at . Please refer to the release note included in the utility on how to use the jflash utility. 3.2) Start your favorite terminal emulator (i.e. Minicom) configured for 115200,8N1. 3.3) Reset the Intel PXA27x Processor Developer platform and press any key when BLOB shows, "Autoboot in progess, press any key to stop ..". You should then be in BLOB commond console. Use "help" to show command lists. NOTE : If the network cable is not a plug-in, it may take around 20 seconds before the prompt shows up. blob> help The following commands are supported: * reset * reboot * arp * autoip * setip * tdownload * tftp * flash * lock * unlock * erase * boot * status * reload * ptprint * reblob * fwrite * ferase * tftp * clockinfo * help Use the "help command" to get help on a specific command. 3.4) Load the file system image to the HCDDBBVA0 or NBMMNSxBVS platform's RAM: blob> tftp rootfs_x32_16M.jffs2 TFTPing rootfs_x32_16M.jffs2........OK received 32770 blocks (16777216 bytes) tftp_cmd: file 'rootfs_x32_16M.jffs2' loaded via TFTP to address 0xa1000000 blob> Please refer to Section 8 to setup the TFTP environment. 3.5) Burn the uploaded file system image on to flash. Burn the image in RAM to flash, and erase the remaining flash. NOTE: It's IMPORTANT to erase the flash until end of it. blob> fwrite 0xa1000000 0x240000 0x1000000 Erasing 64 blocks at 0x00240000:......... Flashing 0x01000000 bytes at 0x00240000 blob> ferase 0x1240000 0xdc0000 Erasing 55 block at 0x01240000:.......... blob> 3.6) At the BLOB prompt, type the following command to upload the kernel: blob> tftp zImage.vga TFTPing zImage.vga........OK ... tftp_cmd: file 'zImage.vga' loaded via TFTP to address 0xa1000000 blob> If you want to download image through XMODEM, please refer to command "xdownload" for details. 3.7) After the kernel image transfer is complete, burn the uploaded kernel image on to flash. To burn the image in RAM to flash. blob> fwrite 0xa1000000 0x40000 0x200000 Erasing 4 blocks at 0x00100000:.... Flash 0x00100000 bytes at 0x00040000:.... blob> Note: If you want to boot without RESET, please use blob> reload kernel blob> boot or using the following command to load the kernel to RAM directly, blob> tftp zImage.vga --kernel blob> boot 3.8) On every board RESET or power up, if you do not press any key on keyboard, the following message should appear on your terminal emulator: Uncompressing Linux..... < kernel displays a lot of debug messages > Linux login: root [root@Linux /root]$ NOTE 1: the kernel will take longer to boot up the first time it loads as it erases some JFFS2 flash blocks. Watch the LED 'D7' until it stops blinking. Subsequent kernel boot time should be faster. NOTE 2: Press any key to abort the autoboot, and then type following command in BLOB. It should be faster than autoboot. blob> boot Start Kernel.... --------------------------------------------------------------- 4. CONFIGURING THE NETWORK: You may configure the network with the following commands: % /sbin/ifconfig eth0 IPADDR netmask NETMASK broadcast BROADCAST % /sbin/route add default gw GATEWAY metric 1 where IPADDR is your IP address, NETMASK is your network mask, BROADCAST is your broadcast address and GATEWAY is your gateway address. Add your DNS entries in /etc/resolv.conf --------------------------------------------------------------- 5. MOUNTING AN NFS PARTITION: Detailed information on setting up your NFS server and client can be obtained at http://www.tldp.org/HOWTO/NFS-HOWTO/. The following is a list of commands that work while running RedHat 6.1: 5.1) Setting up an NFS server: a) Edit the file /etc/exports to share a volume: /a/home/chagas (rw,no_root_squash) b) Initialize NFS services (RedHat 6.1): % /etc/rc.d/init.d/nfs stop % /etc/rc.d/init.d/nfs start Note, you may optionally follow the instructions in the NFS-HOWTO. c) After modifying the /etc/exports file, execute the following command: % exportfs -rav 5.2) Setting up an NFS client: % mount -o nolock :/home/foo /mnt 5.3) Setting up an NFSROOT kernel You may wish to have the PXA27x DVK use an NFS mount as the root file system instead of using one based in the on-board Flash memory. To do this, follow the instructions below: a) Extract the rootfs.tar.gz archive included with this distribution. Make sure you do this as root so the device files get properly created. A convenient place to extract it would be in the top level directory. For example: % cd / % tar -xzvf ~/rootfs.tar.gz This will create a directory called /rootfs. b) Set up your NFS server to export this directory. Refer to section 5.1 for instructions on how to do this. c) Set up a Linux source tree as described in section 1. d) In the top level directory (i.e. linux-2.4.19/) type: % make menuconfig e) Using the arrow keys to navigate, select "General Setup" (should be the fourth line down) and hit Enter. In the next menu, go down to "Default kernel command string" and hit Enter. f) A box will come with the current command string in it. Delete it and replace it with the following string: root=/dev/nfs nfsroot=: ip=:::::eth0:off console=ttyS0,115200 mem=64M Where the parameters are the following: : The server hosting the NFS file system : The directory on the NFS server where you extracted the rootfs.tar.gz archive. : The IP of the PXA27x DVK board : The netmask : An arbitrary hostname for the PXA27x DVK board. Hit enter, then hit escape twice. When it asks if you would like to save you kernel configuration, answer Yes. Note that if you use DHCP or BOOTP instead of static IP configuration, the ip= parameter can read: ip=auto g) Now just build the kernel by typing: % make zImage --------------------------------------------------------------- 6. MOUNTING A RAMFS PARTITION: % mkdir -p /ram1 % mount -t ramfs none /ram1 --------------------------------------------------------------- 7. CREATING A JFFS2 FILE SYSTEM IMAGE You may use the following files to build a JFFS2 file image: * rootfs.tar.gz - root file tree * mkfs.jffs2 - JFFS2 make file system utility The mkfs.jffs2 binary executable utility included with this distribution is known to run on RedHat Linux v7.1 (Pentium). First create a temporary subdirectory and expand the root file system into it. You _must_ login as 'root': % mkdir tmp % cd tmp % tar xvzf ../rootfs.tar.gz % cd .. Then run 'mkfs.jffs2' to create the JFFS2 file image: % ./mkfs.jffs2 -r /home/chagas/rootfs/ -o fs.jffs2 -e 0x40000 --pad=0x01000000 Note 1: '--pad=0x01000000' switch will generate a padded 16MB image to avoid those pesky "JFFS2: Erase block.." warning messages at kernel boot up. --------------------------------------------------------------- 8. CONFIGURING YOUR DEVELOPMENT ENVIRONMENT FOR TFTP FILE DOWNLOAD: 8.1) Configuring TFTP server for RedHat Linux: To enable TFTP on RedHat v6.1: - Edit /etc/inetd.conf and uncomment the following line: tftp dgram udp wait root /usr/sbin/tcpd in.tftpd - Create the TFTP default directory % mkdir /tftpboot - Then re-start your network services or reboot the system. To enable TFTP on RedHat v7.2 edit '/etc/xinetd.d/tftp': service tftp { # enable , yes => no disable = no socket_type = dgram ... # set root directory for tftp you like,here is /tftproot/ server_args = -s /tftproot/ } 8.2) Use Ethernet NOTE : If you are using TCP/IP-over-USB, goto Section "8.3". Connect HCDDBBVA0 or NBMMNSxBVS platform to HOST with a CROSS-OVER twisted-cable, and use "ifconfig" on HOST, % ifconfig eth1 192.168.1.100 8.3) Use TCP/IP-over-USB NOTE : If you are using Ethernet, go to Section "8.2". Use blob-bvd.usb instead of blob-bvd in step 3.1. 8.3.1) Installing USB Ethernet on host, # tar xzf usbdnet.tar.gz # cd usbdnet # make # rmmod usbnet # insmod usbdnet.o NOTE: Remove kernel module "usbnet.o" before installing kernel module "usbdnet.o". 8.3.2) Configuring USB Ethernet EACH TIME after resetting the HCDDBBVA0 or NBMMNSxBVS platform, enter BLOB command line (by stopping the autoboot progress). Now configure the USB Ethernet. - Reset USB Execute "tftp" command, connect the USB cable when the prompt displays. blob> tftp filename **** Plug-in USB cable & config usbdnet now *****" ... - Configure USB Ethernet device on host % ifconfig -a You should find Ethernet interface named "usb0". % ifconfig usb0 192.168.1.100 NOTE: if eth1 is already configured as 192.168.1.100, please disable the eth1. % ifconfig eth1 down Some PXA27x DVK boards need to upgrade the CPLD code on the daughter card to support USB client. - Configure USB Ethernet device on the HCDDBBVA0 or NBMMNSxBVS platform BLOB has following default configuration, * IP address : 192.168.1.101 * Default TFTP server : 192.168.1.100 To change the configuration, use command "ifconfig" on BLOB command line. Note, the new configuration is not permanant before BLOB as it does not have a flash area to store the configuration. --------------------------------------------------------------- 9. APM AND DVM/DFM USAGE 9.1) APM Usage: By write different numbers to /proc/sys/pm/suspend we can let CPU get into different CPU mode. The usage is: # echo number > /proc/sys/pm/suspend Available number and the CPU mode it stands for are listed below: number mode phenomenon 2 Standby LCD off, HEXLED ON 3 Sleep LCD off, HEXLED OFF 7 Deepsleep LCD off, HEXLED OFF Press any key on the keypad or switching SW21 from DOT to no-DOT to wake up the system from Sleep/Standby. APM also support automatically waken up by RTC, use # echo time > /proc/sys/pm/sleeptime to set the time that keep system stay in Sleep/Standby before wakeup. time is in seconds and should be no longer than 59 seconds. For example, # echo 5 > /proc/sys/pm/sleeptime # echo 3 > /proc/sys/pm/suspend will sleep the system for 5 seconds, then it will wakenup automatically. 9.2) DVM/DFM Usage DVFM is used to dynamicly change CPU's run frequency and voltage. Write the desired frequency to /proc/sys/cpu/0/speed to change it. two read-only files, /proc/sys/cpu/0/speed-min and /proc/sys/cpu/0/speed-max, shows the max and min frequency that the CPU can run at. Please be noted that the unit for speed is KHz. DVM provide three files under /proc filesystem, named /proc/sys/voltage/0/voltage, /proc/sys/voltage/0/voltage-min, /proc/sys/voltage/0/voltage-max. One can know CPU's voltage by have a look at /proc/sys/voltage/0/voltage but can't change it by write something in. Another ioctl interface, which can be used to change voltage&frequency together, is also provided. ioctl interface is more flexible than /proc and was recommended. Before use the ioctl interface, make sure /dev/ipmc is there. If not, use # mknod /dev/ipmc c 10 90 to create it first. A application named "dvfm" is developed and comes with the default root fs. The source tarball "dvfm.tar.gz" is under "src/rootfs". # dvfm # Usage: dvfm freq n_value fast_bus_mode # Need parameters are described below: freq: the desired frequnecy in khz; n_value: the N value in CCCR; fast_bus_mode: [0|1], to specify switch to fast bus mode or not. For example, # dvfm 104000 2 0 will switch the system to 104Mhz, with N=2 means RUN mode,no fast bus mode. # dvfm 65000 5 1 will switch the system to 65Mhz, with N=5 means TURBO mode,fast bus mode. Note: Please refer to Intel PXA27x Process Developer's Kit manual to know the combination of freq N and fast_bus_mode, incorrect combination will hang the system, or even damage the hardware! --------------------------------------------------------------- 10. CAMERA INTERFACE(CI) USAGE 10.1) Features Resolution: VGA(480x640), CIF(352x288), QVGA(320x240), QCIF(176x144), QQVGA(160x120), QQCIF(88x72) Output Format: YCbCr422, RGB565, RGB666 10.2) Build CI Driver Before building CI driver, it requires the following configuration, see below. Using the following: % make mainstone_config % make menuconfig At the top level select the Character devices entry: Code maturity level options ---> Loadable module support ---> ... I2O device support ---> ISDN subsystem ---> Input core support ---> ===> Character devices ---> Multimedia devices ---> ... Library routines ---> --- Load an Alternate Configuration File Save Configuration to an Alternate File in Character devices page, select I2C support [*] Virtual terminal ... (256) Maximum number of Unix98 PTYs in use (0-2048) ===> I2C support ---> L3 serial bus support ---> Mice ---> ... [ ] Direct Rendering Manager (XFree86 DRI support) in I2C support page, select the following item as built-in <*> I2C support < > I2C bit-banging interfaces (NEW) < > I2C PCF 8584 interfaces (NEW) <*> PXA I2C Algorithm (NEW) <*> PXA I2C Adapter <*> ADCM2650 support < > I2C device interface (NEW) < > I2C /proc interface (required for hardware sensors) (NEW) Go back to top level, select Multimedia devices. Code maturity level options ---> Loadable module support ---> ... I2O device support ---> ISDN subsystem ---> Input core support ---> Character devices ---> ===> Multimedia devices ---> File systems ---> ... Library routines ---> --- Load an Alternate Configuration File Save Configuration to an Alternate File in Multimedia devices page, select Video for Linux as built-in and select Video for Linux <*> Video For Linux ===> Video For Linux ---> Radio Adapters ---> in Video For Linux page, select "Camera Interface for Bulverde" as built-in [ ] V4L information in proc filesystem (NEW) --- Video Adapters < > Mediavision Pro Movie Studio Video For Linux (NEW) < > CPiA Video For Linux (NEW) < > SAA5249 Teletext processor (NEW) < > SAB3036 tuner (NEW) <*> Camera Interface for Bulverde(Mainstone) (NEW) % make dep % make oldconfig % make zImage 10.3) Camera demo usage The kit includes the application "ci-capture" for the purpose of demonstrating, it comes with the root filesystem by default. The source tarball "camera.tar.gz" is under "src/rootfs/". To build the demo application: % tar xzf src/rootfs/camera.tar.gz % cd camera % make Before we can run the demo application, make sure "/dev/video0" is there. If not, use the following command to create, % mknod /dev/video0 c 81 0 Now run the demo on target board, % ci-capture width height Note: the parameters "width" and "height" means the resolution of image, such as 176x144. The resolution has to be one of CIF(352x288), QVGA(320x240), QCIF(176x144), QQVGA(160x120), QQCIF(88x72). --------------------------------------------------------------- 11. LINUX KERNEL AND CRAMFS XIP USAGE We have Linux kernel and filesystem XIP support with patch with the Preview Kit. Here are the instructions and usages for XIP features. 11.1) Linux Kernel XIP In oder to enable kernel XIP, we need to configure as following, % make mainstone_config % make menuconfig At the top level select "General setup" entry, ... Code maturity level options ---> Loadable module support ---> System Type ---> ===> General setup ---> Parallel port support ---> ... In "General setup" page, select "Kernel Execute-In-Place from ROM...", and set "Kernel .text physical address" to 0x40000; ... [ ] BSD Process Accounting [*] Sysctl support ===> [*] Kernel Execute-In-Place from ROM (EXPERIMENTAL) ===> (00040000) Kernel .text physical address ... % make xipImage After the kernel is built sucessfully, "xipImage" is generated at "arch/arm/boot". NOTE: please pay the attention to the size of "xipImage" , it needs to be <=2M, otherwise we need to change the flash map(BLOB, KERNEL, ROOTFS), or disable some features the kernel, such as USB host function drivers (which can be built as modules) etc. NOTE: To boot "xipImage", using BLOB command "go". Refer section "2.4" for more details. 11.2) CRAMFS XIP The Preview Kit also supports XIP feature for CRAMFS. In order to enable CRAMFS XIP, we need to configure as following, % make oldconfig % make menuconfig At the top level select "File systems" entry, ... Character devices ---> Multimedia devices ---> ===> File systems ---> Console drivers ---> Sound ---> ... In "File systems" Page, select "Compressed ROM file system support", and select the sub items as following. ... < > EFS file system support (read only) (EXPERIMENTAL) < > Journalling Flash File System (JFFS) support <*> Journalling Flash File System v2 (JFFS2) support (0) JFFS2 debugging verbosity (0 = quiet, 2 = noisy) ===> <*> Compressed ROM file system support ===> [*] Use linear addressing for cramfs ===> [*] Support XIP on linear cramfs ===> [*] Root file system on linear cramfs ... In "File systems" Page, select "/dev file system support ...", and select the sub itmes as following, ... < > OS/2 HPFS file system support [*] /proc file system support ===> [*] /dev file system support (EXPERIMENTAL) ===> [*] Automatically mount at boot ===> [ ] Debug devfs % make oldconfig % make xipImage After the kernel is built sucessfully, "xipImage" is generated at "arch/arm/boot". NOTE: please pay the attention to the size of "xipImage" , it needs to be <=2M, otherwise we need to change the flash map(BLOB, KERNEL, ROOTFS), or disable some features the kernel, such as USB host function drivers (which can be built as modules) etc. 11.3) XIP usage model XIP can be used for Linux Kernel, and Filesystem(cramfs). Here are some usual combinations: - Kernel with CRAMFS XIP - Kernel XIP with JFFS2 - Kernel XIP with CRAMFS - Kernel XIP with CRAMFS XIP It's quite configurable. Please following the section "11.1" and "11.2" to build for different XIP combinations. --------------------------------------------------------------- 12. KNOWN PROBLEMS: * Reports have been received that "make xconfig" does not work properly with scripts. Use "make menuconfig" instead. * Ethernet may not be stable enough to transfer large size of data on PXA27x DVK Linux. For example, NFS can't copy/execute large files. * Driver and functionality have not been fully tested or implemented: - Serial Hardware Flow Control - SSP - DVM * BLOB - When downloading image via ethernet(LAN91c111), ignore the "smc_send: memory alloc time out" warning. - XMODEM(xdownload) is not functional to download large files, such as rootfs JFFS2 image. * DVFM problems: - When run higher than 377Mhz(included), SMC91x will report watchdog timeout error sometimes. - Only recommended frequency and voltage are supported. Use at your own risk if you want to use other frequency and voltage points. - Only tested on PXA27x DVK board with PXA27x C0 currently. - Don't set Fastbus mode(B=1) as it will cause system halt in some cases. - Linux minicom terminal can NOT correctly display characters when resuming from PM Sleep in some operating points, eg.Operating point: 208MHz (SW16: dot, SW14, no-dot, SW13: 5, SW12: 9) * Camera Interface problems: - ADCM2650 output quality is not good when the MCLK is higher than 7MHz, or LCD frequency is 52Mhz. - The interval between preview and capture should be longer than 1 second, otherwise only partial frame is fetched, and the app will halt. * Touch Screen problems: - When TS works as the kernel module, TS will conflict with USB Keyboard if USB keyboard is plugged during system booting. USB Keyboard should be plugged-in after TS is enabled. --------------------------------------------------------------- 13. UPDATE NOTES: BSP Support: - PXA27x DVK C0. Some drivers, such as overlay 2, don't work on PXA27x DVK A0/A1. Driver Support: - MTD XIP support - Camera Interface - APM - DVFM - USB Client support - USB Host support - SRAM support - PXA27x DVK Keypad - IrDA - LCD Controller - 640x480, 240x320 - LCD 16bpp/18bpp display support - LCD QVGA support - LCD overlayer1/2 - Touch Screen - UCB1400 touchscreen support (intended to be used in conjunction with tslib from http://www.arm.linux.org.uk/cvs) - Stereo Audio - Product Ethernet support - 32-bit Flash EEPROM - Interrupt controller - Memory Management Unit - Memory controller - Serial port