本系列记载作者来到一个新的车载后装市场小公司,负责从新开始维护一套代码的心路过程。系统使用瑞芯微的rk3368芯片,版本是PX5_Android_8.0_release_20180726,从无到有的每个patch修改以及思考。其中着重点是驱动和系统相关,由于涉及到公司保密,所以APP部分暂时不贴过多的代码,只是针对系统bug进行记录。
2020_02_10 ---- 2020_02_13
将对应版本解压后编译并且下载到了我们自己的主机上,但是出现奇怪的无法启动的log,系统一直重启,经过对比分析觉得是调试口修改问题(不是很清楚原因,估计是硬件上调试口更换,软件没换导致的),最后解决办法也是,通过修改了uboot和内核的调试口,从而系统可以正常启动进入系统,并且屏幕正常显示(此处窃喜)。
其中编译脚本如下:
cd u-boot
make clean
make px5_kernel4.4_defconfig
make ARCHV=aarch64 -j12
cd ..
cd kernel
make ARCH=arm64 rockchip_defconfig
make ARCH=arm64 rk3368-px5-evb-android.img -j12
cd ..
source build/envsetup.sh
lunch px5-userdebug
make -j12
./mkimage.sh
PACK_TOOL_DIR=RKTools/linux/Linux_Pack_Firmware
mkdir -p $PACK_TOOL_DIR/rockdev/Image/
cp -f rockdev/Image-px5/* $PACK_TOOL_DIR/rockdev/Image/
echo "Make update.img"
cd $PACK_TOOL_DIR/rockdev && ./mkupdate.sh
if [ $? -eq 0 ]; then
echo "Make update image ok!"
else
echo "Make update image failed!"
exit 1
fi
cd -
mv $PACK_TOOL_DIR/rockdev/update.img rockdev/Image-px5/
rm $PACK_TOOL_DIR/rockdev/Image -rf
修改的patch有两个部分:
1.内核:
diff --git a/arch/arm64/boot/dts/rockchip/rk3368-px5-evb-android.dts b/arch/arm64/boot/dts/rockchip/rk3368-px5-evb-android.dts
index 3eb50bb..3496368 100644
--- a/arch/arm64/boot/dts/rockchip/rk3368-px5-evb-android.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3368-px5-evb-android.dts
@@ -52,19 +52,19 @@
compatible = "rockchip,px5-evb", "rockchip,px5", "rockchip,rk3368";
chosen {
- bootargs = "earlycon=uart8250,mmio32,0xff1c0000 swiotlb=1 firmware_class.path=/system/vendor/firmware";
+ bootargs = "earlycon=uart8250,mmio32,0xff690000 swiotlb=1 firmware_class.path=/system/vendor/firmware";
};
fiq_debugger: fiq-debugger {
compatible = "rockchip,fiq-debugger";
- rockchip,serial-id = <4>;
+ rockchip,serial-id = <2>;
rockchip,wake-irq = <0>;
/* If enable uart uses irq instead of fiq */
rockchip,irq-mode-enable = <0>;
/* Only 115200 and 1500000 */
rockchip,baudrate = <115200>;
pinctrl-names = "default";
- pinctrl-0 = <&uart4_xfer>;
+ pinctrl-0 = <&uart2_xfer>;
interrupts = ;
};
@@ -1218,7 +1218,7 @@
};
&uart2 {
- status = "disabled";
+ status = "okay";
};
2.uboot:
diff --git a/configs/px5_kernel4.4_defconfig b/configs/px5_kernel4.4_defconfig
index 10e7482..5b119de 100644
--- a/configs/px5_kernel4.4_defconfig
+++ b/configs/px5_kernel4.4_defconfig
@@ -1,4 +1,4 @@
-CONFIG_SYS_EXTRA_OPTIONS="RKCHIP_PX5_KERNEL4_4,RKCHIP_RK3368,PRODUCT_MID,NORMAL_WORLD,SECOND_LEVEL_BOOTLOADER,UART_NUM=UART_CH4"
+CONFIG_SYS_EXTRA_OPTIONS="RKCHIP_PX5_KERNEL4_4,RKCHIP_RK3368,PRODUCT_MID,NORMAL_WORLD,SECOND_LEVEL_BOOTLOADER,UART_NUM=UART_CH2"
CONFIG_ARM=y
CONFIG_ROCKCHIP_ARCH64=y
CONFIG_PLAT_RK33XX=y
u-boot/include/autoconf.mk
CONFIG_UART_NUM="UART_CH2"