HOWTO: Prepare and boot S32V234 EVB from eMMC

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

HOWTO: Prepare and boot S32V234 EVB from eMMC

HOWTO: Prepare and boot S32V234 EVB from eMMC

S32V234 EVB has 32GB of eMMC memory. This memory can be used as OS drive.In text bellow is RED color used for important notes,  GREEN for console commands and BLUE for filenames. Courier font family is used for code/configuration data. 

Requirements 

  • Prepared SD Card with linux image (HOWTO: Prepare A SD Card For Linux Boot Of S32V234-EVB Using BSP From VSDK ) and with u-boot.s32 file in boot partition.
  • Host PC machine with Linux OS, NFS, TFTP server and network connectivity with EVB
  • NFS shared folder with BSP Linux root file system (the root.tar file located in [S32DS_Vision]\s32v234_sdk\os\build_content.tar\build_content\v234_linux_build\ )
  • tftp server with Image, s32v234-evb.dtb and u-boot.s32 files
  • putty or other terminal connected to s32v234 EVB (tested with minicom on Linux)

Procedure 

Setup NFS share and TFTP server. Please look at internet for more details about NFS and TFTP

Don't forget add into root file system files Image, s32v234-evb.dtb and rootfs.tar - we will need them later f or boot and rootfs partitions. Also make sure that all rootfs files are owned by root. 

Here is my entry for /etc/exports file for NFS:

/rfs    192.168.1.0/24(rw,no_root_squash,sync)

and here /etc/xinetd.d/tftp file:

service tftp
{
   protocol = udp
   port = 69
   socket_type = dgram
   wait = yes
   user = nobody
   server = /usr/sbin/in.tftpd
   server_args = /tftpboot
   disable = no
}

It looks like that in ubuntu is some bug and I have to move tftp files location from /tftpboot to /svr/tftp  The tftp file in /etc/xined.d/ remain unchanged. This issue is probably related only to ubuntu. 

Make sure that both servers (nfs,tftp) are accessible from other machine (you can use S32V234 EVB started from SD card for that). 

I used static IP addresses on PC Host side and EVB. In my case PC has address 192.168.1.1 and EVB 192.168.1.10. You can also use DHCP server - but this is not part of this document. Boot from SD card and stop booting by pressing any key when you see first numbers on terminal window. You can get list of commands by help command.

pastedImage_12.png

First - we need to write u-boot.s32 file to eMMC. Unfortunately - there can be active only one storage - SD Card or eMMC. We need to copy u-boot.s32 from SD Card to RAM (use RAM address 0xC0000000), deactivate SD Card and connect eMMC. In u-boot console use

fatload mmc 0:1 0xC0000000 u-boot.s32

command. Write down the size of loaded file - you will need it later for counting number of sectors. In my case - the file size is 282624 (0x45000). 

 pastedImage_117.png

Once is u-boot.s32 in the RAM, we can disconnect SD card and connect eMMC by switching J37 jumper from 1-2 to 2-3 (there may be different name for other board vesions - but the location is same).

pastedImage_118.png

After switching from SD to eMMC you need to rescan mmc device by command:

mmc rescan

You can verify if eMMC is  mapped correctly by 

mmcinfo

pastedImage_1.png

Now we copy u-boot from RAM to emmc. eMMC is located on address 0x1000 - but it is addressed by 512 (0x200) bytes sector size. In this case mmc device address starts on 0x1000/0x200 = 0x08. Number of sectors is (u-boot.s32 filesize) / (sector size) - 0x45000/0x200=0x228. Write u-boot from RAM to eMMC by:

mmc write 0xC0000000 0x08 0x228

pastedImage_8.png

 

Now we can switch boot source from SD to eMMC by switches located on rear side of EVB. The switch name may vary across board version but location is again the same. Turn OFF EVB and remove SD card. For booting from eMMC switch SW503 - BOOT CFG (0:7) 7'th switch from OFF to ON. Switches position for eMMC boot:

pastedImage_11.png

Turn ON EVB and stop again boot in u-boot console. Now we need to configure u-boot for booting from NFS. You can check u-boot variables by 

printenv 

command.

Make sure that nfsbootargs has correct EVB ip address, NFS server IP address and path to root file system. In my case - EVB IP is 192.168.1.10, NFS server is 192.168.1.1 and root file system on host PC machine is located in /rfs directory. You can also test network connectivity to PC Host machie by ping command. 

You can change any of system variables by setenv command. For example - IP address can be changed by:

setenv ipaddr -f ipaddr 192.168.1.10

Here is printenv output on my EVB: 

pastedImage_16.png

We are done with configuration - let's boot from NFS by: 

run nfsboot

It takes a while. At the end you can see login prompt:

pastedImage_23.png

Login as root user. Now we need create boot and root file system partition on eMMC by fdisk. 

Boot partition

fdisk /dev/mmcblk0

check if there are already some partitions by 

p

command in fdisk. If there are partitions - delete all of them by 

d

command. If done - let's create new boot partion with 255 MB size:

n

p

1

[ENTER] key for default selection

+255M

pastedImage_39.png

Root FS partition

in fdisk continue with:

n

p

