HOWTO: Prepare and boot S32V234 EVB from eMMC

Document created by Jiri Kral Employee on Mar 2, 2018Last modified by Jiri Kral Employee on Mar 5, 2018
Version 5Show Document
  • View in full screen mode

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.

 

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). 

 

 

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).

 

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

 

 

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

 

 

 

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:

 

 

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: 

 

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:

 

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

 

Root FS partition

in fdisk continue with:

n

p

[ENTER] key for default selection

[ENTER] key for default selection

[ENTER] key for default selection

 

 

Change boot partition type from Linux to FAT32. 

t

1

c

 

Write all changes by

w

 

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

 

 

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

cp /Image ./boot

cp /s32v234-evb.dtb /boot

 

 

 

 

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

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

 

 

 

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

 

 

 

 

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. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1 person found this helpful

Attachments

    Outcomes