海思SD3403/SS928开发(二)环境搭建

一:ubuntu环境搭建

  1. 需要Ubuntu 18.04的版本,如果版本过低,SDK会出现编译异常问题。

  2. 标题请自行配置网络,并安装 nfs,samba,ssh 等网络组件

  3. 按照《SS928V100 SDK 安装以及升级使用说明.pdf》文档安装SDK、工具链

  4. 操作系统安装完成,且已经配置好网络环境,则可以继续如下步骤

步骤 1 配置默认使用 bash

执行 sudo dpkg-reconfigure dash 选择 no

步骤 2 安装软件包

执行:

sudo apt-get install make libc6-i386 lib32z1 lib32stdc++6 zlib1g-dev libncurses5-dev ncurses-term libncursesw5-dev g++ u-boot-tools texinfo texlive gawk libssl-dev openssl bc p7zip-full gperf bison flex diffutils git unzip

这里列举几个问题
问题一:

*
* Unable to find the ncurses package.
* Install ncurses (ncurses-devel or libncurses-dev
* depending on your distribution).
*
scripts/kconfig/Makefile:228: recipe for target 'scripts/kconfig/.mconf-cfg' failed
make[1]: *** [scripts/kconfig/.mconf-cfg] Error 1
Makefile:534: recipe for target 'menuconfig' failed
make: *** [menuconfig] Error 2

问题二:

UPD     scripts/kconfig/.mconf-cfg
  HOSTCC  scripts/kconfig/mconf.o
  YACC    scripts/kconfig/zconf.tab.c
/bin/sh: 1: bison: not found
scripts/Makefile.lib:196: recipe for target 'scripts/kconfig/zconf.tab.c' failed
make[1]: *** [scripts/kconfig/zconf.tab.c] Error 127
Makefile:534: recipe for target 'menuconfig' failed
make: *** [menuconfig] Error 2

步骤 3 mtd-utils 依赖以下几个库,以 ubuntu 为例,安装方式请参考下面命令:

由于mtd-utils 通过 pkg-config 工具检查各个库是否正常安装,因此请参考如下方式设
置 pkg-config 工具搜索路径:

export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/lib/x86_64-linux-
gnu/pkgconfig"

步骤 4 e2fsprogs 依赖 texlive 库,安装方式请参考如下命令:

sudo apt-get install texlive

二:uboot、内核、文件系统制作

1:编译整个osdrv目录

make BOOT_MEDIA=spi CHIP=ss928v100 all
参数说明:
BOOT_MEDIA:spi nor或spi nand启动选择spi;并口nand启动选择nand;emmc启动选择emmc
问题:mtd-utils编译错误

configure WARNING cannot find ZLIB library required for mkfs programs
configure mtd-utils can optionally be built without mkfs.ubifs
configure mtd-utils can optionally be built without mkfs.jffs2
configure error missing one or more dependencies
Makefile47 recipe for target ‘mtd_board’ failed
make[1] [mtd_board] Error 1
make[1] 离开目录“SS524V100_SDK_V2.0.1.0open_sourcemtd-utils”
Makefile330 recipe for target ‘boardtools’ failed
make [boardtools] Error 2

解决方法:

sudo apt-get install zlib1g-dev liblzo2-dev uuid-dev pkg-config automake

注意:编译整个osdrv目录需要虚拟机内存和处理器数量足够多,亲测在8G内存,处理器总数8时编译会出现虚拟机死机等问题。

2:单独编译

kernel

进入open_source/linux目录

tar xf linux-4.19.90.tar.gz
mv linux-4.19.90 linux-4.19.y
cd linux-4.19.y
patch -p1 < ../linux-4.19.90.patch
cp arch/arm64/configs/ss928v100_defconfig .config
(emmc启动时执行如下操作: cp arch/arm64/configs/ss928v100_emmc_defconfig .config)
(并口 nand 启动时执行如下操作:cp rch/arm64/configs/ss928v100_nand_defconfig .config)
make ARCH=arm64 CROSS_COMPILE=aarch64-mix210-linux- menuconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-mix210-linux- uImage -j 20

进入open_source/trusted-firmware-a/trusted-firmware-a-2.2目录,
	  执行mk.sh脚本(参考主Makefile中atf命令进行适配):
	  chmod 777 mk.sh
	  ./mk.sh
在open_source/trusted-firmware-a/trusted-firmware-a-2.2/build/ss928v100/release目录下,生成的fip.bin文件就是ATF+kernle的镜像.

非安全启动Boot Image

进入uboot源代码目录

tar xf u-boot-2020.01.tar.bz2
cd u-boot-2020.01
patch -p1 < ../u-boot-2020.01.patch
cp configs/ss928v100_defconfig .config(仅用于 spi nor/nand flash)
(emmc启动时执行如下操作: cp configs/ss928v100_emmc_defconfig .config)
(并口 nand 启动时执行如下操作:cp configs/ss928v100_nand_defconfig .config)
make ARCH=arm CROSS_COMPILE=aarch64-mix210-linux- menuconfig
make ARCH=arm CROSS_COMPILE=aarch64-mix210-linux- -j 20

