Creating an OS Image
You can use two methods to load an OS image corresponding to the application modes of the Atlas 200 AI accelerator module. See Table 6-2
Application Mode |
OS Loading Method |
---|---|
Main processor |
Loading the OS from the eMMC flash/SD card |
Coprocessor |
Loading the OS from the eMMC flash/SD card |
- If the Atlas 200 AI accelerator module is used as the main processor or coprocessor, you can create an OS in either of the following ways:
- USB card reader: supports only SD cards.
- File burning: supports eMMC flash or SD cards.
USB Card Reader
Prerequisites
- One SD card of 8 GB or larger
- One USB card reader
- One Linux server or virtual machine (VM) with USB ports (Ubuntu 16.04 is recommended)
The Linux server has qemu-user-static, binfmtsupport, YAML, unzip, unrar, and cross compiler installed.
- All dependencies must be installed as the root user.
- For Ubuntu 16.04, you can run the following command to install the preceding dependencies:
apt-get install -y qemu-user-static python3-yaml binfmt-support gcc-aarch64-linux-gnu g++-aarch64-linux-gnu expect unzip unrar
The versions of gcc-aarch64-linux-gnu and g++-aarch64-linux-gnu must be 5.4.0. There is no version requirement for other dependencies. The default gcc version installed on Ubuntu 16.04.3 is 5.4.0.
Procedure
- Install the SD card in the USB card reader.
- Insert the USB card reader in the Linux server.
- Log in to the Linux server.
- Run the following command to switch to the root user:
su - root
- Use WinSCP to upload the sd_tools.rar image tool package to a directory (for example, /home/ascend/mksd) in the Linux system. For details, see Using WinSCP to Transfer Files.
- Run the following command to go to the directory where the sd_tools.rar tool package is located, for example, /home/ascend/mksd:
cd /home/ascend/mksd
- Run the following command to decompress sd_tools.rar: -
unrar x sd_tools.rar
- Go to the sd_tools directory.
cd sd_tools
- Use WinSCP to upload the A200-3000-Soc-FW-Vxxx.zip and ubuntu-xxx-server-arm64.iso packages to the sd_tools directory, for example /home/ascend/mksd/sd_tools, on the Linux server.
- xxx indicates the version number.
- The Ubuntu Linux version must be 16.04.3. Download the ubuntu-xxx-server-arm64.iso package of the required version from http://old-releases.ubuntu.com/releases/16.04.3/.
- The versions of the software packages in the directory must be the same.
- Run the following command to rename the A200-3000-Soc-FW-Vxxx.zip software package mini_developerkit.rar:
mv A200-3000-Soc-FW-Vxxx.zip mini_developerkit.rar
- (Optional) Change the default IP addresses for the network cable connection mode and USB connection mode (NETWORK_CARD_DEFAULT_IP and USB_CARD_DEFAULT_IP) in the make_sd_card.py script.
The default IP address is 192.168.1.2 for USB connection and 192.168.0.2 for network cable connection.
- Run the following command to query the name of the USB device of the SD card, for example, /dev/sdb:
fdisk -l
- Run the following command to execute the make_sd_card.py script to create the SD card:
python3 make_sd_card.py local /dev/sdb
If the following information is displayed, the SD card is being created:
root@ubuntu:/home/ascend/mksd# python3 make_sd_card.py local /dev/sdb Begin to make SD Card... Please make sure you have installed dependency packages: apt-get install -y qemu-user-static binfmt-support gcc-aarch64-linux-gnu g++-aarch64-linux-gnu Please input Y: continue, other to install them:
- Enter Y.
The SD card is created successfully if the following information is displayed:
Step: Start to make SD Card. It takes some time and please wait... Make SD Card successfully!
- (Optional) Create cards in batches.
Ensure that the model and specifications of the copied card are the same as those of the parent card.
- Method 1: Remove an SD card from the card reader and use a card duplicator for SD card copying.
- Method 2: Run the dd command to export the image from an SD card where the OS is created, and then burn the image to SD cards in batches.
- Run the following command to export the image. For details, see the usage of the Linux dd command.
Command: dd if=Parent drive letter of=Exported image name
Example: dd if=/dev/sda of=/root/tmp/sd.image
- Run the following command to burn the image to child cards:
Command dd if=Image name of=Child card drive letter
Example: dd if=/root/tmp/sd.image of=/dev/sdb
- Run the following command to export the image. For details, see the usage of the Linux dd command.
- Install the SD card in the SD card slot and power on the Atlas 200 AI accelerator module.
- Log in to the OS of the Atlas 200 AI accelerator module. For details, see Logging In Over a Network Port by Using PuTTY.
File Burning
Prerequisites
- One Linux (Ubuntu 16.04 is recommended) server or virtual machine (VM) with network ports is available.
The Linux server has unrar, qemu-user-static, binfmt-support, YAML, expect, unzip, and cross compiler installed.
- All dependencies must be installed as the root user.
- For Ubuntu 16.04, you can run the following command to install the preceding dependencies:
apt-get install -y qemu-user-static python3-yaml binfmt-support gcc-aarch64-linux-gnu g++-aarch64-linux-gnu expect unzip
The versions of gcc-aarch64-linux-gnu and g++-aarch64-linux-gnu must be 5.4.0. There is no version requirement for other dependencies. The default gcc version installed on Ubuntu 16.04.3 is 5.4.0.
- UART1 TX and UART1 RX of the Atlas 200 AI accelerator module have been directly connected and the Linux server has been connected to the Atlas 200 AI accelerator module using a network cable. The Atlas 200 AI accelerator module has been powered on and started.
- eMMC card making is supported only when the file system version in the flash memory of the Atlas 200 AI accelerator module is 1.3.x.x.B893 or later, or 1.32.x.x.Do as follows to check the version of the file system:
- If you can access the OS by using a USB card reader, perform the following operations:
- Run the following command to switch to the driver directory:
cd /var/davinci/driver/
- Run the following command to obtain the version information about the file system in the flash memory:
./upgrade-tool --device_index -1 --component rootfs --version
- Run the following command to switch to the driver directory:
- If the file system version information in the flash memory cannot be obtained, try to make a card by burning a file. If the card fails to be made, contact Huawei technical support.
- If you can access the OS by using a USB card reader, perform the following operations:
Procedure
- Install the SD card in the USB card reader.
- Insert the USB card reader in the Linux server.
- Log in to the Linux server.
- Run the following command to switch to the root user:
su - root
- Use WinSCP to upload the sd_tools.rar image tool package to a directory (for example, /home/ascend/mksd) in the Linux system. For details, see Using WinSCP to Transfer Files.
- Run the following command to go to the directory to which the sd_tools.rar image tool package is uploaded, for example, /home/ascend/mksd:
cd /home/ascend/mksd
- Run the following command to decompress the sd_tools.rar package:
unrar x sd_tools.rar
- Go to the sd_tools directory.
cd sd_tools
- Use WinSCP to upload the A200-3000-Soc-FW-Vxxx.zip and ubuntu-xxx-server-arm64.iso packages to the sd_tools directory, for example /home/ascend/mksd/sd_tools, on the Linux server. For details, see Using WinSCP to Transfer Files.
- xxx indicates the version number.
- The Ubuntu Linux version must be 16.04.3. Download the ubuntu-xxx-server-arm64.iso package of the required version from http://old-releases.ubuntu.com/releases/16.04.3/.
- The versions of the software packages in the directory must be the same.
- Run the following command to rename the A200-3000-Soc-FW-Vxxx.zip software package mini_developerkit.rar:
mv A200-3000-Soc-FW-Vxxx.zip mini_developerkit.rar
- (Optional) Change the default IP addresses for the network cable connection mode and USB connection mode (NETWORK_CARD_DEFAULT_IP and USB_CARD_DEFAULT_IP) in the make_sd_card.py script.
The default IP address is 192.168.1.2 for USB connection and 192.168.0.2 for network cable connection.
- Run the following command to check whether the Atlas 200 AI accelerator module is reachable:
ping 192.168.0.2
The Atlas 200 AI accelerator module is reachable if the following information is displayed:
root@hi19110:/home/ascend/mksd/sd_tools# ping 192.168.0.2 PING 192.168.0.2 (192.168.0.2) 56 (84) bytes of data. 64 bytes from 192.168.0.2: icmp_seq=1 ttl=64 time=0.101 ms 64 bytes from 192.168.0.2: icmp_seq=2 ttl=64 time=0.097 ms 64 bytes from 192.168.0.2: icmp_seq=3 ttl=64 time=0.096 ms 64 bytes from 192.168.0.2: icmp_seq=4 ttl=64 time=0.101 ms
- Run the make_sd_card.py script to make the SD/EMMC card.
python3 make_sd_card.py recover
If the following information is displayed, the SD card is being created:
root@hi1910:/home/ascend/mksd/sd_tools# python3 make_sd_card.py recover Begin to make Card in recover model... Please make sure you have installed dependency packages: apt-get install -y qemu-user-static binfmt-support gcc-aarch64-linux-gnu g++-aarch64-linux-gnu expect Please input Y: continue, other to install them:
- Enter Y.
The SD card is created successfully if the following information is displayed:
Step: Start to make card in recover model. It needs some time, please wait... Make SD Card successfully!
- (Optional) Create cards in batches.
Ensure that the model and specifications of the copied card are the same as those of the parent card.
- Method of making SD cards in batches:
- Method 1: Remove an SD card from the card reader and use a card duplicator for SD card copying.
- Method 2: Run the dd command to export the image from an SD card where the OS is created, and then burn the image to SD cards in batches.
- Run the following command to export the image. For details, see the usage of the Linux dd command.
Command: dd if=Parent drive letter of=Exported image name
Example: dd if=/dev/sda of=/root/tmp/sd.image
- Run the following command to burn the image to child cards:
Command dd if=Image name of=Child card drive letter
Example: dd if=/root/tmp/sd.image of=/dev/sdb
- Run the following command to export the image. For details, see the usage of the Linux dd command.
- Method of making eMMC cards in batches:
Copy the eMMC flash by using a burner. For details, see the method provided by the burner vendor.
- Method of making SD cards in batches:
- Disconnect the UART1 TX and UART1 RX of the Atlas 200 AI accelerator module (model 3000), and power cycle the device.
- Log in to the OS. For details, see Logging In Over a Network Port by Using PuTTY.