Transcription

Freescale SemiconductorApplication NoteDocument Number: AN2145Rev. 2, 10/2006Porting Linux to the PowerPC MPC7451byMaurie OmmermanCPD ApplicationFreescale Semiconductor, Inc.Austin, TXThis document describes porting Montavista’s Hardhat Linux from a sandpoint 2 platform with the MPC8240PMC,the MPC755PMC, or the MPC7400PMC to theMPC7450/MPC7451. It explains how to set up thedevelopment environment and how to compile, load, and runthe resultant Hardhat Linux on the sandpoint MPC7450platform. (If building Linux for sandpoint 3, refer toAppendix A, “Sandpoint 3 Platform.”)The MPC7451 has the same functionality as the MPC7450,and any differences in data regarding bus timing, signalbehavior, and AC, DC, and thermal characteristics aredetailed in the hardware specifications. Note that because theMPC7450 and MPC7451 have the same functionality, theyare used interchangeably throughout the documentation andcode.1TerminologyThe following terms are used in this document. Bash shell—Extension to the bourne shell. It ispopular on Linux systems. Boot—Program that begins at hardware reset whichprepares the hardware for loading an OS. Freescale Semiconductor, Inc., 2001, 2006. All rights ContentsTerminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1Development Environment . . . . . . . . . . . . . . . . . . . . . .2Installing Montavista CDK 1.2 . . . . . . . . . . . . . . . . . . .3CDK RPMs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3Mandrake CD RPMs . . . . . . . . . . . . . . . . . . . . . . . . . . 4Building the Kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . .5Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10Source Code Changes . . . . . . . . . . . . . . . . . . . . . . . . .10Executable Images . . . . . . . . . . . . . . . . . . . . . . . . . . .13Installing an Updated Kernel Source . . . . . . . . . . . . .13Untar the Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14Additional Required Files . . . . . . . . . . . . . . . . . . . . . 14Sandpoint Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15Hard Drive for Linux OS . . . . . . . . . . . . . . . . . . . . . .15fdisk Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16Partition Configuration . . . . . . . . . . . . . . . . . . . . . . . .16Making a ramdisk Linux OS . . . . . . . . . . . . . . . . . . . .17make menuconfig . . . . . . . . . . . . . . . . . . . . . . . . . . . .17genromfs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17Downloading the Executable . . . . . . . . . . . . . . . . . . .19Terminal Emulators . . . . . . . . . . . . . . . . . . . . . . . . . . .20Minicom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20DINK32 Booting the MPC7450 Linux: Example . . .22/dev Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23

Development Environment 2Bourne shell—Gnu Born Again Shell. This is the default shell for most Linux systems becauseLinux uses Gnu tools exclusively (because they are free).CDK—Cross development kit. Development tools for Intel- or Mac-based Linux machine to buildPPC Linux objects.DINK32—Small OS debugger for the Sandpoint evaluation board.IDE—Integrated Device Electronics, which is the standard interface for many devices includinghard 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 andsolutions. They base their distributions on Red Hat.Montavista and Hard Hat Linux (hhl)—One of several companies that modifies and distributesLinux sources for embedded applications.OS—Operating system.Red Hat—One of several companies that uses the freely distributed desktop Linux sources andpackages 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 theconfiguration of the kernel, such as network, IDE, scsi, and other options. The .config file can bebuilt automatically from the make menuconfig command. Two other files are also required in aCDK, .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 candownload 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 alldirectories, mount and unmount file systems, start and end processes, and generally do anything ona Linux system. Unfortunately, this makes it easy to destroy the Linux development system andrender it useless. For that reason, login as a root user only for those activities that require rootpermissions, and revert to normal user for all other activities, including building the Linux kernel.Development EnvironmentTwo development platforms are available, the G4 Mac and the PC. The installation procedure is the samefor both platforms with only the few exceptions discussed in this document. The process defined in thisdocument was executed with a Mandrake Linux 7.0, a variant of Redhat Linux, on a PC (Pentium 166MHz).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. 22Freescale Semiconductor

