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

系统环境

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

遇到再更…

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值