Browse Source

opi4a: update sun55iw3 boot script, kernel config and add spinor support

baiywt 1 tháng trước cách đây
mục cha
commit
a91f8e9038

+ 1 - 0
external/cache/sources/orangepi-config/debian-config-functions

@@ -62,6 +62,7 @@ function main(){
 	[[ "$LINUXFAMILY" == "rockchip-rk3588" ]] && OVERLAYDIR="/boot/dtb/rockchip/overlay";
 	[[ "$LINUXFAMILY" == "sun50iw9" && "$BRANCH" == "current" ]] && OVERLAYDIR="/boot/dtb/sunxi/overlay";
 	[[ "$LINUXFAMILY" == "sun50iw9" && "$BRANCH" == "next" ]] && OVERLAYDIR="/boot/dtb/allwinner/overlay";
+	[[ "$LINUXFAMILY" == "sun55iw3" ]] && OVERLAYDIR="/boot/dtb/allwinner/overlay";
 	[[ "$LINUXFAMILY" == "rockchip-rk356x" ]] && OVERLAYDIR="/boot/dtb/rockchip/overlay";
 	[[ "$LINUXFAMILY" == "ky" ]] && OVERLAYDIR="/boot/dtb/ky/overlay";
 	# detect desktop

+ 2 - 3
external/config/boards/orangepi4a.conf

@@ -6,6 +6,5 @@ BOOT_FDT_FILE="allwinner/sun55i-t527-orangepi-4a.dtb"
 MODULES="bcmdhd vin_v4l2"
 KERNEL_TARGET="current"
 DISTRIB_TYPE_CURRENT="bookworm jammy"
-BOOT_LOGO="desktop"
-REVISION="1.0.2"
-SRC_EXTLINUX="yes"
+REVISION="1.0.4"
+SKIP_BOOTSPLASH="yes" # Skip boot splash patch, conflicts with CONFIG_VT=yes

+ 2 - 0
external/config/bootenv/sun55iw3.txt

@@ -0,0 +1,2 @@
+verbosity=1
+bootlogo=true

+ 60 - 0
external/config/bootscripts/boot-sun55iw3.cmd

@@ -0,0 +1,60 @@
+# DO NOT EDIT THIS FILE
+#
+# Please edit /boot/orangepiEnv.txt to set supported parameters
+#
+
+setenv load_addr "0x43100000"
+setenv overlay_error "false"
+# default values
+setenv verbosity "1"
+setenv console "both"
+setenv bootlogo "false"
+setenv rootfstype "ext4"
+setenv docker_optimizations "on"
+setenv earlycon "on"
+
+echo "Boot script loaded from ${devtype} ${devnum}"
+
+if test -e ${devtype} ${devnum} ${prefix}orangepiEnv.txt; then
+	load ${devtype} ${devnum} ${load_addr} ${prefix}orangepiEnv.txt
+	env import -t ${load_addr} ${filesize}
+fi
+
+if test "${logo}" = "disabled"; then setenv logo "logo.nologo"; fi
+
+if test "${console}" = "display" || test "${console}" = "both"; then setenv consoleargs "console=tty1"; fi
+if test "${console}" = "serial" || test "${console}" = "both"; then setenv consoleargs "console=ttyAS0,115200 ${consoleargs}"; fi
+if test "${earlycon}" = "on"; then setenv consoleargs "earlycon=uart8250,mmio32,0x02500000 ${consoleargs}"; fi
+if test "${bootlogo}" = "true"; then
+	setenv consoleargs "splash plymouth.ignore-serial-consoles ${consoleargs}";
+else
+	setenv consoleargs "splash=verbose ${consoleargs}"
+fi
+
+setenv bootargs "root=${rootdev} rootwait rootfstype=${rootfstype} ${consoleargs} consoleblank=0 loglevel=${verbosity} clk_ignore_unused swiotlb=65536 usb-storage.quirks=${usbstoragequirks} ${extraargs} ${extraboardargs}"
+
+if test "${docker_optimizations}" = "on"; then setenv bootargs "${bootargs} cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1"; fi
+
+load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}uInitrd
+load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}uImage
+
+load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile}
+fdt addr ${fdt_addr_r}
+fdt resize 65536
+for overlay_file in ${overlays}; do
+	if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/allwinner/overlay/${overlay_prefix}-${overlay_file}.dtbo; then
+		echo "Applying kernel provided DT overlay ${overlay_prefix}-${overlay_file}.dtbo"
+		fdt apply ${load_addr} || setenv overlay_error "true"
+	fi
+done
+for overlay_file in ${user_overlays}; do
+	if load ${devtype} ${devnum} ${load_addr} ${prefix}overlay-user/${overlay_file}.dtbo; then
+		echo "Applying user provided DT overlay ${overlay_file}.dtbo"
+		fdt apply ${load_addr} || setenv overlay_error "true"
+	fi
+done
+
+bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
+
+# Recompile with:
+# mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr

