187 | | Other key words |
188 | | * procure, procurement , copy , jtag upload , production |
| 187 | = Provisioning root file system from live Newport board |
| 188 | |
| 189 | It's always best to create your rootfs from scratch when able. If you're prevented from doing so it is possible to provision the root file system from some Newport boards without too much difficulty. Newport SBC's are capable of booting from both eMMC and MMC. The boot device can be selected by the GSC performing a 5x press on the power button. To provision the root filesystem of located on the eMMC boot from MMC, create an image of the eMMC partition 2 on the MMC, then compress so it can be loaded on other boards. |
| 190 | |
| 191 | == Requirements |
| 192 | |
| 193 | * A Newport board with MMC card slot and push button (GSC must be configured to accept push button input—this is default) |
| 194 | * A MMC with capacity enough to accommodate full size of eMMC (8GB) along with BSP for performing recovery. Recommended would be a minimum 16GB or 32GB card. |
| 195 | * A desktop computer with Linux natively installed. This workstation must have a drive capable of accepting an MMC and have packages for DD and Mount. |
| 196 | |
| 197 | |
| 198 | == On your workstation |
| 199 | |
| 200 | Download a Gateworks pre-built image. All of our images include the tools necessary to perform this operation, though Ubuntu will likely be the easiest to work with. |
| 201 | {{{ |
| 202 | wget -N http://dev.gateworks.com/newport/images/focal-newport.img.gz |
| 203 | }}} |
| 204 | |
| 205 | Insert a micro SD card into your workstation and identify the device name it's been assigned. This can be done using a variety of methods, for example the "dmesg" output. In this example the MMC is "/dev/sdb" |
| 206 | |
| 207 | Image the MMC. |
| 208 | {{{ |
| 209 | zcat focal-newport.img.gz | sudo dd of=/dev/sdb bs=4M |
| 210 | }}} |
| 211 | |
| 212 | Remove the SD card from your workstation. |
| 213 | |
| 214 | == On your Newport SBC |
| 215 | |
| 216 | Insert the SD card into the SD card reader, then apply power to the SBC (or otherwise turn it on). 5x press the power button, you will see the status LED turn off and back on. The BDK will display microSD as MMC0. |
| 217 | |
| 218 | Example output: |
| 219 | |
| 220 | {{{ |
| 221 | Gateworks Newport SPL (12.7.0-96865d0 Tue Jul 7 21:19:32 UTC 2020) |
| 222 | |
| 223 | GSC : v55 0xe7e2 RST:BOOT_WDT2 Thermal Protection Enabled |
| 224 | Temp : Board:34C/86C CPU:42C/100C |
| 225 | Model : GW6400-B1 |
| 226 | MFGDate : 09-23-2019 |
| 227 | Serial : 802864 |
| 228 | RTC : 8 |
| 229 | SoC : CN8020-800BG676-SCP-P12-G 1024KB 800/550MHz 0xa2 Pass 1.2 |
| 230 | MMC0 : microSD |
| 231 | MMC1 : eMMC |
| 232 | }}} |
| 233 | |
| 234 | Proceed to boot to Linux user-space. Once there if you would like to check the rootfs you're about to image the rootfs of the eMMC is located at /dev/mmcblk1p2. |
| 235 | |
| 236 | ** Optional: ** |
| 237 | {{{ |
| 238 | mount /dev/mmcblk1p2 /mnt |
| 239 | |
| 240 | ls /mnt #this will display the eMMC's rootfs |
| 241 | |
| 242 | umount /mnt |
| 243 | }}} |
| 244 | |
| 245 | Image the partition to a file. |
| 246 | {{{ |
| 247 | dd if=/dev/mmcblk1p2 of=myrootfs.img |
| 248 | }}} |
| 249 | |
| 250 | "sync" the filesystem and power board off |
| 251 | {{{ |
| 252 | sync |
| 253 | #remove power |
| 254 | }}} |
| 255 | |
| 256 | Remove MMC from the SBC. |
| 257 | |
| 258 | == Create an image |
| 259 | |
| 260 | Navigate to the "/tmp" directory on your workstation. In actuality this can be any directory that you have read and write permissions, "/tmp" should only be used if you don't care what happens to these files later. |
| 261 | {{{ |
| 262 | cd /tmp |
| 263 | }}} |
| 264 | |
| 265 | Insert the MMC into the SD card reader on your workstation, as before note the the name the device is assigned. Because we created our image in within the rootfs we will need to mount the second partition, for example "/dev/sdb2": |
| 266 | {{{ |
| 267 | sudo mount /dev/sdb2 /mnt/ |
| 268 | |
| 269 | ls /mnt/ |
| 270 | }}} |
| 271 | Copy the image you created of mmcblk1p2 into "/tmp" |
| 272 | {{{ |
| 273 | cp /mnt/myrootfs.img . |
| 274 | }}} |
| 275 | Executing the command "file" on this file will return that it is ext4 filesystem data and the volume name is "rootfs". |
| 276 | |
| 277 | Example: |
| 278 | {{{ |
| 279 | user@workstation:/tmp$ file myrootfs.img |
| 280 | myrootfs.img: Linux rev 1.0 ext4 filesystem data, UUID=951f19a1-cc54-4a07-9b7f-41a54ea8acb4, volume name "rootfs" (needs journal recovery) (extents) (64bit) (large files) (huge files) |
| 281 | }}} |
| 282 | |
| 283 | Add boot firmware and create a gzipped image. |
| 284 | * Download boot firmware |
| 285 | {{{ |
| 286 | wget http://dev.gateworks.com/newport/boot_firmware/firmware-newport.img |
| 287 | }}} |
| 288 | * name it however you please |
| 289 | {{{ |
| 290 | cp firmware-newport.img myimg-newport.img |
| 291 | }}} |
| 292 | * Create a disk image containing the root filesystem and boot firmware. The boot firmware is 16M so we will "dd" the rootfs using this offset. |
| 293 | {{{ |
| 294 | dd if=myrootfs.img of=myimg-newport.img bs=16M seek=1 |
| 295 | }}} |
| 296 | * gzip the image so it can be installed using standard methods on other Newport boards. |
| 297 | {{{ |
| 298 | gzip -k -f myimg-newport.img |
| 299 | }}} |
| 300 | Be mindful that the image size can't exceed the total DRAM of the board you plan to install it on if you're using the bootloader command "tftpboot". The "update_all", and "update_rootfs" scripts both use this command |
| 301 | {{{ |
| 302 | ls -lh myimg-newport.img.gz #size must be less than total DRAM of board |
| 303 | }}} |
| 304 | |
| 305 | == Flash this image to a Newport SBC: |
| 306 | |
| 307 | In the bootloader: |
| 308 | {{{ |
| 309 | GW6400-B1> setenv ipaddr 192.168.1.52 |
| 310 | GW6400-B1> setenv serverip 192.168.1.56 |
| 311 | GW6400-B1> setenv image myimg-newport.img.gz |
| 312 | GW6400-B1> setenv dev 0 |
| 313 | GW6400-B1> run update_all |
| 314 | }}} |
| 315 | |
| 316 | |
| 317 | |