Freescale Semiconductor Application Note Document Number: AN2145 Rev. 2, 10/2006 Porting Linux to the PowerPC™ MPC7451 by Maurie Ommerman CPD Application Freescale Semiconductor, Inc. Austin, TX This document describes porting Montavista’s Hardhat™ Linux from a sandpoint 2 platform with the MPC8240PMC, the MPC755PMC, or the MPC7400PMC to the MPC7450/MPC7451. It explains how to set up the development environment and how to compile, load, and run the resultant Hardhat Linux on the sandpoint MPC7450 platform. (If building Linux for sandpoint 3, refer to Appendix A, “Sandpoint 3 Platform.”) The MPC7451 has the same functionality as the MPC7450, and any differences in data regarding bus timing, signal behavior, and AC, DC, and thermal characteristics are detailed in the hardware specifications. Note that because the MPC7450 and MPC7451 have the same functionality, they are used interchangeably throughout the documentation and code. 1 Terminology The following terms are used in this document. • Bash shell—Extension to the bourne shell. It is popular on Linux systems. • Boot—Program that begins at hardware reset which prepares the hardware for loading an OS. © Freescale Semiconductor, Inc., 2001, 2006. All rights reserved. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Contents Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 Development Environment . . . . . . . . . . . . . . . . . . . . . .2 Installing Montavista CDK 1.2 . . . . . . . . . . . . . . . . . . .3 CDK RPMs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Mandrake CD RPMs . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Building the Kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10 Source Code Changes . . . . . . . . . . . . . . . . . . . . . . . . .10 Executable Images . . . . . . . . . . . . . . . . . . . . . . . . . . .13 Installing an Updated Kernel Source . . . . . . . . . . . . .13 Untar the Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 Additional Required Files . . . . . . . . . . . . . . . . . . . . . 14 Sandpoint Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15 Hard Drive for Linux OS . . . . . . . . . . . . . . . . . . . . . .15 fdisk Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16 Partition Configuration . . . . . . . . . . . . . . . . . . . . . . . .16 Making a ramdisk Linux OS . . . . . . . . . . . . . . . . . . . .17 make menuconfig . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 genromfs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 Downloading the Executable . . . . . . . . . . . . . . . . . . .19 Terminal Emulators . . . . . . . . . . . . . . . . . . . . . . . . . . .20 Minicom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20 DINK32 Booting the MPC7450 Linux: Example . . .22 /dev Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23 Development Environment • • • • • • • • • • • • • • 2 Bourne shell—Gnu Born Again Shell. This is the default shell for most Linux systems because Linux uses Gnu tools exclusively (because they are free). CDK—Cross development kit. Development tools for Intel- or Mac-based Linux machine to build PPC Linux objects. DINK32—Small OS debugger for the Sandpoint evaluation board. IDE—Integrated Device Electronics, which is the standard interface for many devices including hard drives, cdrom drives, and others. Kernel—Portion of the OS that interfaces the hardware to the software. Lineo and Lynx—Other companies that distribute Linux sources for embedded applications. MandrakeSoftware and Yellow Dog—Companies that distribute desktop Linux sources and solutions. They base their distributions on Red Hat. Montavista and Hard Hat Linux (hhl)—One of several companies that modifies and distributes Linux sources for embedded applications. OS—Operating system. Red Hat—One of several companies that uses the freely distributed desktop Linux sources and packages them for distribution. They developed the RPM, which has become a standard for Linux. Required files—All Linux distributions require a configuration file, (.config), that specifies the configuration of the kernel, such as network, IDE, scsi, and other options. The .config file can be built automatically from the make menuconfig command. Two other files are also required in a CDK, .hhl_cross_compile, which specifies the cross compiler executables, and .hhl_target_cpu, which specifies the target cpu. RPM—Red Hat package manager. Program to install and to maintain groups of Linux binary, libraries, documentation, and other Linux-style objects. srec or srecord—A file that depicts a binary object file in an ascii representation. DINK32 can download srec or binary files. See Appendix D in the DINK32 User’s Manual. User type—Root user has permissions to install rpms, modify, create, and delete all files in all directories, mount and unmount file systems, start and end processes, and generally do anything on a Linux system. Unfortunately, this makes it easy to destroy the Linux development system and render it useless. For that reason, login as a root user only for those activities that require root permissions, and revert to normal user for all other activities, including building the Linux kernel. Development Environment Two development platforms are available, the G4 Mac and the PC. The installation procedure is the same for both platforms with only the few exceptions discussed in this document. The process defined in this document was executed with a Mandrake™ Linux 7.0, a variant of Redhat Linux, on a PC (Pentium 166 MHz). To create a development machine, do one of the following: • Install a Linux into a PC. • Install LinuxPPC onto a G4-running Mac OS. Porting Linux to the PowerPC™ MPC7451, Rev. 2 2 Freescale Semiconductor Installing Montavista CDK 1.2 3 Installing Montavista CDK 1.2 For the process defined in this document, the Montavista CDK 1.2 Linux-2.4.0-test2 kernel was used as the basis for the port. The 1.2 CDK is available on the Montavista public website (http://www.mvista.com) by choosing CDK from “Other Resource,” by ordering the CD online, or by going directly to the following address: ftp://ftp.mvista.com/pub/cdimages/1.2/powepc_000808.cdimage It is necessary to create a CD from this image and Adaptec CD burner software can be used for this. First, add .iso to the file name (powerpc_000808.cdimage to powerpc_000808.cdimage.iso). Next, using the Adaptec program to create a CD from an iso image, complete the following steps: 1. Go to File menu and choose “Create CD” from disk image. 2. Choose files of type *.iso. 3. Select and open the file powerpc_000808.cdimage.iso. 4. Choose “advanced” and select “close disk.” 4 CDK RPMs Following are the basic steps for installing the CDK; more detailed instructions are available on the CD in the /docs/CDK1.2.pdf file. The CDK CD is organized into various directories. The installation steps require the user to cd to the indicated cdrom directory. The directories listed here are relative to the /mnt/cdrom directory. The rpm maintains a data base of the rpms installed. Unless an rpm is always erased before reinstalling it or unless you want more than one version installed, an error message may occur stating that the rpm is already installed. The installation can be forced by adding the --force parameter to the rpm command. For example: rpm -ihv --force hhl-ppc_7xx-gcc-2.95.2-13.i386.rpm . At times it may be useful to have several versions of these rpms, such as different versions of the CDK or a different version for each of the several platforms. 1. Log in as root. 2. Mount the CD, mount /dev/cdrom, assuming a directory of /mnt/cdrom. In the /install/sp8240/ directory, type: rpm -ihv *.noarch.rpm rpm -ihv *.ppc.rpm If ppc.rpm gets a dependency error, execute the sequence of steps presented in Section 5, “Mandrake CD RPMs.” 3. Install the host rpm. On a PC, type: rpm -ihv *.i386.rpm On a Mac, type: rpm -ihv *.ppc.rpm (may already be installed from step 2 above) 4. To create s records, go to the /common/ directory and type: On a PC, type: rpm -ihv hhl-zsrec-1.0-5.i386.rpm On a Mac, type: rpm -ihv hhl-zsrec-(version).ppc.rpm Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 3 Mandrake CD RPMs Sometimes in completing these steps, not all rpms install correctly. In this case, execute the following sequence of steps to ensure that these specific rpms are installed. 1. Log in as root. 2. In the /install/sp8240/ directory, type: rpm -ihv hhl-ppc_82xx-sp8240-lsp-2.4.0-test2-1.2.2-2 noarch.rpm 3. In the /common/ directory, type: rpm -ihv hhl-zsrec-1.0-5.i386.rpm 4. In the ppc_7xx/RPMS directory, type: rpm -ihv hhl-ppc_7xx-gcc-2.95.2-13.i386.rpm rpm -ihv hhl-ppc_7xx-binutils-18.104.22.168-1.i386.rpm rpm -ihv hhl-ppc_7xx-glibc-2.1.3-1e.noarch.rpm (optional) 5. In the ppc_82xx/RPMS directory, type: rpm -ihv hhl-ppc_82xx-gcc-2.95.2-13.i386.rpm rpm -ihv hhl-ppc_82xx-binutils-22.214.171.124-1.i386.rpm rpm -ihv hhl-ppc_82xx-glibc-2.1.3-1e.noarch.rpm (optional) 5 Mandrake CD RPMs Install the following rpms for use in the build process. cd /mnt/cdrom/Mandrake/RPMS rpm -ihv genromfs-0.3-6mdk.i586.rpm rpm -ihv gzip-1.2.4-18mdk.i586.rpm rpm -ihv ncurses-devel-5.0-7mdk.i586.rpm 5.1 Access to the CDK The bash shell is the default shell on the Mandrake and is therefore recommended for use. In the /home/<name>/.bash_profile file add the following line: PATH=$PATH:/opt/hardhat/devkit/ppc/82xx/bin:/opt/hardhat/host/bin The CDK kernel source is available in the following directory: /opt/hardhat/devkit/lsp/sp8240/linux-2.4.0-test2 This directory should be tarred and moved to a local user directory for modifying and building the MPC7450 version. Therefore, if a significant mistake is made, you can start the work again from the tar. Also, because you should build Linux as a user rather than as root, change the tar file owner and group. cd /opt/hardhat/devkit/lsp/sp8240 tar -cvf linux_sp.tar linux-2.4.0-test2 chown <user name> linux_sp.tar chgrp <group name> linux_sp.tar cp linux_sp.tar <user’s home directory> For important information on this source base, see Section 10.1, “Detecting the Old Version.” Porting Linux to the PowerPC™ MPC7451, Rev. 2 4 Freescale Semiconductor Building the Kernel 6 Building the Kernel This section describes the steps for building the kernel. If some versions of the kernel do not build correctly and a build fails, see 10, “Installing an Updated Kernel Source.” See 20, “Downloading the Executable,” for the steps for downloading the kernel to the MPC7450 Sandpoint. 6.1 Configuring the Linux Image There are two commands for setting the configuration and creating a .config file. • make menuconfig (recommended because it is interactive). Requires ncurses-devel-5.0-7mdk.i586.rpm to be installed from the Mandrake CD. This is normally installed but if it is not install this rpm. See Section 5, “Mandrake CD RPMs”. • make config (not recommended) During the menuconfig phase, there are many options for configuring the kernel being built, which are discussed. Enter these interactive commands: • enter or space—Select (or go into submenu) • esc—Return to previous menu 6.2 Booting The default .config from Montavista is to boot over the network. Because booting from the hard drive is the default .config for the procedure described in this document, booting over the network requires the selection of additional options. While using the .config file in Section Appendix B, “Required Files,” make these changes. • Select Network Options | Kernel level autoconfig • Select File systems | Network file systems | NFS file system support and Provide NFSv3 client If the Montavista default is in use, deselect these settings. 6.3 Configuration Selections Save the new configuration; all configuration settings are now in place. * indicates selected. These can be compared to the options presented by make menuconfig. Code maturity level options ---> [*] Prompt for development and/or incomplete code/drivers Platform support ---> (6xx/7xx/7400) Processor Type (Sandpoint) Machine Type [ ] Symmetric multi-processing support [ ] Real Time Scheduler [*] AltiVec Support Loadable module support ---> [ ] Enable loadable module support General setup ---> [*] Networking support Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 5 Building the Kernel [*] Sysctl support [*] System V IPC [ ] BSD Process Accounting [*] Kernel support for MISC binaries [ ] PCI device name database [ ] Support for hot-pluggable devices Parallel port support ---> [ ] Parallel port support [ ] Support for VGA Console [ ] Support for frame buffer devices [ ] Power management support for PowerBooks [ ] Support for PowerMac floppy [ ] Support for PowerMac serial ports [ ] Apple Desktop Bus (ADB) support [ ] Support for Open Firmware device tree in /proc [ ] Support for early boot text console (BootX only) [ ] Support for Freescale Hot Swap Plug and Play configuration ---> [ ] Plug and Play support Block devices ---> [ ] Normal PC floppy disk support [ ] Compaq SMART2 support [ ] Mylex DAC960/DAC1100 PCI RAID Controller support [*] Loopback device support [*] Network block device support [ ] Logical volume manager (LVM) support [ ] Multiple devices driver support [ ] RAM disk support [ ] Flash Memory block device support Networking options ---> [*] Packet socket [*] Packet socket: mmapped IO [*] Kernel/User netlink socket [*] Routing messages [ ] Netlink device emulation [ ] Network packet filtering (replaces ipchains) [*] Socket Filtering [*] Unix domain sockets [*] TCP/IP networking [ ] IP: multicasting [ ] IP: advanced router [ ] IP: kernel level autoconfiguration [ ] IP: optimize as router not host [ ] IP: tunneling [ ] IP: GRE tunnels over IP [ ] IP: aliasing support [ ] IP: ARP daemon support (EXPERIMENTAL) [ ] IP: TCP syncookie support (disabled per default) --- (it is safe to leave these untouched) [*] IP: Allow large windows (not recommended if <16Mb of memory) [ ] The IPv6 protocol (EXPERIMENTAL) [ ] Kernel httpd acceleration (EXPERIMENTAL) [ ] Asynchronous Transfer Mode (ATM) (EXPERIMENTAL) --[ ] The IPX protocol [ ] Appletalk protocol support [ ] DECnet Support Porting Linux to the PowerPC™ MPC7451, Rev. 2 6 Freescale Semiconductor Building the Kernel [ ] 802.1d Ethernet Bridging [ ] CCITT X.25 Packet Layer (EXPERIMENTAL) [ ] LAPB Data Link Driver (EXPERIMENTAL) [ ] 802.2 LLC (EXPERIMENTAL) [ ] Acorn Econet/AUN protocols (EXPERIMENTAL) [ ] WAN router [ ] Fast switching (read help!) [ ] Forwarding between high speed interfaces [ ] QoS and/or fair queueing ---> ATA/IDE/MFM/RLL support ---> [*] ATA/IDE/MFM/RLL support IDE, ATA and ATAPI Block devices ---> [*] Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support --- Please see Documentation/ide.txt for help/info on IDE drives [ ] Use old disk-only driver on primary interface [*] Include IDE/ATA-2 DISK support [*] Use multi-mode by default [*] Include IDE/ATAPI CDROM support [ ] Include IDE/ATAPI TAPE support [ ] Include IDE/ATAPI FLOPPY support --- IDE chipset support/bugfixes [ ] CMD640 chipset bugfix/support [ ] RZ1000 chipset bugfix/support [*] Generic PCI IDE chipset support [ ] Sharing PCI IDE interrupts support [ ] Generic PCI bus-master DMA support (Turning this option on may fix the problem with a build error, see 10.3, “Alternative Correction”. [ ] Boot off-board chipsets first support [ ] OPTi 82C621 chipset enhanced support (EXPERIMENTAL) [*] Winbond SL82c105 support [ ] Other IDE chipset support SCSI support ---> [ ] SCSI support IEEE 1394 (FireWire) support ---> [ ] IEEE 1394 (FireWire) support (EXPERIMENTAL) Network device support ---> [*] Network device support ARCnet devices ---> [ ] ARCnet support [ ] Dummy net driver support [ ] Bonding driver support [ ] EQL (serial line load balancing) support [ ] Ethertap network tap (EXPERIMENTAL) [ ] General Instruments Surfboard 1000 Ethernet (10 or 100Mbit) ---> [*] Ethernet (10 or 100Mbit) [ ] MACE (Power Mac ethernet) support [ ] MAC (G3 ethernet) support [ ] GMAC (G4/iBook ethernet) support [ ] Symbios 53c885 (Synergy ethernet) support [ ] National DP83902AV (Oak ethernet) support [ ] 3COM cards [ ] AMD LANCE and PCnet (AT1500 and NE2100) support [ ] Western Digital/SMC cards [ ] Racal-Interlan (Micom) NI cards [ ] AT1700/1720 support (EXPERIMENTAL) [ ] DEPCA, DE10x, DE200, DE201, DE202, DE422 support [ ] Other ISA cards Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 7 Building the Kernel [*] EISA, VLB, PCI and on board controllers [ ] AMD PCnet32 (VLB and PCI) support [ ] Adaptec Starfire support (EXPERIMENTAL) [ ] Ansel Communications EISA 3200 support (EXPERIMENTAL) [ ] Apricot Xen-II on board Ethernet [ ] CS89x0 support [ ] Generic DECchip & DIGITAL EtherWORKS PCI/EISA [ ] DECchip Tulip (dc21x4x) PCI support [ ] Digi Intl. RightSwitch SE-X support [ ] DM9102 PCI Fast Ethernet Adapter support (EXPERIMENTAL) [ ] EtherExpressPro/100 support [ ] Mylex EISA LNE390A/B support (EXPERIMENTAL) [ ] Novell/Eagle/Microdyne NE3210 EISA support (EXPERIMENTAL) [ ] PCI NE2000 support [ ] RealTek 8129 (not 8019/8029!) support (EXPERIMENTAL) [*] RealTek RTL-8139 PCI Fast Ethernet Adapter support [ ] SiS 900/7016 PCI Fast Ethernet Adapter support [ ] TI ThunderLAN support [ ] VIA Rhine support [ ] Racal-Interlan EISA ES3210 support (EXPERIMENTAL) [ ] SMC EtherPower II (EXPERIMENTAL) [ ] Pocket and portable adapters Ethernet (1000 Mbit) ---> [ ] Packet Engines Yellowfin Gigabit-NIC support (EXPERIMENTAL) [ ] Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support [ ] SysKonnect SK-98xx support [ ] FDDI driver support [ ] HIPPI driver support (EXPERIMENTAL) [ ] PPP (point-to-point protocol) support [ ] SLIP (serial line) support Wireless LAN (non-hamradio) ---> [ ] Wireless LAN (non-hamradio) Token Ring devices ---> [ ] Token Ring driver support [ ] Fibre Channel driver support [ ] Red Creek Hardware VPN (EXPERIMENTAL) [ ] Traffic Shaper (EXPERIMENTAL) Wan interfaces ---> [ ] Support for Wan interfaces Amateur Radio support ---> [ ] Amateur Radio support IrDA (infrared) support ---> all off ISDN subsystem ---> [ ] ISDN support Old CD-ROM drivers (not SCSI, not IDE) ---> [ ] Support non-SCSI/IDE/ATAPI CDROM drives Console drivers ---> Frame-buffer support ---> [ ] Support for frame buffer devices (EXPERIMENTAL) Character devices ---> [ ] Virtual terminal [*] Standard/generic (dumb) serial support [*] Support for console on serial port [ ] Extended dumb serial driver options [ ] Non-standard serial port support [*] Unix98 PTY support Porting Linux to the PowerPC™ MPC7451, Rev. 2 8 Freescale Semiconductor Building the Kernel (256) Maximum number of Unix98 PTYs in use (0-2048) I2C support ---> [ ] I2C support Mice ---> [ ] Bus Mouse Support [ ] Mouse Support (not serial and bus mice) Joysticks ---> [ ] Joystick support [ ] QIC-02 tape support Watchdog Cards ---> [ ] Watchdog Timer Support [ ] Intel i8x0 Random Number Generator support [ ] /dev/nvram support [ ] Enhanced Real Time Clock Support Video For Linux ---> [ ] Video For Linux [ ] Double Talk PC internal speech card support [ ] Siemens R3964 line discipline [ ] Applicom intelligent fieldbus card support Ftape, the floppy tape device driver ---> [ ] Direct Rendering Manager (XFree86 DRI support) [ ] /dev/agpgart (AGP Support) (EXPERIMENTAL) File systems ---> [ ] Quota support [ ] Kernel automounter support [ ] Kernel automounter version 4 support (also supports v3) [ ] ADFS file system support [ ] Amiga FFS file system support (EXPERIMENTAL) [ ] Apple Macintosh file system support (EXPERIMENTAL) [ ] BFS file system support (EXPERIMENTAL) [ ] DOS FAT fs support [ ] EFS file system support (read only) (EXPERIMENTAL) [ ] Compressed ROM file system support [ ] Simple RAM-based file system support [*] ISO 9660 CDROM file system support [ ] Microsoft Joliet CDROM extensions [ ] Minix fs support [ ] NTFS file system support (read only) [ ] OS/2 HPFS file system support [*] /proc file system support [ ] /dev file system support (EXPERIMENTAL) [*] /dev/pts file system for Unix98 PTYs [ ] QNX4 file system support (read only) (EXPERIMENTAL) [*] ROM file system support [*] Second extended fs support [ ] System V and Coherent file system support (read only) [ ] UDF file system support (read only) [ ] UFS file system support (read only) Network File Systems ---> [ ] Coda file system support (advanced network fs) [*] NFS file system support [ ] Provide NFSv3 client support (EXPERIMENTAL) [ ] NFS server support [ ] SMB file system support (to mount Windows shares etc.) [ ] NCP file system support (to mount NetWare volumes) Partition Types ---> [*] Advanced partition selection [ ] Acorn partition support [ ] Alpha OSF partition support Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 9 Dependencies [ ] [ ] [ ] [*] [ ] [ ] [ ] [ ] [ ] Sound Amiga partition table support Atari partition table support Macintosh partition map support PC BIOS (MSDOS partition tables) support BSD disklabel (FreeBSD partition tables) support Solaris (x86) partition table support Unixware slices support SGI partition support Sun partition tables support ---> [ ] Sound card support ---> [ ] Support for USB Kernel hacking ---> [ ] Magic SysRq key [ ] Include kgdb kernel debugger [*] Include xmon kernel debugger --Load an Alternate Configuration File Save Configuration to an Alternate File USB support 7 Dependencies The make dep builds all the dependencies of all the source files for the build. The makefiles use these dependency files in place of the normal make dependency rules. Therefore, it is important to do a make dep whenever any dependencies or configurations are changed. If it is necessary to make extensive changes to a dependency file that has been previously set up, first remove the two dependency files below. • .depend • .hdepend 8 Source Code Changes The default for the source is to boot over the network; however, it is necessary to boot from the hard drive or from a ramdisk. 8.1 Boot from a Hard Drive 1. Edit the file linux/arch/ppc/boot/misc.c a) Search for the following line: #define CMDLINE "root=nfs" b) Change it to one of the three following: #define CMDLINE "root=/dev/hda1" for partition 1 on the master #define CMDLINE "root=/dev/hdb1" for partition 1 on the slave #define CMDLINE "root=/dev/hdb2" for partition 2 on the slave Set root= to the boot partition. Set it to “root=/dev/hdb1”, which is the first partition on the slave drive. Then create this drive on the development system as a slave and move it to the Sandpoint as a slave. See Section 16.3, “Creating Linux OS on the Partition”. Porting Linux to the PowerPC™ MPC7451, Rev. 2 10 Freescale Semiconductor Source Code Changes Again, edit the file linux/arch/ppc/boot/misc.c. (If you are using Sandpoint 3, see Appendix A.) The original MPC7450 DINK32 does not turn on the timebase facility, bit 5 in hid0; version 12.2 DINK32 does this. So with DINK32 12.2 it is not necessary to turn this bit on in Linux. But, if it is off, the following code turns the bit on in Linux. — Immediately before these lines: *cp = 0; puts("\n"); puts("Uncompressing Linux..."); — Add this line: _put_HID0(_get_HID0() | 0x04000000); /* turn on TBEN */ 8.2 Baud Rate To change the baud rate, perform the following steps: 1. Edit the file linux/arch/ppc/boot/ns16550.c. This changes the default boot baud rate from 9600 to 38400. This is helpful because, when downloading the Linux kernel through DINK32, 38400 can be used for the download and then the baud rate does not need to be changed when the kernel begins running. a) Search for the following line: Access baud rate b) Change the line immediately after it (by changing 0xc to 0x3): com_port->dll = 0xc So that the line reads as follows: com_port->dll = 0x3; /* 38400 baud */ 2. Edit the file linux/arch/ppc/kernel/sandpoint_setup.c to change the default kernel baud rate to 38400. a) Search for the following string: sprintf(cmd_line b) Change it to the following: sprintf(cmd_line, "%s console=ttyS0,38400", cmd_line); 8.3 Bus Frequency To change the bus frequency, perform the following steps: 1. Again, edit the file linux/arch/ppc/kernel/sandpoint_setup.c. a) Search for the following string: freq = 66 b) Change it to the following: /* VGER: assume 100 MHz bus */ // freq = 66; freq = 100; Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 11 Source Code Changes 8.4 Hash Table It is necessary to fix the bug that does not clear the hash table (this bug may have been fixed in this version of the kernel). Therefore, edit the file linux/arch/ppc/mm/init.c to ensure the line is not commented out: 1. Search for the following string: Hash = mem_pieces 2. Change the next line [/* __clear_user(Hash, */] so that it reads as follows: Hash_size); */] by removing the comment [/* __clear_user(Hash, Hash_size); 8.5 Initialize r4 and r5 Edit the file linux/arch/ppc/boot/head.S. 1. Search for this code: /* tell kernel we’re prep */ /* * get start address of kernel code which is stored as a coff */ 2. Add the following code immediately before: /* r4,r5 have initrd_start, size */ lis r2,[email protected] ori r2,r2,[email protected] lwz r4,0(r2) lis r2,[email protected] ori r2,r2,[email protected] lwz r5,0(r2) 8.6 ramdisk Perform this step only if a ramdisk is desired instead of a hard disk. Edit the file linux/arch/ppc/kernel/sandpoint_setup.c. 1. Search for the following: ROOT_DEV = MKDEV(SCSI_CDROM_MAJOR, 0); ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0); 2. Change the following: SCSI_CDROM_MAJOR 3. To the following: RAMDISK_MAJOR At boot time the Linux load message prompt can be changed. See the note at the end of Section 23, “DINK32 Booting the MPC7450 Linux: Example.” Porting Linux to the PowerPC™ MPC7451, Rev. 2 12 Freescale Semiconductor Executable Images 9 Executable Images These commands are used in building the images. • make zImage. To build an image that uses a hard disk see Section 14, “Hard Drive for Linux OS.” • make zImage.initrd The sequence of the build that make performs is as follows: 1. Create an elf file called /linux/vmlinux. 2. gzip vmlinux to /linux/arch/ppc/coffboot/vmlinux.gz. 3. Compile the bootloader (also an elf file). 4. Combines the bootloader and vmlinux.gz to create. /linux/arch/ppc/boot/zvmlinux 9.1 Kernel-Executable Elf File Load the zvmlinux file into the Sandpoint RAM. 9.2 Freescale S-record File Now that the elf file is made, a Freescale S-record can be created to download to the board using DINK32. Type the following: zsrec -s 900000 arch/ppc/boot/zvmlinux >vm.src This should be an executable in the directory /opt/hardhat/host/bin. Thus, if this directory is not in the path variable, the path /opt/hardhat/host/bin/zsrec .... must be completed. See step 4 in Section 4, “CDK RPMs.” 10 Installing an Updated Kernel Source Because the original CDK 1.2 on the Montavista web pages would not build for the configuration used during the procedure this paper documents, it is necessary to determine if you have the old nonworking version or a newer working version. 10.1 Detecting the Old Version If after you follow the directions in this paper beginning with Section 11, “Untar the Source,” a fatal error occurs during the make zImage, the old version of the source code is being used. Therefore, follow the steps in Section 10.2, “Corrected Version,” to get a correct kernel source base. If no make errors occur, the new version is being used. Following is the make error that results from use of the broken version. ‘/mnt/hda8/maurie/linux-2.4.0-test2-vger/arch/ppc/xmo --start-group \ arch/ppc/kernel/kernel.o arch/ppc/mm/mm.o arch/ppc/lib/lib.o kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o arch/ppc/xmon/x.o \ drivers/block/block.o drivers/char/char.o drivers/misc/misc.o drivers/net/net.o drivers/parport/parport.a drivers/ide/idedriver.o Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 13 Untar the Source drivers/cdrom/cdrom.a drivers/pci/pci.a drivers/macintosh/macintosh.o \ net/network.o \ /home/maurie/maurie/linux-2.4.0-test2-vger/lib/lib.a \ --end-group \ -o vmlinux drivers/ide/idedriver.o: In function ‘ide_dmacapable_sl82c105’: drivers/ide/idedriver.o(.text+0x8250): undefined reference to ‘ide_setup_dma’ drivers/ide/idedriver.o(.text+0x8250): relocation truncated to fit: R_PPC_REL24 ide_setup_dma make: *** [vmlinux] Error 1 10.2 Corrected Version The Sandpoint kernel source, sp8240, that accompanies the CDK 1.2 may be broken. After installation, it is found in the following directory (for a discussion of how this kernel was obtained, refer to Section 5.1, “Access to the CDK”): /opt/hardhat/devkit/lsp/sp8240/linux-2.4.0-test2 This old source is not needed, so it can be removed. Replace the broken source code with the new source found at the ftp site: ftp://apocalypse.mvista.com/private/Sandpoint/latest.sandpoint.tar.bz2. This file must be treated with the following two commands: • bunzip2 (unzips the file) • tar -xvf (untars the file) These commnads untar this directory in place of the original broken directory. Once untarred, the directory name is Linux. 10.3 Alternative Correction Turning the generic PCI bus-master DMA support option on (Section 6.3, “Configuration Selections”) causes the error to disappear because this option installs the DMA prototypes that the IDE driver apparently uses. Note that it has not been proved that the resulting zImage works correctly on Sandpoint, but it has been proved that the method in Section 10.2, “Corrected Version,” does work correctly. 11 Untar the Source The steps for building a tar file of the Linux kernel source tree are given in Section 5.1, “Access to the CDK” or in Section 10.2, “Corrected Version.” Now it is necessary to untar the file in the user directory and perform the rest of these steps as a user. Log in as user tar xvf linux_sp.tar. The linux-2.4.0-test2 directory is now in the user directory, and the user is the owner of all the files. 12 Additional Required Files The CDK may not include the additional required files, but they are required to build the Sandpoint kernel. Two of the three files are only 1 line each and can easily be created with an editor. The .config file is Porting Linux to the PowerPC™ MPC7451, Rev. 2 14 Freescale Semiconductor Sandpoint Setup much larger and is created automatically by the make menuconfig process (see Section 6.1, “Configuring the Linux Image”). Section Appendix B, “Required Files,” includes the version of .config used by Freescale applications engineers; this listing and the listing of the configuration options in Section 6.3, “Configuration Selections,” can help in setting up the configuration. The files are as follows: • .config • .hhl_cross_compile • .hhl_target_cpu The .config file is correct for the environment used by Freescale applications engineers. Refer to this .config file while performing the make menuconfig and setting all the variables for the environment. This file is created with make menuconfig. Save the results into a new .config file by exiting the make. It must be created before continuing the build of Linux. 13 Sandpoint Setup Before the Linux kernel download file can be used, the Sandpoint platform must be set up. Sandpoint requires the following switch configuration: • S3:S4 - Mode 1, PMC W/Slots — S3: toward PMC — S4: away from PMC • S5 - Interrupt to PMC Normal S5: toward PMC • S6 - Local I/O shared with Slot 2 S6: toward PMC Sandpoint requires that the processor speed be set to 400Mhz and the bus speed to 100 MHz. Set the memory map to map B. 14 Hard Drive for Linux OS The downloadable image file built by the make zImage requires a hard drive on the primary IDE channel of the Sandpoint. To make this hard drive, use either the PC or Mac Linux development system. Physically connect a hard drive to the development system on an IDE channel. Note that it is necessary to be root to perform these steps. In Linux, the command fdisk can be used to format and create an "ext2" filesystem on the hard drive. For the code modifications described in Section 10, “Installing an Updated Kernel Source,” name it hda1 or hdb1. However, it must be the first partition on this disk and it must be an IDE disk. fdisk must have an argument of one of the following disk drive addresses: • /dev/hda for master IDE • /dev/hdb for slave IDE • /dev/sda for first scsi drive • /dev/sdb for second scsi drive • And so on. For example, the resulting command fdisk /dev/hdb starts fdisk on the slave IDE drive. Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 15 fdisk Commands 15 fdisk Commands To create the partition using fdisk execute the following sequence: 1. p—Prints the partition list. It ensures a disk was not chosen that should be kept. If the wrong disk is chosen, use the command q to quit with no changes. 2. d—Deletes all partitions on this disk. (If there are no partitions, skip this step.) 3. n—Adds a new partition. Follow the steps on the screen, create partition 1 with all the space available on the device. 4. p—Ensures setup is correct. Note that Step 5 or 6 should be chosen, but not both. 5. q—At this point, the q command can be given without changing the partition. Using this option ignores any changes and the disk retains its previous partition table. 6. w—Writes the new partition. At this point changes are permanent and the old partition cannot be retrieved. 16 Partition Configuration 16.1 Creating a New Partition builds a Linux file system on a specified disk if the disk does not already have one. Therefore, choosing the wrong partition, that is, one with any filesystem already on it, results in an error. Specify a partition for mke2fs (unlike fdisk which must specify an entire disk, e.g. /dev/hda). For example, mke2fs /dev/hdb1 creates a file system on the first partition on the slave IDE drive. mke2fs 16.2 Mounting the Partition Execute the following commands to mount the new partion: • cd / • mkdir newdisk (makes a directory to mound the partition) • mount /dev/hdb1 newdis k (partition is now usable as if it were a normal directory) 16.3 Creating Linux OS on the Partition 1. Tar the contents of the /opt/hardhat/devkit/ppc/82xx/target directory. In that directory type: tar cvf filesystem.tar * 2. Untar the filesystem.tar file onto the root directory of the newly created hard drive. cd /newdisk tar xvf /opt/hardhat/devkit/ppc/82xx/target/filesystem.tar 3. Unmount the hard drive and shutdown the Linux system. 4. Physically remove the newly-created hard drive. 5. Physically install it into the Sandpoint on IDE0. Porting Linux to the PowerPC™ MPC7451, Rev. 2 16 Freescale Semiconductor Making a ramdisk Linux OS NOTE Regardless of whether this was created as /dev/hda or /dev/hdb, it can be physically connected to the Sandpoint as the master or slave IDE0, which is /dev/hda. The boot partition should be /dev/hda1 for the master or /dev/hdb1 for the slave. Since misc.c was modified to expect /dev/hdb1, connect it as slave IDE0. See Section 10, “Installing an Updated Kernel Source.” However, by changing the boot partition at startup, when Linux/PPC Load root=/dev/hdb1 appears, it can be changed to something else, such as root=/dev/hdb2. In this case, the disk would be set up as IDE0 slave and the second partition on the disk would contain the Linux file system. 17 Making a ramdisk Linux OS To make a ram drive (ramdisk) for the Sandpoint Linux system use the make zImage.initrd command and follow the steps outlined in the subsequent sections. During make menuconfig (see Section 6.1, “Configuring the Linux Image”), turn off network device support and ATA/IDE support. 18 make menuconfig In the top level of the menu during make menuconfig (see Section 6.1, “Configuring the Linux Image”), select and turn off: • Network Device Support • ATA/IDE/MFM/RLL support In top level of the menu select and turn on: • File systems Rom file system Support • Block Devices Ram disk support 19 genromfs works similarly to tar, creating an image given a target directory. The target directory should create a file ramdisk.img that can be mounted as a device. genromfs 19.1 Creating the ramdisk Image 1. Download a sample ramdisk image from the following site: http://altus.drgw.net/results/ 2. Unzip it with the following command: gzip -d ramdisk.img.gz Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 17 genromfs 19.2 Mounting the ramdisk Image 1. Create a directory called ramdisk in the /mnt directory. 2. Mount the imagef ile with the following command: mount -o loop ramdisk.img /mnt/ramdisk 3. View the contents of the image with the ls command. 4. Create a new directory called myRomFS anywhere (not on the mounted ramdisk) and make the normal /bin, /dev, etc... directories underneath 5. Using the sample ramdisk.img as a starting point, add and remove files depending on what the romfs will need. The goal is to keep this as small as possible, as each file adds to the already long download time. Test programs such as Freescale’s benchmarks should also be included. 6. Copy all the directories from the downloaded ramdisk to this new one with the following commands. Note the -a is necessary for the dev directory and includes recursive activity. cp -a /mnt/ramdisk myRomFS On startup, Linux looks for a startup script called linuxrc in the root directory. The linuxrc file in root of this ramdisk is symlinked to a file called /bin/run. Instead of this, your linuxrc should symlink to the file /bin/ash, which will bring up a simple command shell. 7. Test it to determine the necessary files to run the benchmarks using the command chroot exist. The command should look like this: chroot myRomFS ash (note: there may be a dash before the ash). This makes every subsequent command treat the new directory as the root. Now run the tests to see whether they run correctly or not. 8. Once the myRomFS directory has been filled with the necessary files, create the ramdisk.img using genromfs. genromfs -d myRomFS -f ramdisk.image 9. Compress this file using the command line: gzip ramdisk.image This should create the file ramdisk.image.gz. 10. Place this file into the /arch/ppc/boot directory. It must be named ramdisk.image.gz. 11. Make the new binary with the command make zimage.initrd This creates a file called zvmlinux.initrd which is the kernel and the ramdisk. This can now be converted to an srec and downloaded to the MPC7450 pmc with DINK32's dl -k command (see Section 20, “Downloading the Executable”) It should bring up a command prompt. 12. Change the Linux prompt boot=/dev/hdb1, to the following: (or whatever the ramdisk size may be; default is 4096) 13. The ramdisk size can also be modified by changing rd_size = 4096 in the source code in drivers/block/rd.c to what ever size is desired. boot=/dev/ram ramdisk=8192 Porting Linux to the PowerPC™ MPC7451, Rev. 2 18 Freescale Semiconductor Downloading the Executable 19.3 References For a brief introduction to Romfs refer to this page: www.linuxhq.com/kernel/v2.2/doc/filesystems/romfs.txt.html For information on different ways to implement embedded File Systems on systems based on the PowerPC architecture, refer to this page: www.members.nbci.com/greyhams/linux/PowerPC-Embedded-HOWTO-12.html For an introduction to loopback devices (virtual devices like the ramdisk image), refer to this page: www.linuxdoc.org/HOWTO/mini/Loopback-Root-FS-2.html 20 Downloading the Executable The two methods for downloading the executable using DINK32 are as follows: 1. Using the traditional ascii srecord form, run DINK32 from any terminal emulator. Download the previously created S-record using DINK32 (it is about 17000 lines and takes about 5 minutes, at 38400 baud, to download). a) Use these DINK32 commands: sb -k 38400 (start the download file utility) b) When download is complete: dl -k go 900000 The default Linux kernel runs at 9600 baud rate so it may be necessary to change the baud rate to 9600 with this command: sb -k 9600 However, if changes were made in the baud rate (refer to Section 8.2, “Baud Rate”) the kernel will run at 38400 and this command tis note needed. 2. Using the faster binary srecord form: a) Obtain the srec2bin executable from the DINK32 distribution at dink32/demos/utilities/srec2bin b) Build the executable with the make command on Linux c) Copy the executable, srec2bin, to the development system /bin directory. d) Run the command srec2bin < file.src > file.bin e) Download it with the command in DINK32: sb -k 38400 dl -b -o 900000 f) When download is complete, type: go 900000 The default Linux kernel runs at 9600 baud rate so it may be necessary to change the baud rate to 9600 with this command: Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 19 Terminal Emulators sb -k 9600 However, if changes were made in the baud rate (refer to Section 8.2, “Baud Rate”) the kernel runs at 38400 and this command is not needed. 21 Terminal Emulators Use any terminal emulator on NT or UNIX and execute the following sequence: 1. On WinNT or Win 9x use hyperterminal. To download, a) Type the command dl -k or dl -b -o 900000 (see preceding section) b) Use the menu item, transfer | send text file (do not use the 'send file' option) Set 0 character delay 2. UNIX uses the standard terminal emulator minicom if it is available. Note that the serial port is /dev/ttyS0. a) Use mincom download. This requires setting up a user transfer protocol (see Section 22.1, “Using Minicom”). This method is not recommended. b) Use a separate window to initiate a transfer of the file In minicom, type: dl -k or dl -b -o 900000 In another terminal window, to start the download, type cat vm.src > /dev/ttyS0 (see Section 22, “Minicom”) 22 Minicom The Linux development system and minicom are used to communicate with the Linux Sandpoint target. Minicom can be used only by a root user to set up the configuration, to execute minicom, and to use the /dev/ttyS0 facility. Thus to run minicomn, it is necessary to be root. 22.1 Using Minicom The steps in using the Minicom are as follows: 1. To start minicom in configuration mode to set the terminal characteristics such as baud rate, type: minicom -s 2. To start minicom in terminal mode, type: minicom 3. To configure minicom while its running, type: control-A 4. To create file transfer protocols, type: Z Porting Linux to the PowerPC™ MPC7451, Rev. 2 20 Freescale Semiconductor Minicom O choose file transfer protocols set up this protocol: ascii2 /usr/bin/ascii-xfr -svu -l 15 Y U N Y N and use it for downloads e.g. dl -k esc to go to previous menus 5. To change the baud rate, type: control-A Z O choose serial port setup E to change the baud rate esc to go to previous menus 6. To exit minicom, type: control-A x 22.2 Minicom Problems Minicom errors that may occur are as follows: • Minicom: cannot open /dev/ttyS0: Permission denied Remember that only as root can one run minicom • Terminal /dev/ttyS0 is busy This indicates that some other process has attached ttyS0 and it must be terminated before minicom can start. It is necessary to be root to perform these actions. Type: ps -ef | grep minicom Close the other minicom process, even if the terminal window is already closed, by typing "kill -9 <minicom process number> • Can’t find /dev/modem Indicates that the configuration file, df1, is either missing or set up incorrectly. Type: minicom -s Choose the serial port setup Change A. Serial Device: /dev/modem to /dev/ttyS0 esc (escape key) Choose save setup as df1 Then choose exit Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 21 DINK32 Booting the MPC7450 Linux: Example 23 DINK32 Booting the MPC7450 Linux: Example This example uses the code built according to the instructions in this document. Linux uses a 38400 baud rate; DINK32 binary download feature was used. After the command dl -b -o 900000 is issued in the minicom window, the command cat vm1.bin > /dev/ttyS0 is issued in another terminal window. Version : 12.2, Metaware Build Released : February 16, 2001: Written by : Freescale’s RISC Applications Group, Austin, TX System : Sandpoint with Valis (MPPMC7450) Processor : MPC7450 V2.0 @ 400 MHz, Memory @ 100 MHz Memory : Map B (CHRP), 00000000...03FFFFFF Copyright Freescale Inc. 1993-2000 Refer to ‘history.c’ for release info, changes, errata and fixes. DINK32_V’GER >>sb -k 38400 Baud rate changing to 38400... ap."ÿ DINK32_V'GER >>dl -b -o 900000 Binary protocol Offset Srecords by 0x00900000 607K 622548 bytes transferred. DINK32_V'GER >>go 900000 loaded at: 00900000 00914E20 relocated to: 00800000 00814E20 board data at: 0080E314 00814D20 relocated to: 0080E314 00814D20 zimage at: 0090B000 00996115 avail ram: 00400000 00800000 Linux/PPC load: root=/dev/hdb1 console=ttyS0,38400 (see note below) Uncompressing Linux...done. Now booting the kernel Total memory = 32MB; using 128kB for hash table (at c01a0000) Linux version 2.4.0-test2 ([email protected]) (gcc version 2.95.2 19991030 (2.95.1 Boot arguments: root=/dev/hdb1 console=ttyS0,38400 console=ttyS0,38400 On node 0 totalpages: 8192 <...it continues to boot printing information, then it prints ide info...> IDE timing: 00000364, resetting to PIO0 timing IDE control/status register: 00ff0091 hdb: ST310210A, ATA DISK drive ide0 at 0xaffbf8-0xaffbff,0xaff7f6 on irq 14 hdb: 19925880 sectors (10202 MB) w/2048KiB Cache, CHS=19767/16/63 Partition check: hdb: hdb1 Serial driver version 5.01 (2000-05-29) with MANY_PORTS SHARE_IRQ SERIAL_PCI end ttyS00 at 0x03f8 (irq = 4) is a 16550A ttyS01 at 0x02f8 (irq = 3) is a 16550A 8139too Fast Ethernet driver 0.9.7 loaded PCI: Enabling device 00:10.0 (0000 -> 0003) eth0: RealTek RTL8139 Fast Ethernet board found at 0x9fffe700, IRQ 19 eth0: Chip is 'RTL-8139B' eth0: MAC address 00:40:c7:87:50:b2. kmem_create: Forcing size word alignment - nfs_fh VFS: Mounted root (ext2 filesystem) readonly. Freeing unused kernel memory: 60k init Porting Linux to the PowerPC™ MPC7451, Rev. 2 22 Freescale Semiconductor /dev Directory INIT: version 2.77 booting EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended INIT: Entering runlevel: 3 sh-2.03# ls bin etc include lost+found opt share usr boot filesystem.tar lib man proc targetLib.tar var dev home libexec mnt sbin tmp web NOTE If the CMDLINE defined in misc.c has not been changed, when the Linux/PPC load message appears, change it from: "Linux/PPC load: root=nfs" to "Linux/PPC load: root=/dev/hda1" or "Linux/PPC load: root=/dev/hdb1" for partition 1 on IDE0 slave or "Linux/PPC load: root=/dev/hdb2" for partition 2 on IDE0 slave. 24 /dev Directory The /dev directory contains all the device resources for the system. Every device, CDROM, disk partition, terminal, window, and so on are named /dev/<device name> and contained in the /dev directory. These are not file names; they are device names. During the work with the Linux OS, it may be desired to remove some devices and add others.If all the devices in the /dev directory were accidnetly removed on the target system, there are two options: repair it or rebuild it on the development system. If this occurs on the development system, there are also two options: repair it or reinstall the Linux system. 1. Rebuild /dev for the target Sandpoint system on the development system. For the hard drive, follow the Section 14, “Hard Drive for Linux OS” instructions and recopy the /dev directory. For the ramdisk, follow the Section 17, “Making a ramdisk Linux OS” instructions. Unfortunately, it is not as simple as recopying the /dev directory because a ramdisk is a compressed file. Therefore, recreate the entire ramdisk file. 2. Reinstall Linux on the development system. This usually requires formatting the main partition and reinstalling Linux and any packages that may have been destroyed. 3. Repair /dev for the development system on the development system. Do not kill the terminal window: it is not possible to start a new one. It is necessary to reinstall Linux. Because each terminal window is a device, no more windows can be started. Therefore, while in the same window used to accidently kill /dev and while in the /dev directory, run the script MAKEDEV. This recreates the /dev devices. 25 Revision History Table 1 lists this document’s significant changes and revisions. Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 23 Revision History Table 1. Document History Revision Changes 0, 1 Initial releases 1.1 On page 1, corrected the e-mail address for feedback. In Section 3.2, corrected typo: ‘rmp’ should be ‘rpm’ In Section 3.2.1, corrected typo in the directory path to the CDK kernel source: should be ‘…-test2’ In Section 4.2, corrected the typo: ‘.dependh’ should be ‘.hdepend’ In Section 7.2.3, added ‘ *’ to correct the tar command in the first step. In the first paragraph of Appendix A, added a statement that the Ethernet driver fails intermittently. 1.2 Nontechnical reformatting 2 Rebranding for Freescale; nontechnical formatting. Appendix A Sandpoint 3 Platform Since the first release of this document in May 2001, Montavista HHL linuxhhl R2.0 82xx has been distributed and a sandpoint 3 platform has been released. The Montavista HHL linuxhhl R2.0 82xx is based on Linux kernel 2.4.2. Freescale’s applications engineers have not attempted porting linuxhhl to this new platform or this new release, but one of our customers has done so. However, the Ethernet driver failed intermittently. These steps, while not verified, may help our Sandpoint 3 customers. • Changes from sandpoint 2 linuxhhl R1.0. — There is no arch/ppc/boot/misc.c. The decompress_kernel function is now located in arch/ppc/boot/common/misc-simple.c. — The _put_HID0(_get_HID)() | 0x04000000) call (see the second step under Section 10, “Installing an Updated Kernel Source,”) still must be made even though DINK32 v12.2 is used as the boot facility. When Linux begins, it turns off the TBEN bit. • Changes to the sandpoint_setup.c file and the openpic code — openpic_init now requires four arguments. — If sandpoint 3 is set to ILEGACY mode (SW2-3), the change to the openpic_init call can be ignored. Although the interrupt scheme is significantly different between the two versions of sandpoint, there is a way to select the sandpoint 2 interrupt scheme on the sandpoint 3.The sandpoint 3 can be placed into legacy mode and the interrupts should work the same as on sandpoint 2. Refer to the sandpoint 3 manual, which comes with the board and is also available on the web. Legacy mode is enabled by completing the following sequence: switch 2, pin 3, move to the left (off), and select the Legacy interrupt connections desired. Refer to the code in Section 6.3, “Configuration Selections,”for the following: – Location of SW2—page 6 Porting Linux to the PowerPC™ MPC7451, Rev. 2 24 Freescale Semiconductor Revision History – Description of ILEGACY mode—page 10 – Description of interrupt Legacy modes—page 12 – Description of Legacy interrupt connections—page 29 in Section Appendix B, “Required Files” There are also problems with the sandpoint 2 port when used on sandpoint 3. • When viewed from Linux, the interrupt structure has changed between sandpoint 2 and sandpoint 3. Setting the ILEGACY bit helps in the serial port but the port does not seem to support the ethernet network card correctly. • According to e-mail and newslist exchanges, the main linuxppc_2_4_devel tree does not seem to run correctly on sandpoint 3 as yet. • What other changes are necessary at this point are not known. Appendix B Required Files Notice that all three file names start with a dot (.). These files are included in the /opt/hardhat/devkit/lsp/linux-2.4.0-test directory. Files 1 and 2 are most likely correct; however, file 3, .config, is the default file. The listing shown here is for the modified configuration as shown in Section 6.3, “Configuration Selections”. 1. .hhl_cross_compile /opt/hardhat/devkit/ppc/82xx/bin/ppc_82xx- 2. .hhl_target_cpu ppc 3. .confi 4. g # # Automatically generated by make menuconfig: don’t edit # # CONFIG_UID16 is not set # # Code maturity level options # CONFIG_EXPERIMENTAL=y # # Platform support # CONFIG_PPC=y CONFIG_6xx=y # CONFIG_4xx is not set # CONFIG_PPC64BRIDGE is not set # CONFIG_8260 is not set # CONFIG_8xx is not set # CONFIG_ALL_PPC is not set # CONFIG_GEMINI is not set Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 25 Revision History # CONFIG_EST8260 is not set CONFIG_SANDPOINT=y # CONFIG_APUS is not set # CONFIG_SMP is not set # CONFIG_RTSCHED is not set CONFIG_ALTIVEC=y CONFIG_MACH_SPECIFIC=y # # Loadable module support # # CONFIG_MODULES is not set # # General setup # # CONFIG_ISA is not set # CONFIG_SBUS is not set CONFIG_PCI=y CONFIG_CHRP_MAPB=y CONFIG_NET=y CONFIG_SYSCTL=y CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_KCORE_ELF=y CONFIG_BINFMT_ELF=y CONFIG_KERNEL_ELF=y CONFIG_BINFMT_MISC=y # CONFIG_PCI_NAMES is not set # CONFIG_HOTPLUG is not set # CONFIG_PCMCIA is not set # # # # # # # # # # # # # Parallel port support CONFIG_PARPORT is not set CONFIG_VGA_CONSOLE is not set CONFIG_FB is not set CONFIG_PMAC_PBOOK is not set CONFIG_MAC_FLOPPY is not set CONFIG_MAC_SERIAL is not set CONFIG_ADB is not set CONFIG_PROC_DEVICETREE is not set CONFIG_BOOTX_TEXT is not set CONFIG_Freescale_HOTSWAP is not set # # Plug and Play configuration # # CONFIG_PNP is not set # CONFIG_ISAPNP is not set # # Block devices # # CONFIG_BLK_DEV_FD is not set # CONFIG_BLK_DEV_XD is not set Porting Linux to the PowerPC™ MPC7451, Rev. 2 26 Freescale Semiconductor Revision History # CONFIG_PARIDE is not set # CONFIG_BLK_CPQ_DA is not set # CONFIG_BLK_DEV_DAC960 is not set CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_NBD=y # CONFIG_BLK_DEV_LVM is not set # CONFIG_BLK_DEV_MD is not set # CONFIG_MD_LINEAR is not set # CONFIG_MD_RAID0 is not set # CONFIG_MD_RAID1 is not set # CONFIG_MD_RAID5 is not set # CONFIG_BLK_DEV_RAM is not set # CONFIG_BLK_DEV_INITRD is not set # CONFIG_BLK_DEV_FLASH is not set # # Networking options # CONFIG_PACKET=y CONFIG_PACKET_MMAP=y CONFIG_NETLINK=y CONFIG_RTNETLINK=y # CONFIG_NETLINK_DEV is not set # CONFIG_NETFILTER is not set CONFIG_FILTER=y CONFIG_UNIX=y CONFIG_INET=y # CONFIG_IP_MULTICAST is not set # CONFIG_IP_ADVANCED_ROUTER is not set # CONFIG_IP_PNP is not set # CONFIG_IP_ROUTER is not set # CONFIG_NET_IPIP is not set # CONFIG_NET_IPGRE is not set # CONFIG_IP_ALIAS is not set # CONFIG_ARPD is not set # CONFIG_SYN_COOKIES is not set CONFIG_SKB_LARGE=y # CONFIG_IPV6 is not set # CONFIG_KHTTPD is not set # CONFIG_ATM is not set # CONFIG_IPX is not set CONFIG_ATALK=y # CONFIG_DECNET is not set # CONFIG_BRIDGE is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set # CONFIG_LLC is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set # CONFIG_NET_FASTROUTE is not set # CONFIG_NET_HW_FLOWCONTROL is not set # # QoS and/or fair queueing # # CONFIG_NET_SCHED is not set # # ATA/IDE/MFM/RLL support Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 27 Revision History # CONFIG_IDE=y # # IDE, ATA and ATAPI Block devices # CONFIG_BLK_DEV_IDE=y # CONFIG_BLK_DEV_HD_IDE is not set # CONFIG_BLK_DEV_HD is not set CONFIG_BLK_DEV_IDEDISK=y CONFIG_IDEDISK_MULTI_MODE=y # CONFIG_BLK_DEV_IDEDISK_VENDOR is not set # CONFIG_BLK_DEV_IDEDISK_FUJITSU is not set # CONFIG_BLK_DEV_IDEDISK_IBM is not set # CONFIG_BLK_DEV_IDEDISK_MAXTOR is not set # CONFIG_BLK_DEV_IDEDISK_QUANTUM is not set # CONFIG_BLK_DEV_IDEDISK_SEAGATE is not set # CONFIG_BLK_DEV_IDEDISK_WD is not set # CONFIG_BLK_DEV_COMMERIAL is not set # CONFIG_BLK_DEV_TIVO is not set # CONFIG_BLK_DEV_IDECS is not set CONFIG_BLK_DEV_IDECD=y # CONFIG_BLK_DEV_IDETAPE is not set # CONFIG_BLK_DEV_IDEFLOPPY is not set # CONFIG_BLK_DEV_IDESCSI is not set # CONFIG_BLK_DEV_CMD640 is not set # CONFIG_BLK_DEV_CMD640_ENHANCED is not set # CONFIG_BLK_DEV_ISAPNP is not set # CONFIG_BLK_DEV_RZ1000 is not set CONFIG_BLK_DEV_IDEPCI=y # CONFIG_IDEPCI_SHARE_IRQ is not set # CONFIG_BLK_DEV_IDEDMA_PCI is not set # CONFIG_BLK_DEV_OFFBOARD is not set # CONFIG_IDEDMA_PCI_AUTO is not set # CONFIG_BLK_DEV_IDEDMA is not set # CONFIG_IDEDMA_PCI_WIP is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_AEC62XX_TUNING is not set # CONFIG_BLK_DEV_ALI15X3 is not set # CONFIG_WDC_ALI15X3 is not set # CONFIG_BLK_DEV_AMD7409 is not set # CONFIG_AMD7409_OVERRIDE is not set # CONFIG_BLK_DEV_CMD64X is not set # CONFIG_BLK_DEV_CY82C693 is not set # CONFIG_BLK_DEV_CS5530 is not set # CONFIG_BLK_DEV_HPT34X is not set # CONFIG_HPT34X_AUTODMA is not set # CONFIG_BLK_DEV_HPT366 is not set # CONFIG_BLK_DEV_NS87415 is not set # CONFIG_BLK_DEV_OPTI621 is not set # CONFIG_BLK_DEV_PDC202XX is not set # CONFIG_PDC202XX_BURST is not set # CONFIG_BLK_DEV_SIS5513 is not set # CONFIG_BLK_DEV_TRM290 is not set # CONFIG_BLK_DEV_VIA82CXXX is not set # CONFIG_VIA82CXXX_TUNING is not set Porting Linux to the PowerPC™ MPC7451, Rev. 2 28 Freescale Semiconductor Revision History CONFIG_BLK_DEV_SL82C105=y # CONFIG_IDE_CHIPSETS is not set # CONFIG_IDEDMA_AUTO is not set # CONFIG_DMA_NONPCI is not set CONFIG_BLK_DEV_IDE_MODES=y # # SCSI support # # CONFIG_SCSI is not set # # IEEE 1394 (FireWire) support # # CONFIG_IEEE1394 is not set # # Network device support # CONFIG_NETDEVICES=y # # ARCnet devices # # CONFIG_ARCNET is not set # # # # # # # # # Appletalk devices CONFIG_APPLETALK is not set CONFIG_DUMMY is not set CONFIG_BONDING is not set CONFIG_EQUALIZER is not set CONFIG_ETHERTAP is not set CONFIG_NET_SB1000 is not set # # Ethernet (10 or 100Mbit) # CONFIG_NET_ETHERNET=y # CONFIG_MACE is not set # CONFIG_BMAC is not set # CONFIG_GMAC is not set # CONFIG_NCR885E is not set # CONFIG_OAKNET is not set # CONFIG_NET_VENDOR_3COM is not set # CONFIG_LANCE is not set # CONFIG_NET_VENDOR_SMC is not set # CONFIG_NET_VENDOR_RACAL is not set # CONFIG_AT1700 is not set # CONFIG_DEPCA is not set # CONFIG_NET_ISA is not set CONFIG_NET_PCI=y # CONFIG_PCNET32 is not set # CONFIG_ADAPTEC_STARFIRE is not set # CONFIG_AC3200 is not set # CONFIG_APRICOT is not set # CONFIG_CS89x0 is not set # CONFIG_DE4X5 is not set Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 29 Revision History # CONFIG_TULIP is not set # CONFIG_DGRS is not set # CONFIG_DM9102 is not set # CONFIG_EEPRO100 is not set # CONFIG_LNE390 is not set # CONFIG_NE3210 is not set # CONFIG_NE2K_PCI is not set # CONFIG_RTL8129 is not set CONFIG_8139TOO=y # CONFIG_SIS900 is not set # CONFIG_TLAN is not set # CONFIG_VIA_RHINE is not set # CONFIG_ES3210 is not set # CONFIG_EPIC100 is not set # CONFIG_NET_POCKET is not set # # # # # # # # # # Ethernet (1000 Mbit) CONFIG_YELLOWFIN is not set CONFIG_ACENIC is not set CONFIG_SK98LIN is not set CONFIG_FDDI is not set CONFIG_HIPPI is not set CONFIG_PPP is not set CONFIG_SLIP is not set # # Wireless LAN (non-hamradio) # # CONFIG_NET_RADIO is not set # # # # # # # Token Ring devices CONFIG_TR is not set CONFIG_NET_FC is not set CONFIG_RCPCI is not set CONFIG_SHAPER is not set # # Wan interfaces # # CONFIG_WAN is not set # # Amateur Radio support # # CONFIG_HAMRADIO is not set # # IrDA (infrared) support # # CONFIG_IRDA is not set # # ISDN subsystem Porting Linux to the PowerPC™ MPC7451, Rev. 2 30 Freescale Semiconductor Revision History # # CONFIG_ISDN is not set # # Old CD-ROM drivers (not SCSI, not IDE) # # CONFIG_CD_NO_IDESCSI is not set # # Console drivers # # # Frame-buffer support # # CONFIG_FB is not set # # Character devices # # CONFIG_VT is not set CONFIG_SERIAL=y CONFIG_SERIAL_CONSOLE=y # CONFIG_SERIAL_EXTENDED is not set # CONFIG_SERIAL_NONSTANDARD is not set CONFIG_UNIX98_PTYS=y CONFIG_UNIX98_PTY_COUNT=256 # # I2C support # # CONFIG_I2C is not set # # Mice # # CONFIG_BUSMOUSE is not set # CONFIG_MOUSE is not set # # Joysticks # # CONFIG_JOYSTICK is not set # CONFIG_QIC02_TAPE is not set # # # # # # # # # # # # # Watchdog Cards CONFIG_WATCHDOG is not set CONFIG_INTEL_RNG is not set CONFIG_NVRAM is not set CONFIG_RTC is not set Video For Linux CONFIG_VIDEO_DEV is not set CONFIG_DTLK is not set CONFIG_R3964 is not set Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 31 Revision History # CONFIG_APPLICOM is not set # # # # # # # Ftape, the floppy tape device driver CONFIG_FTAPE is not set CONFIG_DRM is not set CONFIG_DRM_TDFX is not set CONFIG_AGP is not set # # File systems # # CONFIG_QUOTA is not set CONFIG_AUTOFS_FS=y # CONFIG_AUTOFS4_FS is not set # CONFIG_ADFS_FS is not set # CONFIG_ADFS_FS_RW is not set # CONFIG_AFFS_FS is not set # CONFIG_HFS_FS is not set # CONFIG_BFS_FS is not set # CONFIG_FAT_FS is not set # CONFIG_MSDOS_FS is not set # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set CONFIG_ISO9660_FS=y # CONFIG_JOLIET is not set # CONFIG_MINIX_FS is not set # CONFIG_NTFS_FS is not set # CONFIG_NTFS_RW is not set # CONFIG_HPFS_FS is not set CONFIG_PROC_FS=y # CONFIG_DEVFS_FS is not set # CONFIG_DEVFS_MOUNT is not set # CONFIG_DEVFS_DEBUG is not set CONFIG_DEVPTS_FS=y # CONFIG_QNX4FS_FS is not set # CONFIG_QNX4FS_RW is not set CONFIG_ROMFS_FS=y CONFIG_EXT2_FS=y # CONFIG_SYSV_FS is not set # CONFIG_SYSV_FS_WRITE is not set # CONFIG_UDF_FS is not set # CONFIG_UDF_RW is not set # CONFIG_UFS_FS is not set # CONFIG_UFS_FS_WRITE is not set # # Network File Systems # # CONFIG_CODA_FS is not set CONFIG_NFS_FS=y # CONFIG_NFS_V3 is not set # CONFIG_ROOT_NFS is not set Porting Linux to the PowerPC™ MPC7451, Rev. 2 32 Freescale Semiconductor Revision History # CONFIG_NFSD is not set # CONFIG_NFSD_V3 is not set CONFIG_SUNRPC=y CONFIG_LOCKD=y # CONFIG_SMB_FS is not set # CONFIG_NCP_FS is not set # CONFIG_NCPFS_PACKET_SIGNING is not set # CONFIG_NCPFS_IOCTL_LOCKING is not set # CONFIG_NCPFS_STRONG is not set # CONFIG_NCPFS_NFS_NS is not set # CONFIG_NCPFS_OS2_NS is not set # CONFIG_NCPFS_SMALLDOS is not set # CONFIG_NCPFS_MOUNT_SUBDIR is not set # CONFIG_NCPFS_NDS_DOMAINS is not set # CONFIG_NCPFS_NLS is not set # CONFIG_NCPFS_EXTRAS is not set # # Partition Types # CONFIG_PARTITION_ADVANCED=y # CONFIG_ACORN_PARTITION is not set # CONFIG_OSF_PARTITION is not set # CONFIG_AMIGA_PARTITION is not set # CONFIG_ATARI_PARTITION is not set # CONFIG_MAC_PARTITION is not set CONFIG_MSDOS_PARTITION=y # CONFIG_BSD_DISKLABEL is not set # CONFIG_SOLARIS_X86_PARTITION is not set # CONFIG_UNIXWARE_DISKLABEL is not set # CONFIG_SGI_PARTITION is not set # CONFIG_SUN_PARTITION is not set # CONFIG_NLS is not set # # Sound # # CONFIG_SOUND is not set # # USB support # # CONFIG_USB is not set # # Kernel hacking # # CONFIG_MAGIC_SYSRQ is not set # CONFIG_KGDB is not set CONFIG_XMON=y Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 33 Revision History THIS PAGE INTENTIONALLY LEFT BLANK Porting Linux to the PowerPC™ MPC7451, Rev. 2 34 Freescale Semiconductor Revision History THIS PAGE INTENTIONALLY LEFT BLANK Porting Linux to the PowerPC™ MPC7451, Rev. 2 Freescale Semiconductor 35 How to Reach Us: Home Page: www.freescale.com email: [email protected] USA/Europe or Locations Not Listed: Freescale Semiconductor Technical Information Center, CH370 1300 N. Alma School Road Chandler, Arizona 85224 1-800-521-6274 480-768-2130 [email protected] Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductor products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document. Europe, Middle East, and Africa: Freescale Halbleiter Deutschland GmbH Technical Information Center Schatzbogen 7 81829 Muenchen, Germany +44 1296 380 456 (English) +46 8 52200080 (English) +49 89 92103 559 (German) +33 1 69 35 48 48 (French) [email protected] Freescale Semiconductor reserves the right to make changes without further notice to Japan: Freescale Semiconductor Japan Ltd. Headquarters ARCO Tower 15F 1-8-1, Shimo-Meguro, Meguro-ku Tokyo 153-0064, Japan 0120 191014 +81 3 5437 9125 [email protected] parameters, including “Typicals” must be validated for each customer application by Asia/Pacific: Freescale Semiconductor Hong Kong Ltd. Technical Information Center 2 Dai King Street Tai Po Industrial Estate, Tai Po, N.T., Hong Kong +800 2666 8080 [email protected] unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor For Literature Requests Only: Freescale Semiconductor Literature Distribution Center P.O. Box 5405 Denver, Colorado 80217 1-800-441-2447 303-675-2140 Fax: 303-675-2150 LDCForFreescaleSemiconductor @hibbertgroup.com Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. The Power Architecture and Power.org word marks and the Power and Power.org logos and related marks are trademarks and service marks licensed by Power.org. All other product or service names are the property of their respective owners. Document Number: AN2145 Rev. 2 10/2006 any products herein. Freescale Semiconductor makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale Semiconductor assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. “Typical” parameters which may be provided in Freescale Semiconductor data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating customer’s technical experts. Freescale Semiconductor does not convey any license under its patent rights nor the rights of others. Freescale Semiconductor products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Freescale Semiconductor product could create a situation where personal injury or death may occur. Should Buyer purchase or use Freescale Semiconductor products for any such unintended or and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part. © Freescale Semiconductor, Inc., 2001, 2006.