openwrt/target/linux/stm32/image/Makefile
Thomas Richard 58f4667a37
stm32: add new stm32 target
New stm32 target introduces support for stm32mp1 based devices.
For now it includes an initial support of the STM32MP135F-DK device.
The specifications bellow only list supported features.

Specifications
--------------

SOC: STM32MP135FAF7
RAM: 512 MiB
Storage: SD Card
Ethernet: 2x 100 Mbps
Wireless: 2.4GHz Cypress CYW43455 (802.11b/g/n)
LEDs: Heartbeat (Blue)
Buttons: 1x Reset, 1x User (USER2)
USB: 4x 2.0 Type-A

Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
Link: https://github.com/openwrt/openwrt/pull/16716
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 851e7f77e4)
Link: https://github.com/openwrt/openwrt/pull/17097
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2024-11-28 18:48:51 +00:00

64 lines
2.0 KiB
Makefile

# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2024 Bootlin
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
define Build/boot-img-ext4
rm -fR $@.boot
mkdir -p $@.boot
$(foreach dts,$(DEVICE_DTS), $(CP) $(KDIR)/image-$(dts).dtb $@.boot/$(dts).dtb;)
$(CP) $(IMAGE_KERNEL) $@.boot/$(KERNEL_IMG)
$(INSTALL_DIR) $@.boot/extlinux
$(CP) ./extlinux.conf $@.boot/extlinux/
$(SED) 's/@KERNEL@/$(KERNEL_IMG)/' $@.boot/extlinux/extlinux.conf
$(SED) 's/@DEVICE@/$(DEVICE_NAME)/' $@.boot/extlinux/extlinux.conf
$(SED) 's/@DTS@/$(DEVICE_DTS)/' $@.boot/extlinux/extlinux.conf
$(SED) 's/@ROOT@/PARTUUID=$(shell echo $(IMG_PART_DISKGUID) | sed 's/00$$/05/')/' $@.boot/extlinux/extlinux.conf
make_ext4fs -J -L kernel -l $(CONFIG_TARGET_KERNEL_PARTSIZE)M \
$(if $(SOURCE_DATE_EPOCH),-T $(SOURCE_DATE_EPOCH)) \
$@.bootimg $@.boot
endef
define Build/sdcard-img
GUID=$(IMG_PART_DISKGUID) ./gen_stm32_sdcard_img.sh \
$@ $(STAGING_DIR_IMAGE)/tf-a-$(DEVICE_NAME).stm32 \
$(STAGING_DIR_IMAGE)/fip-$(DEVICE_NAME).bin $@.bootimg $(IMAGE_ROOTFS) \
$(ENV_SIZE) $(CONFIG_TARGET_KERNEL_PARTSIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE)
endef
define Device/Default
PROFILES := Default
DEVICE_VENDOR := STMicroelectronics
IMAGES := factory.img.gz sysupgrade.img.gz
IMAGE/factory.img.gz := boot-img-ext4 | sdcard-img | gzip
IMAGE/sysupgrade.img.gz := boot-img-ext4 | sdcard-img | gzip | append-metadata
KERNEL := kernel-bin
KERNEL_NAME := zImage
KERNEL_IMG := zImage
DEVICE_DTS_DIR := $(DTS_DIR)/st
ENV_SIZE := 0x200000
DEVICE_PACKAGES := kmod-brcmfmac \
murata-firmware-43430-sdio \
murata-nvram-43430-sdio \
wpad-basic-mbedtls \
kmod-phy-stm32-usbphyc \
kmod-usb2 \
kmod-usb-storage \
kmod-usb-ledtrig-usbport \
-mtd
endef
define Device/stm32mp135f-dk
DEVICE_MODEL := STM32MP135F-DK
DEVICE_DTS := stm32mp135f-dk
SUPPORTED_DEVICES := st,stm32mp135f-dk
endef
TARGET_DEVICES += stm32mp135f-dk
$(eval $(call BuildImage))