290 | | The following details pertain to buildroot 2017.11 although newer versions will likely be similar if not the same. |
291 | | |
292 | | To configure buildroot for the Cavium CN80XX/CN81XX SoC found on the Newport product family: |
293 | | - interactive menu options: |
294 | | * Target options -> Target Architecture -> AArch64 (little endian) (BR2_aarch64) |
295 | | * Filesystem images -> tar the root filesystem -> Compression method (xz) (BR2_TARGET_ROOTFS_CPIO_XZ) |
296 | | * Filesystem images -> cpio the root filesystem (BR2_TARGET_ROOTFS_CPIO) |
297 | | * Filesystem images -> Compression method (xz) (BR2_TARGET_ROOTFS_TAR_XZ) |
298 | | - defconfig: |
299 | | {{{#!bash |
300 | | cat << EOF > configs/my_defconfig |
| 290 | The following details pertain to buildroot 2020.08 although newer versions will likely be similar if not the same. |
| 291 | |
| 292 | The Newport product family is based on the CN80xx SoC which has 4x Cortex-A53 like compatible CPU cores. Therefore the 'BR2_aarch64' is really the only important configuration which produces binaries executable on arm64 CPU's. |
| 293 | |
| 294 | To build a root filesystem only: |
| 295 | {{{#!bash |
| 296 | cat << EOF > configs/arm64_minimal_defconfig |
| 297 | # arm64 arch |
306 | | make my_defconfig |
307 | | }}} |
308 | | |
309 | | This builds a ~500KiB output/images/root.tar.xz in less than 5 minutes on a typical Linux desktop. |
310 | | |
311 | | If you also want buildroot to build a kernel provided from buildroot using the buildroot rootfs embedded as an initramfs then enable the following to create a kernel suitable for aarch64 and booting via U-Boot {{{booti}}}: |
312 | | * Kernel -> Linux Kernel (BR2_LINUX_KERNEL) |
313 | | * Kernel -> Kernel configuration (Using a custom (def)config file) -> newport_defconfig |
314 | | * Filesystem images -> initial RAM filesystem linked into linux kernel |
315 | | |
316 | | Adding the kernel build produces a ~21MB Image in less than 10 minutes on a typical Linux desktop. |
317 | | |
318 | | To boot this on a Newport bootloader: |
319 | | {{{#!bash |
320 | | tftpboot ${kernel_addr_r} newport/buildroot/Image && booti ${kernel_addr_r} - ${fdtcontroladdr} |
321 | | }}} |
322 | | |
323 | | Now you have a minimal Linux OS that booted in about 6 seconds. |
324 | | |
325 | | A prebuilt image can be found [http://dev.gateworks.com/buildroot/newport/minimal here] which contains: |
326 | | * Linux 4.14 kernel with ThunderX periperhals enabled |
| 302 | make arm64_minimal_defconfig |
| 303 | make -j8 |
| 304 | }}} |
| 305 | |
| 306 | This builds output/images/root.tar.xz consisting of a ~1.7MiB root filesystem (when uncompressed) in 5 to 10 minutes of building on a typical Linux desktop. |
| 307 | |
| 308 | If you also want buildroot to build a Gateworks v5.4.45 kernel with a minimal kernel config attached as an initrd you can use this: |
| 309 | {{{#!bash |
| 310 | cat << EOF > configs/newport_kernel_defconfig |
| 311 | # arm64 arch |
| 312 | BR2_aarch64=y |
| 313 | # toolchain |
| 314 | BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_4=y |
| 315 | # kernel |
| 316 | BR2_LINUX_KERNEL=y |
| 317 | BR2_LINUX_KERNEL_CUSTOM_GIT=y |
| 318 | BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/Gateworks/linux-newport.git" |
| 319 | BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="v5.4.45-newport" |
| 320 | BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y |
| 321 | BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="newport_minimal_kernel_defconfig" |
| 322 | # filesystem options |
| 323 | BR2_TARGET_ROOTFS_TAR_XZ=y |
| 324 | BR2_TARGET_ROOTFS_INITRAMFS=y |
| 325 | EOF |
| 326 | # fetch minimal kernel config |
| 327 | wget http://dev.gateworks.com/buidlroot/newport/minimal/newport_minimal_kernel_defconfig |
| 328 | make newport_kernel_defconfig |
| 329 | make -j8 |
| 330 | }}} |
| 331 | |
| 332 | This produces a ~9MiB output/images/Image in 10 to 15 minutes of building on a typical Linux desktop. This is a kernel Image containing the root filesystem in a ramdisk. This is a really easy way to get a read-only minimal Linux image that boots fast and does not access flash storage. |
| 333 | |
| 334 | You can boot a Kernel+ramdisk via U-Boot like this: |
| 335 | * load from network tftpserver |
| 336 | {{{#!bash |
| 337 | tftpboot $kernel_addr_r Image && booti $kernel_addr_r - $fdtcontroladdr |
| 338 | }}} |
| 339 | * load from microSD with ext/fat filesystem |
| 340 | {{{#!bash |
| 341 | load mmc 1:1 $kernel_addr_r Image && booti $kernel_addr_r - $fdtcontroladdr |
| 342 | }}} |
| 343 | * load from USB with ext/fat filesystem |
| 344 | {{{#!bash |
| 345 | usb start; load usb 0:1 $kernel_addr_r Image && booti $kernel_addr_r - $fdtcontroladdr |
| 346 | }}} |
| 347 | |
| 348 | A prebuilt image can be found here which contains: |
| 349 | * Gateworks Linux 5.4.45 kernel |
331 | | * eudev (BR2_PACKAGE_HAS_UDEV) |
332 | | * usbutils (BR2_PACKAGE_USBUTILS) |
333 | | * disk partitioning tools |
| 355 | * eudev (BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV) (required for usbutils) |
| 356 | * usbutils (BR2_PACKAGE_USBUTILS) |
| 357 | * gdisk/sgdisk disk partitioning tools: |
| 358 | * gdisk/sgdisk (BR2_PACKAGE_GPTFDISK/BR2_PACKAGE_GPTFDISK_SGDISK) |
| 359 | * stress (BR2_PACKAGE_STRESS) |
| 360 | * evtest (BR2_PACKAGE_EVTEST) |