diff --git a/README.md b/README.md
index 7ea83d8389c2486b760aed36897ed9bfc8c06183..7e0f79907e35394977990eba9d8c250acf5c1fe6 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ https://gitee.com/phytium_embedded/phytium-embedded-docs/tree/master/linux
# 支持开发板
- e2000
+ e2000 phytiumpi
# 构建镜像
@@ -51,6 +51,15 @@ https://gitee.com/phytium_embedded/phytium-embedded-docs/tree/master/linux
镜像的输出位置 tmp/deploy/images/e2000/.
+# 构建phytiumpi SD镜像
+
+ $: . ./setup-env -m phytiumpi
+
+ $: bitbake phydisk
+
+ 镜像的输出位置 tmp/deploy/images/phytium/phydisk.img
+ phydisk.img 就是 SD 的镜像文件。
+ 后续部署及使用方法,请参考https://gitee.com/phytium_embedded/phytium-embedded-docs/tree/master/phytiumpi/linux
# 启动开发板
diff --git a/default.xml b/default.xml
index aaa27acec3b11f8a5349a3496b63a740d7a39be9..d69c62a215a8220616d2bf948c90810af804c549 100644
--- a/default.xml
+++ b/default.xml
@@ -9,7 +9,7 @@
-
+
diff --git a/meta-bsp/conf/machine/phytiumpi.conf b/meta-bsp/conf/machine/phytiumpi.conf
new file mode 100644
index 0000000000000000000000000000000000000000..0c637a53f0603ef3ab92ff4643cb68d40b19d7d1
--- /dev/null
+++ b/meta-bsp/conf/machine/phytiumpi.conf
@@ -0,0 +1,18 @@
+#@MAINTAINER: chunrong.guo
+
+require conf/machine/phytium-base.inc
+require conf/machine/include/arm/arch-arm64.inc
+
+UBOOT_DTB_LOADADDRESS = "0x90000000"
+UBOOT_ENTRYPOINT = "0x80080000"
+
+UBOOT_MACHINE = "config"
+KERNEL_CLASSES = " kernel-fitimage "
+KERNEL_IMAGETYPES = " Image.gz"
+
+KERNEL_DEVICETREE ?= "\
+ phytium/phytiumpi_firefly.dtb \
+"
+KERNEL_DEFCONFIG ?= "phytiumpi_firefly_defconfig"
+
+DEF_DEVICETREE = "phytiumpi_firefly.dtb"
diff --git a/meta-bsp/recipes-bsp/phydisk/files/genimage.configold b/meta-bsp/recipes-bsp/phydisk/files/genimage.configold
deleted file mode 100644
index a67d5df6fa18885d386bc0e52186da841c7f69d1..0000000000000000000000000000000000000000
--- a/meta-bsp/recipes-bsp/phydisk/files/genimage.configold
+++ /dev/null
@@ -1,27 +0,0 @@
-image efi-part.vfat {
- vfat {
- file Image {
- image = "Image"
- }
- }
-
- size = 400M
-}
-
-image phyimage.img {
- hdimage {
- partition-table-type = "mbr"
- }
-
- partition boot {
- image = "efi-part.vfat"
- partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b
- offset = 32K
- bootable = true
- }
-
- partition root {
- partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae
- image = "core-image-xfce-e2000.ext4"
- }
-}
diff --git a/meta-bsp/recipes-bsp/phydisk/phydisk.bb b/meta-bsp/recipes-bsp/phydisk/phydisk.bb
index 2cf8416adb4b0ad8b3d6ba82212223ab9bf7f708..a097fc39a59f21e5467a0144d4b817b7a7896219 100644
--- a/meta-bsp/recipes-bsp/phydisk/phydisk.bb
+++ b/meta-bsp/recipes-bsp/phydisk/phydisk.bb
@@ -4,10 +4,14 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384
inherit genimage
DEPENDS += "mtools-native e2fsprogs-native genext2fs-native"
+DEPENDS:append:phytiumpi = " phyuboot"
do_genimage[depends] += "virtual/kernel:do_deploy core-image-xfce:do_image_complete"
-SRC_URI += "file://genimage.config"
-
+SRC_URI:e2000 += "file://genimage.config"
+SRC_URI:phytiumpi += "file://genimage-phytiumpi.config"
+do_configure:prepend (){
+ cp ${WORKDIR}/genimage-phytiumpi.config ${WORKDIR}/genimage.config
+}
GENIMAGE_ROOTFS_IMAGE ?= "core-image-xfce"
GENIMAGE_ROOTFS_IMAGE_FSTYPE ?= "tar.gz"
GENIMAGE_CREATE_BMAP = "1"
diff --git a/meta-bsp/recipes-bsp/phydisk/phydisk/genimage-phytiumpi.config b/meta-bsp/recipes-bsp/phydisk/phydisk/genimage-phytiumpi.config
new file mode 100644
index 0000000000000000000000000000000000000000..b122903021d2fc1c69b5dbdb2b786fa9a0b9eb8d
--- /dev/null
+++ b/meta-bsp/recipes-bsp/phydisk/phydisk/genimage-phytiumpi.config
@@ -0,0 +1,24 @@
+image phydisk.img {
+ hdimage {
+ }
+
+ partition uboot {
+ in-partition-table = no
+ offset = 0
+ image = "fip-all.bin"
+ size = 3M
+ }
+ partition bootload {
+ in-partition-table = no
+ offset = 4M
+ image = "fitImage"
+ size = 60M
+ }
+
+ partition root {
+ partition-type = 0x83
+ image = "core-image-xfce-phytiumpi.ext4"
+ size = 16G
+ }
+
+}
diff --git a/meta-bsp/recipes-bsp/phydisk/files/genimage.config b/meta-bsp/recipes-bsp/phydisk/phydisk/genimage.config
similarity index 100%
rename from meta-bsp/recipes-bsp/phydisk/files/genimage.config
rename to meta-bsp/recipes-bsp/phydisk/phydisk/genimage.config
diff --git a/meta-bsp/recipes-bsp/phydisk/files/genimage.configdos b/meta-bsp/recipes-bsp/phydisk/phydisk/genimage.configdos
similarity index 100%
rename from meta-bsp/recipes-bsp/phydisk/files/genimage.configdos
rename to meta-bsp/recipes-bsp/phydisk/phydisk/genimage.configdos
diff --git a/meta-bsp/recipes-bsp/phyuboot/phyuboot.bb b/meta-bsp/recipes-bsp/phyuboot/phyuboot.bb
new file mode 100644
index 0000000000000000000000000000000000000000..2488728d6d766f1f027533b6f18473ae68b9ee47
--- /dev/null
+++ b/meta-bsp/recipes-bsp/phyuboot/phyuboot.bb
@@ -0,0 +1,30 @@
+SUMMARY = "phytium uboot"
+DESCRIPTION = "phytium uboot"
+LICENSE = "PPL-1.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=44a0d0fad189770cc022af4ac6262cbe"
+
+inherit deploy
+
+SRC_URI = "file://fip-all-4GB.bin \
+ file://fip-all-2GB.bin \
+"
+S = "${WORKDIR}"
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+
+RAMSIZE="4GB"
+
+do_install () {
+ install -d ${D}
+ cp -r ${S}/fip-all-${RAMSIZE}.bin ${D}/fip-all.bin
+}
+
+do_deploy () {
+ install -d ${DEPLOYDIR}/
+ cp -r ${D}/* ${DEPLOYDIR}/
+}
+addtask deploy after do_install
+
+PACKAGES += "${PN}-image"
+FILES:${PN}-image += "/"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/meta-bsp/recipes-bsp/phyuboot/phyuboot/fip-all-2GB.bin b/meta-bsp/recipes-bsp/phyuboot/phyuboot/fip-all-2GB.bin
new file mode 100644
index 0000000000000000000000000000000000000000..cdca376257ddac713eb3953e21f4ae906a82aa8c
Binary files /dev/null and b/meta-bsp/recipes-bsp/phyuboot/phyuboot/fip-all-2GB.bin differ
diff --git a/meta-bsp/recipes-bsp/phyuboot/phyuboot/fip-all-4GB.bin b/meta-bsp/recipes-bsp/phyuboot/phyuboot/fip-all-4GB.bin
new file mode 100644
index 0000000000000000000000000000000000000000..4554eb0e0aafae682058e2331664dd4c9012ff37
Binary files /dev/null and b/meta-bsp/recipes-bsp/phyuboot/phyuboot/fip-all-4GB.bin differ
diff --git a/meta-bsp/recipes-bsp/phyuboot/phyuboot/kernel.its b/meta-bsp/recipes-bsp/phyuboot/phyuboot/kernel.its
new file mode 100644
index 0000000000000000000000000000000000000000..ea6a08989b034b4b01c9ea89679d5bbf97daea6e
--- /dev/null
+++ b/meta-bsp/recipes-bsp/phyuboot/phyuboot/kernel.its
@@ -0,0 +1,59 @@
+/*
+ * Compilation:
+ * mkimage -f fit_kernel_dtb.its fit_kernel_dtb.itb
+ *
+ * Files in linux build dir:
+ * - arch/arm/boot/Image (zImage-old-ok)
+ * - arch/arm/boot/dts/ft.dtb
+ *
+ * fatload usb 0:1 0x90100000 fit_kernel_dtb.itb
+ * bootm 0x90100000#e2000
+ *
+ */
+
+/dts-v1/;
+/ {
+ description = "U-Boot fitImage for Phytium Phytiumpi";
+ #address-cells = <1>;
+
+ images {
+ kernel {
+ description = "Linux kernel";
+ data = /incbin/("Image.gz");
+ type = "kernel";
+ arch = "arm64";
+ os = "linux";
+ compression = "gzip";
+ load = <0x80080000>;
+ entry = <0x80080000>;
+ hash-1 {
+ algo = "sha1";
+ };
+ };
+
+ fdt-phytium {
+ description = "FDT phytiumpi";
+ data = /incbin/("phytiumpi_firefly.dtb");
+ type = "flat_dt";
+ arch = "arm64";
+ compression = "none";
+ hash-1 {
+ algo = "sha1";
+ };
+ };
+ };
+
+ configurations {
+ default = "phytium@cecport";
+
+ phytium {
+ description = "phytimpi";
+ kernel = "kernel";
+ fdt = "fdt-phytium";
+ hash-1 {
+ algo = "sha1";
+ };
+ };
+
+ };
+};
diff --git a/meta-bsp/recipes-core/images/core-image-xfce.bb b/meta-bsp/recipes-core/images/core-image-xfce.bb
index 1eb1fe8eef752741f1cf7b84af2bb644e1d68667..b7db9c0bf58642813e3ad3a581264c72460f1fbe 100644
--- a/meta-bsp/recipes-core/images/core-image-xfce.bb
+++ b/meta-bsp/recipes-core/images/core-image-xfce.bb
@@ -46,3 +46,4 @@ IMAGE_INSTALL += " ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', 'pa
packagegroup-phy-tools-core-dev \
packagegroup-gui-base \
"
+IMAGE_ROOTFS_EXTRA_SPACE:phytiumpi = "5242880"
diff --git a/meta-bsp/recipes-devtools/genimage/genimage.inc b/meta-bsp/recipes-devtools/genimage/genimage.inc
index 9f3ae7e72b9712be8986d8335b57b35eb9a615af..c665ec4eac642dc7d04e46dd48937b115afd6e2a 100644
--- a/meta-bsp/recipes-devtools/genimage/genimage.inc
+++ b/meta-bsp/recipes-devtools/genimage/genimage.inc
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://genimage.c;beginline=1;endline=15;md5=bd66ae8b32d8a33
DEPENDS = "confuse dosfstools"
SRC_URI = "http://www.pengutronix.de/software/genimage/download/genimage-${PV}.tar.xz"
+SRC_URI += "file://0001-image-hd-remove-MBR-space.patch"
EXTRA_OECONF = "--enable-largefile"
diff --git a/meta-bsp/recipes-devtools/genimage/genimage/0001-image-hd-remove-MBR-space.patch b/meta-bsp/recipes-devtools/genimage/genimage/0001-image-hd-remove-MBR-space.patch
new file mode 100644
index 0000000000000000000000000000000000000000..4405b19f998c5d87d9096b9b777a7224566a528a
--- /dev/null
+++ b/meta-bsp/recipes-devtools/genimage/genimage/0001-image-hd-remove-MBR-space.patch
@@ -0,0 +1,33 @@
+From 0facda308510839f33c34b3416080d9e72e51440 Mon Sep 17 00:00:00 2001
+From: Chunrong Guo
+Date: Wed, 14 Jun 2023 13:55:16 +0800
+Subject: [PATCH] image-hd: remove MBR space
+
+Signed-off-by: Chunrong Guo
+---
+ image-hd.c | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/image-hd.c b/image-hd.c
+index 5e3a3b4..09affcd 100644
+--- a/image-hd.c
++++ b/image-hd.c
+@@ -859,15 +859,6 @@ static int hdimage_setup(struct image *image, cfg_t *cfg)
+ part->name);
+ return -EINVAL;
+ }
+- if (!part->extended) {
+- int ret = check_overlap(image, part);
+- if (ret)
+- return ret;
+- } else if (now > part->offset) {
+- image_error(image, "part %s overlaps with previous partition\n",
+- part->name);
+- return -EINVAL;
+- }
+ if (part->in_partition_table && (part->size % 512)) {
+ image_error(image, "part %s size (%lld) must be a "
+ "multiple of 1 sector (512 bytes)\n",
+--
+2.25.1
+
diff --git a/meta-bsp/recipes-kernel/linux/linux-phytium.inc b/meta-bsp/recipes-kernel/linux/linux-phytium.inc
index 2cf2c7f5b55fd247649c58e3166570e2589d7547..5cefeb6618130782e4b7c246fb61e98c45b2d26f 100644
--- a/meta-bsp/recipes-kernel/linux/linux-phytium.inc
+++ b/meta-bsp/recipes-kernel/linux/linux-phytium.inc
@@ -9,11 +9,12 @@ SRC_URI = "git://gitee.com/phytium_embedded/phytium-linux-kernel.git;protocol=ht
SRC_URI += " \
file://iso.config \
+ file://kernel.its \
"
S = "${WORKDIR}/git"
-DEPENDS:append = " libgcc u-boot-tools-native"
+DEPENDS:append = " libgcc u-boot-tools-native dtc-native"
# not put Images into /boot of rootfs, install kernel-image if needed
RDEPENDS_${KERNEL_PACKAGE_NAME}-base = ""
@@ -31,9 +32,10 @@ ZIMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
SCMVERSION ?= "y"
LOCALVERSION = "-phytium-embeded"
DELTA_KERNEL_DEFCONFIG ?= ""
-DELTA_KERNEL_DEFCONFIG:prepend = "e2000_defconfig iso.config"
+DELTA_KERNEL_DEFCONFIG:e2000:prepend = "e2000_defconfig iso.config"
do_merge_delta_config[dirs] = "${B}"
+do_uboot_mkimage[dirs] = "${B}"
do_merge_delta_config() {
# create config with make config
@@ -59,6 +61,11 @@ do_merge_delta_config() {
}
do_uboot_mkimage() {
+ if [ "${MACHINE}" = "phytiumpi" ]; then
+ cp ${WORKDIR}/kernel.its ./
+ uboot-mkimage -f kernel.its fitImage
+ cp fitImage ${DEPLOY_DIR_IMAGE}/fitImage
+ fi
uboot-mkimage -A arm64 -O linux -T kernel -C none -a 0x80080000 -e 0x80080000 -n "Linux" -d ${DEPLOY_DIR_IMAGE}/Image ${DEPLOY_DIR_IMAGE}/uImage
}
addtask merge_delta_config before do_preconfigure after do_patch do_prepare_recipe_sysroot
diff --git a/meta-bsp/recipes-kernel/linux/linux-phytium/0001-Makefile-fix-cannot-find-.h.patch b/meta-bsp/recipes-kernel/linux/linux-phytium/0001-Makefile-fix-cannot-find-.h.patch
new file mode 100644
index 0000000000000000000000000000000000000000..cb5bb94d80051d1ba0a561706e8b658e6eca4e9c
--- /dev/null
+++ b/meta-bsp/recipes-kernel/linux/linux-phytium/0001-Makefile-fix-cannot-find-.h.patch
@@ -0,0 +1,31 @@
+From ff09b2ab84b8711382540d118ab68ec8f4b4d39f Mon Sep 17 00:00:00 2001
+From: jenkins
+Date: Wed, 30 Aug 2023 13:45:01 +0800
+Subject: [PATCH] Makefile: fix cannot find *.h
+
+Signed-off-by: jenkins
+---
+ drivers/net/wireless/rtl8821cs/Makefile | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/wireless/rtl8821cs/Makefile b/drivers/net/wireless/rtl8821cs/Makefile
+index 3103f5f52..5a6e12322 100644
+--- a/drivers/net/wireless/rtl8821cs/Makefile
++++ b/drivers/net/wireless/rtl8821cs/Makefile
+@@ -20,8 +20,11 @@ ifeq ($(GCC_VER_49),1)
+ EXTRA_CFLAGS += -Wno-date-time # Fix compile error && warning on gcc 4.9 and later
+ endif
+
+-EXTRA_CFLAGS += -I$(src)/include
+-
++EXTRA_CFLAGS += -I$(srctree)/include
++ccflags-y += -I$(srctree)/drivers/net/wireless/rtl8821cs/platform
++ccflags-y += -I$(srctree)/drivers/net/wireless/rtl8821cs/core/crypto
++ccflags-y += -I$(srctree)/drivers/net/wireless/rtl8821cs/hal/phydm
++ccflags-y += -I$(srctree)/drivers/net/wireless/rtl8821cs/include
+ EXTRA_LDFLAGS += --strip-debug
+
+ CONFIG_AUTOCFG_CP = n
+--
+2.30.2
+
diff --git a/meta-bsp/recipes-kernel/linux/linux-phytium/kernel.its b/meta-bsp/recipes-kernel/linux/linux-phytium/kernel.its
new file mode 100644
index 0000000000000000000000000000000000000000..eae9260a9c78cf6c58988c752fd2f0118aca4456
--- /dev/null
+++ b/meta-bsp/recipes-kernel/linux/linux-phytium/kernel.its
@@ -0,0 +1,59 @@
+/*
+ * Compilation:
+ * mkimage -f fit_kernel_dtb.its fit_kernel_dtb.itb
+ *
+ * Files in linux build dir:
+ * - arch/arm/boot/Image (zImage-old-ok)
+ * - arch/arm/boot/dts/ft.dtb
+ *
+ * fatload usb 0:1 0x90100000 fit_kernel_dtb.itb
+ * bootm 0x90100000#e2000
+ *
+ */
+
+/dts-v1/;
+/ {
+ description = "U-Boot fitImage for Phytium Phytiumpi";
+ #address-cells = <1>;
+
+ images {
+ kernel {
+ description = "Linux kernel";
+ data = /incbin/("arch/arm64/boot/Image.gz");
+ type = "kernel";
+ arch = "arm64";
+ os = "linux";
+ compression = "gzip";
+ load = <0x80080000>;
+ entry = <0x80080000>;
+ hash-1 {
+ algo = "sha1";
+ };
+ };
+
+ fdt-phytium {
+ description = "FDT phytiumpi";
+ data = /incbin/("arch/arm64/boot/dts/phytium/phytiumpi_firefly.dtb");
+ type = "flat_dt";
+ arch = "arm64";
+ compression = "none";
+ hash-1 {
+ algo = "sha1";
+ };
+ };
+ };
+
+ configurations {
+ default = "phytium@cecport";
+
+ phytium {
+ description = "phytimpi";
+ kernel = "kernel";
+ fdt = "fdt-phytium";
+ hash-1 {
+ algo = "sha1";
+ };
+ };
+
+ };
+};
diff --git a/meta-bsp/recipes-kernel/linux/linux-phytium_5.10.bbappend b/meta-bsp/recipes-kernel/linux/linux-phytium_5.10.bbappend
index 3d338762e3810ed72cac1aaa11ee4198e8809d86..270546023bcba12fff7a77c106c0fe85a05389a2 100644
--- a/meta-bsp/recipes-kernel/linux/linux-phytium_5.10.bbappend
+++ b/meta-bsp/recipes-kernel/linux/linux-phytium_5.10.bbappend
@@ -3,3 +3,4 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
JAJLHOUSE_PATCHES = " file://0001-modify-the-dts-of-e2000-linux-5.10-kernel-to-reserve.patch"
SRC_URI:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'jailhouse', '${JAJLHOUSE_PATCHES}', '', d)}"
+SRC_URI:append = " file://0001-Makefile-fix-cannot-find-.h.patch"