+ 78 - 33
external/config/kernel/linux-5.15-sun55iw3-current.config

@@ -200,6 +200,14 @@ CONFIG_AW_MMC_V5P3X=y
 CONFIG_AW_MMC_CQHCI=y
 # end of SD/MMC Drivers
 
+#
+# NAND Drivers
+#
+CONFIG_AW_NAND=y
+CONFIG_AW_RAWNAND=y
+# CONFIG_AW_RAWNAND_CD is not set
+# end of NAND Drivers
+
 # CONFIG_AW_MTD is not set
 # CONFIG_SUNXI_REDEPOSIT is not set
 
@@ -351,8 +359,8 @@ CONFIG_AW_DRM_DE=y
 CONFIG_AW_DRM_TCON=y
 CONFIG_AW_DRM_TCON_TV=y
 CONFIG_AW_DRM_TCON_TOP=y
-# CONFIG_AW_DRM_LVDS is not set
-# CONFIG_AW_DRM_RGB is not set
+CONFIG_AW_DRM_LVDS=y
+CONFIG_AW_DRM_RGB=y
 CONFIG_AW_DRM_DSI=y
 CONFIG_AW_DRM_HDMI_TX=y
 # CONFIG_AW_DRM_HDMI14 is not set
@@ -367,8 +375,8 @@ CONFIG_AW_DRM_INNO_EDP13=y
 # sunxi drm panels select
 #
 CONFIG_PANEL_DSI_GENERAL=y
-# CONFIG_PANEL_LVDS_GENERAL is not set
-# CONFIG_PANEL_RGB_GENERAL is not set
+CONFIG_PANEL_LVDS_GENERAL=y
+CONFIG_PANEL_RGB_GENERAL=y
 CONFIG_PANEL_EDP_GENERAL=y
 # end of sunxi drm panels select
 
@@ -434,6 +442,7 @@ CONFIG_SND_SOC_SUNXI_AAUDIO=y
 CONFIG_SND_SOC_SUNXI_I2S=y
 CONFIG_SND_SOC_SUNXI_CODEC_HDMI=y
 # CONFIG_SND_SOC_SUNXI_CODEC_EDP is not set
+# CONFIG_SND_SOC_SUNXI_CODEC_AV is not set
 CONFIG_SND_SOC_SUNXI_COMPONENTS=y
 # CONFIG_SND_SOC_SUNXI_SFX is not set
 # CONFIG_SND_SOC_SUNXI_TEST_CLK is not set
@@ -484,6 +493,7 @@ CONFIG_AW_SID=y
 #
 CONFIG_AW_PCIE_RC=y
 # CONFIG_AW_PCIE_EP is not set
+# CONFIG_AW_PCIE_NONE is not set
 # end of PCIe Drivers
 
 #
@@ -512,8 +522,9 @@ CONFIG_AW_GMAC_MDIO=y
 # Stmmac Drivers
 #
 CONFIG_AW_STMMAC_ETH=y
+CONFIG_AW_DWMAC_SUNXI=y
 CONFIG_AW_STMMAC_SELFTESTS=y
