To prepare an SD card for a Linux boot, it is necessary to connect the SD card to a machine with Linux OS. If a Linux OS machine is not available, then a virtual machine installed to a Windows OS machine may be used.
If you have access to a Linux OS machine, skip to step 4.
1) Download and install a virtual machine
2) Download Ubuntu. This tutorial uses the Ubuntu version 14.04.5. The image will be ubuntu-14.04.5-desktop-amd64.iso.
3) Launch VMware or Virtual Box and create a new virtual machine
Use downloaded Ubuntu image when requested for installer disc image file
Hit Next and select Linux as the guest operating system and select Ubuntu for the version.
Hit Next and name your virtual machine and specify where you want to store it.
Increase the disk size to 40 GB
Hit Finish and install VMware Tools for Linux, if asked
4) Within C:\NXP\S32DS_Vision_v2.0\S32DS\s32v234_sdk\os extract 'build_content.tar.gz', then extract 'build_content.tar' and navigate to the 'v234_linux_build' folder
5) Start virtual machine
May need to manually connect USB-mounted SD card reader
Log in to virtual machine
6) In files, go to 'Home' directory and create a folder "VSDK"
7) Within VSDK folder, copy the files image, u-boot.s32, s32v234-evb.dtb, and rootfs.tar from the 'v234_linux_build' folder.
Note: The file s32v234-evb.dtb and u-boot.s32 will have names with XXXXX-suffix for the schematic number printed on the evaluation board (EVB) you are using. Be sure to use the files which correspond to your EVB.
8) Load the card into the reader. If you are using a virtual machine, it is recommended to use a USB adapter instead of a built-in reader in the PC.
9) Within the virtual machine, launch the terminal program
10) Within the terminal program, enter command 'cat /proc/partitions' to view the names of the partitions and identify the names of the partitions on your SD card. Perhaps it is named 'sdb'.
11) Delete all existing partitions.
a) Enter command 'sudo fdisk /dev/sdb'.
b) Enter command 'd' and then the number of the partition to delete. Repeat as necessary until all partitions have been deleted
12) Create new partitions
a) Enter command 'n' for new
b) Enter 'p' (or just hit <enter>, as this is the default) for primary
c) Enter '1' (or just hit <enter>, as this is the default) for partition number 1.
d) Press <enter> to select the default value for the First sector
e) Enter '+255M' to set the size
b) Enter command 'n' again, for partition number 2, however, press <enter> to select the default value for the 'Last sector'
13) Set the partition type
a) Enter command 't' for type
b) Enter '1' for partition number 1
c) Enter 'c' for partition type FAT32
d) Enter command 't' again, for partition number 2, however, enter '83' for partition type LINUX
If you get error 16: Device or resource busy, as shown above, use commands 'umount /dev/sdb1' and 'umount /dev/sdb2' to free the pre-existing partitions.
Then try again and should be ok now
14) Write the new configuration, enter 'w'
15) Try to setup the filesystems. Enter 'sudo mkfs.vfat -n boot /dev/sdb1'. If you get the error '/dev/sdb1 contains a mounted filesystem', you will need to unmount the partition first.
To save time, unmount both /dev/sdb1 and /dev/sdb2. Enter 'umount /dev/sdb1' and then 'umount /dev/sdb2'
Now try 'sudo mkfs.vfat -n boot /dev/sdb1' again
16) It worked, so now enter 'sudo mkfs.ext3 -L rootfs /dev/sdb2'. It will take a minute or two for this to complete. Wait until you get the command prompt again.
17) Now it's time to load the BSP content from the VSDK. But first, change the directory to the one we created earlier for the BSP files. Enter 'cd /home/user/VSDK' or 'cd VSDK'.
Enter the following commands:
sudo dd if=u-boot.s32 of=/dev/sdb bs=512 seek=8 conv=fsync
sudo cp Image /media/user/boot
sudo cp s32v234-evb.dtb /media/user/boot
18) Now we need to extract the root filesystem, change the directory to its location
19) Enter command 'sudo tar -xvf /home/user/VSDK/rootfs.tar'
20) Once the files are extracted, enter command 'sync'
Now the SD card is ready to be used in the S32V234-EVB.