[gnome-build-meta/tpollard/raspi4: 3/4] Add initial boards/raspberrypi-4 target



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

    Add initial boards/raspberrypi-4 target

 elements/boards/raspberrypi-4/README.md            |   8 +
 elements/boards/raspberrypi-4/bsp.bst              |  10 +
 elements/boards/raspberrypi-4/bsp/boot.bst         |   9 +
 elements/boards/raspberrypi-4/bsp/firmware.bst     |  34 ++++
 .../boards/raspberrypi-4/bsp/kernel-modules.bst    |   9 +
 elements/boards/raspberrypi-4/bsp/linux.bst        | 206 +++++++++++++++++++++
 .../boards/raspberrypi-4/bsp/userland-firmware.bst |  16 ++
 elements/boards/raspberrypi-4/deps.bst             |  20 ++
 elements/boards/raspberrypi-4/filesystem.bst       |  14 ++
 elements/boards/raspberrypi-4/image.bst            |  88 +++++++++
 elements/boards/raspberrypi-4/initial-scripts.bst  |   7 +
 files/raspberrypi-4/cmdline.txt                    |   1 +
 files/raspberrypi-4/config.txt                     |  64 +++++++
 13 files changed, 486 insertions(+)
---
diff --git a/elements/boards/raspberrypi-4/README.md b/elements/boards/raspberrypi-4/README.md
new file mode 100644
index 00000000..d63d98c3
--- /dev/null
+++ b/elements/boards/raspberrypi-4/README.md
@@ -0,0 +1,8 @@
+## Build the Rasberry Pi 4b image on aarch64
+
+``` shell
+bst build boards/raspberrypi-4/image.bst
+bst checkout boards/raspberrypi-4/image.bst raspi-img
+
+sudo dd if=raspi-img/sdcard.img of=$SDCARD status=progress bs=1M
+```
diff --git a/elements/boards/raspberrypi-4/bsp.bst b/elements/boards/raspberrypi-4/bsp.bst
new file mode 100644
index 00000000..7be29a47
--- /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 a Raspberry Pi 4B 64bit
+
+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
diff --git a/elements/boards/raspberrypi-4/bsp/boot.bst b/elements/boards/raspberrypi-4/bsp/boot.bst
new file mode 100644
index 00000000..17399c96
--- /dev/null
+++ b/elements/boards/raspberrypi-4/bsp/boot.bst
@@ -0,0 +1,9 @@
+kind: import
+
+sources:
+- kind: local
+  path: files/raspberrypi-4
+
+config:
+  source: /
+  target: /boot
\ No newline at end of file
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..7023ee36
--- /dev/null
+++ b/elements/boards/raspberrypi-4/bsp/kernel-modules.bst
@@ -0,0 +1,9 @@
+kind: filter
+
+build-depends:
+- boards/raspberrypi-4/bsp/linux.bst
+
+config:
+  exclude:
+  - boot
+  include-orphans: True
diff --git a/elements/boards/raspberrypi-4/bsp/linux.bst b/elements/boards/raspberrypi-4/bsp/linux.bst
new file mode 100644
index 00000000..4ec8236c
--- /dev/null
+++ b/elements/boards/raspberrypi-4/bsp/linux.bst
@@ -0,0 +1,206 @@
+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
+  # Aim to track 5.4 LTS work for vc4-kms etc
+  # track: 5.4.y
+  track: a98ba9221895e03b8736312ce6666005da5968a1
+  track-tags: false
+
+variables:
+  make: make Image modules dtbs
+
+config:
+  configure-commands:
+  - |
+    KERNEL=kernel8
+    make ARCH=arm64 bcm2711_defconfig
+
+  - |
+    # Kernel Config Options
+    scripts/config -e DEVTMPFS
+    scripts/config -e CGROUPS
+    scripts/config -e INOTIFY_USER
+    scripts/config -e SIGNALFD
+    scripts/config -e TIMERFD
+    scripts/config -e EPOLL
+    scripts/config -e NET
+    scripts/config -e SYSFS
+    scripts/config -e PROC_FS
+    scripts/config -e FHANDLE
+
+    # Kernel crypto/hash API
+    scripts/config -e CRYPTO_USER_API_HASH
+    scripts/config -e CRYPTO_HMAC
+    scripts/config -e CRYPTO_SHA256
+
+    # udev will fail to work with legacy sysfs
+    scripts/config -d SYSFS_DEPRECATED
+
+    # Boot is very slow with systemd when legacy PTYs are present
+    scripts/config -d LEGACY_PTYS
+    scripts/config -d LEGACY_PTY_COUNT
+
+    # Legacy hotplug confuses udev
+    scripts/config --set-str UEVENT_HELPER_PATH ""
+
+    # Userspace firmware loading not supported
+    scripts/config -d FW_LOADER_USER_HELPER
+
+    # Some udev/virtualization requires
+    scripts/config -e DMIID
+
+    # Support for some SCSI devices serial number retrieval
+    scripts/config -e BLK_DEV_BSG
+
+    # Required for PrivateNetwork= in service units
+    scripts/config -e NET_NS
+    scripts/config -e USER_NS
+
+    # Required for 9p support
+    scripts/config -e NET_9P
+    scripts/config -e NET_9P_VIRTIO
+    scripts/config -e 9P_FS
+    scripts/config -e 9P_FS_POSIX_ACL
+    scripts/config -e 9P_FS_SECURITY
+    scripts/config -e VIRTIO_PCI
+
+    # Strongly Recommended
+    scripts/config -e IPV6
+    scripts/config -e AUTOFS4_FS
+    scripts/config -e TMPFS_XATTR
+    scripts/config -e TMPFS_POSIX_ACL
+    scripts/config -e EXT4_FS_POSIX_ACL
+    scripts/config -e EXT4_FS_SECURITY
+    scripts/config -e XFS_POSIX_ACL
+    scripts/config -e BTRFS_FS_POSIX_ACL
+    scripts/config -e SECCOMP
+    scripts/config -e SECCOMP_FILTER
+    scripts/config -e CHECKPOINT_RESTORE
+
+    # Required for CPUShares= in resource control unit settings
+    scripts/config -e CGROUP_SCHED
+    scripts/config -e FAIR_GROUP_SCHED
+
+    # Required for CPUQuota= in resource control unit settings
+    scripts/config -e CFS_BANDWIDTH
+
+    # Required for IPAddressDeny=, IPAddressAllow= in resource control unit settings
+    scripts/config -e CGROUP_BPF
+
+    # For UEFI systems
+    scripts/config -e EFIVAR_FS
+    scripts/config -e EFI_PARTITION
+
+    # RT group scheduling (effectively) makes RT scheduling unavailable for userspace
+    scripts/config -d RT_GROUP_SCHED
+
+    # Required for 3D acceleration in qemu
+    scripts/config -e CONFIG_DRM_VIRTIO_GPU
+
+    # Required for systemd-nspawn
+    scripts/config -e DEVPTS_MULTIPLE_INSTANCES
+
+    # Sound with QEMU
+    scripts/config -e SND_HDA_GENERIC
+
+    scripts/config -e MMC
+    scripts/config -m PWRSEQ_SD8787
+    scripts/config -e MMC_BLOCK_MINORS=32
+    scripts/config -m SDIO_UART
+    scripts/config -e MMC_SDHCI
+    scripts/config -e MMC_SDHCI_PCI
+    scripts/config -e MMC_SDHCI_ACPI
+    scripts/config -e MMC_SDHCI_PLTFM
+    scripts/config -e MMC_SDHCI_OF_ARASAN
+    scripts/config -e MMC_SPI
+    scripts/config -e MMC_DW
+    scripts/config -e MMC_DW_PCI
+    scripts/config -e MMC_DW_ROCKCHIP
+
+    scripts/config -d DRM_LIMA
+
+    scripts/config -e DRM_PANFROST
+    scripts/config -m DRM_MALI_DISPLAY
+    scripts/config -m DRM_ANALOGIX_ANX78XX
+    scripts/config -m DRM_DW_HDMI_CEC
+    scripts/config -e DRM_LOAD_EDID_FIRMWARE
+
+    scripts/config -m BATTERY_CW2015
+
+    scripts/config -e FIRMWARE_EDID
+
+    scripts/config -m CRYPTO_DEV_ROCKCHIP
+    scripts/config -e PCIE_ROCKCHIP_HOST
+    scripts/config -e PHY_ROCKCHIP_DP
+    scripts/config -e PHY_ROCKCHIP_INNO_HDMI
+    scripts/config -e PHY_ROCKCHIP_PCIE
+    scripts/config -e ROCKCHIP_LVDS
+    scripts/config -e ROCKCHIP_MBOX
+    scripts/config -e ROCKCHIP_RGB
+    scripts/config -m SND_SOC_ROCKCHIP_MAX98090
+    scripts/config -m SND_SOC_ROCKCHIP_PDM
+    scripts/config -m VIDEO_ROCKCHIP_RGA
+    scripts/config -e ROCKCHIP_SUSPEND_MODE
+    scripts/config -e ROCKCHIP_SIP
+
+    scripts/config -e DRM_PANEL
+    scripts/config -m DRM_PANEL_LVDS
+    scripts/config -m DRM_PANEL_SIMPLE
+
+    scripts/config -m HID_MULTITOUCH
+
+    scripts/config -m SND_SOC_ES8316
+    scripts/config -m SND_SOC_SIMPLE_AMPLIFIER
+    scripts/config -m SND_SIMPLE_CARD
+
+    scripts/config -e CHARGER_GPIO
+    scripts/config -m PWRSEQ_SD8787
+    scripts/config -m PWRSEQ_SIMPLE
+    scripts/config -e GPIO_SYSCON
+
+    scripts/config -e RTC_DRV_RK808
+
+    scripts/config -e WIRELESS
+    scripts/config -m CFG80211
+    scripts/config -e CFG80211_WEXT
+    scripts/config -e MAC80211
+    scripts/config -e NETDEVICES
+    scripts/config -e WLAN
+
+    # 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..01a49722
--- /dev/null
+++ b/elements/boards/raspberrypi-4/bsp/userland-firmware.bst
@@ -0,0 +1,16 @@
+kind: cmake
+
+sources:
+- kind: git_tag
+  url: https://github.com/raspberrypi/userland/
+  track: a246147c21ae5be92ad1b85199b5b0bb447e0544
+
+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
diff --git a/elements/boards/raspberrypi-4/deps.bst b/elements/boards/raspberrypi-4/deps.bst
new file mode 100644
index 00000000..9181e830
--- /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:components/avahi.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
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..280c8fde
--- /dev/null
+++ b/elements/boards/raspberrypi-4/image.bst
@@ -0,0 +1,88 @@
+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:
+  - |
+    # Create needed api
+    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
+
+  - |
+     # Add empty machine-id, to allow systemd to read-only
+     # boot whilst creating & committing a unique id on first boot,
+     # avoiding waiting on systemd-timesyncd or caching a generated id.
+     touch "/sysroot/etc/machine-id"
+
+  - |
+    cat >/genimage/genimage.cfg <<EOF
+     image boot.vfat {
+       vfat {
+        }
+        mountpoint = "/boot"
+        size = 64M
+    }
+    image rootfs.ext4 {
+        ext4  {
+            label = "root"
+            use-mke2fs = true
+        }
+        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
diff --git a/files/raspberrypi-4/cmdline.txt b/files/raspberrypi-4/cmdline.txt
new file mode 100644
index 00000000..6929801a
--- /dev/null
+++ b/files/raspberrypi-4/cmdline.txt
@@ -0,0 +1 @@
+dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 
elevator=deadline rootwait kernel=kernel8.img splash plymouth.ignore-serial-consoles
\ No newline at end of file
diff --git a/files/raspberrypi-4/config.txt b/files/raspberrypi-4/config.txt
new file mode 100644
index 00000000..3265d073
--- /dev/null
+++ b/files/raspberrypi-4/config.txt
@@ -0,0 +1,64 @@
+# 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
\ No newline at end of file


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