全志哪吒D1-H Tina Linux Ubuntu 22.04入门踩坑日记

本文记录了在WSL2Ubuntu22.04环境下编译哪吒D1-HTinaLinux遇到的C++标准、m4SIGSTKSZ、libfakeroot的STAT_VER等问题以及解决方法,还包括bash编译依赖问题和刷入开发板的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

系统环境

WSL2 Ubuntu 22.04
头铁,就不用官方建议的14.04,一路踩下来确实也能用,另外WSL1不支持32位的ELF,在最后打包的时候会用到一个32位的可执行文件,理论上讲去找找其他替代的img打包工具应该也可以,不过我懒得研究全志这个镜像文件该怎么封装了,所以这里尽量使用WSL2。
至于物理机Ubuntu,我至今没整明白那个QT4的鬼LiveSuit怎么才能不闪退,所以在Windows+WSL下用PhoenixSuit刷板子的体验应该是要好于在Ubuntu下做全部事情的。
环境搭建按照官网官网指南一步一步走就可以了

对于Ubuntu 16.04以上版本,部分软件包已不再提供或者采用了其他的包,执行上述命令时, 安装失败的包可先忽略,进一步执行以下命令:

指南里这一段在22.04不用管,它上面的命令直接是安装成功的。

源码编译

一路按照官网指南走就可以了,在编译过程中会依次遇到几个error,过程中参考了D1tina2.0编译的排错过程,把其中的几个写成了patch文件。

mklibs-readelf的C++标准问题

error: ISO C++17 does not allow dynamic exception specifications

需在Makefile指定C++标准

tina/tools/mklibs/patches/0001-Declare-cxxstd.patch

--- a/src/mklibs-readelf/Makefile.am
+++ b/src/mklibs-readelf/Makefile.am
@@ -3,1 +3,2 @@ 

+ CXXFLAGS += -std=gnu++98

m4的SIGSTKSZ问题

error: missing binary operator before token

将SIGSTKSZ改为足够大的常量

tina/tools/mklibs/patches/011-fix-sigstksz.patch

--- a/lib/c-stack.c
+++ b/lib/c-stack.c
@@ -50,15 +50,16 @@
 #if ! HAVE_STACK_T && ! defined stack_t
 typedef struct sigaltstack stack_t;
 #endif
-#ifndef SIGSTKSZ
-# define SIGSTKSZ 16384
-#elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
-/* libsigsegv 2.6 through 2.8 have a bug where some architectures use
-   more than the Linux default of an 8k alternate stack when deciding
-   if a fault was caused by stack overflow.  */
-# undef SIGSTKSZ
-# define SIGSTKSZ 16384
-#endif
+/* Storage for the alternate signal stack.
+ * 64 KiB is not too large for Gnulib-using apps, and is large enough
+ * for all known platforms. Smaller sizes may run into trouble.
+ * For example, libsigsegv 2.6 through 2.8 have a bug where some
+ * architectures use more than the Linux default of an 8 KiB alternate
+ * stack when deciding if a fault was caused by stack overflow. */
+static max_align_t alternate_signal_stack[(64 * 1024
+					+ sizeof (max_align_t) - 1)
+					/ sizeof (max_align_t)];
+
 
 #include <stdlib.h>
 #include <string.h>
@@ -128,18 +129,6 @@ die (int signo)
 #if (HAVE_SIGALTSTACK && HAVE_DECL_SIGALTSTACK \
      && HAVE_STACK_OVERFLOW_HANDLING) || HAVE_LIBSIGSEGV
 
-/* Storage for the alternate signal stack.  */
-static union
-{
-  char buffer[SIGSTKSZ];
-
-  /* These other members are for proper alignment.  There's no
-     standard way to guarantee stack alignment, but this seems enough
-     in practice.  */
-  long double ld;
-  long l;
-  void *p;
-} alternate_signal_stack;
 
 static void
 null_action (int signo __attribute__ ((unused)))