-# CONFIG_AW_STMMAC_PCI is not set
+# CONFIG_AW_STMMAC_UIO is not set
 # end of Stmmac Drivers
 
 #
@@ -559,6 +570,8 @@ CONFIG_USB_SUNXI_UDC0=y
 #
 # USB Type-C Multiplexer/DeMultiplexer Switch support
 #
+# CONFIG_TYPEC_MUX_GPIO_GMA340 is not set
+# CONFIG_TYPEC_MUX_SUNXI_PHY_SWITCHER is not set
 # end of USB Type-C Multiplexer/DeMultiplexer Switch support
 # end of USB Type-C Support
 
@@ -566,7 +579,41 @@ CONFIG_USB_SUNXI_UDC0=y
 # USB Gadget Drivers
 #
 # CONFIG_USB_SUNXI_GADGET is not set
+
+#
+# USB Gadget precomposed configurations
+#
+# CONFIG_USB_ZERO is not set
+# CONFIG_USB_AUDIO is not set
+# CONFIG_USB_ETH is not set
+# CONFIG_USB_G_NCM is not set
+# CONFIG_USB_GADGETFS is not set
+# CONFIG_USB_FUNCTIONFS is not set
+# CONFIG_USB_MASS_STORAGE is not set
+# CONFIG_USB_G_SERIAL is not set
+# CONFIG_USB_MIDI_GADGET is not set
+# CONFIG_USB_G_PRINTER is not set
+# CONFIG_USB_CDC_COMPOSITE is not set
+# CONFIG_USB_G_ACM_MS is not set
+# CONFIG_USB_G_MULTI is not set
+# CONFIG_USB_G_HID is not set
+# CONFIG_USB_G_DBGP is not set
+# CONFIG_USB_G_WEBCAM is not set
+# CONFIG_USB_RAW_GADGET is not set
+# end of USB Gadget precomposed configurations
 # end of USB Gadget Drivers
+
+#
+# USB EXTCON Support
+#
+# CONFIG_USB_SUNXI_EXTCON is not set
+# end of USB EXTCON Support
+
+#
+# USB PHY Support
+#
+# CONFIG_USB_SUNXI_PHY is not set
+# end of USB PHY Support
 # end of USB Drivers
 
 #
@@ -779,7 +826,7 @@ CONFIG_NVMEM_AW_SID=y
 # CONFIG_AW_GPU_PM_DOMAINS is not set
 CONFIG_AW_PM_DOMAINS=y
 CONFIG_AW_PCK600_DOMAINS=y
-# CONFIG_AW_POWER_DOMAIN_TEST is not set
+CONFIG_AW_POWER_DOMAIN_TEST=y
 # end of Power Domain Drivers
 
 #
@@ -797,6 +844,7 @@ CONFIG_AW_MFD_PMU_EXT_I2C=y
 #
 CONFIG_AW_REGULATOR_AXP2101=y
 CONFIG_AW_REGULATOR_PMU_EXT=y
+CONFIG_AW_AXP1530_WORKAROUND_DVM=y
 # CONFIG_AW_REGULATOR_PWM is not set
 
 #
@@ -845,6 +893,7 @@ CONFIG_AW_EVENT_DDR=y
 #
 CONFIG_AW_SUNXI_DSUFREQ=y
 # CONFIG_AW_SUNXI_DSUFREQ_TEST is not set
+# CONFIG_AW_SUNXI_DSUFREQ_ADJUST is not set
 # end of sunxi dsufreq Drivers
 
 #
@@ -958,16 +1007,16 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
 # CONFIG_FAT_DEFAULT_UTF8 is not set
 
 #
-# AWLINK Drivers
+# AW andes adaption
 #
-# end of AWLINK Drivers
-# end of Device Drivers
+# CONFIG_AW_ANDES_DMA_ADAPT is not set
+# end of AW andes adaption
 
 #
-# Avaota SBC Drivers
+# AWLINK Drivers
 #
