[gnome-build-meta/tpollard/raspi4: 11/12] Add boards/raspberrpi-4 target



commit d449dc250e0be38efb9129c4af505219017ece4d
Author: Tom Pollard <tom pollard codethink co uk>
Date:   Mon May 4 18:09:40 2020 +0100

    Add boards/raspberrpi-4 target

 elements/boards/raspberrypi-4/bsp.bst              | 10 +++
 elements/boards/raspberrypi-4/bsp/boot.bst         | 89 ++++++++++++++++++++++
 elements/boards/raspberrypi-4/bsp/firmware.bst     | 34 +++++++++
 .../boards/raspberrypi-4/bsp/kernel-modules.bst    | 15 ++++
 elements/boards/raspberrypi-4/bsp/linux.bst        | 54 +++++++++++++
 .../boards/raspberrypi-4/bsp/userland-firmware.bst | 17 +++++
 elements/boards/raspberrypi-4/deps.bst             | 20 +++++
 elements/boards/raspberrypi-4/filesystem.bst       | 14 ++++
 elements/boards/raspberrypi-4/image.bst            | 80 +++++++++++++++++++
 elements/boards/raspberrypi-4/initial-scripts.bst  |  7 ++
 10 files changed, 340 insertions(+)
---
diff --git a/elements/boards/raspberrypi-4/bsp.bst b/elements/boards/raspberrypi-4/bsp.bst
new file mode 100644
index 00000000..9590b275
--- /dev/null
+++ b/elements/boards/raspberrypi-4/bsp.bst
@@ -0,0 +1,10 @@
+kind: stack
+description:  |
+  Linux kernel and platform specific components required to boot an Raspberry Pi 3B+
+
+depends:
+  - filename: boards/raspberrypi-4/bsp/linux.bst
+  - filename: boards/raspberrypi-4/bsp/firmware.bst
+  - filename: boards/raspberrypi-4/bsp/userland-firmware.bst
+  - filename: boards/raspberrypi-4/bsp/boot.bst
+  - filename: boards/raspberrypi-4/bsp/kernel-modules.bst
diff --git a/elements/boards/raspberrypi-4/bsp/boot.bst b/elements/boards/raspberrypi-4/bsp/boot.bst
new file mode 100644
index 00000000..39de9f13
--- /dev/null
+++ b/elements/boards/raspberrypi-4/bsp/boot.bst
@@ -0,0 +1,89 @@
+kind: manual
+
+
+build-depends:
+- boards/raspberrypi-4/bsp/linux.bst
+- boards/raspberrypi-4/bsp/firmware.bst
+- freedesktop-sdk.bst:bootstrap-import.bst
+
+
+public:
+  bst:
+    overlap-whitelist:
+    # FIX
+    - '**'
+
+config:
+  install-commands:
+  - mkdir -p %{install-root}/boot/
+  - cp  -r /boot/* %{install-root}/boot/
+  - echo "dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 
elevator=deadline rootwait kernel=kernel8.img" > %{install-root}/boot/cmdline.txt
+  - |
+    cat > %{install-root}/boot/config.txt << EOF
+    # For more options and information see
+    # http://rpf.io/configtxt
+    # Some settings may impact device functionality. See link above for details
+
+    enable_uart=1
+    arm_64bit=1
+    start_x=1
+    gpu_mem=16
+
+    # Use VideoCore 4 Firmware KMS shim for RPi4, open-source KMS is WIP
+    dtoverlay=vc4-fkms-v3d
+
+    # uncomment if you get no picture on HDMI for a default "safe" mode
+    #hdmi_safe=1
+
+    # uncomment this if your display has a black border of unused pixels visible
+    # and your display can output without overscan
+    #disable_overscan=1
+
+    # uncomment the following to adjust overscan. Use positive numbers if console
+    # goes off screen, and negative if there is too much border
+    #overscan_left=16
+    #overscan_right=16
+    #overscan_top=16
+    #overscan_bottom=16
+
+    # uncomment to force a console size. By default it will be display's size minus
+    # overscan.
+    #framebuffer_width=1280
+    #framebuffer_height=720
+
+    # uncomment if hdmi display is not detected and composite is being output
+    #hdmi_force_hotplug=1
+
+    # uncomment to force a specific HDMI mode (this will force VGA)
+    #hdmi_group=1
+    #hdmi_mode=1
+
+    # uncomment to force a HDMI mode rather than DVI. This can make audio work in
+    # DMT (computer monitor) modes
+    #hdmi_drive=2
+
+    # uncomment to increase signal to HDMI, if you have interference, blanking, or
+    # no display
+    #config_hdmi_boost=4
+
+    # uncomment for composite PAL
+    #sdtv_mode=2
+
+    #uncomment to overclock the arm. 700 MHz is the default.
+    #arm_freq=800
+
+    # Uncomment some or all of these to enable the optional hardware interfaces
+    #dtparam=i2c_arm=on
+    #dtparam=i2s=on
+    #dtparam=spi=on
+
+    # Uncomment this to enable the lirc-rpi module
+    #dtoverlay=lirc-rpi
+
+    # Additional overlays and parameters are documented /boot/overlays/README
+
+    # Enable audio (loads snd_bcm2835)
+    dtparam=audio=on
+    EOF
+
+
diff --git a/elements/boards/raspberrypi-4/bsp/firmware.bst b/elements/boards/raspberrypi-4/bsp/firmware.bst
new file mode 100644
index 00000000..2e9779ac
--- /dev/null
+++ b/elements/boards/raspberrypi-4/bsp/firmware.bst
@@ -0,0 +1,34 @@
+# Pre-compiled binaries, userspace libs & GPU/bootloader firmware
+
+kind: manual
+
+build-depends:
+- freedesktop-sdk.bst:bootstrap-import.bst
+
+sources:
+- kind: git_tag
+  url: https://github.com/raspberrypi/firmware
+  track: 20354bebcc2a8448128f2348e19e155910d25122
+  track-tags: false
+
+config:
+  install-commands:
+  - mkdir -p  %{install-root}/boot/
+  - cp -a boot/LICENCE.broadcom %{install-root}/boot/
+
+  # https://github.com/raspberrypi/documentation/blob/master/configuration/boot_folder.md
+  # Default firmware, standard GPU features
+  - cp -a boot/fixup4.dat %{install-root}/boot/
+  - cp -a boot/start4.elf %{install-root}/boot/
+
+  # Extended firmware, camera driver and codec, when `start_x=1`
+  - cp -a boot/fixup4x.dat %{install-root}/boot/
+  - cp -a boot/start4x.elf %{install-root}/boot/
+
+  # Cut-down firmware, no hardware blocks (codecs, 3D), when `gpu_mem=16`
+  - cp -a boot/fixup4cd.dat %{install-root}/boot/
+  - cp -a boot/start4cd.elf %{install-root}/boot/
+
+  # Debug firmware
+  - cp -a boot/fixup4db.dat %{install-root}/boot/
+  - cp -a boot/start4db.elf %{install-root}/boot/
diff --git a/elements/boards/raspberrypi-4/bsp/kernel-modules.bst 
b/elements/boards/raspberrypi-4/bsp/kernel-modules.bst
new file mode 100644
index 00000000..c5b7b3a2
--- /dev/null
+++ b/elements/boards/raspberrypi-4/bsp/kernel-modules.bst
@@ -0,0 +1,15 @@
+kind: filter
+depends:
+- filename: boards/raspberrypi-4/bsp/linux.bst
+  type: build
+
+config:
+  exclude:
+  - boot
+  include-orphans: True
+
+public:
+  bst:
+    overlap-whitelist:
+    # FIX
+    - '**'
diff --git a/elements/boards/raspberrypi-4/bsp/linux.bst b/elements/boards/raspberrypi-4/bsp/linux.bst
new file mode 100644
index 00000000..0d82a4b7
--- /dev/null
+++ b/elements/boards/raspberrypi-4/bsp/linux.bst
@@ -0,0 +1,54 @@
+kind: autotools
+
+build-depends:
+- freedesktop-sdk.bst:bootstrap-import.bst
+- freedesktop-sdk.bst:components/kmod.bst
+- freedesktop-sdk.bst:components/flex.bst
+- freedesktop-sdk.bst:components/bison.bst
+- freedesktop-sdk.bst:components/bc.bst
+- freedesktop-sdk.bst:components/gzip.bst
+
+
+
+sources:
+- kind: git_tag
+  url: https://github.com/raspberrypi/linux
+  # track: 5.4.y
+  track: 4f10063ffdc292908e3d40e844cc37902e9e65de
+  track-tags: false
+
+variables:
+  make: make Image modules dtbs
+
+config:
+  configure-commands:
+  - |
+    KERNEL=kernel8
+    make ARCH=arm64 bcm2711_defconfig
+
+  - |
+    # Enable vc4 drm
+     scripts/config -e I2C_BCM2835
+     scripts/config -e DRM
+     scripts/config -e DRM_FBDEV_EMULATION
+     scripts/config -e DRM_VC4
+
+  install-commands:
+  - |
+    make INSTALL_MOD_PATH="%{install-root}/usr/" modules_install
+    mkdir -p %{install-root}/boot/
+    mkdir -p %{install-root}/boot/overlays
+
+    cp arch/arm64/boot/Image %{install-root}/boot/kernel8.img
+    cp arch/arm64/boot/dts/broadcom/*.dtb* %{install-root}/boot/
+    cp arch/arm64/boot/dts/overlays/*.dtb* %{install-root}/boot/overlays/
+    cp arch/arm64/boot/dts/overlays/README %{install-root}/boot/overlays/
+
+public:
+  bst:
+    split-rules:
+      boot:
+        - '/boot/*'
+      mods:
+        - '/lib/*'
+
diff --git a/elements/boards/raspberrypi-4/bsp/userland-firmware.bst 
b/elements/boards/raspberrypi-4/bsp/userland-firmware.bst
new file mode 100644
index 00000000..c3ea7e90
--- /dev/null
+++ b/elements/boards/raspberrypi-4/bsp/userland-firmware.bst
@@ -0,0 +1,17 @@
+kind: cmake
+
+sources:
+- kind: git_tag
+  url: https://github.com/raspberrypi/userland/
+  track: 6e6a2c859a17a195fbb6a97c9da584dd2b9b0178
+
+build-depends:
+- freedesktop-sdk.bst:public-stacks/buildsystem-cmake.bst
+- boards/raspberrypi-4/bsp/kernel-modules.bst
+
+
+variables:
+  cmake-local: |
+    -DCMAKE_BUILD_TYPE=Release \
+    -DARM64=ON \
+    -DBUILD_WAYLAND=TRUE
diff --git a/elements/boards/raspberrypi-4/deps.bst b/elements/boards/raspberrypi-4/deps.bst
new file mode 100644
index 00000000..cfa51c31
--- /dev/null
+++ b/elements/boards/raspberrypi-4/deps.bst
@@ -0,0 +1,20 @@
+kind: stack
+
+runtime-depends:
+- freedesktop-sdk.bst:components/util-linux.bst
+- freedesktop-sdk.bst:components/tzdata.bst
+- freedesktop-sdk.bst:components/systemd.bst
+- freedesktop-sdk.bst:components/xorg-server.bst
+- freedesktop-sdk.bst:components/shadow.bst
+- freedesktop-sdk.bst:vm/mesa-default.bst
+
+- vm/plymouth-gnome-theme.bst
+
+- freedesktop-sdk.bst:vm/config/pulseaudio.bst
+- freedesktop-sdk.bst:vm/config/sudo.bst
+- freedesktop-sdk.bst:vm/config/journald.bst
+
+- sdk-platform.bst
+- core.bst
+- core/systemd-presets.bst
+- core-deps/avahi.bst
diff --git a/elements/boards/raspberrypi-4/filesystem.bst b/elements/boards/raspberrypi-4/filesystem.bst
new file mode 100644
index 00000000..3b723b33
--- /dev/null
+++ b/elements/boards/raspberrypi-4/filesystem.bst
@@ -0,0 +1,14 @@
+kind: compose
+
+build-depends:
+- boards/raspberrypi-4/bsp.bst
+- boards/raspberrypi-4/deps.bst
+
+# Currently we just take everything and remove the
+# devel stuff (headers and static libraries), and debugging
+# symbols which take a huge amount of space, we could
+# refine this and make it much more selective, though.
+config:
+  exclude:
+  - devel
+  - debug
diff --git a/elements/boards/raspberrypi-4/image.bst b/elements/boards/raspberrypi-4/image.bst
new file mode 100644
index 00000000..8ab9e877
--- /dev/null
+++ b/elements/boards/raspberrypi-4/image.bst
@@ -0,0 +1,80 @@
+kind: script
+
+build-depends:
+- boards/raspberrypi-4/filesystem.bst
+- freedesktop-sdk.bst:integration/mtab.bst
+- freedesktop-sdk.bst:components/genimage.bst
+- boards/raspberrypi-4/initial-scripts.bst
+- freedesktop-sdk.bst:vm/prepare-image.bst
+
+config:
+  layout:
+  - element: ''
+    destination: '/genimage'
+  - element: integration/mtab.bst
+    destination: '/'
+  - element: components/genimage.bst
+    destination: '/'
+  - element: ''
+    destination: /tmp
+  - element: boards/raspberrypi-4/filesystem.bst
+    destination: /sysroot
+  - element: boards/raspberrypi-4/initial-scripts.bst
+    destination: /
+  - element: vm/prepare-image.bst
+    destination: /
+
+  commands:
+  - |
+    cd /sysroot
+    mkdir -p {srv,sys,tmp}
+
+  - |
+    prepare-image.sh \
+       --sysroot /sysroot \
+       --rootsource /dev/mmcblk0p2 \
+       --rootpasswd "root" \
+       --noboot \
+       --rootfsopts "defaults,noatime"
+
+  - |
+     cat >>"/sysroot/etc/fstab" <<EOF
+     /dev/mmcblk0p1 /boot vfat defaults 0 2
+     EOF
+
+  - |
+    cat >/genimage/genimage.cfg <<EOF
+     image boot.vfat {
+       vfat {
+        }
+        mountpoint = "/boot"
+        size = 64M
+    }
+    image rootfs.ext4 {
+        ext4  {
+            label = "root"
+        }
+        size = 4G
+    }
+    image sdcard.img {
+        hdimage {
+        }
+        partition boot {
+            partition-type = 0xC
+            bootable = "true"
+            image = "boot.vfat"
+
+        }
+        partition rootfs {
+            partition-type = 0x83
+            image = "rootfs.ext4"
+        }
+    }
+    EOF
+
+  - |
+    cd /genimage
+    genimage --rootpath /sysroot
+
+  - |
+    install -Dm644 -t "%{install-root}" genimage/images/sdcard.img
diff --git a/elements/boards/raspberrypi-4/initial-scripts.bst 
b/elements/boards/raspberrypi-4/initial-scripts.bst
new file mode 100644
index 00000000..d660ef2b
--- /dev/null
+++ b/elements/boards/raspberrypi-4/initial-scripts.bst
@@ -0,0 +1,7 @@
+kind: collect_initial_scripts
+
+build-depends:
+- boards/raspberrypi-4/deps.bst
+
+config:
+  path: /etc/fdsdk/initial_scripts


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