Browse Source

support openamp

support ubuntu22.04 and it is the default version

phytiumpi: automatically extend partition

Signed-off-by: weishanshan1084 <weishanshan1084@phytium.com.cn>
pull/23/head
weishanshan1084 8 months ago
parent
commit
d58eca40fe
  1. 49
      README.md
  2. 17
      board/phytium/common/debian-package-installer
  3. 6
      board/phytium/common/post-custom-skeleton-debian-11.sh
  4. 33
      board/phytium/common/post-custom-skeleton-ubuntu.sh
  5. 37
      board/phytium/common/ubuntu-package-installer
  6. 2
      board/phytium/common/ubuntu_overlay/etc/asound.conf
  7. 7
      board/phytium/grub-d2000.cfg
  8. 6
      board/phytium/post-image.sh
  9. 9
      configs/openamp_free_rtos.config
  10. 9
      configs/openamp_standalone.config
  11. 2
      configs/phytium_ubuntu_defconfig
  12. 1
      configs/ubuntu_20.04.config
  13. 153
      linux/kernel-patches/openamp/0001-modify-the-dts-of-e2000q-and-phytiumpi-to-enable-hom.patch
  14. 3
      package/Config.in
  15. 2
      package/aarch64-none-elf-toolchain/aarch64-none-elf-toolchain.hash
  16. 26
      package/aarch64-none-elf-toolchain/aarch64-none-elf-toolchain.mk
  17. 6
      package/jailhouse/jailhouse.mk
  18. 16
      package/phytium-free-rtos/Config.in
  19. 31
      package/phytium-free-rtos/phytium-free-rtos.mk
  20. 19
      package/phytium-iot-environment/phytium-iot-environment.mk
  21. 7
      package/phytium-iot-environment/phytium_dev.sh
  22. 16
      package/phytium-standalone/Config.in
  23. 26
      package/phytium-standalone/phytium-standalone.mk
  24. 1
      package/phytium-tools/phytium-tools.mk
  25. 16
      package/phytium-tools/src/rc.local
  26. 6
      package/rpmsg-demo/Config.in
  27. 2
      package/rpmsg-demo/rpmsg-demo.hash
  28. 22
      package/rpmsg-demo/rpmsg-demo.mk
  29. 20
      system/Config.in

49
README.md