-# CONFIG_AVA_FB_TFT is not set
-# end of Avaota SBC Drivers
+# end of AWLINK Drivers
+# end of Device Drivers
 # end of Allwinner BSP
 
 CONFIG_CC_VERSION_TEXT="aarch64-none-linux-gnu-gcc (GNU Toolchain for the Arm Architecture 11.2-2022.02 (arm-11.14)) 11.2.1 20220111"
@@ -2684,8 +2733,12 @@ CONFIG_MTD_OF_PARTS=y
 #
 # User Modules And Translation Layers
 #
-# CONFIG_MTD_BLOCK is not set
-# CONFIG_MTD_BLOCK_RO is not set
+CONFIG_MTD_BLKDEVS=y
+CONFIG_MTD_BLOCK=y
+
+#
+# Note that in some cases UBI block is preferred. See MTD_UBI_BLOCK.
+#
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
 # CONFIG_INFTL is not set
@@ -3185,7 +3238,15 @@ CONFIG_NET_VENDOR_SMSC=y
 # CONFIG_SMSC9420 is not set
 CONFIG_NET_VENDOR_SOCIONEXT=y
 CONFIG_NET_VENDOR_STMICRO=y
-# CONFIG_STMMAC_ETH is not set
+CONFIG_STMMAC_ETH=y
+CONFIG_STMMAC_SELFTESTS=y
+CONFIG_STMMAC_PLATFORM=y
+# CONFIG_DWMAC_DWC_QOS_ETH is not set
+CONFIG_DWMAC_GENERIC=y
+CONFIG_DWMAC_SUNXI=y
+CONFIG_DWMAC_SUN8I=y
+# CONFIG_DWMAC_INTEL_PLAT is not set
+# CONFIG_STMMAC_PCI is not set
 CONFIG_NET_VENDOR_SUN=y
 # CONFIG_HAPPYMEAL is not set
 # CONFIG_SUNGEM is not set
@@ -3283,6 +3344,7 @@ CONFIG_MDIO_DEVRES=y
 #
 # MDIO Multiplexers
 #
+CONFIG_MDIO_BUS_MUX=y
 # CONFIG_MDIO_BUS_MUX_GPIO is not set
 # CONFIG_MDIO_BUS_MUX_MULTIPLEXER is not set
 # CONFIG_MDIO_BUS_MUX_MMIOREG is not set
@@ -3290,7 +3352,7 @@ CONFIG_MDIO_DEVRES=y
 #
 # PCS device drivers
 #
-# CONFIG_PCS_XPCS is not set
+CONFIG_PCS_XPCS=y
 # end of PCS device drivers
 
 # CONFIG_PPP is not set
@@ -5745,23 +5807,6 @@ CONFIG_USB_CONFIGFS_F_HID=y
 #
 # USB Gadget precomposed configurations
 #
-# CONFIG_USB_ZERO is not set
-# CONFIG_USB_AUDIO is not set
-# CONFIG_USB_ETH is not set
-# CONFIG_USB_G_NCM is not set
-# CONFIG_USB_GADGETFS is not set
-# CONFIG_USB_FUNCTIONFS is not set
-# CONFIG_USB_MASS_STORAGE is not set
-# CONFIG_USB_G_SERIAL is not set
-# CONFIG_USB_MIDI_GADGET is not set
-# CONFIG_USB_G_PRINTER is not set
-# CONFIG_USB_CDC_COMPOSITE is not set
-# CONFIG_USB_G_ACM_MS is not set
-# CONFIG_USB_G_MULTI is not set
-# CONFIG_USB_G_HID is not set
-# CONFIG_USB_G_DBGP is not set
-# CONFIG_USB_G_WEBCAM is not set
-# CONFIG_USB_RAW_GADGET is not set
 # end of USB Gadget precomposed configurations
 
 CONFIG_TYPEC=y

+ 26 - 10
external/config/sources/families/sun55iw3.conf

@@ -1,13 +1,13 @@
 source "${BASH_SOURCE%/*}/include/sunxi64_common.inc"
 
 LINUXFAMILY=sun55iw3