Installing Montavista CDK 1.23Installing Montavista CDK 1.2For the process defined in this document, the Montavista CDK 1.2 Linux-2.4.0-test2 kernel wasused 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, orby going directly to the following pc 000808.cdimageIt 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.”4CDK RPMsFollowing are the basic steps for installing the CDK; more detailed instructions are available onthe CD in the /docs/CDK1.2.pdf file. The CDK CD is organized into various directories. Theinstallation steps require the user to cd to the indicated cdrom directory. The directories listed hereare relative to the /mnt/cdrom directory.The rpm maintains a data base of the rpms installed. Unless an rpm is always erased beforereinstalling it or unless you want more than one version installed, an error message may occurstating that the rpm is already installed. The installation can be forced by adding the --forceparameter to the rpm command. For example: rpm -ihv --forcehhl-ppc 7xx-gcc-2.95.2-13.i386.rpm . At times it may be useful to have several versions ofthese rpms, such as different versions of the CDK or a different version for each of the severalplatforms.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.rpmrpm -ihv *.ppc.rpmIf 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.rpmOn 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.rpmOn a Mac, type: rpm -ihv hhl-zsrec-(version).ppc.rpmPorting Linux to the PowerPC MPC7451, Rev. 2Freescale Semiconductor3

Mandrake CD RPMsSometimes in completing these steps, not all rpms install correctly. In this case, execute the followingsequence 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.rpm3. In the /common/ directory, type:rpm -ihv hhl-zsrec-1.0-5.i386.rpm4. In the ppc 7xx/RPMS directory, type:rpm -ihv hhl-ppc 7xx-gcc-2.95.2-13.i386.rpmrpm -ihv hhl-ppc 7xx-binutils-2.10.0.12-1.i386.rpmrpm -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.rpmrpm -ihv hhl-ppc 82xx-binutils-2.10.0.12-1.i386.rpmrpm -ihv hhl-ppc 82xx-glibc-2.1.3-1e.noarch.rpm (optional)5Mandrake CD RPMsInstall the following rpms for use in the build process.cd /mnt/cdrom/Mandrake/RPMSrpm -ihv genromfs-0.3-6mdk.i586.rpmrpm -ihv gzip-1.2.4-18mdk.i586.rpmrpm -ihv ncurses-devel-5.0-7mdk.i586.rpm5.1Access to the CDKThe 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 /host/binThe CDK kernel source is available in the following .0-test2This directory should be tarred and moved to a local user directory for modifying and building theMPC7450 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/sp8240tar -cvf linux sp.tar linux-2.4.0-test2chown user name linux sp.tarchgrp group name linux sp.tarcp 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. 24Freescale Semiconductor

Building the Kernel6Building the KernelThis section describes the steps for building the kernel. If some versions of the kernel do not buildcorrectly and a build fails, see 10, “Installing an Updated Kernel Source.” See 20, “Downloadingthe Executable,” for the steps for downloading the kernel to the MPC7450 Sandpoint.6.1Configuring the Linux ImageThere are two commands for setting the configuration and creating a .config file. make menuconfig (recommended because it is interactive). Requiresncurses-devel-5.0-7mdk.i586.rpm to be installed from the Mandrake CD. This is normallyinstalled 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, whichare discussed.Enter these interactive commands: enter or space—Select (or go into submenu) esc—Return to previous menu6.2BootingThe default .config from Montavista is to boot over the network. Because booting from the harddrive is the default .config for the procedure described in this document, booting over the networkrequires 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 NFSv3clientIf the Montavista default is in use, deselect these settings.6.3Configuration SelectionsSave the new configuration; all configuration settings are now in place. * indicates selected. Thesecan be compared to the options presented by make menuconfig.Code maturity level options --- [*] Prompt for development and/or incomplete code/driversPlatform support --- (6xx/7xx/7400) Processor Type(Sandpoint) Machine Type[ ] Symmetric multi-processing support[ ] Real Time Scheduler[*] AltiVec SupportLoadable module support --- [ ] Enable loadable module supportGeneral setup --- [*] Networking supportPorting Linux to the PowerPC MPC7451, Rev. 2Freescale Semiconductor5