@ -1,6 +1,10 @@
# phytium-linux-buildroot
Buildroot是一种简单、高效且易于使用的工具,可以通过交叉编译生成嵌入式Linux系统。Buildroot的用户手册位于docs/manual/manual.pdf。
phytium-linux-buildroot基于Buildroot,适配了飞腾嵌入式CPU、桌面CPU相关开发板,支持ubuntu文件系统、debian文件系统、initrd文件系统、基于busybox最小文件系统的编译。
phytium-linux-buildroot基于Buildroot,适配了飞腾E2000,D2000,FT-2000/4等CPU和X100套片,支持ubuntu文件系统、debian文件系统、initrd文件系统、基于busybox最小文件系统的编译。
# 预备知识
Buildroot涉及了rootfs、make、Kconfig、Linux command、Shell scripts、U-Boot、Linux kernel、dts等相关知识,了解与熟悉它们有助于Buildroot的使用。
了解上述知识,可以参考Wiki:[相关知识与学习链接](https://gitee.com/phytium_embedded/phytium-linux-buildroot/wikis/%E7%9B%B8%E5%85%B3%E7%9F%A5%E8%AF%86%E4%B8%8E%E5%AD%A6%E4%B9%A0%E9%93%BE%E6%8E%A5)
# 开发环境
## 系统要求
@ -60,6 +64,7 @@ config文件是功能扩展配置文件,具体的文件及功能如下:
| config | 功能 |
|------------------------|--------|
| linux_xxx.config | 内核配置文件,含有linux 4.19、4.19 rt和5.10 rt内核版本 |
| ubuntu_20.04.config | Ubuntu20.04 |
| desktop.config | XFCE桌面 |
| e2000_optee.config | Phytium-optee |
| xenomai_xxx.config | cobalt_4.19、cobalt_5.10、mercury_4.19和mercury_5.10 |
@ -67,14 +72,15 @@ config文件是功能扩展配置文件,具体的文件及功能如下:
| jailhouse.config | jailhouse |
| x100.config | X100 |
| qt5_eglfs.config | 无桌面qt5 eglfs,需要x100.config的支持 |
| openamp_xxx.config | OpenAMP |
| phytiumpi_sdcard.config | 飞腾派配置文件 |
## 配置文件的组合
defconfig可以和config文件进行组合,用以扩展特定的功能,defconfig与config的组合关系如下:
| deconfig | config |
|------------------------|--------|
| phytium_ubuntu_defconfig | linux_xxx.config、desktop.config、e2000_optee.config、xenomai_xxx.config、ethercat.config、jailhouse.config、x100.config、qt5_eglfs.config、phytiumpi_sdcard.config |
| phytium_debian_defconfig | linux_xxx.config、desktop.config、e2000_optee.config、xenomai_xxx.config、ethercat.config、jailhouse.config、x100.config、qt5_eglfs.config、phytiumpi_sdcard.config |
| phytium_defconfig | linux_xxx.config、e2000_optee.config、phytiumpi_sdcard.config、xenomai_xxx.config、ethercat.config、jailhouse.config |
| phytium_ubuntu_defconfig | linux_xxx.config、ubuntu_20.04.config、desktop.config、e2000_optee.config、xenomai_xxx.config、ethercat.config、jailhouse.config、x100.config、qt5_eglfs.config、openamp_xxx.config、phytiumpi_sdcard.config |
| phytium_debian_defconfig | linux_xxx.config、desktop.config、e2000_optee.config、xenomai_xxx.config、ethercat.config、jailhouse.config、x100.config、qt5_eglfs.config、openamp_xxx.config、phytiumpi_sdcard.config |
| phytium_defconfig | linux_xxx.config、e2000_optee.config、phytiumpi_sdcard.config、xenomai_xxx.config、ethercat.config、jailhouse.config、openamp_xxx.config |
| phytium_initrd_defconfig | |
# 编译文件系统
@ -115,6 +121,15 @@ configs/linux_5.10_rt.config
(3)镜像的输出位置
生成的根文件系统、内核、img 镜像位于output/images目录。
### 更换Ubuntu版本
使用phytium_ubuntu_defconfig编译的Ubuntu系统,默认版本是Ubuntu22.04,如果需要编译Ubuntu20.04请执行:
(1)使用phytium_ubuntu_defconfig作为基础配置项,合并支持Ubuntu20.04的配置:
`$ ./support/kconfig/merge_config.sh configs/phytium_ubuntu_defconfig configs/ubuntu_20.04.config`
(2)编译
`$ make`
(3)镜像的输出位置
生成的根文件系统、内核、img 镜像位于output/images目录。
### 支持XFCE桌面
(1)使用phytium_debian_defconfig或phytium_ubuntu_defconfig作为基础配置项,合并支持desktop的配置:
`$ ./support/kconfig/merge_config.sh configs/phytium_xxx_defconfig configs/desktop.config`
@ -239,6 +254,23 @@ $ make
qt5相关的文件被安装到根文件系统的/usr目录:
头文件安装到/usr/include/qt5,库安装到/usr/lib,plugins安装到/usr/lib/qt/plugins,examples安装到/usr/lib/qt/examples。
### 支持OpenAMP
本项目还支持编译OpenAMP,手动编译OpenAMP裸跑二进制镜像请参考:`https://gitee.com/phytium_embedded/phytium-standalone-sdk` ,
手动编译OpenAMP FreeRTOS二进制镜像请参考:`https://gitee.com/phytium_embedded/phytium-free-rtos-sdk`
Buildroot中集成了OpenAMP裸跑二进制镜像和OpenAMP FreeRTOS二进制镜像,支持将OpenAMP二进制镜像、用户空间测试程序编译并安装到系统上,OpenAMP支持linux 4.19,linux 5.10内核。如果需要编译OpenAMP请执行:
(1)根据自己开发板的CPU型号,修改configs/openamp_standalone.config中的变量BR2_PACKAGE_PHYTIUM_STANDALONE_CPU_NAME,
以及configs/openamp_free_rtos.config中的变量BR2_PACKAGE_PHYTIUM_FREE_RTOS_CPU_NAME,支持的值有”e2000q”, “phytiumpi”, “d2000”, “ft2004”。
(2)使用phytium_debian_defconfig、phytium_ubuntu_defconfig或phytium_defconfig作为基础配置项,合并支持openamp的配置:
`./support/kconfig/merge_config.sh configs/phytium_xxx_defconfig configs/openamp_xxx.config`
其中,`openamp_xxx.config`为`openamp_standalone.config`或`openamp_free_rtos.config`。
(3)编译
`$ make`
(4)镜像的输出位置
生成的根文件系统、内核、img 镜像位于output/images目录。
(5)文件的安装路径
将OpenAMP二进制镜像openamp_core0.elf安装到/lib/firmware;用户空间测试程序安装到/usr/bin。
关于OpenAMP的使用方法等更多信息,请参考`https://gitee.com/phytium_embedded/phytium-embedded-docs/tree/master/open-amp`
### initrd
initrd支持E2000和D2000开发板,如果需要使用initrd,请按照以下步骤编译:
(1)配置及编译initrd
@ -347,6 +379,7 @@ $ sudo umount /dev/sdb2
SATA盘:
```
=>setenv bootargs console=ttyAMA1,115200 audit=0 earlycon=pl011,0x2800d000 root=/dev/sda2 rw;
=>saveenv;
=>fatload scsi 0:1 0x90100000 Image;
=>fatload scsi 0:1 0x90000000 e2000q-demo-board.dtb;
=>booti 0x90100000 - 0x90000000
@ -354,11 +387,13 @@ SATA盘:
U盘:
```
=>setenv bootargs console=ttyAMA1,115200 audit=0 earlycon=pl011,0x2800d000 root=/dev/sda2 rootdelay=5 rw;
=>saveenv;
=>usb start
=>fatload usb 0:1 0x90100000 Image;
=>fatload usb 0:1 0x90000000 e2000q-demo-board.dtb;
=>booti 0x90100000 - 0x90000000
```
注:由于执行了saveenv命令,下次启动时不用执行第一条setenv bootargs命令。
### UEFI启动系统
如果是使用img 镜像安装系统,将存储设备接到开发板,启动开发板电源,即可自动启动系统。
@ -441,12 +476,12 @@ $ make
1. 下载ubuntu及debian太慢或报错?
目前下载ubuntu及debian的源为清华大学镜像,如果遇到下载很慢,或者下载报错:
`E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?`
从而导致编译的phytium_e2000_debian_desktop_defconfig或phytium_e2000_ubuntu_desktop_defconfig没有桌面问题,
从而导致编译的带Xfce桌面的系统没有桌面等问题,
请将清华源更换为中科大源,即将以下文件
```
board/phytium/common/post-custom-skeleton-ubuntu-base-20.04.sh
board/phytium/common/post-custom-skeleton-ubuntu.sh
board/phytium/common/ubuntu-package-installer
board/phytium/common/post-custom-skeleton-debian-base-11.sh
board/phytium/common/post-custom-skeleton-debian-11.sh
board/phytium/common/debian-package-installer
```
中的`mirrors.tuna.tsinghua.edu.cn`改为`mirrors.ustc.edu.cn`

17
board/phytium/common/debian-package-installer

@ -62,17 +62,6 @@ do_distrorfs_second_stage() {
for pkg in task-xfce-desktop ukui-greeter; do
DEBIAN_FRONTEND=noninteractive apt -y install $pkg || true
done
if [ $5 = phytiumX100 ]; then
mkdir -p /usr/local/var/log
sed -i '1 a /usr/local/lib' /etc/ld.so.conf.d/aarch64-linux-gnu.conf
ldconfig
ln -sf /usr/local/bin/Xorg /usr/bin/X
sed -i '2 a rm -rf /home/*/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml' /etc/X11/Xsession.d/55xfce4-session
sed -i '17 a Environment="LD_LIBRARY_PATH=/usr/local/lib"' /lib/systemd/system/lightdm.service
gpasswd -a lightdm render
gpasswd -a lightdm video
gpasswd -a lightdm audio
fi
usermod -a -G video,render,audio user
ln -sf /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service
@ -83,12 +72,6 @@ do_distrorfs_second_stage() {
fi
if [ $5 = phytium ]; then
echo 'defaults.pcm.!card phytiumpe220xi2' >> /etc/asound.conf
echo 'defaults.ctl.!card phytiumpe220xi2' >> /etc/asound.conf
echo 'default-sink = alsa_output.platform-sound.stereo-fallback' >> /etc/pulse/client.conf
fi
# clean cached packages
apt-get clean

6
board/phytium/common/post-custom-skeleton-debian-11.sh

@ -154,7 +154,7 @@ setup_distribution_info () {
tgtfile=$RFSDIR/usr/lib/os-release
echo NAME=\"$distroname\" > $tgtfile
echo VERSION=${DISTROTYPE}-$distroversion >> $tgtfile
echo ID=Phytium >> $tgtfile
echo ID=debian >> $tgtfile
echo VERSION_ID=$distroversion >> $tgtfile
echo PRETTY_NAME=\"Ubuntu Built with Buildroot, based on Ubuntu $distroversion LTS\" >> $tgtfile
echo VERSION_CODENAME=$distro >> $tgtfile
@ -166,11 +166,7 @@ setup_distribution_info () {
plat_name()
{
if grep -Eq "^BR2_PACKAGE_XORG_ROGUE_UMLIBS=y$" ${BR2_CONFIG}; then
echo "phytiumX100"
else
echo "phytium"
fi
}
arch_type()

33
board/phytium/common/post-custom-skeleton-ubuntu-20.04.sh → board/phytium/common/post-custom-skeleton-ubuntu.sh

@ -1,7 +1,5 @@
#!/usr/bin/env bash
distro=focal
trap recover_from_ctrl_c INT
recover_from_ctrl_c()
@ -74,7 +72,7 @@ do_distrorfs_first_stage() {
if [ ! -d $RFSDIR/debootstrap ]; then
echo "testdeboot"
export LANG=en_US.UTF-8
sudo debootstrap --arch=$1 --foreign focal $RFSDIR https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports
sudo debootstrap --arch=$1 --foreign $4 $RFSDIR https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports
[ $1 != amd64 -a ! -f $RFSDIR/usr/bin/qemu-${tgtarch}-static ] && sudo cp $(which qemu-${tgtarch}-static) $RFSDIR/usr/bin
echo "installing for second-stage ..."
@ -90,7 +88,7 @@ do_distrorfs_first_stage() {
sudo chroot $RFSDIR dpkg --configure -a
fi
sudo chroot $RFSDIR ubuntu-package-installer $1 $distro $5 $3 $6 $7
sudo chroot $RFSDIR ubuntu-package-installer $1 $4 $5 $3 $6 $7
if [ "x$?" != "x0" ]; then
do_recover_from_error "ubuntu-package-installer failed"
exit 1
@ -108,12 +106,12 @@ do_distrorfs_first_stage() {
chmod +rw -R $RFSDIR/var/lib/snapd/
fi
if [ $distro = focal ]; then
if [ $4 = focal ]; then
echo Ubuntu,20.04 | tee $RFSDIR/etc/.firststagedone 1>/dev/null
elif [ $distro = bionic ]; then
echo Ubuntu,18.04.5 | tee $RFSDIR/etc/.firststagedone 1>/dev/null
elif [ $4 = jammy ]; then
echo Ubuntu,22.04 | tee $RFSDIR/etc/.firststagedone 1>/dev/null
fi
setup_distribution_info $5 $2 $1
setup_distribution_info $5 $2 $1 $4
#rm $RFSDIR/etc/apt/apt.conf
rm $RFSDIR/dev/* -rf
@ -123,6 +121,7 @@ setup_distribution_info () {
DISTROTYPE=$1
RFSDIR=$2
tarch=$3
distro=$4
distroname=`head -1 $RFSDIR/etc/.firststagedone | cut -d, -f1`
distroversion=`head -1 $RFSDIR/etc/.firststagedone | cut -d, -f2`
releaseversion="$distroname (based on $DISTROTYPE-$distroversion-base) ${tarch}"
@ -156,7 +155,7 @@ setup_distribution_info () {
tgtfile=$RFSDIR/usr/lib/os-release
echo NAME=\"$distroname\" > $tgtfile
echo VERSION=${DISTROTYPE}-$distroversion >> $tgtfile
echo ID=Phytium >> $tgtfile
echo ID=ubuntu >> $tgtfile
echo VERSION_ID=$distroversion >> $tgtfile
echo PRETTY_NAME=\"Ubuntu Built with Buildroot, based on Ubuntu $distroversion LTS\" >> $tgtfile
echo VERSION_CODENAME=$distro >> $tgtfile
@ -168,11 +167,7 @@ setup_distribution_info () {
plat_name()
{
if grep -Eq "^BR2_PACKAGE_XORG_ROGUE_UMLIBS=y$" ${BR2_CONFIG}; then
echo "phytiumX100"
else
echo "phytium"
fi
}
arch_type()
@ -193,6 +188,14 @@ full_rtf()
fi
}
ubuntu_distro()
{
if grep -Eq "^BR2_ROOTFS_SKELETON_UBUNTU_FOCAL=y$" ${BR2_CONFIG}; then
echo "focal"
else
echo "jammy"
fi
}
main()
{
@ -200,14 +203,12 @@ main()
rm -rf $1/*
# run first stage do_distrorfs_first_stage arm64 ${1} ubuntu-additional_packages_list focal ubuntu
do_distrorfs_first_stage $(arch_type) ${1} ubuntu-additional_packages_list focal ubuntu $(plat_name) $(full_rtf)
do_distrorfs_first_stage $(arch_type) ${1} ubuntu-additional_packages_list $(ubuntu_distro) ubuntu $(plat_name) $(full_rtf)
# change the hostname to "platforms-Ubuntu"
echo $(plat_name)-Ubuntu > ${1}/etc/hostname
if [ $distro = focal ]; then
sed -i "s/float(n\[0\])/float(n[0].split()[0])/" ${1}/usr/share/pyshared/lsb_release.py
fi
exit $?
}

37
board/phytium/common/ubuntu-package-installer

@ -34,10 +34,10 @@ do_distrorfs_second_stage() {
asl=/etc/apt/sources.list
rm -f $asl
cat <<-EOF > $asl
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-security main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ $2 main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ $2-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ $2-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ $2-security main restricted universe multiverse
EOF
chmod +777 /tmp
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C \
@ -60,20 +60,23 @@ do_distrorfs_second_stage() {
echo installed additional packages.
if [ $6 = desktop ]; then
for pkg in xfce4 ukui-greeter firefox; do
for pkg in xfce4 ukui-greeter; do
DEBIAN_FRONTEND=noninteractive apt -y install $pkg || true
done
if [ $5 = phytiumX100 ]; then
mkdir -p /usr/local/var/log
sed -i '1 a /usr/local/lib' /etc/ld.so.conf.d/aarch64-linux-gnu.conf
ldconfig
ln -sf /usr/local/bin/Xorg /usr/bin/X
sed -i '2 a rm -rf /home/*/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml' /etc/X11/Xsession.d/55xfce4-session
sed -i '13 a Environment="LD_LIBRARY_PATH=/usr/local/lib"' /lib/systemd/system/lightdm.service
gpasswd -a lightdm render
gpasswd -a lightdm video
gpasswd -a lightdm audio
if [ $2 = jammy ]; then
sed -i 's/debian-x-terminal-emulator/gnome-terminal/g' /etc/xdg/xfce4/helpers.rc || true
DEBIAN_FRONTEND=noninteractive apt -y install software-properties-common || true
DEBIAN_FRONTEND=noninteractive add-apt-repository -y ppa:mozillateam/ppa || true
sed -i 's/ppa.launchpadcontent.net/launchpad.proxy.ustclug.org/g' /etc/apt/sources.list.d/mozillateam-*.list && \
DEBIAN_FRONTEND=noninteractive apt -y update || true
cat <<-EOF > /etc/apt/preferences.d/mozillateamppa
Package: firefox
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 501
EOF
fi
DEBIAN_FRONTEND=noninteractive apt -y install firefox || true
usermod -a -G video,render,audio user
ln -sf /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service
@ -83,10 +86,6 @@ do_distrorfs_second_stage() {
echo 'user-session=xfce' >> /etc/lightdm/lightdm.conf
fi
if [ $5 = phytium ]; then
echo 'defaults.pcm.!card phytiumpe220xi2' >> /etc/asound.conf
echo 'defaults.ctl.!card phytiumpe220xi2' >> /etc/asound.conf
fi
# clean cached packages
apt-get clean

2
board/phytium/common/ubuntu_overlay/etc/asound.conf

@ -1,2 +0,0 @@
defaults.pcm.!card phytiumpe220xi2
defaults.ctl.!card phytiumpe220xi2

7
board/phytium/grub-d2000.cfg

@ -1,7 +0,0 @@
set default="0"
set timeout="5"
menuentry "Buildroot" {
linux /Image root=/dev/sda2 rootwait rw
initrd /initrd
}

6
board/phytium/post-image.sh

@ -2,8 +2,4 @@
BOARD_DIR="$(dirname $0)"
if grep -Eq "^BR2_PACKAGE_XORG_ROGUE_UMLIBS=y$" ${BR2_CONFIG}; then
cp -f ${BOARD_DIR}/grub-d2000.cfg ${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg
else
cp -f ${BOARD_DIR}/grub.cfg ${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg
fi
cp -f ${BOARD_DIR}/grub.cfg ${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg

9
configs/openamp_free_rtos.config

@ -0,0 +1,9 @@
# kernel patch for e2000q\phytiumpi\d2000\ft2004, kernel version of 4.19 and 5.10
BR2_LINUX_KERNEL_PATCH="$(LINUX_PKGDIR)/kernel-patches/openamp/0001-modify-the-dts-of-e2000q-and-phytiumpi-to-enable-hom.patch"
# rpmsg-demo
BR2_PACKAGE_RPMSG_DEMO=y
# free-rtos openamp
BR2_PACKAGE_PHYTIUM_FREE_RTOS=y
BR2_PACKAGE_PHYTIUM_FREE_RTOS_CPU_NAME="e2000q"

9
configs/openamp_standalone.config

@ -0,0 +1,9 @@
# kernel patch for e2000q\phytiumpi\d2000\ft2004, kernel version of 4.19 and 5.10
BR2_LINUX_KERNEL_PATCH="$(LINUX_PKGDIR)/kernel-patches/openamp/0001-modify-the-dts-of-e2000q-and-phytiumpi-to-enable-hom.patch"
# rpmsg-demo
BR2_PACKAGE_RPMSG_DEMO=y
# standalone openamp
BR2_PACKAGE_PHYTIUM_STANDALONE=y
BR2_PACKAGE_PHYTIUM_STANDALONE_CPU_NAME="e2000q"

2
configs/phytium_ubuntu_defconfig

@ -13,7 +13,7 @@ BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/phytium/genimage-5.10.cfg"
# custom skeleton
BR2_ROOTFS_SKELETON_CUSTOM=y
BR2_ROOTFS_SKELETON_UBUNTU=y
BR2_ROOTFS_POST_CUSTOM_SKELETON_SCRIPT="board/phytium/common/post-custom-skeleton-ubuntu-20.04.sh"
BR2_ROOTFS_POST_CUSTOM_SKELETON_SCRIPT="board/phytium/common/post-custom-skeleton-ubuntu.sh"
BR2_ROOTFS_POST_BUILD_SCRIPT="board/phytium/common/post-build.sh"
BR2_INIT_NONE=y
BR2_ENABLE_LOCALE_PURGE=n

1
configs/ubuntu_20.04.config

@ -0,0 +1 @@
BR2_ROOTFS_SKELETON_UBUNTU_FOCAL=y

153
linux/kernel-patches/openamp/0001-modify-the-dts-of-e2000q-and-phytiumpi-to-enable-hom.patch

@ -0,0 +1,153 @@
From 628d8bea52ba87c0b46eb6d4b489b6fa6fee561a Mon Sep 17 00:00:00 2001
From: weishanshan1084 <weishanshan1084@phytium.com.cn>
Date: Wed, 21 Feb 2024 14:11:08 +0800
Subject: [PATCH] modify the dts of e2000q and phytiumpi to enable homo_rproc
Signed-off-by: weishanshan1084 <weishanshan1084@phytium.com.cn>
---
.../boot/dts/phytium/e2000q-come-board.dts | 4 ++++
.../boot/dts/phytium/e2000q-demo-board.dts | 4 ++++
.../boot/dts/phytium/e2000q-edu-board.dts | 4 ++++
.../boot/dts/phytium/e2000q-hanwei-board.dts | 4 ++++
.../boot/dts/phytium/e2000q-miniitx-board.dts | 4 ++++
.../boot/dts/phytium/e2000q-vpx-board.dts | 4 ++++
arch/arm64/boot/dts/phytium/pe2204.dtsi | 20 +++++++++++++++++++
.../boot/dts/phytium/phytiumpi_firefly.dts | 4 ++++
8 files changed, 48 insertions(+)
diff --git a/arch/arm64/boot/dts/phytium/e2000q-come-board.dts b/arch/arm64/boot/dts/phytium/e2000q-come-board.dts
index 8041464684..57fe545214 100755
--- a/arch/arm64/boot/dts/phytium/e2000q-come-board.dts
+++ b/arch/arm64/boot/dts/phytium/e2000q-come-board.dts
@@ -258,6 +258,10 @@ &gpio5 {
status = "okay";
};
+&homo_rproc {
+ status = "okay";
+};
+
&pwm1 {
phytium,db = <0 0 0 1000 1000 0>;
status = "okay";
diff --git a/arch/arm64/boot/dts/phytium/e2000q-demo-board.dts b/arch/arm64/boot/dts/phytium/e2000q-demo-board.dts
index a9d892fbbf..6ee897ccb1 100644
--- a/arch/arm64/boot/dts/phytium/e2000q-demo-board.dts
+++ b/arch/arm64/boot/dts/phytium/e2000q-demo-board.dts
@@ -268,6 +268,10 @@ &pmdk_dp {
status = "okay";
};
+&homo_rproc {
+ status = "okay";
+};
+
&rng0 {
status = "okay";
};
diff --git a/arch/arm64/boot/dts/phytium/e2000q-edu-board.dts b/arch/arm64/boot/dts/phytium/e2000q-edu-board.dts
index 5e9dd98c04..cdca4ecbff 100755
--- a/arch/arm64/boot/dts/phytium/e2000q-edu-board.dts
+++ b/arch/arm64/boot/dts/phytium/e2000q-edu-board.dts
@@ -345,3 +345,7 @@ &keypad {
0x03030044 /*KEY_44*/>;
status = "okay";
};
+
+&homo_rproc {
+ status = "okay";
+};
diff --git a/arch/arm64/boot/dts/phytium/e2000q-hanwei-board.dts b/arch/arm64/boot/dts/phytium/e2000q-hanwei-board.dts
index 5649d0826b..263b3b1f27 100755
--- a/arch/arm64/boot/dts/phytium/e2000q-hanwei-board.dts
+++ b/arch/arm64/boot/dts/phytium/e2000q-hanwei-board.dts
@@ -209,6 +209,10 @@ &gpio4 {
status = "okay";
};
+&homo_rproc {
+ status = "okay";
+};
+
&gpio5 {
status = "okay";
};
diff --git a/arch/arm64/boot/dts/phytium/e2000q-miniitx-board.dts b/arch/arm64/boot/dts/phytium/e2000q-miniitx-board.dts
index e2adaa4d51..409e6a34ec 100644
--- a/arch/arm64/boot/dts/phytium/e2000q-miniitx-board.dts
+++ b/arch/arm64/boot/dts/phytium/e2000q-miniitx-board.dts
@@ -323,6 +323,10 @@ &can1 {
status = "okay";
};
+&homo_rproc {
+ status = "okay";
+};
+
&rng0 {
status = "okay";
};
diff --git a/arch/arm64/boot/dts/phytium/e2000q-vpx-board.dts b/arch/arm64/boot/dts/phytium/e2000q-vpx-board.dts
index ce2bc39bc2..4413588b81 100755
--- a/arch/arm64/boot/dts/phytium/e2000q-vpx-board.dts
+++ b/arch/arm64/boot/dts/phytium/e2000q-vpx-board.dts
@@ -316,6 +316,10 @@ &can1 {
status = "okay";
};
+&homo_rproc {
+ status = "okay";
+};
+
&rng0 {
status = "okay";
};
diff --git a/arch/arm64/boot/dts/phytium/pe2204.dtsi b/arch/arm64/boot/dts/phytium/pe2204.dtsi
index 201a01e752..a2f192c361 100644
--- a/arch/arm64/boot/dts/phytium/pe2204.dtsi
+++ b/arch/arm64/boot/dts/phytium/pe2204.dtsi
@@ -10,6 +10,26 @@
/ {
compatible = "phytium,pe2204";
+ reserved-memory {
+ #address-cells = <0x2>;
+ #size-cells = <0x2>;
+ ranges;
+ rproc: rproc@b0100000 {
+ /*下面的保留物理地址可以根据机器实际指定地址范围 */
+ no-map;
+ reg = <0x0 0xb0100000 0x0 0x19900000>;
+ };
+ };
+
+ homo_rproc: homo_rproc@0 {
+ compatible = "homo,rproc";
+ remote-processor = <3>;
+ inter-processor-interrupt = <9>;
+ memory-region = <&rproc>;
+ firmware-name = "openamp_core0.elf";
+ status = "disabled";
+ };
+
aliases {
ethernet0 = &macb0;
ethernet1 = &macb1;
diff --git a/arch/arm64/boot/dts/phytium/phytiumpi_firefly.dts b/arch/arm64/boot/dts/phytium/phytiumpi_firefly.dts
index 56f4e689ea..651a28156f 100644
--- a/arch/arm64/boot/dts/phytium/phytiumpi_firefly.dts
+++ b/arch/arm64/boot/dts/phytium/phytiumpi_firefly.dts
@@ -311,6 +311,10 @@ &pmdk_dp {
status = "okay";
};
+&homo_rproc {
+ status = "okay";
+};
+
&rng0 {
status = "okay";
};
--
2.25.1

3
package/Config.in

@ -441,6 +441,9 @@ menu "Firmware"
source "package/vpu-lib/Config.in"
source "package/phytium-tools/Config.in"
source "package/phyuboot/Config.in"
source "package/phytium-standalone/Config.in"
source "package/phytium-free-rtos/Config.in"
source "package/rpmsg-demo/Config.in"
endmenu
source "package/18xx-ti-utils/Config.in"
source "package/a10disp/Config.in"

2
package/aarch64-none-elf-toolchain/aarch64-none-elf-toolchain.hash

@ -0,0 +1,2 @@
# Locally calculated
sha256 6f74b1ee370caeb716688d2e467e5b44727fdc0ed56023fe5c72c0620019ecef gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz

26
package/aarch64-none-elf-toolchain/aarch64-none-elf-toolchain.mk

@ -0,0 +1,26 @@
################################################################################
#
# aarch64-none-elf-toolchain
#
################################################################################
AARCH64_NONE_ELF_TOOLCHAIN_VERSION = 10.3-2021.07
AARCH64_NONE_ELF_TOOLCHAIN_SITE = https://developer.arm.com/-/media/Files/downloads/gnu-a/$(AARCH64_NONE_ELF_TOOLCHAIN_VERSION)/binrel
AARCH64_NONE_ELF_TOOLCHAIN_SOURCE = gcc-arm-$(AARCH64_NONE_ELF_TOOLCHAIN_VERSION)-x86_64-aarch64-none-elf.tar.xz
AARCH64_NONE_ELF_TOOLCHAIN_LICENSE = GPL-3.0+
HOST_AARCH64_NONE_ELF_TOOLCHAIN_INSTALL_DIR = $(HOST_DIR)/opt/aarch64-none-elf
define HOST_AARCH64_NONE_ELF_TOOLCHAIN_INSTALL_CMDS
rm -rf $(HOST_AARCH64_NONE_ELF_TOOLCHAIN_INSTALL_DIR)
mkdir -p $(HOST_AARCH64_NONE_ELF_TOOLCHAIN_INSTALL_DIR)
cp -rf $(@D)/* $(HOST_AARCH64_NONE_ELF_TOOLCHAIN_INSTALL_DIR)/
mkdir -p $(HOST_DIR)/bin
cd $(HOST_DIR)/bin && \
for i in ../opt/aarch64-none-elf/bin/*; do \
ln -sf $$i; \
done
endef
$(eval $(host-generic-package))

6
package/jailhouse/jailhouse.mk

@ -55,10 +55,14 @@ define JAILHOUSE_INSTALL_TARGET_CMDS
$(if $(BR2_PACKAGE_JAILHOUSE_HELPER_SCRIPTS), \
cd $(@D)/src/jailhouse && $(PKG_PYTHON_SETUPTOOLS_ENV) $(HOST_DIR)/bin/python setup.py install --no-compile $(PKG_PYTHON_SETUPTOOLS_INSTALL_TARGET_OPTS))
$(and $(BR2_PACKAGE_JAILHOUSE_HELPER_SCRIPTS),$(BR2_ROOTFS_SKELETON_UBUNTU), \
$(and $(BR2_PACKAGE_JAILHOUSE_HELPER_SCRIPTS),$(BR2_ROOTFS_SKELETON_UBUNTU_FOCAL), \
mkdir -p $(TARGET_DIR)/usr/local/lib/python3.8/dist-packages && \
mv $(TARGET_DIR)/usr/lib/python3.10/site-packages/pyjailhouse $(TARGET_DIR)/usr/local/lib/python3.8/dist-packages && \
mv $(TARGET_DIR)/usr/lib/python3.10/site-packages/pyjailhouse-0.12-py3.10.egg-info $(TARGET_DIR)/usr/local/lib/python3.8/dist-packages/pyjailhouse-0.12-py3.8.egg-info)
$(and $(BR2_PACKAGE_JAILHOUSE_HELPER_SCRIPTS),$(BR2_ROOTFS_SKELETON_UBUNTU_JAMMY), \
mkdir -p $(TARGET_DIR)/usr/local/lib/python3.10/dist-packages && \
mv $(TARGET_DIR)/usr/lib/python3.10/site-packages/pyjailhouse $(TARGET_DIR)/usr/local/lib/python3.10/dist-packages && \
mv $(TARGET_DIR)/usr/lib/python3.10/site-packages/pyjailhouse-0.12-py3.10.egg-info $(TARGET_DIR)/usr/local/lib/python3.10/dist-packages/pyjailhouse-0.12-py3.10.egg-info)
$(and $(BR2_PACKAGE_JAILHOUSE_HELPER_SCRIPTS),$(BR2_ROOTFS_SKELETON_DEBIAN), \
mkdir -p $(TARGET_DIR)/usr/local/lib/python3.9/dist-packages && \
mv $(TARGET_DIR)/usr/lib/python3.10/site-packages/pyjailhouse $(TARGET_DIR)/usr/local/lib/python3.9/dist-packages && \

16
package/phytium-free-rtos/Config.in

@ -0,0 +1,16 @@
config BR2_PACKAGE_PHYTIUM_FREE_RTOS
bool "phytium-free-rtos"
help
Phytium-FreeRTOS-SDK for OpenAMP
https://gitee.com/phytium_embedded/phytium-free-rtos-sdk
if BR2_PACKAGE_PHYTIUM_FREE_RTOS
config BR2_PACKAGE_PHYTIUM_FREE_RTOS_CPU_NAME
string "CPU name"
help
Supported CPU:
"e2000q", "phytiumpi", "d2000", "ft2004".
endif

31
package/phytium-free-rtos/phytium-free-rtos.mk

@ -0,0 +1,31 @@
################################################################################
#
# phytium-free-rtos
#
################################################################################
PHYTIUM_FREE_RTOS_VERSION = v0.7.1
PHYTIUM_FREE_RTOS_SITE = https://gitee.com/phytium_embedded/phytium-free-rtos-sdk.git
PHYTIUM_FREE_RTOS_SITE_METHOD = git
PHYTIUM_FREE_RTOS_DEPENDENCIES = host-phytium-iot-environment host-python3 linux
PHYTIUM_FREE_RTOS_CPU = $(call qstrip,$(BR2_PACKAGE_PHYTIUM_FREE_RTOS_CPU_NAME))
define PHYTIUM_FREE_RTOS_CONFIGURE_CMDS
cd $(@D) && \
$(TARGET_MAKE_ENV) ./install.py
endef
define PHYTIUM_FREE_RTOS_BUILD_CMDS
if [[ $(LINUX_VERSION_PROBED) = 5.10* ]]; then \
PHYTIUM_FREE_RTOS_ARCH=aarch64; \
else \
PHYTIUM_FREE_RTOS_ARCH=aarch32; \
fi && \
. $(HOST_DIR)/etc/profile.d/phytium_dev.sh && \
cd $(@D)/example/system/amp/openamp_for_linux && \
$(TARGET_MAKE_ENV) $(MAKE1) config_$(PHYTIUM_FREE_RTOS_CPU)_$${PHYTIUM_FREE_RTOS_ARCH} && \
mkdir -p $(TARGET_DIR)/lib/firmware && \
$(TARGET_MAKE_ENV) $(MAKE1) image USR_BOOT_DIR=$(TARGET_DIR)/lib/firmware
endef
$(eval $(generic-package))

19
package/phytium-iot-environment/phytium-iot-environment.mk

@ -0,0 +1,19 @@
################################################################################
#
# phytium-iot-environment
#
################################################################################
# source included in the package
HOST_PHYTIUM_IOT_ENVIRONMENT_DEPENDENCIES = host-arm-gnu-a-toolchain host-aarch64-none-elf-toolchain
define HOST_PHYTIUM_IOT_ENVIRONMENT_EXTRACT_CMDS
cp $(HOST_PHYTIUM_IOT_ENVIRONMENT_PKGDIR)/phytium_dev.sh $(@D)
endef
define HOST_PHYTIUM_IOT_ENVIRONMENT_INSTALL_CMDS
mkdir -p $(HOST_DIR)/etc/profile.d
$(INSTALL) -D -m 0755 $(@D)/phytium_dev.sh $(HOST_DIR)/etc/profile.d
endef
$(eval $(host-generic-package))

7
package/phytium-iot-environment/phytium_dev.sh

@ -0,0 +1,7 @@
### PHYTIUM DEV SETTING START
export AARCH32_CROSS_PATH=${HOST_DIR}/opt/gcc-arm-none-eabi
export PATH=$PATH:${AARCH32_CROSS_PATH}/bin
export AARCH64_CROSS_PATH=${HOST_DIR}/opt/aarch64-none-elf
export PATH=$PATH:${AARCH64_CROSS_PATH}/bin
export PHYTIUM_DEV_PATH=${HOST_DIR}
### PHYTIUM DEV SETTING END

16
package/phytium-standalone/Config.in

@ -0,0 +1,16 @@
config BR2_PACKAGE_PHYTIUM_STANDALONE
bool "phytium-standalone"
help
Phytium-Standalone-SDK for OpenAMP
https://gitee.com/phytium_embedded/phytium-standalone-sdk
if BR2_PACKAGE_PHYTIUM_STANDALONE
config BR2_PACKAGE_PHYTIUM_STANDALONE_CPU_NAME
string "CPU name"
help
Supported CPU:
"e2000q", "phytiumpi", "d2000", "ft2004".
endif

26
package/phytium-standalone/phytium-standalone.mk

@ -0,0 +1,26 @@
################################################################################
#
# phytium-standalone
#
################################################################################
PHYTIUM_STANDALONE_VERSION = v1.2.3
PHYTIUM_STANDALONE_SITE = https://gitee.com/phytium_embedded/phytium-standalone-sdk.git
PHYTIUM_STANDALONE_SITE_METHOD = git
PHYTIUM_STANDALONE_DEPENDENCIES = host-phytium-iot-environment host-python3 linux
PHYTIUM_STANDALONE_CPU = $(call qstrip,$(BR2_PACKAGE_PHYTIUM_STANDALONE_CPU_NAME))
define PHYTIUM_STANDALONE_BUILD_CMDS
if [[ $(LINUX_VERSION_PROBED) = 5.10* ]]; then \
PHYTIUM_STANDALONE_ARCH=aarch64; \
else \
PHYTIUM_STANDALONE_ARCH=aarch32; \
fi && \
. $(HOST_DIR)/etc/profile.d/phytium_dev.sh && \
cd $(@D)/example/system/amp/openamp_for_linux && \
$(TARGET_MAKE_ENV) $(MAKE1) config_$(PHYTIUM_STANDALONE_CPU)_$${PHYTIUM_STANDALONE_ARCH} && \
mkdir -p $(TARGET_DIR)/lib/firmware && \
$(TARGET_MAKE_ENV) $(MAKE1) image USR_BOOT_DIR=$(TARGET_DIR)/lib/firmware
endef
$(eval $(generic-package))

1
package/phytium-tools/phytium-tools.mk

@ -19,6 +19,7 @@ define PHYTIUM_TOOLS_INSTALL_TARGET_CMDS
$(INSTALL) -m 755 -D $(@D)/resize.sh $(TARGET_DIR)/usr/bin/
$(INSTALL) -m 644 -D $(@D)/systemd-hciattach.service $(TARGET_DIR)/lib/systemd/system/
$(INSTALL) -m 444 -D $(@D)/rtw8821c_fw.bin $(TARGET_DIR)/lib/firmware/rtw88/
$(INSTALL) -m 755 -D $(@D)/rc.local $(TARGET_DIR)/etc/
endef
$(eval $(generic-package))

16
package/phytium-tools/src/rc.local

@ -0,0 +1,16 @@
#!/bin/bash
lock_file="/var/tmp/resize.lock"
if [ -f "$lock_file" ]; then
echo "Partition expansion script has already been executed."
exit 0
fi
# if the scripts has not been executed yet, create a lock file
touch "$lock_file"
# execute the partition expansion script
nohup /usr/bin/resize.sh &
exit 0

6
package/rpmsg-demo/Config.in

@ -0,0 +1,6 @@
config BR2_PACKAGE_RPMSG_DEMO
bool "rpmsg-demo"
help
Phytium openamp rpmsg-demo.
https://gitee.com/phytium_embedded/phytium-embedded-docs/blob/master/open-amp/rpmsg-demo.c

2
package/rpmsg-demo/rpmsg-demo.hash

@ -0,0 +1,2 @@
# Locally calculated
sha256 c5fb688bbe06eabebf2a1f3cb37d352e5bf3834e2f5116ecce51cda27dff4ac3 rpmsg-demo.c

22
package/rpmsg-demo/rpmsg-demo.mk

@ -0,0 +1,22 @@
################################################################################
#
# rpmsg-demo
#
################################################################################
RPMSG_DEMO_SITE = https://gitee.com/phytium_embedded/phytium-embedded-docs/raw/master/open-amp
RPMSG_DEMO_SOURCE = rpmsg-demo.c
define RPMSG_DEMO_EXTRACT_CMDS
cp $(RPMSG_DEMO_DL_DIR)/$(RPMSG_DEMO_SOURCE) $(@D)
endef
define RPMSG_DEMO_BUILD_CMDS
$(TARGET_CC) -o $(@D)/rpmsg-demo $(@D)/$(RPMSG_DEMO_SOURCE)
endef
define RPMSG_DEMO_INSTALL_TARGET_CMDS
$(INSTALL) -m 0755 -D $(@D)/rpmsg-demo $(TARGET_DIR)/usr/bin/
endef
$(eval $(generic-package))

20
system/Config.in

@ -35,6 +35,26 @@ config BR2_ROOTFS_SKELETON_UBUNTU
help
Custom target skeleton is ubuntu.
if BR2_ROOTFS_SKELETON_UBUNTU
choice
prompt "Choose Ubuntu version"
default BR2_ROOTFS_SKELETON_UBUNTU_JAMMY
config BR2_ROOTFS_SKELETON_UBUNTU_JAMMY
bool "Ubuntu 22.04"
help
Ubuntu 22.04 LTS (Jammy Jellyfish)
config BR2_ROOTFS_SKELETON_UBUNTU_FOCAL
bool "Ubuntu 20.04"
help
Ubuntu 20.04 LTS (Focal Fossa)
endchoice
endif
config BR2_ROOTFS_SKELETON_DEBIAN
bool "custom target skeleton is debian"
help

Loading…
Cancel
Save