-NAME_KERNEL="uImage"
-NAME_INITRD="uInitrd"
+#NAME_KERNEL="uImage"
+#NAME_INITRD="uInitrd"
 
-SRC_CMDLINE="earlycon=uart8250,mmio32,0x02500000 clk_ignore_unused initcall_debug=0 console=ttyAS0,115200 console=tty0 loglevel=8 cma=64M init=/sbin/init rw no_console_suspend consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0 splash plymouth.ignore-serial-consoles"
+#SRC_CMDLINE="earlycon=uart8250,mmio32,0x02500000 clk_ignore_unused initcall_debug=0 console=ttyAS0,115200 console=tty0 loglevel=8 cma=64M init=/sbin/init rw no_console_suspend consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0 splash plymouth.ignore-serial-consoles"
 
-[[ -z $CPUMIN ]] && CPUMIN=480000
-[[ -z $CPUMAX ]] && CPUMAX=1512000
+[[ -z $CPUMIN ]] && CPUMIN=408000
+[[ -z $CPUMAX ]] && CPUMAX=1800000
 GOVERNOR=ondemand
 
 #ASOUND_STATE=asound.state.sun55iw3-${BRANCH}
@@ -22,11 +22,11 @@ case $BRANCH in
 		[[ $BOARD =~ orangepi4a ]] && BOOTBRANCH='branch:v2018.05-t527'
 
 		KERNELPATCHDIR=${BOARDFAMILY}-${BRANCH}
-		UBOOT_TARGET_MAP=";;dts/${BOARD}-u-boot.dts boot0_sdcard.fex boot_package.fex"
+		UBOOT_TARGET_MAP=";;dts/${BOARD}-u-boot.dts boot0_sdcard.fex boot0_spinor.fex boot_package.fex"
 		UBOOT_COMPILER="arm-linux-gnueabi-"
 		UBOOT_USE_GCC='> 6.0'
-		BOOTENV_FILE=sun50iw9-default.txt
-		BOOTSCRIPT='boot-sun50iw9.cmd:boot.cmd'
+		BOOTENV_FILE='sun55iw3.txt'
+		BOOTSCRIPT='boot-sun55iw3.cmd:boot.cmd'
 		KERNEL_USE_GCC='> 10.0'
 		OFFSET=20
 		ATFSOURCE=""
@@ -48,6 +48,8 @@ family_tweaks_s()
 		run_on_sdcard "systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target" > /dev/null 2>&1
 	fi
 
+	[[ $RELEASE == jammy && ${DESKTOP_ENVIRONMENT} == xfce ]] && chroot $SDCARD /bin/bash -c "apt-get -y -qq install ocl-icd-libopencl1" >/dev/null 2>&1
+
 	if [[ "${BOARD}x" == orangepi4ax ]]; then
 		nvram=$EXTER/cache/sources/orangepi-firmware-git
 		[[ -f ${nvram}/nvram_ap6256.txt-$BOARD ]] && cp ${nvram}/nvram_ap6256.txt-${BOARD} ${SDCARD}/lib/firmware/nvram_ap6256.txt
@@ -55,7 +57,7 @@ family_tweaks_s()
 
 	rsync -a --chown=root:root "${EXTER}"/packages/bsp/overlays_arm64/* ${SDCARD}/
 
-	chroot $SDCARD /bin/bash -c "apt-get -y -qq install rfkill bluetooth bluez bluez-tools ir-keytable tree lirc v4l-utils dnsmasq" >/dev/null 2>&1
+	chroot $SDCARD /bin/bash -c "apt-get -y -qq install mtd-utils rfkill bluetooth bluez bluez-tools ir-keytable tree lirc v4l-utils dnsmasq" >/dev/null 2>&1
 
 	if [[ $BUILD_DESKTOP == yes ]]; then
 
@@ -68,10 +70,12 @@ family_tweaks_s()
 			echo "load-module module-alsa-sink device=hw:0,0 sink_name=AudioCodec-Playback sink_properties=\"device.description='Audio Codec'\"" >> ${SDCARD}/etc/pulse/default.pa
 			echo "load-module module-alsa-sink device=hw:2,0 sink_name=HDMI-Playback sink_properties=\"device.description='HDMI Audio'\"" >> ${SDCARD}/etc/pulse/default.pa
 		fi
+
+		chroot $SDCARD /bin/bash -c "apt-get -y -qq install vlc mpv" >/dev/null 2>&1
 	fi
 
 	if [[ ${BRANCH} == current ]]; then
-		[[ ${SRC_EXTLINUX} != "yes" ]] && sed -i 's/^debug_uart.*/debug_uart=ttyAS0/' "${SDCARD}"/boot/orangepiEnv.txt
+		#[[ ${SRC_EXTLINUX} != "yes" ]] && sed -i 's/^debug_uart.*/debug_uart=ttyAS0/' "${SDCARD}"/boot/orangepiEnv.txt
 		SERIALCON="ttyAS0"
 	fi
 