Building the Kernel[*] Sysctl support[*] System V IPC[ ] BSD Process Accounting[*] Kernel support for MISC binaries[ ] PCI device name database[ ] Support for hot-pluggable devicesParallel 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 SwapPlug and Play configuration --- [ ] Plug and Play supportBlock 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 supportNetworking 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 SupportPorting Linux to the PowerPC MPC7451, Rev. 26Freescale 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 supportIDE, 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 supportSCSI support --- [ ] SCSI supportIEEE 1394 (FireWire) support --- [ ] IEEE 1394 (FireWire) support (EXPERIMENTAL)Network device support --- [*] Network device supportARCnet devices --- [ ] ARCnet support[ ] Dummy net driver support[ ] Bonding driver support[ ] EQL (serial line load balancing) support[ ] Ethertap network tap (EXPERIMENTAL)[ ] General Instruments Surfboard 1000Ethernet (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 cardsPorting Linux to the PowerPC MPC7451, Rev. 2Freescale Semiconductor7

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 adaptersEthernet (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) supportWireless 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 interfacesAmateur Radio support --- [ ] Amateur Radio supportIrDA (infrared) support --- all offISDN subsystem --- [ ] ISDN supportOld CD-ROM drivers (not SCSI, not IDE) --- [ ] Support non-SCSI/IDE/ATAPI CDROM drivesConsole 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 supportPorting Linux to the PowerPC MPC7451, Rev. 28Freescale Semiconductor

Building the Kernel(256) Maximum number of Unix98 PTYs in use (0-2048)I2C support --- [ ] I2C supportMice --- [ ] Bus Mouse Support[ ] Mouse Support (not serial and bus mice)Joysticks --- [ ] Joystick support[ ] QIC-02 tape supportWatchdog Cards --- [ ] Watchdog Timer Support[ ] Intel i8x0 Random Number Generator support[ ] /dev/nvram support[ ] Enhanced Real Time Clock SupportVideo For Linux --- [ ] Video For Linux[ ] Double Talk PC internal speech card support[ ] Siemens R3964 line discipline[ ] Applicom intelligent fieldbus card supportFtape, 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 supportPorting Linux to the PowerPC MPC7451, Rev. 2Freescale Semiconductor9

Dependencies[ ][ ][ ][*][ ][ ][ ][ ][ ]SoundAmiga partition table supportAtari partition table supportMacintosh partition map supportPC BIOS (MSDOS partition tables) supportBSD disklabel (FreeBSD partition tables) supportSolaris (x86) partition table supportUnixware slices supportSGI partition supportSun partition tables support--- [ ] Sound card support--- [ ] Support for USBKernel hacking --- [ ] Magic SysRq key[ ] Include kgdb kernel debugger[*] Include xmon kernel debugger--Load an Alternate Configuration FileSave Configuration to an Alternate FileUSB support7DependenciesThe make dep builds all the dependencies of all the source files for the build. The makefiles use thesedependency files in place of the normal make dependency rules. Therefore, it is important to do amake dep whenever any dependencies or configurations are changed. If it is necessary to make extensivechanges to a dependency file that has been previously set up, first remove the two dependency files below. .depend .hdepend8Source Code ChangesThe default for the source is to boot over the network; however, it is necessary to boot from the hard driveor from a ramdisk.8.1Boot from a Hard Drive1. Edit the file linux/arch/ppc/boot/misc.ca) 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 slaveSet root to the boot partition. Set it to “root /dev/hdb1”, which is the first partition on the slavedrive. Then create this drive on the development system as a slave and move it to the Sandpoint asa slave. See Section 16.3, “Creating Linux OS on the Partition”.Porting Linux to the PowerPC MPC7451, Rev. 210Freescale Semiconductor

