In this post I will mention the steps that should be performed to run embedded linux on powerpc board mpc8572ds using NFS and TFTP servers. I have used mentor embedded linux for this purpose. In order to boot the target with linux we need to perform following steps.
- Setting up NFS Server
- Setting up TFTP Server
- Running embedded linux on target
Setting up NFS Server
I installed NFS Server on Ubuntu 12.04 64 bit machine using following command.
sudo apt-get install nfs-kernel-server
In order to configure the directories to be exported edit /etc/exports file. I exported /nfsboot directory by adding following line in /etc/exports.
/nfsboot *(ro,sync,no_root_squash)
In above command I specified all host formats to be valid by specifying *, as this is a network machine in my case which can only be accessed by network machine and expected to be accessed by all systems in the network network, so this format is fine in my case. If you want to restrict unwanted access to NFS server make it specific one.
Start the NFS server by executing following command
sudo /etc/init.d/nfs-kernel-server start
Setting up TFTP Server
Install TFTP server by executing following command'
sudo apt-get install tftpd-hpa openbsd-inetd
I want directory /tftpboot to be the root of tftp server. So create it and give rights to everyone using following commands.
cd /mdir tftpbootsudo chmod -R 777 /tftpboot
Now, in order to configure tftp server open tftpd-hpa file using following commands
cd /etc/default
sudo vi tftpd-hpa
# /etc/default/tftpd-hpa
RUN_DAEMON="yes"
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"TFTP_OPTIONS="--secure"
Now restart tftp server using following commands.
sudo service openbsd-inetd restart
sudo service tftpd-hpa restart
Running embedded linux on target
Now transfer filesystem and boot images on nfsboot and tftboot servers. Create a directory mpc8572ds in tftpboot and copy following files.
mpc8572ds/uimage.bin
mpc8572ds/uimage.dtb
Similarly create a folder mpc8572ds in nfsboot and copy file system in it.
Now connect target serial port with computer and monitor the output using a suitable tool like putty, minicom etc.
Here I am assuming that uboot is already installed on the target. Starting up the target will show similar uboot console output.
U-Boot 2009.11-rc1 (Nov 05 2010 - 01:19:31)CPU0: 8572E, Version: 2.1, (0x80e80021)Core: E500, Version: 3.0, (0x80210030)Clock Configuration:CPU0:1499.985 MHz, CPU1:1499.985 MHz,CCB:599.994 MHz,DDR:399.996 MHz (799.992 MT/s data rate) (Asynchronous), LBC:37.500 MHzL1: D-cache 32 kB enabledI-cache 32 kB enabledBoard: MPC8572DS Sys ID: 0x14, Sys Ver: 0x20, FPGA Ver: 0x01, vBank: 0I2C: readyDRAM: Initializing.... DDR: 1 GB (DDR2, 64-bit, CL=6, ECC off)DDR Controller Interleaving Mode: bankNow running in RAM - U-Boot at: 3ff70000FLASH: 128 MBL2: 1024 KB enabledNAND: 4096 MiBEEPROM: Invalid ID (ff ff ff ff)PCIE3 connected to ULI as Root Complex (base addr ffe08000)Scanning PCI bus 0102 1c 10b9 5237 0c03 0002 1c 10b9 5237 0c03 0002 1c 10b9 5237 0c03 0002 1c 10b9 5239 0c03 0002 1d 10b9 5455 0401 0002 1d 10b9 5457 0703 0002 1e 10b9 1575 0601 0002 1e 10b9 7101 0680 0002 1f 10b9 5229 0101 0002 1f 10b9 5288 0101 0001 00 10b9 5249 0604 00PCIE3 on bus 00 - 02PCIE2 connected to Slot 1 as Root Complex (base addr ffe09000)PCIE2 on bus 03 - 03PCIE1 connected to Slot 2 as Root Complex (base addr ffe0a000)PCIE1 on bus 04 - 04In: serialOut: serialErr: serialSCSI: AHCI 0001.0000 32 slots 4 ports 3 Gbps 0xf impl IDE modeflags: ncq ilck pm led clo pmp pio slum partscanning bus for devices...Net: eTSEC1, eTSEC2, eTSEC3, eTSEC4Hit any key to stop autoboot: 10
Press enter when you see above message. Now execute printenv command to see the settings of the machine. In my case I see following settings. You need to make the correct settings for your specific case.
=> printenvramboot=setenv bootargs root=/dev/ram rw console=$consoledev,$baudrate
$othbootargs;tftp $ramdiskaddr $ramdiskfile;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr $ramdiskaddr $fdtaddrbaudrate=115200loads_echo=1ethaddr=00:E0:0C:02:00:FDeth1addr=00:E0:0C:02:01:FDeth2addr=00:E0:0C:02:02:FDeth3addr=00:E0:0C:02:03:FDrootpath=/opt/nfsroothostname=unknownloadaddr=1000000memctl_intlv_ctl=2netdev=eth0uboot=u-boot.bintftpflash=tftpboot $loadaddr $uboot; protect off 0xeff80000 +$filesize;
erase 0xeff80000 +$filesize; cp.b $loadaddr 0xeff80000 $filesize;
protect on 0xeff80000 +$filesize; cmp.b $loadaddr 0xeff80000 $filesizeconsoledev=ttyS0ramdiskaddr=2000000ramdiskfile=8572ds/ramdisk.ubootbdev=sda3bootdelay=3bootcmd=run nfsbootbootfilele=/tftpboot/abbasr/mpc8572/uImage-2.6.31-r14-mpc8572ds.binfdtaddr=c00000dtbfile=MEL4_cycle1_rc4/mpc8572ds-nonsmp/uImage-mpc8572ds.dtbnfsboot=tftp 1000000 $bootfile;tftp c00000 $fdtfile;bootm 1000000 - c00000bootfile=uImage-mpc8572ds.binfdtfile=uImage-mpc8572ds.dtbfilesize=3AACfileaddr=C00000gatewayip=137.202.157.254netmask=255.255.254.0ipaddr=137.202.156.100bootargs=root=/dev/nfs rw nfsroot=137.202.157.115:/nfsboot/8572ds ip=dhcp console=ttyS0,115200ethact=eTSEC1serverip=137.202.157.94stdin=serialstdout=serialstderr=serial
Now execute below command to set serverip, which will be used to get boot images from tftpserver
setenv serverip 137.202.156.63
Now execute following commands to specify the location of bin and dtb files. It can be seen that I don't specify tftpboot folder path while specifying any file, using tftpboot in the path will be wrong here.
setenv fdtfile mpc8572ds/uimage.dtb
setenv bootfile mpc8572ds/uimage.bin
Now set the bootargs as shown below.
setenv bootargs root=/dev/nfs rw nfsroot=137.202.156.63:/nfsboot/mpc8572ds/ ip=dhcp console=ttyS0,115200
If I need to use a static ip address instead of using dhcp I can use following command as shown below.
setenv bootargs root=/dev/nfs rw nfsroot=137.202.156.63:/nfsboot/mpc8572ds/ip=137.202.156.114:137.202.156.63:137.202.157.255:255.255.254.0:MPC8572DS:eth0:on console=ttyS0,115200
Now load the bin and dtb files using tftp command as shown below.
tftp 1000000 $bootfile;tftp c00000 $fdtfile;
Now start the linux using following boot command.
bootm 1000000 - c00000
If images are fine and properly placed on servers, executing above command will successfully boot embedded linux on mpc8572ds
No comments:
Post a Comment