@@ -143,3 +147,15 @@ uboot_custom_postprocess()
 		fi
 	fi
 }
+
+write_uboot_platform_mtd()
+{
+	if [[ -b /dev/mtdblock0 ]]; then
+		flash_erase /dev/mtd0 0 512
+		size=$(stat --format="%s" $1/boot0_spinor.fex)
+		mtd_debug write /dev/mtd0 0 $size $1/boot0_spinor.fex
+		size=$(stat --format="%s" $1/boot_package.fex)
+		mtd_debug write /dev/mtd0 65536 $size $1/boot_package.fex
+		sync
+	fi
+}

+ 2 - 0
external/packages/bsp/common/usr/lib/orangepi/orangepi-hardware-optimization

@@ -356,6 +356,8 @@ prepare_board() {
 			;;
 		orangepi4a)
 			echo usb_host > /sys/devices/platform/soc@3000000/10.usbc0/otg_role
+			echo 4 1 > /sys/devices/platform/soc@3000000/2020000.nsi-controller/nsi-pmu/hwmon0/port_abs_bwlen
+			echo 4 400 > /sys/devices/platform/soc@3000000/2020000.nsi-controller/nsi-pmu/hwmon0/port_abs_bwl
 			chmod 666 /dev/vipcore
 			tinymix -D 0 23 1
 			tinymix -D 0 26 1

+ 2 - 8
external/packages/bsp/common/usr/sbin/opi-bkimg

@@ -91,7 +91,7 @@ sdsize=$(bc -l <<< "scale=0; ((($imagesize * 1.35) / 1 + 0) / 4 + 1) * 4")
 
 mnt_free=$(df -BM /mnt | grep ^/dev | head -1 | awk '{print $4}' | tr -cd '[0-9]. \n')
 
-if [ "$mnt_free" -lt "$sdsize" ]; then
+if [[ "$mnt_free" -lt "$sdsize" ]]; then
 	display_alert "Not enough space in /mnt" "Required: ${sdsize}MiB, Available: ${mnt_free}MiB" "err"
 	exit 1
 fi
@@ -120,13 +120,7 @@ display_alert "Creating partitions" "${bootfs:+/boot: $bootfs }root: $ROOTFS_TYP
 	echo "$rootpart : name=\"rootfs\", start=${next}MiB, type=${type}"
 } | sfdisk $image >> "$logfile" 2>&1
 
-LOOP=$(losetup -f)
-[[ -z $LOOP ]] && echo "error" && exit
-
-losetup $LOOP $image
-
-partprobe $LOOP
-
+LOOP=$(losetup -fP --show $image)
 rootdevice="${LOOP}p${rootpart}"
 
 display_alert "Creating rootfs" "$ROOTFS_TYPE on $rootdevice"

+ 0 - 5
external/packages/bsp/overlays_arm64/etc/docker/daemon.json

@@ -1,5 +0,0 @@
-{
-  "registry-mirrors": [
-    "https://docker.mirrors.ustc.edu.cn"
-  ]
-}

BIN
external/packages/pack-uboot/sun55iw3/bin/boot0_spinor.fex