[gnome-build-meta/valentindavid/rock64: 7/9] Add rock64 board



commit 1b88295e9f407998c9b34548ed3553dcd10c9b43
Author: Valentin David <valentin david codethink co uk>
Date:   Tue May 5 15:50:01 2020 +0200

    Add rock64 board

 elements/boards/rock64/arm-trusted-firmware.bst |  26 +++++
 elements/boards/rock64/image-deps.bst           |   8 ++
 elements/boards/rock64/image.bst                | 122 ++++++++++++++++++++++++
 elements/boards/rock64/u-boot.bst               |  34 +++++++
 4 files changed, 190 insertions(+)
---
diff --git a/elements/boards/rock64/arm-trusted-firmware.bst b/elements/boards/rock64/arm-trusted-firmware.bst
new file mode 100644
index 00000000..b3465522
--- /dev/null
+++ b/elements/boards/rock64/arm-trusted-firmware.bst
@@ -0,0 +1,26 @@
+kind: manual
+
+sources:
+- kind: tar
+  url: https://github.com/ARM-software/arm-trusted-firmware/archive/v2.3.tar.gz
+
+build-depends:
+- freedesktop-sdk.bst:bootstrap-import.bst
+# This is required because at part of the firmware has to be built for
+# armv7. freedesktop-sdk.bst:cross-compilers/gcc-arm.bst does not
+# seem to be able to compile like needed.
+- boards/common/arm-none-eabi-gcc.bst
+
+variables:
+  board: rock64-rk3328
+
+environment:
+  CFLAGS: '-fno-stack-protector'
+  LDFLAGS: ''
+
+config:
+  build-commands:
+  - make PLAT=rk3328
+
+  install-commands:
+  - install -Dm644 -t "%{install-root}%{indep-libdir}/u-boot/%{board}" build/rk3328/release/bl31/bl31.elf
diff --git a/elements/boards/rock64/image-deps.bst b/elements/boards/rock64/image-deps.bst
new file mode 100644
index 00000000..75a135a0
--- /dev/null
+++ b/elements/boards/rock64/image-deps.bst
@@ -0,0 +1,8 @@
+kind: stack
+
+runtime-depends:
+- freedesktop-sdk.bst:integration/mtab.bst
+- freedesktop-sdk.bst:components/genimage.bst
+- vm/qemu-tools.bst
+- core-deps/libostree.bst
+- boards/rock64/u-boot.bst
diff --git a/elements/boards/rock64/image.bst b/elements/boards/rock64/image.bst
new file mode 100644
index 00000000..bc2797c2
--- /dev/null
+++ b/elements/boards/rock64/image.bst
@@ -0,0 +1,122 @@
+kind: script
+
+build-depends:
+- boards/rock64/image-deps.bst
+- vm/repo.bst
+- freedesktop-sdk.bst:components/linux.bst
+
+variables:
+  linux-root: B921B045-1DF0-41C3-AF44-4C6F280D3FAE
+  ostree-branch: gnome-os/aarch64/master
+  board: rock64-rk3328
+
+  sysroot: "/sysroot"
+
+environment:
+  OSTREE_REPO: "%{sysroot}/ostree/repo"
+
+config:
+  layout:
+  - element: ''
+    destination: '/sysroot'
+  - element: ''
+    destination: '/genimage'
+  - element: vm/repo.bst
+    destination: '/source-repo'
+  - element: boards/rock64/image-deps.bst
+    destination: '/'
+  - element: components/linux.bst
+    destination: '/kernel'
+
+  commands:
+  - mkdir -p "${OSTREE_REPO}"
+  - ostree init --repo="${OSTREE_REPO}" --mode=bare
+
+  - ostree config --group sysroot set bootloader auto
+  - ostree pull-local "/source-repo" %{ostree-branch}
+
+  - mkdir -p "%{sysroot}/boot"
+
+  - ostree admin init-fs "%{sysroot}"
+  - ostree admin os-init --sysroot="%{sysroot}" gnome-os
+
+  # U-Boot does not provide EFI variables at runtime. So /dev/gpt-auto-root
+  # is not available.
+  - |
+    ostree admin deploy --os="gnome-os" \
+         --sysroot="%{sysroot}" %{ostree-branch} \
+         --karg="rw" --karg="quiet" --karg="splash" \
+         --karg="root=LABEL=root" \
+         --karg-append="console=ttyS2,1500000n8" \
+         --karg="earlycon=uart8250,mmio32,0xff130000" \
+         --karg-append="console=tty0" \
+         --karg="plymouth.ignore-serial-consoles"
+
+  - |
+    mkdir -p "%{sysroot}/etc/ostree"
+    cp -r "%{sysroot}"/ostree/boot.1/gnome-os/*/*/etc/ostree/remotes.d "%{sysroot}/etc/ostree/remotes.d"
+
+  - |
+    ostree admin set-origin --sysroot="%{sysroot}" \
+           --index=0 \
+           GnomeOS dummy \
+           %{ostree-branch}
+
+  - |
+    cp -r "%{sysroot}"/ostree/boot.1/gnome-os/*/*/boot/EFI/ "%{sysroot}/boot/"
+
+  - |
+    cp -r "/kernel/boot/dtbs" "%{sysroot}/boot/dtb"
+
+  - |
+    size=$(($(du -s -B 4K "%{sysroot}" | cut -f1)*4+200*1024))
+    cat >/genimage/genimage.cfg <<EOF
+    image efi.img {
+        vfat {
+            extraargs = "-F32 -n EFI"
+        }
+        mountpoint = "/boot"
+        size = 500M
+    }
+    image root.img {
+        ext4  {
+            label = "root"
+            use-mke2fs = true
+        }
+        size = ${size}K
+    }
+    image disk.img {
+        hdimage {
+            gpt = true
+            align = 1M
+        }
+        partition idbloader {
+            image = "idbloader.img"
+            offset = 32K
+            in-partition-table = false
+        }
+        partition uboot {
+            image = "u-boot.itb"
+            offset = 8M
+            in-partition-table = false
+        }
+        partition efi {
+            image = "efi.img"
+            partition-type-uuid = "U"
+        }
+        partition root {
+            image = "root.img"
+            partition-type-uuid = "%{linux-root}"
+        }
+    }
+    EOF
+
+  - |
+    cd /genimage
+    genimage --rootpath "%{sysroot}" --inputpath "%{indep-libdir}/u-boot/%{board}"
+
+  - |
+    sfdisk --part-attrs /genimage/images/disk.img 2 55
+
+  - |
+    qemu-img convert -O qcow2 -f raw /genimage/images/disk.img "%{install-root}/disk.qcow2"
diff --git a/elements/boards/rock64/u-boot.bst b/elements/boards/rock64/u-boot.bst
new file mode 100644
index 00000000..eb9e1e88
--- /dev/null
+++ b/elements/boards/rock64/u-boot.bst
@@ -0,0 +1,34 @@
+kind: manual
+
+sources:
+- kind: tar
+  url: ftp://ftp.denx.de/pub/u-boot/u-boot-2020.04.tar.bz2
+
+build-depends:
+- freedesktop-sdk.bst:components/bison.bst
+- freedesktop-sdk.bst:components/flex.bst
+- freedesktop-sdk.bst:components/gzip.bst
+- freedesktop-sdk.bst:components/bc.bst
+
+- boards/common/swig.bst
+- boards/common/python3-as-python2.bst
+- boards/common/dtc.bst
+
+- boards/rock64/arm-trusted-firmware.bst
+
+environment:
+  BL31: "%{indep-libdir}/u-boot/%{board}/bl31.elf"
+
+variables:
+  board: rock64-rk3328
+
+config:
+  configure-commands:
+  - make "%{board}_defconfig"
+
+  build-commands:
+  - make V=1 all
+
+  install-commands:
+  - install -Dm644 -t "%{install-root}%{indep-libdir}/u-boot/%{board}" idbloader.img
+  - install -Dm644 -t "%{install-root}%{indep-libdir}/u-boot/%{board}" u-boot.itb


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]