-
Notifications
You must be signed in to change notification settings - Fork 0
Servo Drive Demo Build Update the SD Card
In the previous sections methods are described to build the FPGA image, the Linux kernel, the Preloader, uboot and software images. These files must be copied to the SD card in order for the system to boot. The following steps describe how to implement this. The instructions below assume that SD card is partitioned properly.
- Insert the SD card adapter
- Prerequisits
- SD card structure
- Building the SD card image
- Updating the full SD card
- Eject the SD card adapter
Determine the device associated with the SD card on the host. Run the command below before and after inserting the SD card. The new drive letter will show up as /dev/sdx/ where x represents the actual letter (a,b,c,d etc). Substitute the letter x with the actual letter in the dd commands listed below.
-
Insert the Micro SD Card into the USB to Micro SD card Adapter.
-
Plug the USB (or Micro SD card) Adapter into the host PC.
-
The VM will detect the Adapter and ask the user to choose where it should be connected
Choose "Connect to a virtual machine" and select OK
Two file manager windows will open in the VM. The first called 268 MB Volume represents the FAT partition. The second called 799 MB Volume represents the root file system partition. Close this partition (by clicking on the 'X' in the top left part of the window) since it will not be utilized
The following files are required to be in the same directory:
- dev_5cs.rbf (in ~/ArrowCMR/hw/fpga/cmr_motor_demo)
- preloader-mkpimage.bin (Preloader in ~/ArrowCMR/hw/fpga/cmr_motor_demo/software/preloader/generated)
- ubootenv.bin (U-Boot environment in ~/ArrowCMR/hw/fpga/cmr_motor_demo/software/preloader/generated)
- u-boot.img (U-Boot in ~/ArrowCMR/hw/fpga/cmr_motor_demo/software/preloader/uboot-socfpga)
- cmr.bin (demo application in ~/ArrowCMR/sw/ARM/bare-metal)
- make_sd.sh (SD card image generation script. Execute commands below:)
$ cd ~/ArrowCMR
$ git archive --format=tar --remote=git://support.criticallink.com/home/git/meta-cl-socfpga.git rocko recipes-bsp/sd-card-scripts/files/make_sd.sh | tar -xO > make_sd.sh
$ sudo chmod +x make_sd.sh
The following packages must be installed before the script can be run. Note: You must reboot (reboot what?) after adding the user to the kvm group.
$ sudo apt-get install --no-install-recommends -y libguestfs-tools qemu-utils linux-image-generic
$ sudo chmod o+r,g+r /boot/vmlinuz-*
$ sudo chmod 0666 /dev/kvm
$ sudo usermod -a -G kvm $USER
$ sudo reboot
The SD cards from Critical Link are setup with the following structure. Note: There should be three partitions on the SD card after the image is written. The image contains the MBR which stores the partition information.
Offset | Size | Partition | Filesystem |
---|---|---|---|
0x00400000 | 0x10000000 | 1 | fat |
0x10400000 | 0x00100000 | 2 | |
0x10500000 | 0x2FB00000 | 3 | ext3 |
The SD card image will be sd_card.img. Note: make_sd.sh must be run on the virtual machine. Note: Make sure you have permissions to access \boot\vmlinuz-*. If it has updated, you will need read privileges for the most recent file. Note: This command will fail if a virtual machine is running and using KVM. Note: This files may be named differently or located in different directories.
Execute:
$ cd ~/ArrowCMR
$ ./make_sd.sh -d CycloneV -p ./hw/fpga/cmr_motor_demo/software/preloader/preloader-mkpimage.bin -s 32 -F 16 -u ./hw/fpga/cmr_motor_demo/software/preloader/uboot-socfpga/u-boot.img -e ./hw/fpga/cmr_motor_demo/software/preloader/ubootenv.bin -f ./hw/fpga/cmr_motor_demo/dev_5cs.rbf -f ./sw/ARM/bare-metal/cmr.bin
The make_sd.sh command:
Usage:
$ make_sd.sh [-s|--size <size>] [-o|--outfile <outfile>]
[-p|--preloader <preloader bin>]
[-e|--environment <env binary>] [-u|--uboot <u-Boot bin>]
[-f|--fatfile <file>] [-r|--rfsoverlay <dir>] [-t|--fatoverlay <dir>]
[-v] [-g] [-d|--device <CycloneV|Arria10>] [-F|--fatsize <size>]
[-h|--help] [<root.tar.gz>]
-d device type [CycloneV Arria10]
-s --size size of image [default 1024 MB]
-o --outfile name of the output file [default is sd_card.img]
-p --preloader preloader to be used, Only Cyclone V
-e --environment u-Boot environment to be used
-u --uboot u-Boot image to be used
-f --fatfile Files to add to the FAT partition (rbf images)
-r --rfsoverlay File structure overlay to be put on top of root fs
-t --fatoverlay FAT structure overlay to be put on top of FAT partition
-v --verbose sets verbose flag in shell
-z --zip will result in the output file + md5 being compressed with zip (good for etcher)
-g --gzip will result in the output file being compressed with gzip
-F --fatsize size of the FAT partition in MB
-h --help display this message
<root.tar.gz> is the yocto filesystem tarball to use
As the CMR demo app is a bare-metal application, the filesystem tarball is not used.
Copy the sd_card.img file to the windows Host and follow the steps in Update the SD Card starting at step #3.
Note : Never remove the SD card media from the Linux host before it has been ejected.
To Eject the media :
- Click on the eject button in the file manager partition named BOOT
Return to Build the Example Design
Return to Reconfigurable Industrial Robotics Platform User Guide