Windows下进入到osdrv/tools/pc/uboot_tools/目录下打开对应单板的Excel文件,在main标签中点击"Generate reg bin file"按钮,生成reg_info.bin即为对应平台的表格文件。
从tools/pc/uboot_tools目录拷贝reg_info.bin到boot源代码目录,重命名为.reg

cp ../../../osdrv/tools/pc/uboot_tools/reg_info.bin .reg
make ARCH=arm CROSS_COMPILE=aarch64-mix210-linux- u-boot-z.bin

open_source/uboot/u-boot-2020.01下生成的u-boot-ss928v100.bin即为“快速启动”使用的u-boot镜像
非安全启动方法需要进行如下操作

tar xf boot.tar.gz
cd boot/gsl/
 make
 cd ../image_map/
 cp ../gsl/pub/gsl.bin ./
 cp ../../../../open_source/u-boot/u-boot-2020.01/u-boot-ss928v100.bin ./u-boot-original.bin 
 cp ../../../../open_source/u-boot/u-boot-2020.01/.reg ./
 python3 oem/oem_quick_build.py

osdrv/components/boot/image_map/image/oem/下生成的boot_image.bin即为“非安全启动”使用的Boot Image。

文件系统

按照资料所说

spi flash使用jffs2格式的镜像,制作jffs2镜像时,需要用到spi flash的块大小。这些信息会在uboot启动时会打印出来。建议使用时先直接运行mkfs.jffs2工具,根据打印信息填写相关参数。下面以块大小为64KB为例:
osdrv/pub/bin/pc/mkfs.jffs2 -d osdrv/pub/rootfs_glibc_xxx -l -e 0x10000 -o osdrv/pub/rootfs_ss928v100_64k.jffs2

nand flash使用ubifs格式的镜像,制作ubifs镜像时,需要用到nand flash的pagesize和blocksize。这些信息会在uboot启动时会打印出来。
下面以2KB pagesize、128KB block size为例:
./tools/pc/ubi_sh/mkubiimg.sh ss928v100 2k 128k osdrv/pub/rootfs_glibc_xxx 32M osdrv/pub/bin/pc

emmc 使用ext4格式的镜像:以96MB镜像为例:
dd if=/dev/zero of=osdrv/pub/ss928v100_image_glibc/rootfs_ss928v100_96M.ext4 bs=512 count=196608
备注:(196608 = 96 *1024 * 1024 / 512)
./osdrv/pub/bin/pc/mkfs.ext4 osdrv/pub/ss928v100_image_glibc/rootfs_ss928v100_96M.ext4
cd open_source/e2fsprogs/out/pc/contrib
./populate-extfs.sh ../../../../../osdrv/pub/rootfs_glibc_arm64 ../../../../../osdrv/pub/ss928v100_image_glibc/rootfs_ss928v100_96M.ext4

制作出的文件系统烧写板子里会出现

Starting kernel ...
"Synchronous Abort" handler, esr 0x02000000
elr: ffffffffe8935000 lr : 0000000048815374 (reloc)
elr: 0000000000080000 lr : 000000005ff60374
x0 : 0000000000000000 x1 : 0000000000000000
x2 : 0000000000000000 x3 : 0000000000000000
x4 : 0000000000080000 x5 : 0000000000000001
x6 : 00000000000003c9 x7 : 0000000000000000
x8 : 000000005feaa860 x9 : 0000000000000002
x10: 0000000082000023 x11: 0000000000000002
x12: 0000000000000002 x13: 0000000000000200
x14: 000000000000000c x15: 000000005ff5faa0
x16: 0000000000000000 x17: 0000000000000000
x18: 000000005feaadf8 x19: 000000005ffcecb0
x20: 0000000000000000 x21: 0000000000000000
x22: 0000000000000001 x23: 000000005feadd28
x24: 0000000000000001 x25: 000000005feadd28
x26: 000000005ffc21a8 x27: 0000000000000000
x28: 0000000042000040 x29: 000000005feaa9a0

Code: ffea8043 0903034b ff6d110c ffea8037 (09010343)
Resetting CPU ...

resetting ...

等一系列问题,后来跟换文件系统后正常启动
下面是下载制作文件系统的执行文件

链接:https://pan.baidu.com/s/1ej3qIVt784LIV4IMfWAHLA
提取码:27am
例子:

./make_ext4fs -l 2000M -s rootfs.ext4 rootfs_glibc

如果大家有新解决方法,请留言!!!!

猜你喜欢

转载自blog.csdn.net/jiangshan_hua/article/details/127702986