@@ -205,8 +194,8 @@ c_stack_action (void (*action) (int))
 
   /* Always install the overflow handler.  */
   if (stackoverflow_install_handler (overflow_handler,
-                                     alternate_signal_stack.buffer,
-                                     sizeof alternate_signal_stack.buffer))
+                                     alternate_signal_stack,
+                                     sizeof alternate_signal_stack))
     {
       errno = ENOTSUP;
       return -1;
@@ -279,14 +268,14 @@ c_stack_action (void (*action) (int))
   stack_t st;
   struct sigaction act;
   st.ss_flags = 0;
+  st.ss_sp = alternate_signal_stack;
+  st.ss_size = sizeof alternate_signal_stack;
 # if SIGALTSTACK_SS_REVERSED
   /* Irix mistakenly treats ss_sp as the upper bound, rather than
      lower bound, of the alternate stack.  */
-  st.ss_sp = alternate_signal_stack.buffer + SIGSTKSZ - sizeof (void *);
-  st.ss_size = sizeof alternate_signal_stack.buffer - sizeof (void *);
-# else
-  st.ss_sp = alternate_signal_stack.buffer;
-  st.ss_size = sizeof alternate_signal_stack.buffer;
+  st.ss_size -= sizeof (void *);
+  char *ss_sp = st.ss_sp;
+  st.ss_sp = ss_sp + st.ss_size;
 # endif
   r = sigaltstack (&st, NULL);
   if (r != 0)
--- a/lib/c-stack.h
+++ b/lib/c-stack.h
@@ -34,7 +34,7 @@
    A null ACTION acts like an action that does nothing.
 
    ACTION must be async-signal-safe.  ACTION together with its callees
-   must not require more than SIGSTKSZ bytes of stack space.  Also,
+   must not require more than 64 KiB of stack space.  Also,
    ACTION should not call longjmp, because this implementation does
    not guarantee that it is safe to return to the original stack.
 

libfakeroot的_STAT_VER问题

error: ‘_STAT_VER’ undeclared (first use in this function)

定义_STAT_VER的值

tina/tools/fakeroot/patches/0001-Fix-STAT_VER.patch

--- a/libfakeroot.c
+++ b/libfakeroot.c
@@ -89,4 +89,13 @@
#define SEND_GET_STAT64(a,b) send_get_stat64(a)
#define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b)
#endif
+ #ifndef _STAT_VER
+ #if defined (aarch64)
+ #define _STAT_VER 0
+ #elif defined (x86_64)
+ #define _STAT_VER 1
+ #else
+ #define _STAT_VER 3
+ #endif
+ #endif


read_fs.o:(.bss+0x0): multiple definition of `bwriter_buffer’; mksquashfs.o:(.bss+0x0): first defined here

tina/tools/squashfskit4/patches/0003-fix-build-failure-against-gcc-10.patch

--- a/squashfs-tools/mksquashfs.h
+++ b/squashfs-tools/mksquashfs.h
@@ -143,7 +143,7 @@ struct append_file {
 #endif
 
 extern struct cache *reader_buffer, *fragment_buffer, *reserve_cache;
-struct cache *bwriter_buffer, *fwriter_buffer;
+extern struct cache *bwriter_buffer, *fwriter_buffer;
 extern struct queue *to_reader, *to_deflate, *to_writer, *from_writer,
 	*to_frag, *locked_fragment, *to_process_frag;
 extern struct append_file **file_mapping;

刷入开发板

打开PhoenixSuit后按住FEL从OTG的Type-C接口接入USB线就可以烧写.img固件了。

其他的问题

编译bash时报错找不到libhistory.so.6

Package bash is missing dependencies for the following libraries:
libhistory.so.6

Tina的依赖关系树有问题,在tina/package/utils/bash/Makefile中33行更改为

  DEPENDS:=+libncurses +libreadline

遇到再更…

哪吒D1开发板是一款基于RISC-V架构的开发板,广泛用于嵌入式系统和物联网设备的开发。适配摄像头到哪吒D1开发板上,可以实现图像采集和处理功能。以下是适配摄像头的基本步骤: ### 1. 硬件连接 首先,需要将摄像头模块与哪吒D1开发板进行物理连接。不同类型的摄像头模块(如USB摄像头、MIPI CSI摄像头)有不同的连接方式: - **USB摄像头**:直接将USB接口插入开发板的USB端口。 - **MIPI CSI摄像头**:需要使用开发板上专用的CSI接口,并确保连接正确。 ### 2. 软件配置 接下来,需要在开发板上配置软件环境,以便能够识别和使用摄像头。 #### a. 安装必要的驱动 根据摄像头类型,安装相应的驱动程序。例如,对于USB摄像头,通常不需要额外的驱动,系统会自动识别。但对于MIPI CSI摄像头,可能需要手动编译和安装驱动。 #### b. 配置内核 如果使用的是Linux操作系统,可能需要配置内核以支持摄像头模块。编辑`/boot/config.txt`文件,添加或修改相关配置参数。 #### c. 安装图像处理库 安装OpenCV或其他图像处理库,以便进行图像采集和处理。例如: ```sh sudo apt-get update sudo apt-get install libopencv-dev python3-opencv ``` ### 3. 测试摄像头 完成硬件连接和软件配置后,可以通过以下命令测试摄像头是否正常工作: - **使用`fswebcam`测试USB摄像头**: ```sh sudo apt-get install fswebcam fswebcam test.jpg ``` - **使用`v4l2-ctl`测试MIPI CSI摄像头**: ```sh sudo apt-get install v4l-utils v4l2-ctl --list-devices ``` ### 4. 编写代码 使用编程语言(如Python)编写代码,调用摄像头进行图像采集和处理。以下是一个简单的Python示例,使用OpenCV库: ```python import cv2 # 打开摄像头 cap = cv2.VideoCapture(0) while True: # 读取帧 ret, frame = cap.read() if not ret: break # 显示帧 cv2.imshow('Camera', frame) # 按下q键退出 if cv2.waitKey(1) & 0xFF == ord('q'): break # 释放摄像头 cap.release() cv2.destroyAllWindows() ``` ### 5. 调试与优化 根据实际需求,调整摄像头参数(如分辨率、帧率)并进行调试和优化。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值