Source Code ChangesAgain, edit the file linux/arch/ppc/boot/misc.c. (If you are using Sandpoint 3, seeAppendix A.)The original MPC7450 DINK32 does not turn on the timebase facility, bit 5 in hid0; version12.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.2Baud RateTo 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, whendownloading the Linux kernel through DINK32, 38400 can be used for the download andthen the baud rate does not need to be changed when the kernel begins running.a) Search for the following line:Access baud rateb) Change the line immediately after it (by changing 0xc to 0x3):com port- dll 0xcSo 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 baudrate to 38400.a) Search for the following string:sprintf(cmd lineb) Change it to the following:sprintf(cmd line, "%s console ttyS0,38400", cmd line);8.3Bus FrequencyTo 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 66b) Change it to the following:/* VGER: assume 100 MHz bus */// freq 66;freq 100;Porting Linux to the PowerPC MPC7451, Rev. 2Freescale Semiconductor11

Source Code Changes8.4Hash TableIt is necessary to fix the bug that does not clear the hash table (this bug may have been fixed in this versionof 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 pieces2. 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.5Initialize r4 and r5Edit 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 */lisr2,initrd [email protected],r2,initrd [email protected],0(r2)lisr2,initrd [email protected],r2,initrd [email protected],0(r2)8.6ramdiskPerform this step only if a ramdisk is desired instead of a hard disk. Edit the filelinux/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 MAJOR3. To the following:RAMDISK MAJORAt 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. 212Freescale Semiconductor

Executable Images9Executable ImagesThese commands are used in building the images. make zImage. To build an image that uses a hard disk see Section 14, “Hard Drive for LinuxOS.” make zImage.initrdThe 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 utable Elf FileLoad the zvmlinux file into the Sandpoint RAM.9.2Freescale S-record FileNow that the elf file is made, a Freescale S-record can be created to download to the board usingDINK32. Type the following:zsrec -s 900000 arch/ppc/boot/zvmlinux vm.srcThis should be an executable in the directory /opt/hardhat/host/bin. Thus, if this directory is notin the path variable, the path /opt/hardhat/host/bin/zsrec . must be completed. See step 4 inSection 4, “CDK RPMs.”10 Installing an Updated Kernel SourceBecause the original CDK 1.2 on the Montavista web pages would not build for the configurationused during the procedure this paper documents, it is necessary to determine if you have the oldnonworking version or a newer working version.10.1Detecting the Old VersionIf after you follow the directions in this paper beginning with Section 11, “Untar the Source,” afatal 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 sourcebase. If no make errors occur, the new version is being used. Following is the make error that resultsfrom use of the broken /arch/ppc/xmo--start-group \arch/ppc/kernel/kernel.o arch/ppc/mm/mm.o arch/ppc/lib/lib.okernel/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.odrivers/net/net.o drivers/parport/parport.a drivers/ide/idedriver.oPorting Linux to the PowerPC MPC7451, Rev. 2Freescale Semiconductor13

Untar the Sourcedrivers/cdrom/cdrom.a drivers/pci/pci.a drivers/macintosh/macintosh.o \net/network.o b.a \--end-group \-o vmlinuxdrivers/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 REL24ide setup dmamake: *** [vmlinux] Error 110.2Corrected VersionThe Sandpoint kernel source, sp8240, that accompanies the CDK 1.2 may be broken. After installation, itis found in the following directory (for a discussion of how this kernel was obtained, refer to Section 5.1,“Access to the -test2This old source is not needed, so it can be removed. Replace the broken source code with the new sourcefound at the ftp /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 directoryname is Linux.10.3Alternative CorrectionTurning 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 driverapparently 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 SourceThe steps for building a tar file of the Linux kernel source tree are given in Section 5.1, “Access to theCDK” or in Section 10.2, “Corrected Version.” Now it is necessary to untar the file in the user directoryand perform the rest of these steps as a user. Log in as user tar xvf linux sp.tar. The linux-2.4.0-test2directory is now in the user directory, and the user is the owner of all the files.12 Additional Required FilesThe 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 isPorting Linux to the PowerPC MPC7451, Rev. 214Freescale Semiconductor

Sandpoint Setupmuch larger and is created automatically by the make menuconfig process (see Section 6.1,“Configuring the Linux Image”).

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 th