[ENTER] key for default selection

[ENTER] key for default selection

[ENTER] key for default selection

pastedImage_51.png

Change boot partition type from Linux to FAT32. 

t

1

c

pastedImage_60.png

Write all changes by

w

pastedImage_61.png

 

Create filesystem for boot (vfat) and root fs (ext3) partition:

mkfs.vfat -n boot /dev/mmcblk0p1

mkfs.ext3 -L rootfs /dev/mmcblk0p2

Now is time for copy some files in new partitions. I created in root home directory boot and rootfs folders: 

cd

mkdir boot

mkdir rootfs

mount /dev/mmcblk0p1 ./boot

mount /dev/mmcblk0p2 ./rootfs

pastedImage_76.png

Copy Image and s32v234-evb.dtb files from root to already mounted mmcblk0p1 partition:

cp /Image ./boot

cp /s32v234-evb.dtb /boot

pastedImage_97.png

 

And now - the final step - untar root file system to mmcblk0p2:

tar -xf /rootfs.tar -C ./rootfs

pastedImage_98.png

We are done. Disconnect Ethernet cable, reboot and wait for login prompt:

pastedImage_113.png

 

Troubleshooting

 

Can't start u-boot console:

You have only about two seconds from power up to interrupt regular boot by pressing key to jump in u-boot console. So - keep trying. Best time for pressing any key is when numbers 2  1 are shown up. 

Can't perform NFS boot:

  • check network connectivity between EVB and host PC.
  • Try ping host PC from u-boot console. If it doesn't work - check EVB ipaddress by echo $ipaddr or printenv u-boot command.
  • check that nfsbootargs contain corect path/ip address to NFS root file system.
  • Check again if your NFS directory is accessible from other machine and it is really s32v234 BSP Linux rootfs. Root fs must not be inside some subfolder. 
  • check if you can get files from tftp server from other machine. for example tftp 192.168.1.1  ... get Image

Can't perform partitioning of eMMC:

Make sure that /dev/mmcblk0 is unmounted (in case that there was already some partitions). 

Can't mount partitions on /dev/mmcblk0:

Make sure that all files on NFS root file system belongs to root. You can also check boot messages for mount errors related to /proc file system. 

 

 

 

 

 

コメント

Thank you very much and It is very helpful!!!

Hi, @Jiri Kral,

Can not boot from nfs(rootfs file system) on bsp16.0(s32v234evb 29288).

Ping tftp server and nfs server successfully on uboot.

Mount nfs successfully on linux kernel  when boot from sd.

But exectue "run nfsboot" on uboot, kernel panic happened.

Log is:

    [ 3.551938] device=eth0, hwaddr=00:1b:c3:12:34:22, ipaddr=192.168.5.236, mask=255.255.255.0, gw=192.168.5.1
    [ 3.564359] host=192.168.5.236, domain=, nis-domain=(none)
    [ 3.571553] bootserver=192.168.5.174, rootserver=192.168.5.174, rootpath=

    [ 309.280808] VFS: Unable to mount root fs via NFS, trying floppy.
    [ 309.288689] VFS: Cannot open root device "nfs" or unknown-block(2,0): error -6
    [ 309.297870] Please append a correct "root=" boot option; here are the available partitions:

    ......

When mounting rootfs via NFS, the sja1105 module does not be inserted(insmod) by shell, but sja1105 was inited on uboot through spi.

Why can not mount rootfs via NFS?

Hi, 

please check nfsbootargs uboot variable if root=/dev/nfs and if nfsroot points to unpacked root file system. In my case - root filesystem is on /rfs folder on 192.168.1.1 address. nfsroot in my case is:

nfsroot=192.168.1.1:/rfs,nolock

Also make sure that NFS settings on PC machine contain  "no_root_squash" option. 

Jiri 

My nfsbootargs is:

Kernel command line: console=ttyLF0,115200 root=/dev/nfs rw ip=192.168.5.236:192.168.5.174:192.168.5.1:255.255.255.0::eth0:off nfsroot=192.168.5.174:/home/build/work/nfsroot/rootfs,nolock

PC nfs config:/home/build/nfsroot/rootfs *(rw,sync,no_root_squash,no_subtree_check)

I can mout nfs rootfs dir through my pc (ubuntu and windows).

So I think it is not nfs server or uboot xxargs problem, no network connection when mount nfs rootfs.

I do not get sja1105 driver load information refer your nfs boot  log. Does sja1105 switch remain u-boot  configuration data with spi interface? 

What is your option? Thanks!@Jiri Kral

Hi, @Jiri Kral,

   I have some problems after running nfsboot command:

   I can't understand why u-boot runs as the following log.

=> run nfsboot
Booting from net using tftp and nfs...
Loading SJA1105 firmware over SPI 0:0
Using FEC device
TFTP from server 192.168.31.216; our IP address is 192.168.31.177
Filename 'Image'.
Load address: 0x80080000
Loading: *
ARP Retry count exceeded; starting again
Using FEC device

   My Tftp and NFS can be accessed. I'm using BSP 18.0

評価なし
バージョン履歴
最終更新日:
‎03-02-2018 07:41 AM
更新者: