This commit is contained in:
刘可亮 2024-11-29 16:23:11 +08:00
parent 73fa723435
commit f198a1a4ad
16112 changed files with 7002922 additions and 311996 deletions

View File

@ -166,6 +166,9 @@ endif
add_board: $(BUILD_DIR)/luban-config/conf
@$(TOPDIR)/tools/scripts/add_board.py -c $^ -t $(TOPDIR) -o $(BASE_DIR)
del_board: $(BUILD_DIR)/luban-config/conf
@$(TOPDIR)/tools/scripts/del_board.py -c $^ -t $(TOPDIR) -o $(BASE_DIR)
# Some quick commands
k: linux-rebuild
km: linux-menuconfig

View File

@ -1,3 +1,82 @@
# V1.2.3 #
##新增##
- 新增驱动模块PSADC、EPWM、rx8025t
- USB Gadget增加f_iap功能
- 新增器件支持:
- NANDxtx
- WiFiasr5505、sv6x5x
- 新增第三方包msnlink/zjinnova/Carbit的投屏方案适配、GDB、libpjsip、libsrtp、libatomic_ops
- 新增方案demo88 nor musl
- 默认打开SD卡、U盘的自动挂载功能
##优化##
- 功耗优化包括驱动、PBP等
- Audio支持Fade in/out
- LVGL优化透明度的处理性能支持缩放和任意角度旋转的组合
- 启动流程全面支持自适应DDR Size处理
- NOR方案支持自动计算分区信息
- USB增加外部阻抗的参数配置
- SPI支持配置Sample Delay、Rx Delay
- SID增加时序参数可配置
- DMA增强通道参数的有效性检查
- package支持子目录、外部源码目录的编译管理
- i2c-tools支持10bit模式
- 简化U-Boot的DTS配置合并board-u-boot.dtsi到board.dts
##修改##
- DDR Init默认打开展频功能便于ESD测试
- MPP修正部分MP4文件的播放错误
- test_fb增加"-b"参数显示渐变色块,方便验证硬件环境
- test_gpio增加output的配置功能
# V1.2.2 #
## 新增 ##
- Display支持在线调屏
- MPP支持mp4封装格式
- U-Boot支持MIPI驱动支持xz压缩格式支持DDR Size自适应处理
- FS用户态支持jffs2、squashfs
- 提供独立编译 linux/uboot/dtb 的示例脚本
- 新增器件支持:
- NANDBYTe BY5F1GQ5UAYIG
- NORgd25q256
- panelsw070wv20
- 新增第三方包sqlite、cJSON、freetype、libkcapi-1.4、pulseaudio、libsamplerate、预编译4个常用的Benchmark、
- 新增方案demo88 NOR
- OneStep新增命令del_board
## 优化 ##
- USB支持OTG的动态切换
- PBP支持Boot pin功能
## 修改 ##
- SPL提升size限制为128KB
- AWTK修正若干Bug并进行多处优化
- LVGL重构目录结构支持freetype字体
- Falcon修正SD卡启动时的处理流程
- 编译NAND方案默认不再生成4K block版本的镜像打包原始DTS文件
- SPINAND分区 Image 大小默认从image_cfg.json 中获取,
- 测试示例规范命名格式为test_*
# V1.2.1 #
## 新增 ##
- 新增AWTK的支持
- 新增几款mipi屏的支持
- 新增test-blkdev
- 新增 .gitignore
## 优化 ##
- SPL容量策略
- GStreamer 播放格式添加
## 修改 ##
- OneStep 工具移植到tools目录
# V1.2.0 #

View File

@ -1 +1 @@
eba2ce02f2d983afd3d50ab602305f3383e9295a
65904a5a56db6930a3c989e1e95156e6ccca4c00

Binary file not shown.

Binary file not shown.

BIN
dl/gdb/gdb-12.1.tar.xz Normal file

Binary file not shown.

BIN
dl/gmp/gmp-6.2.1.tar.xz Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,846 @@
/* $NetBSD: queue.h,v 1.70 2015/11/02 15:21:23 christos Exp $ */
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)queue.h 8.5 (Berkeley) 8/20/94
*/
#ifndef _SYS_QUEUE_H_
#define _SYS_QUEUE_H_
/*
* This file defines five types of data structures: singly-linked lists,
* lists, simple queues, tail queues, and circular queues.
*
* A singly-linked list is headed by a single forward pointer. The
* elements are singly linked for minimum space and pointer manipulation
* overhead at the expense of O(n) removal for arbitrary elements. New
* elements can be added to the list after an existing element or at the
* head of the list. Elements being removed from the head of the list
* should use the explicit macro for this purpose for optimum
* efficiency. A singly-linked list may only be traversed in the forward
* direction. Singly-linked lists are ideal for applications with large
* datasets and few or no removals or for implementing a LIFO queue.
*
* A list is headed by a single forward pointer (or an array of forward
* pointers for a hash table header). The elements are doubly linked
* so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before
* or after an existing element or at the head of the list. A list
* may only be traversed in the forward direction.
*
* A simple queue is headed by a pair of pointers, one the head of the
* list and the other to the tail of the list. The elements are singly
* linked to save space, so elements can only be removed from the
* head of the list. New elements can be added to the list after
* an existing element, at the head of the list, or at the end of the
* list. A simple queue may only be traversed in the forward direction.
*
* A tail queue is headed by a pair of pointers, one to the head of the
* list and the other to the tail of the list. The elements are doubly
* linked so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before or
* after an existing element, at the head of the list, or at the end of
* the list. A tail queue may be traversed in either direction.
*
* A circle queue is headed by a pair of pointers, one to the head of the
* list and the other to the tail of the list. The elements are doubly
* linked so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before or after
* an existing element, at the head of the list, or at the end of the list.
* A circle queue may be traversed in either direction, but has a more
* complex end of list detection.
*
* For details on the use of these macros, see the queue(3) manual page.
*/
/*
* Include the definition of NULL only on NetBSD because sys/null.h
* is not available elsewhere. This conditional makes the header
* portable and it can simply be dropped verbatim into any system.
* The caveat is that on other systems some other header
* must provide NULL before the macros can be used.
*/
#ifdef __NetBSD__
#include <sys/null.h>
#endif
#if defined(QUEUEDEBUG)
# if defined(_KERNEL)
# define QUEUEDEBUG_ABORT(...) panic(__VA_ARGS__)
# else
# include <err.h>
# define QUEUEDEBUG_ABORT(...) err(1, __VA_ARGS__)
# endif
#endif
/*
* Singly-linked List definitions.
*/
#define SLIST_HEAD(name, type) \
struct name { \
struct type *slh_first; /* first element */ \
}
#define SLIST_HEAD_INITIALIZER(head) \
{ NULL }
#define SLIST_ENTRY(type) \
struct { \
struct type *sle_next; /* next element */ \
}
/*
* Singly-linked List access methods.
*/
#define SLIST_FIRST(head) ((head)->slh_first)
#define SLIST_END(head) NULL
#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
#define SLIST_FOREACH(var, head, field) \
for((var) = (head)->slh_first; \
(var) != SLIST_END(head); \
(var) = (var)->field.sle_next)
#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = SLIST_FIRST((head)); \
(var) != SLIST_END(head) && \
((tvar) = SLIST_NEXT((var), field), 1); \
(var) = (tvar))
/*
* Singly-linked List functions.
*/
#define SLIST_INIT(head) do { \
(head)->slh_first = SLIST_END(head); \
} while (/*CONSTCOND*/0)
#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
(elm)->field.sle_next = (slistelm)->field.sle_next; \
(slistelm)->field.sle_next = (elm); \
} while (/*CONSTCOND*/0)
#define SLIST_INSERT_HEAD(head, elm, field) do { \
(elm)->field.sle_next = (head)->slh_first; \
(head)->slh_first = (elm); \
} while (/*CONSTCOND*/0)
#define SLIST_REMOVE_AFTER(slistelm, field) do { \
(slistelm)->field.sle_next = \
SLIST_NEXT(SLIST_NEXT((slistelm), field), field); \
} while (/*CONSTCOND*/0)
#define SLIST_REMOVE_HEAD(head, field) do { \
(head)->slh_first = (head)->slh_first->field.sle_next; \
} while (/*CONSTCOND*/0)
#define SLIST_REMOVE(head, elm, type, field) do { \
if ((head)->slh_first == (elm)) { \
SLIST_REMOVE_HEAD((head), field); \
} \
else { \
struct type *curelm = (head)->slh_first; \
while(curelm->field.sle_next != (elm)) \
curelm = curelm->field.sle_next; \
curelm->field.sle_next = \
curelm->field.sle_next->field.sle_next; \
} \
} while (/*CONSTCOND*/0)
/*
* List definitions.
*/
#define LIST_HEAD(name, type) \
struct name { \
struct type *lh_first; /* first element */ \
}
#define LIST_HEAD_INITIALIZER(head) \
{ NULL }
#define LIST_ENTRY(type) \
struct { \
struct type *le_next; /* next element */ \
struct type **le_prev; /* address of previous next element */ \
}
/*
* List access methods.
*/
#define LIST_FIRST(head) ((head)->lh_first)
#define LIST_END(head) NULL
#define LIST_EMPTY(head) ((head)->lh_first == LIST_END(head))
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
#define LIST_FOREACH(var, head, field) \
for ((var) = ((head)->lh_first); \
(var) != LIST_END(head); \
(var) = ((var)->field.le_next))
#define LIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = LIST_FIRST((head)); \
(var) != LIST_END(head) && \
((tvar) = LIST_NEXT((var), field), 1); \
(var) = (tvar))
#define LIST_MOVE(head1, head2) do { \
LIST_INIT((head2)); \
if (!LIST_EMPTY((head1))) { \
(head2)->lh_first = (head1)->lh_first; \
LIST_INIT((head1)); \
} \
} while (/*CONSTCOND*/0)
/*
* List functions.
*/
#if defined(QUEUEDEBUG)
#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field) \
if ((head)->lh_first && \
(head)->lh_first->field.le_prev != &(head)->lh_first) \
QUEUEDEBUG_ABORT("LIST_INSERT_HEAD %p %s:%d", (head), \
__FILE__, __LINE__);
#define QUEUEDEBUG_LIST_OP(elm, field) \
if ((elm)->field.le_next && \
(elm)->field.le_next->field.le_prev != \
&(elm)->field.le_next) \
QUEUEDEBUG_ABORT("LIST_* forw %p %s:%d", (elm), \
__FILE__, __LINE__); \
if (*(elm)->field.le_prev != (elm)) \
QUEUEDEBUG_ABORT("LIST_* back %p %s:%d", (elm), \
__FILE__, __LINE__);
#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field) \
(elm)->field.le_next = (void *)1L; \
(elm)->field.le_prev = (void *)1L;
#else
#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field)
#define QUEUEDEBUG_LIST_OP(elm, field)
#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field)
#endif
#define LIST_INIT(head) do { \
(head)->lh_first = LIST_END(head); \
} while (/*CONSTCOND*/0)
#define LIST_INSERT_AFTER(listelm, elm, field) do { \
QUEUEDEBUG_LIST_OP((listelm), field) \
if (((elm)->field.le_next = (listelm)->field.le_next) != \
LIST_END(head)) \
(listelm)->field.le_next->field.le_prev = \
&(elm)->field.le_next; \
(listelm)->field.le_next = (elm); \
(elm)->field.le_prev = &(listelm)->field.le_next; \
} while (/*CONSTCOND*/0)
#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
QUEUEDEBUG_LIST_OP((listelm), field) \
(elm)->field.le_prev = (listelm)->field.le_prev; \
(elm)->field.le_next = (listelm); \
*(listelm)->field.le_prev = (elm); \
(listelm)->field.le_prev = &(elm)->field.le_next; \
} while (/*CONSTCOND*/0)
#define LIST_INSERT_HEAD(head, elm, field) do { \
QUEUEDEBUG_LIST_INSERT_HEAD((head), (elm), field) \
if (((elm)->field.le_next = (head)->lh_first) != LIST_END(head))\
(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
(head)->lh_first = (elm); \
(elm)->field.le_prev = &(head)->lh_first; \
} while (/*CONSTCOND*/0)
#define LIST_REMOVE(elm, field) do { \
QUEUEDEBUG_LIST_OP((elm), field) \
if ((elm)->field.le_next != NULL) \
(elm)->field.le_next->field.le_prev = \
(elm)->field.le_prev; \
*(elm)->field.le_prev = (elm)->field.le_next; \
QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \
} while (/*CONSTCOND*/0)
#define LIST_REPLACE(elm, elm2, field) do { \
if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \
(elm2)->field.le_next->field.le_prev = \
&(elm2)->field.le_next; \
(elm2)->field.le_prev = (elm)->field.le_prev; \
*(elm2)->field.le_prev = (elm2); \
QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \
} while (/*CONSTCOND*/0)
/*
* Simple queue definitions.
*/
#define SIMPLEQ_HEAD(name, type) \
struct name { \
struct type *sqh_first; /* first element */ \
struct type **sqh_last; /* addr of last next element */ \
}
#define SIMPLEQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).sqh_first }
#define SIMPLEQ_ENTRY(type) \
struct { \
struct type *sqe_next; /* next element */ \
}
/*
* Simple queue access methods.
*/
#define SIMPLEQ_FIRST(head) ((head)->sqh_first)
#define SIMPLEQ_END(head) NULL
#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == SIMPLEQ_END(head))
#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
#define SIMPLEQ_FOREACH(var, head, field) \
for ((var) = ((head)->sqh_first); \
(var) != SIMPLEQ_END(head); \
(var) = ((var)->field.sqe_next))
#define SIMPLEQ_FOREACH_SAFE(var, head, field, next) \
for ((var) = ((head)->sqh_first); \
(var) != SIMPLEQ_END(head) && \
((next = ((var)->field.sqe_next)), 1); \
(var) = (next))
/*
* Simple queue functions.
*/
#define SIMPLEQ_INIT(head) do { \
(head)->sqh_first = NULL; \
(head)->sqh_last = &(head)->sqh_first; \
} while (/*CONSTCOND*/0)
#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
(head)->sqh_last = &(elm)->field.sqe_next; \
(head)->sqh_first = (elm); \
} while (/*CONSTCOND*/0)
#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
(elm)->field.sqe_next = NULL; \
*(head)->sqh_last = (elm); \
(head)->sqh_last = &(elm)->field.sqe_next; \
} while (/*CONSTCOND*/0)
#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
(head)->sqh_last = &(elm)->field.sqe_next; \
(listelm)->field.sqe_next = (elm); \
} while (/*CONSTCOND*/0)
#define SIMPLEQ_REMOVE_HEAD(head, field) do { \
if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
(head)->sqh_last = &(head)->sqh_first; \
} while (/*CONSTCOND*/0)
#define SIMPLEQ_REMOVE_AFTER(head, elm, field) do { \
if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \
== NULL) \
(head)->sqh_last = &(elm)->field.sqe_next; \
} while (/*CONSTCOND*/0)
#define SIMPLEQ_REMOVE(head, elm, type, field) do { \
if ((head)->sqh_first == (elm)) { \
SIMPLEQ_REMOVE_HEAD((head), field); \
} else { \
struct type *curelm = (head)->sqh_first; \
while (curelm->field.sqe_next != (elm)) \
curelm = curelm->field.sqe_next; \
if ((curelm->field.sqe_next = \
curelm->field.sqe_next->field.sqe_next) == NULL) \
(head)->sqh_last = &(curelm)->field.sqe_next; \
} \
} while (/*CONSTCOND*/0)
#define SIMPLEQ_CONCAT(head1, head2) do { \
if (!SIMPLEQ_EMPTY((head2))) { \
*(head1)->sqh_last = (head2)->sqh_first; \
(head1)->sqh_last = (head2)->sqh_last; \
SIMPLEQ_INIT((head2)); \
} \
} while (/*CONSTCOND*/0)
#define SIMPLEQ_LAST(head, type, field) \
(SIMPLEQ_EMPTY((head)) ? \
NULL : \
((struct type *)(void *) \
((char *)((head)->sqh_last) - offsetof(struct type, field))))
/*
* Tail queue definitions.
*/
#define _TAILQ_HEAD(name, type, qual) \
struct name { \
qual type *tqh_first; /* first element */ \
qual type *qual *tqh_last; /* addr of last next element */ \
}
#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,)
#define TAILQ_HEAD_INITIALIZER(head) \
{ TAILQ_END(head), &(head).tqh_first }
#define _TAILQ_ENTRY(type, qual) \
struct { \
qual type *tqe_next; /* next element */ \
qual type *qual *tqe_prev; /* address of previous next element */\
}
#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,)
/*
* Tail queue access methods.
*/
#define TAILQ_FIRST(head) ((head)->tqh_first)
#define TAILQ_END(head) (NULL)
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
#define TAILQ_LAST(head, headname) \
(*(((struct headname *)(void *)((head)->tqh_last))->tqh_last))
#define TAILQ_PREV(elm, headname, field) \
(*(((struct headname *)(void *)((elm)->field.tqe_prev))->tqh_last))
#define TAILQ_EMPTY(head) (TAILQ_FIRST(head) == TAILQ_END(head))
#define TAILQ_FOREACH(var, head, field) \
for ((var) = ((head)->tqh_first); \
(var) != TAILQ_END(head); \
(var) = ((var)->field.tqe_next))
#define TAILQ_FOREACH_SAFE(var, head, field, next) \
for ((var) = ((head)->tqh_first); \
(var) != TAILQ_END(head) && \
((next) = TAILQ_NEXT(var, field), 1); (var) = (next))
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
for ((var) = TAILQ_LAST((head), headname); \
(var) != TAILQ_END(head); \
(var) = TAILQ_PREV((var), headname, field))
#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev) \
for ((var) = TAILQ_LAST((head), headname); \
(var) != TAILQ_END(head) && \
((prev) = TAILQ_PREV((var), headname, field), 1); (var) = (prev))
/*
* Tail queue functions.
*/
#if defined(QUEUEDEBUG)
#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field) \
if ((head)->tqh_first && \
(head)->tqh_first->field.tqe_prev != &(head)->tqh_first) \
QUEUEDEBUG_ABORT("TAILQ_INSERT_HEAD %p %s:%d", (head), \
__FILE__, __LINE__);
#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field) \
if (*(head)->tqh_last != NULL) \
QUEUEDEBUG_ABORT("TAILQ_INSERT_TAIL %p %s:%d", (head), \
__FILE__, __LINE__);
#define QUEUEDEBUG_TAILQ_OP(elm, field) \
if ((elm)->field.tqe_next && \
(elm)->field.tqe_next->field.tqe_prev != \
&(elm)->field.tqe_next) \
QUEUEDEBUG_ABORT("TAILQ_* forw %p %s:%d", (elm), \
__FILE__, __LINE__); \
if (*(elm)->field.tqe_prev != (elm)) \
QUEUEDEBUG_ABORT("TAILQ_* back %p %s:%d", (elm), \
__FILE__, __LINE__);
#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field) \
if ((elm)->field.tqe_next == NULL && \
(head)->tqh_last != &(elm)->field.tqe_next) \
QUEUEDEBUG_ABORT("TAILQ_PREREMOVE head %p elm %p %s:%d",\
(head), (elm), __FILE__, __LINE__);
#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field) \
(elm)->field.tqe_next = (void *)1L; \
(elm)->field.tqe_prev = (void *)1L;
#else
#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field)
#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field)
#define QUEUEDEBUG_TAILQ_OP(elm, field)
#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field)
#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field)
#endif
#define TAILQ_INIT(head) do { \
(head)->tqh_first = TAILQ_END(head); \
(head)->tqh_last = &(head)->tqh_first; \
} while (/*CONSTCOND*/0)
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
QUEUEDEBUG_TAILQ_INSERT_HEAD((head), (elm), field) \
if (((elm)->field.tqe_next = (head)->tqh_first) != TAILQ_END(head))\
(head)->tqh_first->field.tqe_prev = \
&(elm)->field.tqe_next; \
else \
(head)->tqh_last = &(elm)->field.tqe_next; \
(head)->tqh_first = (elm); \
(elm)->field.tqe_prev = &(head)->tqh_first; \
} while (/*CONSTCOND*/0)
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
QUEUEDEBUG_TAILQ_INSERT_TAIL((head), (elm), field) \
(elm)->field.tqe_next = TAILQ_END(head); \
(elm)->field.tqe_prev = (head)->tqh_last; \
*(head)->tqh_last = (elm); \
(head)->tqh_last = &(elm)->field.tqe_next; \
} while (/*CONSTCOND*/0)
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
QUEUEDEBUG_TAILQ_OP((listelm), field) \
if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != \
TAILQ_END(head)) \
(elm)->field.tqe_next->field.tqe_prev = \
&(elm)->field.tqe_next; \
else \
(head)->tqh_last = &(elm)->field.tqe_next; \
(listelm)->field.tqe_next = (elm); \
(elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
} while (/*CONSTCOND*/0)
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
QUEUEDEBUG_TAILQ_OP((listelm), field) \
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
(elm)->field.tqe_next = (listelm); \
*(listelm)->field.tqe_prev = (elm); \
(listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
} while (/*CONSTCOND*/0)
#define TAILQ_REMOVE(head, elm, field) do { \
QUEUEDEBUG_TAILQ_PREREMOVE((head), (elm), field) \
QUEUEDEBUG_TAILQ_OP((elm), field) \
if (((elm)->field.tqe_next) != TAILQ_END(head)) \
(elm)->field.tqe_next->field.tqe_prev = \
(elm)->field.tqe_prev; \
else \
(head)->tqh_last = (elm)->field.tqe_prev; \
*(elm)->field.tqe_prev = (elm)->field.tqe_next; \
QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \
} while (/*CONSTCOND*/0)
#define TAILQ_REPLACE(head, elm, elm2, field) do { \
if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != \
TAILQ_END(head)) \
(elm2)->field.tqe_next->field.tqe_prev = \
&(elm2)->field.tqe_next; \
else \
(head)->tqh_last = &(elm2)->field.tqe_next; \
(elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
*(elm2)->field.tqe_prev = (elm2); \
QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \
} while (/*CONSTCOND*/0)
#define TAILQ_CONCAT(head1, head2, field) do { \
if (!TAILQ_EMPTY(head2)) { \
*(head1)->tqh_last = (head2)->tqh_first; \
(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
(head1)->tqh_last = (head2)->tqh_last; \
TAILQ_INIT((head2)); \
} \
} while (/*CONSTCOND*/0)
/*
* Singly-linked Tail queue declarations.
*/
#define STAILQ_HEAD(name, type) \
struct name { \
struct type *stqh_first; /* first element */ \
struct type **stqh_last; /* addr of last next element */ \
}
#define STAILQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).stqh_first }
#define STAILQ_ENTRY(type) \
struct { \
struct type *stqe_next; /* next element */ \
}
/*
* Singly-linked Tail queue access methods.
*/
#define STAILQ_FIRST(head) ((head)->stqh_first)
#define STAILQ_END(head) NULL
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
#define STAILQ_EMPTY(head) (STAILQ_FIRST(head) == STAILQ_END(head))
/*
* Singly-linked Tail queue functions.
*/
#define STAILQ_INIT(head) do { \
(head)->stqh_first = NULL; \
(head)->stqh_last = &(head)->stqh_first; \
} while (/*CONSTCOND*/0)
#define STAILQ_INSERT_HEAD(head, elm, field) do { \
if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \
(head)->stqh_last = &(elm)->field.stqe_next; \
(head)->stqh_first = (elm); \
} while (/*CONSTCOND*/0)
#define STAILQ_INSERT_TAIL(head, elm, field) do { \
(elm)->field.stqe_next = NULL; \
*(head)->stqh_last = (elm); \
(head)->stqh_last = &(elm)->field.stqe_next; \
} while (/*CONSTCOND*/0)
#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
(head)->stqh_last = &(elm)->field.stqe_next; \
(listelm)->field.stqe_next = (elm); \
} while (/*CONSTCOND*/0)
#define STAILQ_REMOVE_HEAD(head, field) do { \
if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \
(head)->stqh_last = &(head)->stqh_first; \
} while (/*CONSTCOND*/0)
#define STAILQ_REMOVE(head, elm, type, field) do { \
if ((head)->stqh_first == (elm)) { \
STAILQ_REMOVE_HEAD((head), field); \
} else { \
struct type *curelm = (head)->stqh_first; \
while (curelm->field.stqe_next != (elm)) \
curelm = curelm->field.stqe_next; \
if ((curelm->field.stqe_next = \
curelm->field.stqe_next->field.stqe_next) == NULL) \
(head)->stqh_last = &(curelm)->field.stqe_next; \
} \
} while (/*CONSTCOND*/0)
#define STAILQ_FOREACH(var, head, field) \
for ((var) = ((head)->stqh_first); \
(var); \
(var) = ((var)->field.stqe_next))
#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = STAILQ_FIRST((head)); \
(var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
(var) = (tvar))
#define STAILQ_CONCAT(head1, head2) do { \
if (!STAILQ_EMPTY((head2))) { \
*(head1)->stqh_last = (head2)->stqh_first; \
(head1)->stqh_last = (head2)->stqh_last; \
STAILQ_INIT((head2)); \
} \
} while (/*CONSTCOND*/0)
#define STAILQ_LAST(head, type, field) \
(STAILQ_EMPTY((head)) ? \
NULL : \
((struct type *)(void *) \
((char *)((head)->stqh_last) - offsetof(struct type, field))))
#ifndef _KERNEL
/*
* Circular queue definitions. Do not use. We still keep the macros
* for compatibility but because of pointer aliasing issues their use
* is discouraged!
*/
/*
* __launder_type(): We use this ugly hack to work around the the compiler
* noticing that two types may not alias each other and elide tests in code.
* We hit this in the CIRCLEQ macros when comparing 'struct name *' and
* 'struct type *' (see CIRCLEQ_HEAD()). Modern compilers (such as GCC
* 4.8) declare these comparisons as always false, causing the code to
* not run as designed.
*
* This hack is only to be used for comparisons and thus can be fully const.
* Do not use for assignment.
*
* If we ever choose to change the ABI of the CIRCLEQ macros, we could fix
* this by changing the head/tail sentinal values, but see the note above
* this one.
*/
static __inline const void * __launder_type(const void *);
static __inline const void *
__launder_type(const void *__x)
{
__asm __volatile("" : "+r" (__x));
return __x;
}
#if defined(QUEUEDEBUG)
#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field) \
if ((head)->cqh_first != CIRCLEQ_ENDC(head) && \
(head)->cqh_first->field.cqe_prev != CIRCLEQ_ENDC(head)) \
QUEUEDEBUG_ABORT("CIRCLEQ head forw %p %s:%d", (head), \
__FILE__, __LINE__); \
if ((head)->cqh_last != CIRCLEQ_ENDC(head) && \
(head)->cqh_last->field.cqe_next != CIRCLEQ_ENDC(head)) \
QUEUEDEBUG_ABORT("CIRCLEQ head back %p %s:%d", (head), \
__FILE__, __LINE__);
#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field) \
if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) { \
if ((head)->cqh_last != (elm)) \
QUEUEDEBUG_ABORT("CIRCLEQ elm last %p %s:%d", \
(elm), __FILE__, __LINE__); \
} else { \
if ((elm)->field.cqe_next->field.cqe_prev != (elm)) \
QUEUEDEBUG_ABORT("CIRCLEQ elm forw %p %s:%d", \
(elm), __FILE__, __LINE__); \
} \
if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) { \
if ((head)->cqh_first != (elm)) \
QUEUEDEBUG_ABORT("CIRCLEQ elm first %p %s:%d", \
(elm), __FILE__, __LINE__); \
} else { \
if ((elm)->field.cqe_prev->field.cqe_next != (elm)) \
QUEUEDEBUG_ABORT("CIRCLEQ elm prev %p %s:%d", \
(elm), __FILE__, __LINE__); \
}
#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field) \
(elm)->field.cqe_next = (void *)1L; \
(elm)->field.cqe_prev = (void *)1L;
#else
#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field)
#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field)
#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field)
#endif
#define CIRCLEQ_HEAD(name, type) \
struct name { \
struct type *cqh_first; /* first element */ \
struct type *cqh_last; /* last element */ \
}
#define CIRCLEQ_HEAD_INITIALIZER(head) \
{ CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
#define CIRCLEQ_ENTRY(type) \
struct { \
struct type *cqe_next; /* next element */ \
struct type *cqe_prev; /* previous element */ \
}
/*
* Circular queue functions.
*/
#define CIRCLEQ_INIT(head) do { \
(head)->cqh_first = CIRCLEQ_END(head); \
(head)->cqh_last = CIRCLEQ_END(head); \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \
(elm)->field.cqe_next = (listelm)->field.cqe_next; \
(elm)->field.cqe_prev = (listelm); \
if ((listelm)->field.cqe_next == CIRCLEQ_ENDC(head)) \
(head)->cqh_last = (elm); \
else \
(listelm)->field.cqe_next->field.cqe_prev = (elm); \
(listelm)->field.cqe_next = (elm); \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \
(elm)->field.cqe_next = (listelm); \
(elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
if ((listelm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \
(head)->cqh_first = (elm); \
else \
(listelm)->field.cqe_prev->field.cqe_next = (elm); \
(listelm)->field.cqe_prev = (elm); \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
(elm)->field.cqe_next = (head)->cqh_first; \
(elm)->field.cqe_prev = CIRCLEQ_END(head); \
if ((head)->cqh_last == CIRCLEQ_ENDC(head)) \
(head)->cqh_last = (elm); \
else \
(head)->cqh_first->field.cqe_prev = (elm); \
(head)->cqh_first = (elm); \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
(elm)->field.cqe_next = CIRCLEQ_END(head); \
(elm)->field.cqe_prev = (head)->cqh_last; \
if ((head)->cqh_first == CIRCLEQ_ENDC(head)) \
(head)->cqh_first = (elm); \
else \
(head)->cqh_last->field.cqe_next = (elm); \
(head)->cqh_last = (elm); \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_REMOVE(head, elm, field) do { \
QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
QUEUEDEBUG_CIRCLEQ_ELM((head), (elm), field) \
if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) \
(head)->cqh_last = (elm)->field.cqe_prev; \
else \
(elm)->field.cqe_next->field.cqe_prev = \
(elm)->field.cqe_prev; \
if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \
(head)->cqh_first = (elm)->field.cqe_next; \
else \
(elm)->field.cqe_prev->field.cqe_next = \
(elm)->field.cqe_next; \
QUEUEDEBUG_CIRCLEQ_POSTREMOVE((elm), field) \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_FOREACH(var, head, field) \
for ((var) = ((head)->cqh_first); \
(var) != CIRCLEQ_ENDC(head); \
(var) = ((var)->field.cqe_next))
#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
for ((var) = ((head)->cqh_last); \
(var) != CIRCLEQ_ENDC(head); \
(var) = ((var)->field.cqe_prev))
/*
* Circular queue access methods.
*/
#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
#define CIRCLEQ_LAST(head) ((head)->cqh_last)
/* For comparisons */
#define CIRCLEQ_ENDC(head) (__launder_type(head))
/* For assignments */
#define CIRCLEQ_END(head) ((void *)(head))
#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
#define CIRCLEQ_EMPTY(head) \
(CIRCLEQ_FIRST(head) == CIRCLEQ_ENDC(head))
#define CIRCLEQ_LOOP_NEXT(head, elm, field) \
(((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) \
? ((head)->cqh_first) \
: (elm->field.cqe_next))
#define CIRCLEQ_LOOP_PREV(head, elm, field) \
(((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \
? ((head)->cqh_last) \
: (elm->field.cqe_prev))
#endif /* !_KERNEL */
#endif /* !_SYS_QUEUE_H_ */

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dl/swig/swig-4.1.1.tar.gz Normal file

Binary file not shown.

View File

@ -1 +1 @@
084b0d8fc9695ef865f57ed01bcce52b8979bc4b
3d7d56cce57babd65b7484694bfd311b4cbe6470

View File

@ -20,6 +20,9 @@ config BR2_BASE_DIR
string
option env="BASE_DIR"
# br2-external paths definitions
source "$BR2_BASE_DIR/.br2-external.in.paths"
config BR2_DEFCONFIG_FROM_ENV
string
option env="BR2_DEFCONFIG"
@ -376,6 +379,10 @@ source package/uboot/Config.in
endmenu
source package/linux/Config.in
source package/artinchip/Config.in
source package/vendor/Config.in
source package/third-party/Config.in
source package/third-party/Config.in.host
source package/firmware/Config.in
# br2-external menus definitions
source "$BR2_BASE_DIR/.br2-external.in.menus"

View File

@ -36,7 +36,8 @@ HIDDEN_PREFIX=.hidden
noconfig_targets := menuconfig nconfig gconfig xconfig config oldconfig randconfig \
defconfig %_defconfig allyesconfig allnoconfig alldefconfig syncconfig release \
randpackageconfig allyespackageconfig allnopackageconfig \
print-version olddefconfig manual manual-% check-package check-flake8 add_board
print-version olddefconfig manual manual-% check-package check-flake8 add_board del_board \
external-update
# Some global targets do not trigger a build, but are used to collect
# metadata, or do various checks. When such targets are triggered,
@ -91,6 +92,43 @@ ifneq ("$(notdir $(BASE_DIR))", "output")
UNIQUE_BUILD_NAME := $(notdir $(BASE_DIR))
endif
# Handling of BR2_EXTERNAL.
#
# The value of BR2_EXTERNAL is stored in .br-external in the output directory.
# The location of the external.mk makefile fragments is computed in that file.
# On subsequent invocations of make, this file is read in. BR2_EXTERNAL can
# still be overridden on the command line, therefore the file is re-created
# every time make is run.
# If user provide BR2_EXTERNAL from cmdline, save it to external.mk
ifeq ($(origin BR2_EXTERNAL), command line)
$(shell echo "LUBAN_EXTERNAL=$(BR2_EXTERNAL)">>$(TOPDIR)/external.mk)
endif
# Load latest LUBAN_EXTERNAL
-include external.mk
# If user not provide BR2_EXTERNAL in cmdline
# Use LUBAN_EXTERNAL value in external.mk
ifeq ($(BR2_EXTERNAL),)
BR2_EXTERNAL := $(LUBAN_EXTERNAL)
endif
# If already configure BR2_EXTERNAL in project, load BR2_EXTERNAL from it
BR2_EXTERNAL_FILE = $(BASE_DIR)/.br2-external.mk
-include $(BR2_EXTERNAL_FILE)
$(shell tools/support/scripts/br2-external -d '$(BASE_DIR)' $(BR2_EXTERNAL))
BR2_EXTERNAL_ERROR =
include $(BR2_EXTERNAL_FILE)
ifneq ($(BR2_EXTERNAL_ERROR),)
$(error $(BR2_EXTERNAL_ERROR))
endif
# Workaround bug in make-4.3: https://savannah.gnu.org/bugs/?57676
$(BASE_DIR)/.br2-external.mk:;
SOURCE_DIR := $(TOPDIR)/source
BUILD_DIR := $(BASE_DIR)/build
BINARIES_DIR := $(BASE_DIR)/images
@ -375,6 +413,7 @@ include package/arch/arch.mk
include tools/support/dependencies/dependencies.mk
include $(sort $(wildcard package/artinchip/*/*.mk))
include $(sort $(wildcard package/vendor/*/*.mk))
include $(sort $(wildcard package/firmware/*/*.mk))
include $(sort $(wildcard package/opensbi/*.mk))
include $(sort $(wildcard package/uboot/*.mk))
@ -385,6 +424,16 @@ include $(sort $(wildcard package/third-party/*/*.mk))
include $(sort $(wildcard package/toolchain/*.mk))
include $(sort $(wildcard package/toolchain/*/*.mk))
# If using a br2-external tree, the BR2_EXTERNAL_$(NAME)_PATH variables
# are also present in the .config file. Since .config is included after
# we defined them in the Makefile, the values for those variables are
# quoted. We just include the generated Makefile fragment .br2-external.mk
# a third time, which will set those variables to the un-quoted values.
include $(BR2_EXTERNAL_FILE)
# Nothing to include if no BR2_EXTERNAL tree in use
include $(BR2_EXTERNAL_MKS)
$(BUILD_DIR)/luban-config/auto.conf: $(BR2_CONFIG)
$(MAKE1) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" syncconfig
@ -716,7 +765,7 @@ check_defconfig_change= \
define percent_defconfig
# Override the BR2_DEFCONFIG from COMMON_CONFIG_ENV with the new defconfig
%_defconfig: $(BUILD_DIR)/luban-config/conf $(1)/target/configs/%_defconfig outputmakefile
%_defconfig: external-update $(BUILD_DIR)/luban-config/conf $(1)/target/configs/%_defconfig outputmakefile
$(call check_defconfig_change,$(1)/target/configs/$$@)
@$$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(1)/target/configs/$$@ \
$(BUILD_DIR)/luban-config/conf --defconfig=$(1)/target/configs/$$@ $$(CONFIG_CONFIG_IN)
@ -740,7 +789,11 @@ savedefconfig: $(BUILD_DIR)/luban-config/conf outputmakefile
echo "`cat $(O)/.defconfig_file` is updated"; \
fi
.PHONY: defconfig savedefconfig update-defconfig
# generate br2-external files before apply new sdk defconfig
external-update:
@$(TOPDIR)/tools/support/scripts/br2-external -d '$(BASE_DIR)' $(LUBAN_EXTERNAL)
.PHONY: defconfig savedefconfig update-defconfig external-update
################################################################################
#

View File

@ -18,6 +18,9 @@ config BR2_RISCV_ISA_RVD
config BR2_RISCV_ISA_RVC
bool
config BR2_RISCV_ISA_RVV
bool
config BR2_RISCV_ISA_RVXTHEAD
bool
@ -35,7 +38,7 @@ config BR2_riscv_g
General purpose (G) is equivalent to IMAFD.
config BR2_riscv64_gcxthead
bool # "Riscv64 + General (G) + Compressed (C) + T-HEAD Xtension (X)"
bool "Riscv64 + General (G) + Compressed (C) + T-HEAD Xtension (X)"
select BR2_RISCV_ISA_RVI
select BR2_RISCV_ISA_RVM
select BR2_RISCV_ISA_RVA
@ -47,6 +50,20 @@ config BR2_riscv64_gcxthead
help
Integer Riscv64 + General (IMAFD) + Compressed (C) + T-Head Xtension (X).
config BR2_riscv64_gcvxthead
bool "Riscv64 + General (G) + Compressed (C) + Vector (V) + T-HEAD Xtension (X)"
select BR2_RISCV_ISA_RVI
select BR2_RISCV_ISA_RVM
select BR2_RISCV_ISA_RVA
select BR2_RISCV_ISA_RVF
select BR2_RISCV_ISA_RVD
select BR2_RISCV_ISA_RVC
select BR2_RISCV_ISA_RVV
select BR2_RISCV_ISA_RVXTHEAD
select BR2_RISCV_64
help
Integer Riscv64 + General (IMAFD) + Compressed (C) + Vector (V) + T-Head Xtension (X).
config BR2_riscv_custom
bool # "Custom architecture"
select BR2_RISCV_ISA_RVI

View File

@ -43,6 +43,10 @@ ifeq ($(BR2_RISCV_ISA_RVC),y)
GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)c
endif
ifeq ($(BR2_RISCV_ISA_RVV),y)
GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)v
endif
ifeq ($(BR2_RISCV_ISA_RVXTHEAD),y)
GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)xthead
endif

View File

@ -3,17 +3,18 @@ menu "ArtInChip packages"
source package/artinchip/openssl-hwengine/Config.in
source package/artinchip/aic-authorization/Config.in
source package/artinchip/aic-mpp/Config.in
source package/artinchip/aic-logo/Config.in
source package/artinchip/libuserid/Config.in
source package/artinchip/gst1-plugins-aic/Config.in
source package/artinchip/awtk-ui/Config.in
source package/artinchip/lvgl-ui/Config.in
menu "Sample code"
source package/artinchip/test-adc/Config.in
source package/artinchip/test-mtop/Config.in
source package/artinchip/test-ce/Config.in
source package/artinchip/test-dma-buf/Config.in
source package/artinchip/test-dvp/Config.in
source package/artinchip/test-fb/Config.in
source package/artinchip/test-lvgl/Config.in
source package/artinchip/test-touchscreen/Config.in
source package/artinchip/test-uart/Config.in
source package/artinchip/test-watchdog/Config.in
@ -22,7 +23,13 @@ menu "Sample code"
source package/artinchip/test-keyadc/Config.in
source package/artinchip/reg-dump/Config.in
source package/artinchip/test-gpio/Config.in
source package/artinchip/test-can/Config.in
source package/artinchip/test-eth/Config.in
source package/artinchip/test-audio/Config.in
source package/artinchip/test-blkdev/Config.in
source package/artinchip/test-mbox/Config.in
endmenu
menu "Launchers"
source package/artinchip/qtlauncher/Config.in
endmenu

View File

@ -1,7 +1,7 @@
menuconfig BR2_PACKAGE_AIC_AUTHORIZATION
bool "aic-authorization"
default y
select BR2_PACKAGE_LIBKCAPI
select BR2_PACKAGE_LIBKCAPI_ASYM
select BR2_PACKAGE_LIBOPENSSL
if BR2_PACKAGE_AIC_AUTHORIZATION

View File

@ -0,0 +1,4 @@
menuconfig BR2_PACKAGE_AIC_LOGO
bool "aic-logo"
default y

View File

@ -0,0 +1,15 @@
AIC_LOGO_VERSION =
AIC_LOGO_ENABLE_TARBALL = NO
AIC_LOGO_ENABLE_PATCH = NO
AIC_LOGO_INSTALL_STAGING = YES
AIC_LOGO_DEPENDENCIES += test-common
AIC_LOGO_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=/usr/local
define AIC_LOGO_REMOVE_HEADERS_IN_TARGET
rm -rf $(TARGET_DIR)/usr/local/include/
endef
AIC_LOGO_POST_INSTALL_TARGET_HOOKS += AIC_LOGO_REMOVE_HEADERS_IN_TARGET
$(eval $(cmake-package))

View File

@ -12,7 +12,7 @@ AIC_MPP_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=/usr/local -DARCH=ARM
endif
ifeq ($(BR2_PACKAGE_AIC_MPP_MIDDLEWARE),y)
AIC_MPP_DEPENDENCIES += libmad alsa-lib
AIC_MPP_DEPENDENCIES += libmad alsa-lib cJSON
AIC_MPP_CONF_OPTS += -DMIDDLEWARE=enable
endif
@ -21,6 +21,9 @@ AIC_MPP_DEPENDENCIES += faad2
AIC_MPP_CONF_OPTS += -DAAC_DECODER=enable
endif
ifeq ($(BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE), "6.5")
AIC_MPP_CONF_OPTS += -DLINUX_VERSION_6=enable
endif
define AIC_MPP_REMOVE_HEADERS_IN_TARGET
rm -rf $(TARGET_DIR)/usr/local/include/

View File

@ -0,0 +1,4 @@
menuconfig BR2_PACKAGE_AWTK_UI
bool "awtk-ui"
default n

View File

@ -0,0 +1,66 @@
#!/bin/sh
#
# Start test_awtk....
#
DAEMON="/usr/local/bin/test_awtk"
DAEMONOPTS=""
PIDFILE=/var/run/test_awtk.pid
TSCALIB=/etc/pointercal
start() {
printf "Starting test_awtk: "
export TSLIB_FBDEVICE=/dev/fb0
export POINTERCAL_CALIBFILE=$TSCALIB
export TSLIB_CONSOLEDEVICE=none
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_PLUGINDIR=/usr/lib/ts
if [ ! -f $TSCALIB ]; then
/usr/bin/ts_calibrate
fi
sync
cd /usr/local/share/awtk_data/res
#PID=`$DAEMON $DAEMONOPTS > /dev/console 2>&1 & echo $!`
PID=`$DAEMON $DAEMONOPTS > /dev/null 2>&1 & echo $!`
if [ -z $PID ]; then
printf "Fail \n"
else
echo $PID >$PIDFILE
printf "OK \n"
fi
}
stop() {
printf "Stopping test_awtk: "
PID=`cat $PIDFILE`
if [ -f $PIDFILE]; then
kill -HUP $PID
printf "OK \n"
rm -f $PIDFILE
else
printf "pidfile not found \n"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?

View File

@ -0,0 +1,18 @@
AWTK_UI_VERSION =
AWTK_UI_ENABLE_TARBALL = NO
AWTK_UI_ENABLE_PATCH = NO
AWTK_UI_INSTALL_STAGING = YES
AWTK_UI_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=/usr/local
define TEST_AWTK_POST_TARGET_INSTALL
@$(call MESSAGE,"post target install")
$(INSTALL) -m 0755 -D package/artinchip/awtk-ui/S00test_awtk \
$(TARGET_DIR)/etc/init.d/S00awtk
endef
AWTK_UI_POST_INSTALL_TARGET_HOOKS += TEST_AWTK_POST_TARGET_INSTALL
$(eval $(cmake-package))

View File

@ -0,0 +1,9 @@
menuconfig BR2_PACKAGE_LVGL_UI
bool "lvgl-ui"
default n
if BR2_PACKAGE_LVGL_UI
config BR2_TEST_LVGL_USE_RTP
bool "use RTP"
default n
endif

View File

@ -0,0 +1,61 @@
#!/bin/sh
#
# Start test_lvgl....
#
DAEMON="/usr/local/bin/test_lvgl"
PIDFILE=/var/run/test_lvgl.pid
TSCALIB=/etc/pointercal
start() {
printf "Starting test_lvgl: "
export TSLIB_FBDEVICE=/dev/fb0
export POINTERCAL_CALIBFILE=$TSCALIB
export TSLIB_CONSOLEDEVICE=none
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_PLUGINDIR=/usr/lib/ts
if [ ! -f $TSCALIB ]; then
/usr/bin/ts_calibrate
fi
sync
PID=`$DAEMON > /dev/null 2>&1 & echo $!`
if [ -z $PID ]; then
printf "Fail \n"
else
echo $PID >$PIDFILE
printf "OK \n"
fi
}
stop() {
printf "Stopping test_lvgl: "
PID=`cat $PIDFILE`
if [ -f $PIDFILE ]; then
kill -HUP $PID
printf "OK \n"
rm -f $PIDFILE
else
printf "pidfile not found \n"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?

View File

@ -0,0 +1,29 @@
LVGL_UI_VERSION =
LVGL_UI_ENABLE_TARBALL = NO
LVGL_UI_ENABLE_PATCH = NO
LVGL_UI_INSTALL_STAGING = YES
LVGL_UI_DEPENDENCIES += tslib
LVGL_UI_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=/usr/local
ifeq ($(BR2_TEST_LVGL_USE_RTP),y)
LVGL_UI_CONF_OPTS += -DUSE_RTP_TSLIB=yes
else
LVGL_UI_CONF_OPTS += -DUSE_RTP_TSLIB=no
endif
ifeq ($(BR2_PACKAGE_FREETYPE),y)
LVGL_UI_DEPENDENCIES += freetype
LVGL_UI_CONF_OPTS += -DUSE_FREETYPE=yes -DSTAGING_DIR=$(STAGING_DIR)
else
LVGL_UI_CONF_OPTS += -DUSE_FREETYPE=no
endif
define LVGL_UI_POST_TARGET_INSTALL
@$(call MESSAGE,"post target install")
$(INSTALL) -m 0755 -D package/artinchip/lvgl-ui/S00lvgl \
$(TARGET_DIR)/etc/init.d/S00lvgl
endef
LVGL_UI_POST_INSTALL_TARGET_HOOKS += LVGL_UI_POST_TARGET_INSTALL
$(eval $(cmake-package))

View File

@ -1,9 +0,0 @@
menuconfig BR2_PACKAGE_TEST_ADC
bool "test-adc"
default y
if BR2_PACKAGE_TEST_ADC
config BR2_PACKAGE_TEST_ADC_USE_PREBUILT
bool "use prebuilt binary instead of building from source"
default n
endif

View File

@ -1,8 +0,0 @@
TEST_ADC_VERSION =
TEST_ADC_ENABLE_TARBALL = NO
TEST_ADC_ENABLE_PATCH = NO
TEST_ADC_DEPENDENCIES += test-common
TEST_ADC_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=/usr/local
$(eval $(cmake-package))

View File

@ -0,0 +1,10 @@
menuconfig BR2_PACKAGE_TEST_AUDIO
bool "test-audio"
default y
select BR2_PACKAGE_ALSA_LIB
if BR2_PACKAGE_TEST_AUDIO
config BR2_PACKAGE_TEST_AUDIO_USE_PREBUILT
bool "use prebuilt binary instead of building from source"
default n
endif

View File

@ -0,0 +1,8 @@
TEST_AUDIO_VERSION =
TEST_AUDIO_ENABLE_TARBALL = NO
TEST_AUDIO_ENABLE_PATCH = NO
TEST_AUDIO_DEPENDENCIES += alsa-lib test-common
TEST_AUDIO_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=/usr/local
$(eval $(cmake-package))

View File

@ -0,0 +1,9 @@
menuconfig BR2_PACKAGE_TEST_BLKDEV
bool "test-blkdev"
default y
if BR2_PACKAGE_TEST_BLKDEV
config BR2_PACKAGE_TEST_BLKDEV_USE_PREBUILT
bool "use prebuilt binary instead of building from source"
default n
endif

View File

@ -0,0 +1,8 @@
TEST_BLKDEV_VERSION =
TEST_BLKDEV_ENABLE_TARBALL = NO
TEST_BLKDEV_ENABLE_PATCH = NO
TEST_BLKDEV_DEPENDENCIES += test-common
TEST_BLKDEV_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=/usr/local
$(eval $(cmake-package))

View File

@ -0,0 +1,9 @@
menuconfig BR2_PACKAGE_TEST_CAN
bool "test-can"
default y
if BR2_PACKAGE_TEST_CAN
config BR2_PACKAGE_TEST_CAN_USE_PREBUILT
bool "use prebuilt binary instead of building from source"
default n
endif

View File

@ -0,0 +1,8 @@
TEST_CAN_VERSION =
TEST_CAN_ENABLE_TARBALL = NO
TEST_CAN_ENABLE_PATCH = NO
TEST_CAN_DEPENDENCIES += test-common
TEST_CAN_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=/usr/local
$(eval $(cmake-package))

View File

@ -1,7 +1,7 @@
menuconfig BR2_PACKAGE_TEST_CE
bool "test-ce"
default y
select BR2_PACKAGE_LIBKCAPI
select BR2_PACKAGE_LIBKCAPI_ASYM
select BR2_PACKAGE_LIBOPENSSL
if BR2_PACKAGE_TEST_CE

View File

@ -0,0 +1,9 @@
menuconfig BR2_PACKAGE_TEST_ETH
bool "test-eth"
default y
if BR2_PACKAGE_TEST_ETH
config BR2_PACKAGE_TEST_ETH_USE_PREBUILT
bool "use prebuilt binary instead of building from source"
default n
endif

View File

@ -0,0 +1,8 @@
TEST_ETH_VERSION =
TEST_ETH_ENABLE_TARBALL = NO
TEST_ETH_ENABLE_PATCH = NO
TEST_ETH_DEPENDENCIES += test-common
TEST_ETH_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=/usr/local
$(eval $(cmake-package))

View File

@ -1,9 +0,0 @@
menuconfig BR2_PACKAGE_TEST_LVGL
bool "test-lvgl"
default n
if BR2_PACKAGE_TEST_LVGL
config BR2_TEST_LVGL_USE_RTP
bool "use RTP"
default n
endif

View File

@ -1,62 +0,0 @@
#!/bin/sh
#
# Start test_lvgl....
#
DAEMON="/usr/local/bin/test_lvgl"
DAEMONOPTS=" -qws"
PIDFILE=/var/run/test_lvgl.pid
TSCALIB=/etc/pointercal
start() {
printf "Starting test_lvgl: "
export TSLIB_FBDEVICE=/dev/fb0
export POINTERCAL_CALIBFILE=$TSCALIB
export TSLIB_CONSOLEDEVICE=none
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_PLUGINDIR=/usr/lib/ts
if [ ! -f $TSCALIB ]; then
/usr/bin/ts_calibrate
fi
sync
PID=`$DAEMON $DAEMONOPTS > /dev/null 2>&1 & echo $!`
if [ -z $PID ]; then
printf "Fail \n"
else
echo $PID >$PIDFILE
printf "OK \n"
fi
}
stop() {
printf "Stopping test_lvgl: "
PID=`cat $PIDFILE`
if [ -f $PIDFILE]; then
kill -HUP $PID
printf "OK \n"
rm -f $PIDFILE
else
printf "pidfile not found \n"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?

View File

@ -1,21 +0,0 @@
TEST_LVGL_VERSION =
TEST_LVGL_ENABLE_TARBALL = NO
TEST_LVGL_ENABLE_PATCH = NO
TEST_LVGL_DEPENDENCIES += lvgl tslib
TEST_LVGL_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=/usr/local
ifeq ($(BR2_TEST_LVGL_USE_RTP),y)
TEST_LVGL_CONF_OPTS += -DUSE_RTP_TSLIB=yes
else
TEST_LVGL_CONF_OPTS += -DUSE_RTP_TSLIB=no
endif
define TEST_LVGL_POST_TARGET_INSTALL
@$(call MESSAGE,"post target install")
$(INSTALL) -m 0755 -D package/artinchip/test-lvgl/S20test_lvgl \
$(TARGET_DIR)/etc/init.d/S00lvgl
endef
TEST_LVGL_POST_INSTALL_TARGET_HOOKS += TEST_LVGL_POST_TARGET_INSTALL
$(eval $(cmake-package))

View File

@ -0,0 +1,9 @@
menuconfig BR2_PACKAGE_TEST_MBOX
bool "test-mbox"
default n
if BR2_PACKAGE_TEST_MBOX
config BR2_PACKAGE_TEST_MBOX_USE_PREBUILT
bool "use prebuilt binary instead of building from source"
default n
endif

View File

@ -0,0 +1,9 @@
TEST_MBOX_VERSION =
TEST_MBOX_ENABLE_TARBALL = NO
TEST_MBOX_ENABLE_PATCH = NO
TEST_MBOX_DEPENDENCIES += test-common
TEST_MBOX_LIBS += -lpthread
TEST_MBOX_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=/usr/local
$(eval $(cmake-package))

View File

@ -0,0 +1,26 @@
How to Set Your External Package Tree to SDK
============================================
Step1: Create your package tree base on "package/external/example_tree"
------------------------------------------------------------------------
1. Rename folder name "example_tree" to "your_tree" name
2. Rename the "name" value in "your_tree"/external.desc from "EXAMPLE_TREE" to "YOUR_TREE"
3. Rename the "BR2_EXTERNAL_EXAMPLE_TREE_PATH" to "BR2_EXTERNAL_YOUR_TREE_PATH" in
"your_tree"/Config.in
"your_tree"/external.mk
BTW: You can create "your_tree" in any place, e.g. beside on SDK folder.
Step2: Copy "package/external/external.mk" to SDKROOT
-----------------------------------------------------
1. Update LUBAN_EXTERNAL value in SDKROOT/external.mk, e.g.
LUBAN_EXTERNAL=../your_tree
Step3: Add your package
-----------------------
Add your package setting to "your_tree"/package, and your code to "your_tree"/source

View File

@ -0,0 +1,5 @@
menu "Example"
source "$BR2_EXTERNAL_EXAMPLE_TREE_PATH/package/example_mod/Config.in"
endmenu

View File

@ -0,0 +1,2 @@
name: EXAMPLE_TREE
desc: Example External Tree

View File

@ -0,0 +1 @@
include $(sort $(wildcard $(BR2_EXTERNAL_EXAMPLE_TREE_PATH)/package/*/*.mk))

View File

@ -0,0 +1,6 @@
# Please replace the "EXAMPLE_MOD" and "example module" name to your package name
config BR2_MOD_EXAMPLE_MOD
bool "example module"
default y

View File

@ -0,0 +1,4 @@
EXAMPLE_PACKAGE_VERSION =
EXAMPLE_PACKAGE_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=/usr/local
$(eval $(cmake-package))

View File

@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(example LANGUAGES C)
# Suppress cmake unused warning
set(ignore ${BUILD_DOC} ${BUILD_DOCS} ${BUILD_EXAMPLE} ${BUILD_EXAMPLES}
${BUILD_SHARED_LIBS}${BUILD_TEST}${BUILD_TESTING}${BUILD_TESTS})
add_compile_options(-Wall -Werror)
add_executable(example main.c)
# Install
# install directories
if(NOT CMAKE_INSTALL_PREFIX)
message(FATAL_ERROR "ERROR: CMAKE_INSTALL_PREFIX is not defined.")
endif()
include(GNUInstallDirs)
if(DEFINED CMAKE_INSTALL_FULL_LIBDIR)
install(TARGETS example RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}")
endif() # CMAKE_INSTALL_FULL_LIBDIR

View File

@ -0,0 +1,20 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/mman.h>
#include <string.h>
#include <dirent.h>
#include <ctype.h>
int main(int argc, char *argv[])
{
int i;
printf("argc: %d\n", argc);
for (i = 0; i < argc; i++) {
printf(" %s\n", argv[i]);
}
return 0;
}

8
package/external/external.mk vendored Normal file
View File

@ -0,0 +1,8 @@
# Use to set extenral tree directories to Luban SDK
# Example:
# LUBAN_EXTERNAL=MyTree
#
# If there are multi-external trees, set as following example:
# LUBAN_EXTERNAL=MyTree1:MyTree2
#
LUBAN_EXTERNAL=example_tree

View File

@ -16,4 +16,14 @@ source "package/fs/userfs/Config.in.userfs1"
source "package/fs/userfs/Config.in.userfs2"
source "package/fs/userfs/Config.in.userfs3"
config BR2_GENERATE_BURNER_IMAGE
bool "Generate burner format image"
default n
config BR2_GENERATE_IMAGE_AUTO_CALCULATE_SIZE
bool "Auto calculate partition size to generate image"
default n
help
The partition size is obtained through image_cfg.json
endmenu

View File

@ -162,10 +162,114 @@ ROOTFS_$(2)_COMPRESS_EXT = .zst
ROOTFS_$(2)_COMPRESS_CMD = zstd -19 -z -f -T$(PARALLEL_JOBS)
endif
ifeq ($(BR2_GENERATE_IMAGE_AUTO_CALCULATE_SIZE),y)
IMAGE_CFG_ADDR := $(TARGET_BOARD_DIR)/image_cfg.json
ifeq ($(BR2_TARGET_ROOTFS_EXT2),y)
TARGET_EXTFS_MAX_SIZE := "BR2_TARGET_ROOTFS_EXT2_SIZE"
BR2_TARGET_ROOTFS_EXT2_SIZE_X := $(if $(IMAGE_CFG_ADDR),$(shell tools/scripts/get_fs_max_size.sh $(IMAGE_CFG_ADDR) $(TARGET_EXTFS_MAX_SIZE)))
ifneq ($(BR2_TARGET_ROOTFS_EXT2_SIZE_X),)
BR2_TARGET_ROOTFS_EXT2_SIZE := $(BR2_TARGET_ROOTFS_EXT2_SIZE_X)
endif
ifeq ($(BR2_TARGET_USERFS1),y)
TARGET_EXTFS_MAX_SIZE1 := "BR2_TARGET_USERFS1_EXT4_SIZE"
BR2_TARGET_USERFS1_EXT4_SIZE_X := $(if $(IMAGE_CFG_ADDR),$(shell tools/scripts/get_fs_max_size.sh $(IMAGE_CFG_ADDR) $(TARGET_EXTFS_MAX_SIZE1)))
ifneq ($(BR2_TARGET_USERFS1_EXT4_SIZE_X),)
BR2_TARGET_USERFS1_EXT4_SIZE := $(BR2_TARGET_USERFS1_EXT4_SIZE_X)
endif
endif
ifeq ($(BR2_TARGET_USERFS2),y)
TARGET_EXTFS_MAX_SIZE2 := "BR2_TARGET_USERFS2_EXT4_SIZE"
BR2_TARGET_USERFS2_EXT4_SIZE := $(if $(IMAGE_CFG_ADDR),$(shell tools/scripts/get_fs_max_size.sh $(IMAGE_CFG_ADDR) $(TARGET_EXTFS_MAX_SIZE2)))
ifneq ($(BR2_TARGET_USERFS2_EXT4_SIZE_X),)
BR2_TARGET_USERFS2_EXT4_SIZE := $(BR2_TARGET_USERFS2_EXT4_SIZE_X)
endif
endif
ifeq ($(BR2_TARGET_USERFS3),y)
TARGET_EXTFS_MAX_SIZE3 := "BR2_TARGET_USERFS3_EXT4_SIZE"
BR2_TARGET_USERFS3_EXT4_SIZE := $(if $(IMAGE_CFG_ADDR),$(shell tools/scripts/get_fs_max_size.sh $(IMAGE_CFG_ADDR) $(TARGET_EXTFS_MAX_SIZE3)))
ifneq ($(BR2_TARGET_USERFS3_EXT4_SIZE_X),)
BR2_TARGET_USERFS3_EXT4_SIZE := $(BR2_TARGET_USERFS3_EXT4_SIZE_X)
endif
endif
endif
ifeq ($(BR2_TARGET_ROOTFS_UBI),y)
TARGET_UBIFS_MAX_SIZE := "BR2_TARGET_ROOTFS_UBIFS_MAX_SIZE"
BR2_TARGET_ROOTFS_UBIFS_MAX_SIZE_X := $(if $(IMAGE_CFG_ADDR),$(shell tools/scripts/get_fs_max_size.sh $(IMAGE_CFG_ADDR) $(TARGET_UBIFS_MAX_SIZE)))
ifneq ($(BR2_TARGET_ROOTFS_UBIFS_MAX_SIZE_X),)
BR2_TARGET_ROOTFS_UBIFS_MAX_SIZE := $(BR2_TARGET_ROOTFS_UBIFS_MAX_SIZE_X)
endif
ifeq ($(BR2_TARGET_USERFS1),y)
TARGET_UBIFS_MAX_SIZE1 := "BR2_TARGET_USERFS1_UBIFS_MAX_SIZE"
BR2_TARGET_USERFS1_UBIFS_MAX_SIZE_X := $(if $(IMAGE_CFG_ADDR),$(shell tools/scripts/get_fs_max_size.sh $(IMAGE_CFG_ADDR) $(TARGET_UBIFS_MAX_SIZE1)))
ifneq ($(BR2_TARGET_USERFS1_UBIFS_MAX_SIZE_X),)
BR2_TARGET_USERFS1_UBIFS_MAX_SIZE := $(BR2_TARGET_USERFS1_UBIFS_MAX_SIZE_X)
endif
endif
ifeq ($(BR2_TARGET_USERFS2),y)
TARGET_UBIFS_MAX_SIZE2 := "BR2_TARGET_USERFS2_UBIFS_MAX_SIZE"
BR2_TARGET_USERFS2_UBIFS_MAX_SIZE_X := $(if $(IMAGE_CFG_ADDR),$(shell tools/scripts/get_fs_max_size.sh $(IMAGE_CFG_ADDR) $(TARGET_UBIFS_MAX_SIZE2)))
ifneq ($(BR2_TARGET_USERFS2_UBIFS_MAX_SIZE_X),)
BR2_TARGET_USERFS2_UBIFS_MAX_SIZE := $(BR2_TARGET_USERFS2_UBIFS_MAX_SIZE_X)
endif
endif
ifeq ($(BR2_TARGET_USERFS3),y)
TARGET_UBIFS_MAX_SIZE3 := "BR2_TARGET_USERFS3_UBIFS_MAX_SIZE"
BR2_TARGET_USERFS3_UBIFS_MAX_SIZE_X := $(if $(IMAGE_CFG_ADDR),$(shell tools/scripts/get_fs_max_size.sh $(IMAGE_CFG_ADDR) $(TARGET_UBIFS_MAX_SIZE3)))
ifneq ($(BR2_TARGET_USERFS3_UBIFS_MAX_SIZE_X),)
BR2_TARGET_USERFS3_UBIFS_MAX_SIZE := $(BR2_TARGET_USERFS3_UBIFS_MAX_SIZE_X)
endif
endif
endif
endif
$$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): ROOTFS=$(2)
$$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): FAKEROOT_SCRIPT=$$(ROOTFS_$(2)_DIR)/fakeroot
$$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): $$(ROOTFS_$(2)_DEPENDENCIES)
@$$(call MESSAGE,"Generating filesystem image $$(ROOTFS_$(2)_FINAL_IMAGE_NAME)")
ifeq ($(BR2_GENERATE_IMAGE_AUTO_CALCULATE_SIZE),y)
ifeq ($(BR2_TARGET_ROOTFS_EXT2),y)
@$$(call MESSAGE,"BR2_TARGET_ROOTFS_EXT2_SIZE $$(BR2_TARGET_ROOTFS_EXT2_SIZE)")
ifeq ($(BR2_TARGET_USERFS1),y)
@$$(call MESSAGE,"BR2_TARGET_USERFS1_EXT4_SIZE $$(BR2_TARGET_USERFS1_EXT4_SIZE)")
endif
ifeq ($(BR2_TARGET_USERFS2),y)
@$$(call MESSAGE,"BR2_TARGET_USERFS2_EXT4_SIZE $$(BR2_TARGET_USERFS2_EXT4_SIZE)")
endif
ifeq ($(BR2_TARGET_USERFS3),y)
@$$(call MESSAGE,"BR2_TARGET_USERFS3_EXT4_SIZE $$(BR2_TARGET_USERFS3_EXT4_SIZE)")
endif
endif
ifeq ($(BR2_TARGET_ROOTFS_UBI),y)
@$$(call MESSAGE,"BR2_TARGET_ROOTFS_UBIFS_MAX_SIZE $$(BR2_TARGET_ROOTFS_UBIFS_MAX_SIZE)")
ifeq ($(BR2_TARGET_USERFS1),y)
@$$(call MESSAGE,"BR2_TARGET_USERFS1_UBIFS_MAX_SIZE $$(BR2_TARGET_USERFS1_UBIFS_MAX_SIZE)")
endif
ifeq ($(BR2_TARGET_USERFS2),y)
@$$(call MESSAGE,"BR2_TARGET_USERFS2_UBIFS_MAX_SIZE $$(BR2_TARGET_USERFS2_UBIFS_MAX_SIZE)")
endif
ifeq ($(BR2_TARGET_USERFS3),y)
@$$(call MESSAGE,"BR2_TARGET_USERFS3_UBIFS_MAX_SIZE $$(BR2_TARGET_USERFS3_UBIFS_MAX_SIZE)")
endif
endif
endif
$(Q)mkdir -p $$(@D)
$(Q)rm -rf $$(ROOTFS_$(2)_DIR)
$(Q)mkdir -p $$(ROOTFS_$(2)_DIR)
@ -191,6 +295,9 @@ $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): $$(ROOTFS_$(2)_DEPENDENCIES)
$(Q)$$(call PRINTF,$$(ROOTFS_REPRODUCIBLE)) >> $$(FAKEROOT_SCRIPT)
$(Q)$$(call PRINTF,$$(ROOTFS_SELINUX)) >> $$(FAKEROOT_SCRIPT)
$(Q)$$(call PRINTF,$$(ROOTFS_$(2)_CMD)) >> $$(FAKEROOT_SCRIPT)
ifeq ($(BR2_TARGET_ROOTFS_EXT2_TO_SPARSE),y)
$(Q)$$(call PRINTF,$$(ROOTFS_SPARSE_CMD)) >> $$(FAKEROOT_SCRIPT)
endif
$(Q)chmod a+x $$(FAKEROOT_SCRIPT)
$(Q)PATH=$$(BR_PATH) FAKEROOTDONTTRYCHOWN=1 $$(HOST_DIR)/bin/fakeroot -- $$(FAKEROOT_SCRIPT)
ifneq ($$(ROOTFS_$(2)_COMPRESS_CMD),)

View File

@ -41,6 +41,12 @@ config BR2_TARGET_ROOTFS_EXT2_REV
default 0 if BR2_TARGET_ROOTFS_EXT2_2r0
default 1 if !BR2_TARGET_ROOTFS_EXT2_2r0
config BR2_TARGET_ROOTFS_EXT2_TO_SPARSE
bool "generate sparse format filesystem"
default y
select BR2_PACKAGE_HOST_ANDROID_TOOLS
select BR2_PACKAGE_HOST_ANDROID_TOOLS_EXT4_UTILS
config BR2_TARGET_ROOTFS_EXT2_LABEL
string "filesystem label"
default "rootfs"

View File

@ -25,6 +25,9 @@ ROOTFS_EXT2_OPTS = \
$(ROOTFS_EXT2_MKFS_OPTS)
ROOTFS_EXT2_DEPENDENCIES = host-e2fsprogs
ifeq ($(BR2_TARGET_ROOTFS_EXT2_TO_SPARSE),y)
ROOTFS_EXT2_DEPENDENCIES = host-android-tools
endif
define ROOTFS_EXT2_CMD
rm -f $@
@ -36,6 +39,17 @@ define ROOTFS_EXT2_CMD
}
endef
ifeq ($(BR2_TARGET_ROOTFS_EXT2_TO_SPARSE),y)
define ROOTFS_SPARSE_CMD
rm -f $(BINARIES_DIR)/rootfs.sparse
$(HOST_DIR)/bin/img2simg $@ $(BINARIES_DIR)/rootfs.sparse \
|| { ret=$$?; \
echo "*** ext2 image format to sparse image format failed"; \
exit $$ret; \
}
endef
endif
ifneq ($(BR2_TARGET_ROOTFS_EXT2_GEN),2)
define ROOTFS_EXT2_SYMLINK
ln -sf rootfs.ext2$(ROOTFS_EXT2_COMPRESS_EXT) $(BINARIES_DIR)/rootfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN)$(ROOTFS_EXT2_COMPRESS_EXT)

View File

@ -15,6 +15,10 @@ choice
bool "Ext4"
config BR2_TARGET_USERFS1_TYPE_UBIFS
bool "UBIFS"
config BR2_TARGET_USERFS1_TYPE_JFFS2
bool "JFFS2"
config BR2_TARGET_USERFS1_TYPE_SQUASHFS
bool "SQUASHFS"
endchoice
config BR2_TARGET_USERFS1_GZIP
@ -38,6 +42,12 @@ config BR2_TARGET_USERFS1_XZ
default n
if BR2_TARGET_USERFS1_TYPE_EXT4
config BR2_TARGET_USERFS1_EXT4_TO_SPARSE
bool "generate sparse format filesystem"
default y
select BR2_PACKAGE_HOST_ANDROID_TOOLS
select BR2_PACKAGE_HOST_ANDROID_TOOLS_EXT4_UTILS
config BR2_TARGET_USERFS1_EXT4_SIZE
string "Size"
default "10M"
@ -45,6 +55,7 @@ config BR2_TARGET_USERFS1_EXT4_SIZE
config BR2_TARGET_USERFS1_EXT4_INODES
int "Number of inodes (leave at 0 for auto calculation)"
default 0
config BR2_TARGET_USERFS1_EXT4_RESBLKS
int "Reserved blocks percentage"
default 5
@ -163,6 +174,153 @@ config BR2_TARGET_USERFS1_UBIFS_OPTS
Any additional mkfs.ubifs options you may want to include.
endif # BR2_TARGET_USERFS1_TYPE_UBIFS
if BR2_TARGET_USERFS1_TYPE_JFFS2
choice
prompt "Flash Type"
default BR2_TARGET_USERFS1_JFFS2_FLASH_128
config BR2_TARGET_USERFS1_JFFS2_DATAFLASH_1056
bool "AT45 dataflash with 1056 byte pagesize"
select BR2_TARGET_USERFS1_JFFS2_NOCLEANMARKER
config BR2_TARGET_USERFS1_JFFS2_DATAFLASH_528
bool "AT45 dataflash with 528 byte pagesize"
select BR2_TARGET_USERFS1_JFFS2_NOCLEANMARKER
config BR2_TARGET_USERFS1_JFFS2_NANDFLASH_16K
bool "NAND flash with 16 kB erasesize"
select BR2_TARGET_USERFS1_JFFS2_NOCLEANMARKER
config BR2_TARGET_USERFS1_JFFS2_NANDFLASH_128K
bool "NAND flash with 128 kB erasesize"
select BR2_TARGET_USERFS1_JFFS2_NOCLEANMARKER
config BR2_TARGET_USERFS1_JFFS2_FLASH_128
bool "Parallel flash with 128 kB erase size"
config BR2_TARGET_USERFS1_JFFS2_FLASH_64
bool "Parallel flash with 64 kB erase size"
config BR2_TARGET_USERFS1_JFFS2_CUSTOM
bool "Select custom erase size"
endchoice
config BR2_TARGET_USERFS1_JFFS2_CUSTOM_EBSIZE
hex "Erase block size"
default 0x20000
depends on BR2_TARGET_USERFS1_JFFS2_CUSTOM
help
Set to erase size of memory
config BR2_TARGET_USERFS1_JFFS2_EBSIZE
hex
default 0x2100 if BR2_TARGET_USERFS1_JFFS2_DATAFLASH_1056
default 0x1080 if BR2_TARGET_USERFS1_JFFS2_DATAFLASH_528
default 0x4000 if BR2_TARGET_USERFS1_JFFS2_NANDFLASH_16K
default 0x20000 if BR2_TARGET_USERFS1_JFFS2_NANDFLASH_128K
default 0x20000 if BR2_TARGET_USERFS1_JFFS2_FLASH_128
default 0x10000 if BR2_TARGET_USERFS1_JFFS2_FLASH_64
default BR2_TARGET_USERFS1_JFFS2_CUSTOM_EBSIZE if BR2_TARGET_ROOTFS_JFFS2_CUSTOM
config BR2_TARGET_USERFS1_JFFS2_NOCLEANMARKER
bool "Do not use Cleanmarker"
default y if BR2_TARGET_USERFS1_JFFS2_DATAFLASH_1056
default y if BR2_TARGET_USERFS1_JFFS2_DATAFLASH_528
default y if BR2_TARGET_USERFS1_JFFS2_NANDFLASH_16K
default y if BR2_TARGET_USERFS1_JFFS2_NANDFLASH_128K
help
Do not use cleanmarkers if using NAND flash or Dataflash where
the pagesize is not a power of 2
config BR2_TARGET_USERFS1_JFFS2_PAD
bool "Pad output"
config BR2_TARGET_USERFS1_JFFS2_PADSIZE
hex "Pad output size (0x0 = to end of EB)"
default 0x0
depends on BR2_TARGET_USERFS1_JFFS2_PAD
help
Set to 0x0 to pad to end of erase block.
choice
prompt "Endianess"
default BR2_TARGET_USERFS1_JFFS2_BE if BR2_ENDIAN = "BIG"
config BR2_TARGET_USERFS1_JFFS2_LE
bool "little-endian"
config BR2_TARGET_USERFS1_JFFS2_BE
bool "big-endian"
endchoice
config BR2_TARGET_USERFS1_JFFS2_SUMMARY
bool "Produce a summarized JFFS2 image"
help
A summarised image can be mounted faster if support is
enabled in the kernel (CONFIG_JFFS2_SUMMARY)
config BR2_TARGET_USERFS1_JFFS2_USE_CUSTOM_PAGESIZE
bool "Select custom virtual memory page size"
help
Use a custom virtual memory page size. Note that this is not
related to the flash memory page size. Using this option is
only needed if Linux is configured to use a page size
different than 4kB.
config BR2_TARGET_USERFS1_JFFS2_CUSTOM_PAGESIZE
hex "Virtual memory page size"
default 0x1000
depends on BR2_TARGET_USERFS1_JFFS2_USE_CUSTOM_PAGESIZE
help
Set to virtual memory page size of target system (in bytes).
This value should match the virtual page size in Linux (i.e.
this should have the same value as the value of the PAGE_SIZE
macro in Linux). It is not related to the flash memory page
size.
endif # BR2_TARGET_USERFS1_TYPE_JFFS2
if BR2_TARGET_USERFS1_TYPE_SQUASHFS
config BR2_TARGET_USERFS1_SQUASHFS_PAD
bool "pad to a 4K boundary"
default y # legacy was always ON
help
Say 'y' here (the default) to pad the the filesystem image
to a 4K boundary. Say 'n' to disable padding.
choice
prompt "Compression algorithm"
default BR2_TARGET_USERFS1_SQUASHFS4_GZIP
help
Select the squashfs compression algorithm to use when
generating the filesystem.
config BR2_TARGET_USERFS1_SQUASHFS4_GZIP
bool "gzip"
config BR2_TARGET_USERFS1_SQUASHFS4_LZ4
bool "lz4"
config BR2_TARGET_USERFS1_SQUASHFS4_LZMA
bool "lzma"
config BR2_TARGET_USERFS1_SQUASHFS4_LZO
bool "lzo"
config BR2_TARGET_USERFS1_SQUASHFS4_XZ
bool "xz"
config BR2_TARGET_USERFS1_SQUASHFS4_ZSTD
bool "zstd"
endchoice
endif # BR2_TARGET_USERFS1_TYPE_SQUASHFS
config BR2_TARGET_USERFS1_OVERLAY
string "Overlay directory"
default ""

View File

@ -15,6 +15,10 @@ choice
bool "Ext4"
config BR2_TARGET_USERFS2_TYPE_UBIFS
bool "UBIFS"
config BR2_TARGET_USERFS2_TYPE_JFFS2
bool "JFFS2"
config BR2_TARGET_USERFS2_TYPE_SQUASHFS
bool "SQUASHFS"
endchoice
config BR2_TARGET_USERFS2_GZIP
@ -38,6 +42,12 @@ config BR2_TARGET_USERFS2_XZ
default n
if BR2_TARGET_USERFS2_TYPE_EXT4
config BR2_TARGET_USERFS2_EXT4_TO_SPARSE
bool "generate sparse format filesystem"
default y
select BR2_PACKAGE_HOST_ANDROID_TOOLS
select BR2_PACKAGE_HOST_ANDROID_TOOLS_EXT4_UTILS
config BR2_TARGET_USERFS2_EXT4_SIZE
string "Size"
default "10M"
@ -45,6 +55,7 @@ config BR2_TARGET_USERFS2_EXT4_SIZE
config BR2_TARGET_USERFS2_EXT4_INODES
int "Number of inodes (leave at 0 for auto calculation)"
default 0
config BR2_TARGET_USERFS2_EXT4_RESBLKS
int "Reserved blocks percentage"
default 5
@ -163,6 +174,153 @@ config BR2_TARGET_USERFS2_UBIFS_OPTS
Any additional mkfs.ubifs options you may want to include.
endif # BR2_TARGET_USERFS2_TYPE_UBIFS
if BR2_TARGET_USERFS2_TYPE_JFFS2
choice
prompt "Flash Type"
default BR2_TARGET_USERFS2_JFFS2_FLASH_128
config BR2_TARGET_USERFS2_JFFS2_DATAFLASH_1056
bool "AT45 dataflash with 1056 byte pagesize"
select BR2_TARGET_USERFS2_JFFS2_NOCLEANMARKER
config BR2_TARGET_USERFS2_JFFS2_DATAFLASH_528
bool "AT45 dataflash with 528 byte pagesize"
select BR2_TARGET_USERFS2_JFFS2_NOCLEANMARKER
config BR2_TARGET_USERFS2_JFFS2_NANDFLASH_16K
bool "NAND flash with 16 kB erasesize"
select BR2_TARGET_USERFS2_JFFS2_NOCLEANMARKER
config BR2_TARGET_USERFS2_JFFS2_NANDFLASH_128K
bool "NAND flash with 128 kB erasesize"
select BR2_TARGET_USERFS2_JFFS2_NOCLEANMARKER
config BR2_TARGET_USERFS2_JFFS2_FLASH_128
bool "Parallel flash with 128 kB erase size"
config BR2_TARGET_USERFS2_JFFS2_FLASH_64
bool "Parallel flash with 64 kB erase size"
config BR2_TARGET_USERFS2_JFFS2_CUSTOM
bool "Select custom erase size"
endchoice
config BR2_TARGET_USERFS2_JFFS2_CUSTOM_EBSIZE
hex "Erase block size"
default 0x20000
depends on BR2_TARGET_USERFS2_JFFS2_CUSTOM
help
Set to erase size of memory
config BR2_TARGET_USERFS2_JFFS2_EBSIZE
hex
default 0x2100 if BR2_TARGET_USERFS2_JFFS2_DATAFLASH_1056
default 0x1080 if BR2_TARGET_USERFS2_JFFS2_DATAFLASH_528
default 0x4000 if BR2_TARGET_USERFS2_JFFS2_NANDFLASH_16K
default 0x20000 if BR2_TARGET_USERFS2_JFFS2_NANDFLASH_128K
default 0x20000 if BR2_TARGET_USERFS2_JFFS2_FLASH_128
default 0x10000 if BR2_TARGET_USERFS2_JFFS2_FLASH_64
default BR2_TARGET_USERFS2_JFFS2_CUSTOM_EBSIZE if BR2_TARGET_ROOTFS_JFFS2_CUSTOM
config BR2_TARGET_USERFS2_JFFS2_NOCLEANMARKER
bool "Do not use Cleanmarker"
default y if BR2_TARGET_USERFS2_JFFS2_DATAFLASH_1056
default y if BR2_TARGET_USERFS2_JFFS2_DATAFLASH_528
default y if BR2_TARGET_USERFS2_JFFS2_NANDFLASH_16K
default y if BR2_TARGET_USERFS2_JFFS2_NANDFLASH_128K
help
Do not use cleanmarkers if using NAND flash or Dataflash where
the pagesize is not a power of 2
config BR2_TARGET_USERFS2_JFFS2_PAD
bool "Pad output"
config BR2_TARGET_USERFS2_JFFS2_PADSIZE
hex "Pad output size (0x0 = to end of EB)"
default 0x0
depends on BR2_TARGET_USERFS2_JFFS2_PAD
help
Set to 0x0 to pad to end of erase block.
choice
prompt "Endianess"
default BR2_TARGET_USERFS2_JFFS2_BE if BR2_ENDIAN = "BIG"
config BR2_TARGET_USERFS2_JFFS2_LE
bool "little-endian"
config BR2_TARGET_USERFS2_JFFS2_BE
bool "big-endian"
endchoice
config BR2_TARGET_USERFS2_JFFS2_SUMMARY
bool "Produce a summarized JFFS2 image"
help
A summarised image can be mounted faster if support is
enabled in the kernel (CONFIG_JFFS2_SUMMARY)
config BR2_TARGET_USERFS2_JFFS2_USE_CUSTOM_PAGESIZE
bool "Select custom virtual memory page size"
help
Use a custom virtual memory page size. Note that this is not
related to the flash memory page size. Using this option is
only needed if Linux is configured to use a page size
different than 4kB.
config BR2_TARGET_USERFS2_JFFS2_CUSTOM_PAGESIZE
hex "Virtual memory page size"
default 0x1000
depends on BR2_TARGET_USERFS2_JFFS2_USE_CUSTOM_PAGESIZE
help
Set to virtual memory page size of target system (in bytes).
This value should match the virtual page size in Linux (i.e.
this should have the same value as the value of the PAGE_SIZE
macro in Linux). It is not related to the flash memory page
size.
endif # BR2_TARGET_USERFS2_TYPE_JFFS2
if BR2_TARGET_USERFS2_TYPE_SQUASHFS
config BR2_TARGET_USERFS2_SQUASHFS_PAD
bool "pad to a 4K boundary"
default y # legacy was always ON
help
Say 'y' here (the default) to pad the the filesystem image
to a 4K boundary. Say 'n' to disable padding.
choice
prompt "Compression algorithm"
default BR2_TARGET_USERFS2_SQUASHFS4_GZIP
help
Select the squashfs compression algorithm to use when
generating the filesystem.
config BR2_TARGET_USERFS2_SQUASHFS4_GZIP
bool "gzip"
config BR2_TARGET_USERFS2_SQUASHFS4_LZ4
bool "lz4"
config BR2_TARGET_USERFS2_SQUASHFS4_LZMA
bool "lzma"
config BR2_TARGET_USERFS2_SQUASHFS4_LZO
bool "lzo"
config BR2_TARGET_USERFS2_SQUASHFS4_XZ
bool "xz"
config BR2_TARGET_USERFS2_SQUASHFS4_ZSTD
bool "zstd"
endchoice
endif # BR2_TARGET_USERFS2_TYPE_SQUASHFS
config BR2_TARGET_USERFS2_OVERLAY
string "Overlay directory"
default ""

View File

@ -15,6 +15,10 @@ choice
bool "Ext4"
config BR2_TARGET_USERFS3_TYPE_UBIFS
bool "UBIFS"
config BR2_TARGET_USERFS3_TYPE_JFFS2
bool "JFFS2"
config BR2_TARGET_USERFS3_TYPE_SQUASHFS
bool "SQUASHFS"
endchoice
config BR2_TARGET_USERFS3_GZIP
@ -38,6 +42,12 @@ config BR2_TARGET_USERFS3_XZ
default n
if BR2_TARGET_USERFS3_TYPE_EXT4
config BR2_TARGET_USERFS3_EXT4_TO_SPARSE
bool "generate sparse format filesystem"
default y
select BR2_PACKAGE_HOST_ANDROID_TOOLS
select BR2_PACKAGE_HOST_ANDROID_TOOLS_EXT4_UTILS
config BR2_TARGET_USERFS3_EXT4_SIZE
string "Size"
default "10M"
@ -45,6 +55,7 @@ config BR2_TARGET_USERFS3_EXT4_SIZE
config BR2_TARGET_USERFS3_EXT4_INODES
int "Number of inodes (leave at 0 for auto calculation)"
default 0
config BR2_TARGET_USERFS3_EXT4_RESBLKS
int "Reserved blocks percentage"
default 5
@ -163,6 +174,153 @@ config BR2_TARGET_USERFS3_UBIFS_OPTS
Any additional mkfs.ubifs options you may want to include.
endif # BR2_TARGET_USERFS3_TYPE_UBIFS
if BR2_TARGET_USERFS3_TYPE_JFFS2
choice
prompt "Flash Type"
default BR2_TARGET_USERFS3_JFFS2_FLASH_128
config BR2_TARGET_USERFS3_JFFS2_DATAFLASH_1056
bool "AT45 dataflash with 1056 byte pagesize"
select BR2_TARGET_USERFS3_JFFS2_NOCLEANMARKER
config BR2_TARGET_USERFS3_JFFS2_DATAFLASH_528
bool "AT45 dataflash with 528 byte pagesize"
select BR2_TARGET_USERFS3_JFFS2_NOCLEANMARKER
config BR2_TARGET_USERFS3_JFFS2_NANDFLASH_16K
bool "NAND flash with 16 kB erasesize"
select BR2_TARGET_USERFS3_JFFS2_NOCLEANMARKER
config BR2_TARGET_USERFS3_JFFS2_NANDFLASH_128K
bool "NAND flash with 128 kB erasesize"
select BR2_TARGET_USERFS3_JFFS2_NOCLEANMARKER
config BR2_TARGET_USERFS3_JFFS2_FLASH_128
bool "Parallel flash with 128 kB erase size"
config BR2_TARGET_USERFS3_JFFS2_FLASH_64
bool "Parallel flash with 64 kB erase size"
config BR2_TARGET_USERFS3_JFFS2_CUSTOM
bool "Select custom erase size"
endchoice
config BR2_TARGET_USERFS3_JFFS2_CUSTOM_EBSIZE
hex "Erase block size"
default 0x20000
depends on BR2_TARGET_USERFS3_JFFS2_CUSTOM
help
Set to erase size of memory
config BR2_TARGET_USERFS3_JFFS2_EBSIZE
hex
default 0x2100 if BR2_TARGET_USERFS3_JFFS2_DATAFLASH_1056
default 0x1080 if BR2_TARGET_USERFS3_JFFS2_DATAFLASH_528
default 0x4000 if BR2_TARGET_USERFS3_JFFS2_NANDFLASH_16K
default 0x20000 if BR2_TARGET_USERFS3_JFFS2_NANDFLASH_128K
default 0x20000 if BR2_TARGET_USERFS3_JFFS2_FLASH_128
default 0x10000 if BR2_TARGET_USERFS3_JFFS2_FLASH_64
default BR2_TARGET_USERFS3_JFFS2_CUSTOM_EBSIZE if BR2_TARGET_ROOTFS_JFFS2_CUSTOM
config BR2_TARGET_USERFS3_JFFS2_NOCLEANMARKER
bool "Do not use Cleanmarker"
default y if BR2_TARGET_USERFS3_JFFS2_DATAFLASH_1056
default y if BR2_TARGET_USERFS3_JFFS2_DATAFLASH_528
default y if BR2_TARGET_USERFS3_JFFS2_NANDFLASH_16K
default y if BR2_TARGET_USERFS3_JFFS2_NANDFLASH_128K
help
Do not use cleanmarkers if using NAND flash or Dataflash where
the pagesize is not a power of 2
config BR2_TARGET_USERFS3_JFFS2_PAD
bool "Pad output"
config BR2_TARGET_USERFS3_JFFS2_PADSIZE
hex "Pad output size (0x0 = to end of EB)"
default 0x0
depends on BR2_TARGET_USERFS3_JFFS2_PAD
help
Set to 0x0 to pad to end of erase block.
choice
prompt "Endianess"
default BR2_TARGET_USERFS3_JFFS2_BE if BR2_ENDIAN = "BIG"
config BR2_TARGET_USERFS3_JFFS2_LE
bool "little-endian"
config BR2_TARGET_USERFS3_JFFS2_BE
bool "big-endian"
endchoice
config BR2_TARGET_USERFS3_JFFS2_SUMMARY
bool "Produce a summarized JFFS2 image"
help
A summarised image can be mounted faster if support is
enabled in the kernel (CONFIG_JFFS2_SUMMARY)
config BR2_TARGET_USERFS3_JFFS2_USE_CUSTOM_PAGESIZE
bool "Select custom virtual memory page size"
help
Use a custom virtual memory page size. Note that this is not
related to the flash memory page size. Using this option is
only needed if Linux is configured to use a page size
different than 4kB.
config BR2_TARGET_USERFS3_JFFS2_CUSTOM_PAGESIZE
hex "Virtual memory page size"
default 0x1000
depends on BR2_TARGET_USERFS3_JFFS2_USE_CUSTOM_PAGESIZE
help
Set to virtual memory page size of target system (in bytes).
This value should match the virtual page size in Linux (i.e.
this should have the same value as the value of the PAGE_SIZE
macro in Linux). It is not related to the flash memory page
size.
endif # BR2_TARGET_USERFS3_TYPE_JFFS2
if BR2_TARGET_USERFS3_TYPE_SQUASHFS
config BR2_TARGET_USERFS3_SQUASHFS_PAD
bool "pad to a 4K boundary"
default y # legacy was always ON
help
Say 'y' here (the default) to pad the the filesystem image
to a 4K boundary. Say 'n' to disable padding.
choice
prompt "Compression algorithm"
default BR2_TARGET_USERFS3_SQUASHFS4_GZIP
help
Select the squashfs compression algorithm to use when
generating the filesystem.
config BR2_TARGET_USERFS3_SQUASHFS4_GZIP
bool "gzip"
config BR2_TARGET_USERFS3_SQUASHFS4_LZ4
bool "lz4"
config BR2_TARGET_USERFS3_SQUASHFS4_LZMA
bool "lzma"
config BR2_TARGET_USERFS3_SQUASHFS4_LZO
bool "lzo"
config BR2_TARGET_USERFS3_SQUASHFS4_XZ
bool "xz"
config BR2_TARGET_USERFS3_SQUASHFS4_ZSTD
bool "zstd"
endchoice
endif # BR2_TARGET_USERFS3_TYPE_SQUASHFS
config BR2_TARGET_USERFS3_OVERLAY
string "Overlay directory"
default ""

View File

@ -14,11 +14,26 @@ USERFS_$(1)_DEPENDENCIES += host-e2fsprogs
else ifeq ($$(BR2_TARGET_USERFS$(1)_TYPE_UBIFS),y)
USERFS_$(1)_IMAGE_NAME ?= $$(call qstrip,$$(BR2_TARGET_USERFS$(1)_NAME)).ubifs
USERFS_$(1)_DEPENDENCIES = host-mtd
else ifeq ($$(BR2_TARGET_USERFS$(1)_TYPE_JFFS2),y)
USERFS_$(1)_IMAGE_NAME ?= $$(call qstrip,$$(BR2_TARGET_USERFS$(1)_NAME)).jffs2
USERFS_$(1)_DEPENDENCIES = host-mtd
else ifeq ($$(BR2_TARGET_USERFS$(1)_TYPE_SQUASHFS),y)
USERFS_$(1)_IMAGE_NAME ?= $$(call qstrip,$$(BR2_TARGET_USERFS$(1)_NAME)).squashfs
USERFS_$(1)_DEPENDENCIES = host-squashfs
else
USERFS_$(1)_IMAGE_NAME ?= userfs$(1).dummyimage
endif
ifeq ($$(BR2_TARGET_USERFS$(1)_EXT4_TO_SPARSE),y)
USERFS_$(1)_SPARSE_IMAGE_NAME ?= $$(call qstrip,$$(BR2_TARGET_USERFS$(1)_NAME)).sparse
USERFS_$(1)_DEPENDENCIES += host-android-tools
endif
USERFS_$(1)_FINAL_IMAGE_NAME = $$(strip $$(USERFS_$(1)_IMAGE_NAME))
ifeq ($$(BR2_TARGET_USERFS$(1)_EXT4_TO_SPARSE),y)
USERFS_$(1)_FINAL_SPARSE_IMAGE_NAME = $$(strip $$(USERFS_$(1)_SPARSE_IMAGE_NAME))
endif
USERFS_$(1)_DIR = $$(USERFS_DIR)/fs$(1).$$(call qstrip,$$(BR2_TARGET_USERFS$(1)_NAME))
USERFS_$(1)_TARGET_DIR = $$(USERFS_$(1)_DIR)/target
@ -95,6 +110,15 @@ USERFS_$(1)_EXT4_CMD = rm -rf $$(BINARIES_DIR)/$$(USERFS_$(1)_FINAL_IMAGE_NAME);
exit $$ret; \
}
ifeq ($$(BR2_TARGET_USERFS$(1)_EXT4_TO_SPARSE),y)
USERFS_$(1)_SPARSE_CMD = rm -rf $$(BINARIES_DIR)/$$(USERFS_$(1)_FINAL_SPARSE_IMAGE_NAME); \
$(HOST_DIR)/bin/img2simg $$(BINARIES_DIR)/$$(USERFS_$(1)_FINAL_IMAGE_NAME) $$(BINARIES_DIR)/$$(USERFS_$(1)_FINAL_SPARSE_IMAGE_NAME) \
|| { ret=$$?; \
echo "*** ext4 image format to sparse image format failed"; \
exit $$ret; \
}
endif
######## UBIFS commands ########
ifeq ($$(BR2_TARGET_USERFS$(1)_UBIFS_RT_ZLIB),y)
@ -151,6 +175,82 @@ endif
USERFS_$(1)_UBIFS_CMD = $$(foreach MKCMD, $$(MK_UBIFS_$(1)_CMD), $$(call $$(MKCMD))$$(sep))
######## JFFS2 commands ########
USERFS_$(1)_JFFS2_OPTS = -e $$(BR2_TARGET_USERFS$(1)_JFFS2_EBSIZE) --with-xattr
USERFS_$(1)_JFFS2_SUMTOOL_OPTS = -e $$(BR2_TARGET_USERFS$(1)_JFFS2_EBSIZE)
ifeq ($$(BR2_TARGET_USERFS$(1)_JFFS2_PAD),y)
ifneq ($$(strip $$(BR2_TARGET_USERFS$(1)_JFFS2_PADSIZE)),0x0)
USERFS_$(1)_JFFS2_OPTS += --pad=$$(strip $$(BR2_TARGET_USERFS$(1)_JFFS2_PADSIZE))
else
USERFS_$(1)_JFFS2_OPTS += -p
endif
USERFS_$(1)_JFFS2_SUMTOOL_OPTS += -p
endif
ifeq ($$(BR2_TARGET_USERFS$(1)_JFFS2_LE),y)
USERFS_$(1)_JFFS2_OPTS += -l
USERFS_$(1)_JFFS2_SUMTOOL_OPTS += -l
endif
ifeq ($$(BR2_TARGET_USERFS$(1)_JFFS2_BE),y)
USERFS_$(1)_JFFS2_OPTS += -b
USERFS_$(1)_JFFS2_SUMTOOL_OPTS += -b
endif
ifeq ($$(BR2_TARGET_USERFS$(1)_JFFS2_USE_CUSTOM_PAGESIZE),y)
USERFS_$(1)_JFFS2_OPTS += -s $$(BR2_TARGET_USERFS$(1)_JFFS2_CUSTOM_PAGESIZE)
endif
ifeq ($$(BR2_TARGET_USERFS$(1)_JFFS2_NOCLEANMARKER),y)
USERFS_$(1)_JFFS2_OPTS += -n
USERFS_$(1)_JFFS2_SUMTOOL_OPTS += -n
endif
ifneq ($$(BR2_TARGET_USERFS$(1)_JFFS2_SUMMARY),)
USERFS_$(1)_JFFS2_CMD = \
$(HOST_DIR)/sbin/mkfs.jffs2 $$(USERFS_$(1)_JFFS2_OPTS) \
-d $$(USERFS_$(1)_TARGET_DIR) \
-o $$(BINARIES_DIR)/$$(USERFS_$(1)_FINAL_IMAGE_NAME).nosummary \
$$(USERFS_$(1)_JFFS2_SUMTOOL) $$(USERFS_$(1)_JFFS2_SUMTOOL_OPTS) \
-i $$(BINARIES_DIR)/$$(USERFS_$(1)_FINAL_IMAGE_NAME).nosummary \
-o $$(BINARIES_DIR)/$$(USERFS_$(1)_FINAL_IMAGE_NAME)
rm $$(BINARIES_DIR)/$$(USERFS_$(1)_FINAL_IMAGE_NAME).nosummary
else
USERFS_$(1)_JFFS2_CMD = \
$(HOST_DIR)/sbin/mkfs.jffs2 $$(USERFS_$(1)_JFFS2_OPTS) \
-d $$(USERFS_$(1)_TARGET_DIR) \
-o $$(BINARIES_DIR)/$$(USERFS_$(1)_FINAL_IMAGE_NAME)
endif
######## SQUASHFS commands ########
USERFS_$(1)_SQUASHFS_ARGS = -noappend -processors $$(PARALLEL_JOBS)
ifeq ($$(BR2_TARGET_USERFS$(1)_SQUASHFS_PAD),y)
USERFS_$(1)_SQUASHFS_ARGS += -nopad
endif
ifeq ($$(BR2_TARGET_USERFS$(1)_SQUASHFS4_LZ4),y)
USERFS_$(1)_SQUASHFS_ARGS += -comp lz4 -Xhc
else ifeq ($$(BR2_TARGET_USERFS$(1)_SQUASHFS4_LZO),y)
USERFS_$(1)_SQUASHFS_ARGS += -comp lzo
else ifeq ($$(BR2_TARGET_USERFS$(1)_SQUASHFS4_LZMA),y)
USERFS_$(1)_SQUASHFS_ARGS += -comp lzma
else ifeq ($$(BR2_TARGET_USERFS$(1)_SQUASHFS4_XZ),y)
USERFS_$(1)_SQUASHFS_ARGS += -comp xz
else ifeq ($$(BR2_TARGET_USERFS$(1)_SQUASHFS4_ZSTD),y)
USERFS_$(1)_SQUASHFS_ARGS += -comp zstd
else
USERFS_$(1)_SQUASHFS_ARGS += -comp gzip
endif
USERFS_$(1)_SQUASHFS_CMD = rm -rf $$(BINARIES_DIR)/$$(USERFS_$(1)_FINAL_IMAGE_NAME); \
$(HOST_DIR)/bin/mksquashfs $$(USERFS_$(1)_TARGET_DIR) \
$$(BINARIES_DIR)/$$(USERFS_$(1)_FINAL_IMAGE_NAME) \
$$(USERFS_$(1)_SQUASHFS_ARGS);
$$(BINARIES_DIR)/$$(USERFS_$(1)_FINAL_IMAGE_NAME): FAKEROOT_SCRIPT=$$(USERFS_$(1)_DIR)/fakeroot
$$(BINARIES_DIR)/$$(USERFS_$(1)_FINAL_IMAGE_NAME): $$(USERFS_$(1)_DEPENDENCIES)
@$$(call MESSAGE,"Generating filesystem image $$(USERFS_$(1)_FINAL_IMAGE_NAME)")
@ -176,9 +276,21 @@ ifeq ($$(BR2_TARGET_USERFS$(1)_TYPE_EXT4),y)
$$(call PRINTF,$$(USERFS_$(1)_EXT4_CMD)) >> $$(FAKEROOT_SCRIPT)
endif
ifeq ($$(BR2_TARGET_USERFS$(1)_EXT4_TO_SPARSE),y)
$$(call PRINTF,$$(USERFS_$(1)_SPARSE_CMD)) >> $$(FAKEROOT_SCRIPT)
endif
ifeq ($$(BR2_TARGET_USERFS$(1)_TYPE_UBIFS),y)
$$(call PRINTF,$$(USERFS_$(1)_UBIFS_CMD)) >> $$(FAKEROOT_SCRIPT)
endif
ifeq ($$(BR2_TARGET_USERFS$(1)_TYPE_JFFS2),y)
$$(call PRINTF,$$(USERFS_$(1)_JFFS2_CMD)) >> $$(FAKEROOT_SCRIPT)
endif
ifeq ($$(BR2_TARGET_USERFS$(1)_TYPE_SQUASHFS),y)
$$(call PRINTF,$$(USERFS_$(1)_SQUASHFS_CMD)) >> $$(FAKEROOT_SCRIPT)
endif
chmod a+x $$(FAKEROOT_SCRIPT)
PATH=$$(BR_PATH) FAKEROOTDONTTRYCHOWN=1 $$(HOST_DIR)/bin/fakeroot -- $$(FAKEROOT_SCRIPT)
ifneq ($$(USERFS_$(1)_COMPRESS_CMD),)

View File

@ -124,6 +124,10 @@ config BR2_LINUX_KERNEL_IMAGELZ4
bool "Image.lz4"
depends on BR2_riscv
config BR2_LINUX_KERNEL_IMAGEXZ
bool "Image.xz"
depends on BR2_riscv
config BR2_LINUX_KERNEL_IMAGELZMA
bool "Image.lzma"
depends on BR2_riscv

View File

@ -103,6 +103,8 @@ else ifeq ($(BR2_LINUX_KERNEL_IMAGEGZ),y)
LINUX_DEPENDENCIES += host-gzip
else ifeq ($(BR2_LINUX_KERNEL_IMAGELZ4),y)
LINUX_DEPENDENCIES += host-lz4
else ifeq ($(BR2_LINUX_KERNEL_IMAGEXZ),y)
LINUX_DEPENDENCIES += host-xz
else ifeq ($(BR2_LINUX_KERNEL_IMAGELZMA),y)
LINUX_DEPENDENCIES += host-lzma
else ifeq ($(BR2_LINUX_KERNEL_IMAGELZO),y)
@ -185,8 +187,10 @@ else ifeq ($(BR2_LINUX_KERNEL_IMAGEGZ),y)
LINUX_IMAGE_NAME = Image.gz
else ifeq ($(BR2_LINUX_KERNEL_IMAGELZ4),y)
LINUX_IMAGE_NAME = Image.lz4
else ifeq ($(BR2_LINUX_KERNEL_IMAGEXZ),y)
LINUX_IMAGE_NAME = Image.xz
else ifeq ($(BR2_LINUX_KERNEL_IMAGELZMA),y)
LINUX_IMAGE_NAME = Image.lzmz
LINUX_IMAGE_NAME = Image.lzma
else ifeq ($(BR2_LINUX_KERNEL_IMAGELZO),y)
LINUX_IMAGE_NAME = Image.lzo
else ifeq ($(BR2_LINUX_KERNEL_LINUX_BIN),y)

View File

@ -7,17 +7,14 @@ OPENSBI_ADD_LINUX_HEADERS_DEPENDENCY = NO
OPENSBI_SUPPORTS_OUT_SOURCE_BUILD = YES
ifeq ($(LUBAN_BOARD_NAME),"qemu")
OPENSBI_MAKE_OPTS += FW_JUMP_FDT_ADDR=0x82200000
else
OPENSBI_MAKE_OPTS += CHIP=ARCH_ARTINCHIP
endif
OPENSBI_MAKE_OPTS += CROSS_COMPILE="$(TARGET_CROSS)" \
PLATFORM=generic \
FW_TEXT_START=$(BR2_PACKAGE_OPENSBI_FW_TEXT_BASE)
else
OPENSBI_MAKE_OPTS += CROSS_COMPILE="$(TARGET_CROSS)" \
PLATFORM=generic CHIP=ARCH_ARTINCHIP \
FW_TEXT_START=$(shell printf "0x%X" $$(($(BR2_PACKAGE_OPENSBI_FW_TEXT_BASE) + 0x3FE0000)))
endif
ifeq ($(LUBAN_BOARD_NAME),"qemu")
OPENSBI_MAKE_OPTS += FW_JUMP_FDT_ADDR=0x82200000
endif
define OPENSBI_BUILD_CMDS
$(Q)$(TARGET_MAKE_ENV) $(MAKE1) $(OPENSBI_MAKE_OPTS) -C $(OPENSBI_SRCDIR) O=$(@D) all

View File

@ -17,9 +17,17 @@ menu "Third-party packages"
source package/third-party/gperf/Config.in
source package/third-party/udev/Config.in
source package/third-party/eudev/Config.in
source package/third-party/musl-compat-headers/Config.in
source package/third-party/gmp/Config.in
source package/third-party/gdb/Config.in
source package/third-party/binutils/Config.in
source package/third-party/sqlite/Config.in
source package/third-party/libatomic_ops/Config.in
comment "************************ Multimedia **************************"
source package/third-party/alsa-lib/Config.in
source package/third-party/alsa-utils/Config.in
source package/third-party/pulseaudio/Config.in
source package/third-party/libsamplerate/Config.in
source package/third-party/directfb/Config.in
source package/third-party/directfb-examples/Config.in
source package/third-party/freetype/Config.in
@ -29,7 +37,6 @@ menu "Third-party packages"
source package/third-party/libsndfile/Config.in
source package/third-party/qt/Config.in
source package/third-party/qt5/Config.in
source package/third-party/lvgl/Config.in
source package/third-party/gstreamer1/Config.in
source package/third-party/fbdump/Config.in
source package/third-party/libmad/Config.in
@ -39,6 +46,8 @@ menu "Third-party packages"
source package/third-party/pixman/Config.in
source package/third-party/faad2/Config.in
source package/third-party/lame/Config.in
source package/third-party/mpg123/Config.in
source package/third-party/libpjsip/Config.in
comment "************************ Network *****************************"
source package/third-party/can-utils/Config.in
source package/third-party/ethtool/Config.in
@ -53,6 +62,9 @@ menu "Third-party packages"
source package/third-party/libpcap/Config.in
source package/third-party/hostapd/Config.in
comment "************************ Security ****************************"
source package/third-party/libselinux/Config.in
source package/third-party/libsepol/Config.in
source package/third-party/libsrtp/Config.in
source package/third-party/libkcapi/Config.in
source package/third-party/openssl/Config.in
source package/third-party/cryptsetup/Config.in
@ -94,6 +106,7 @@ menu "Third-party packages"
source package/third-party/android-tools/Config.in
source package/third-party/bzip2/Config.in
source package/third-party/gzip/Config.in
source package/third-party/lrzsz/Config.in
source package/third-party/lz4/Config.in
source package/third-party/lzip/Config.in
source package/third-party/lzo/Config.in
@ -115,5 +128,6 @@ menu "Third-party packages"
source package/third-party/swupdate/Config.in
source package/third-party/perl/Config.in
source package/third-party/openssh/Config.in
source package/third-party/cJSON/Config.in
endmenu

View File

@ -8,6 +8,8 @@ menu "Host utilities"
source package/third-party/uboot-tools/Config.in.host
source package/third-party/util-linux/Config.in.host
source package/third-party/zic/Config.in.host
source package/third-party/gdb/Config.in.host
source package/third-party/binutils/Config.in.host
comment "************************ Storage/Memory **********************"
source package/third-party/e2fsprogs/Config.in.host
source package/third-party/mtd/Config.in.host
@ -47,11 +49,11 @@ menu "Host utilities"
source package/third-party/libtool/Config.in.host
source package/third-party/make/Config.in.host
source package/third-party/meson/Config.in.host
source package/third-party/ncurses/Config.in.host
source package/third-party/ninja/Config.in.host
source package/third-party/pkgconf/Config.in.host
source package/third-party/patchelf/Config.in.host
source package/third-party/python3/Config.in.host
source package/third-party/python3-fdt/Config.in.host
source package/third-party/python3-pycryptodomex/Config.in.host
source package/third-party/swig/Config.in.host
endmenu

View File

@ -56,10 +56,12 @@ config BR2_PACKAGE_ALSA_UTILS_AMIDI
config BR2_PACKAGE_ALSA_UTILS_AMIXER
bool "amixer"
default y
select BR2_PACKAGE_ALSA_LIB_MIXER
config BR2_PACKAGE_ALSA_UTILS_APLAY
bool "aplay/arecord"
default y
select BR2_PACKAGE_ALSA_LIB_PCM
config BR2_PACKAGE_ALSA_UTILS_APLAYMIDI

View File

@ -0,0 +1,48 @@
From 33f3c1f804efc2e4f97849081589efb70cda31e5 Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Fri, 25 Dec 2015 11:38:13 +0100
Subject: [PATCH] sh-conf
Likewise, binutils has no idea about any of these new targets either, so we
fix that up too.. now we're able to actually build a real toolchain for
sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more
inept targets than that one, really. Go look, I promise).
[Romain: rebase on top of 2.32]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
[Thomas: rebase on top of 2.29, in which sh64 support was removed.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
configure | 2 +-
configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 3dd206525a7..6881ce632f5 100755
--- a/configure
+++ b/configure
@@ -3892,7 +3892,7 @@ case "${target}" in
nvptx*-*-*)
noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
;;
- sh-*-*)
+ sh*-*-*)
case "${target}" in
sh*-*-elf)
;;
diff --git a/configure.ac b/configure.ac
index 797a624621e..1f9256bbf18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1175,7 +1175,7 @@ case "${target}" in
nvptx*-*-*)
noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
;;
- sh-*-*)
+ sh*-*-*)
case "${target}" in
sh*-*-elf)
;;
--
2.31.1

View File

@ -0,0 +1,306 @@
From 4d8705ddb55897e8a74b617ab95736d520d9e1ea Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Fri, 25 Dec 2015 11:45:38 +0100
Subject: [PATCH] poison-system-directories
Patch adapted to binutils 2.23.2 and extended to use
BR_COMPILER_PARANOID_UNSAFE_PATH by Thomas Petazzoni.
[Romain: rebase on top of 2.33.1]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
[Gustavo: adapt to binutils 2.25]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Upstream-Status: Inappropriate [distribution: codesourcery]
Patch originally created by Mark Hatle, forward-ported to
binutils 2.21 by Scott Garman.
purpose: warn for uses of system directories when cross linking
Code Merged from Sourcery G++ binutils 2.19 - 4.4-277
2008-07-02 Joseph Myers <joseph@codesourcery.com>
ld/
* ld.h (args_type): Add error_poison_system_directories.
* ld.texinfo (--error-poison-system-directories): Document.
* ldfile.c (ldfile_add_library_path): Check
command_line.error_poison_system_directories.
* ldmain.c (main): Initialize
command_line.error_poison_system_directories.
* lexsup.c (enum option_values): Add
OPTION_ERROR_POISON_SYSTEM_DIRECTORIES.
(ld_options): Add --error-poison-system-directories.
(parse_args): Handle new option.
2007-06-13 Joseph Myers <joseph@codesourcery.com>
ld/
* config.in: Regenerate.
* ld.h (args_type): Add poison_system_directories.
* ld.texinfo (--no-poison-system-directories): Document.
* ldfile.c (ldfile_add_library_path): Check
command_line.poison_system_directories.
* ldmain.c (main): Initialize
command_line.poison_system_directories.
* lexsup.c (enum option_values): Add
OPTION_NO_POISON_SYSTEM_DIRECTORIES.
(ld_options): Add --no-poison-system-directories.
(parse_args): Handle new option.
2007-04-20 Joseph Myers <joseph@codesourcery.com>
Merge from Sourcery G++ binutils 2.17:
2007-03-20 Joseph Myers <joseph@codesourcery.com>
Based on patch by Mark Hatle <mark.hatle@windriver.com>.
ld/
* configure.ac (--enable-poison-system-directories): New option.
* configure, config.in: Regenerate.
* ldfile.c (ldfile_add_library_path): If
ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib,
/usr/lib, /usr/local/lib or /usr/X11R6/lib.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
ld/config.in | 3 +++
ld/configure | 14 ++++++++++++++
ld/configure.ac | 10 ++++++++++
ld/ld.h | 8 ++++++++
ld/ld.texi | 12 ++++++++++++
ld/ldfile.c | 17 +++++++++++++++++
ld/ldlex.h | 2 ++
ld/ldmain.c | 2 ++
ld/lexsup.c | 21 +++++++++++++++++++++
9 files changed, 89 insertions(+)
diff --git a/ld/config.in b/ld/config.in
index 26d55a00d47..ffad464783c 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -43,6 +43,9 @@
language is requested. */
#undef ENABLE_NLS
+/* Define to warn for use of native system library directories */
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+
/* Additional extension a shared object might have. */
#undef EXTRA_SHLIB_EXTENSION
diff --git a/ld/configure b/ld/configure
index c197aaef3cb..882263aa43f 100755
--- a/ld/configure
+++ b/ld/configure
@@ -829,6 +829,7 @@ with_lib_path
enable_targets
enable_64_bit_bfd
with_sysroot
+enable_poison_system_directories
enable_gold
enable_got
enable_compressed_debug_sections
@@ -1498,6 +1499,8 @@ Optional Features:
--enable-checking enable run-time checks
--enable-targets alternative target configurations
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
+ --enable-poison-system-directories
+ warn for use of native system library directories
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-got=<type> GOT handling scheme (target, single, negative,
multigot)
@@ -15236,7 +15239,18 @@ else
fi
+# Check whether --enable-poison-system-directories was given.
+if test "${enable_poison_system_directories+set}" = set; then :
+ enableval=$enable_poison_system_directories;
+else
+ enable_poison_system_directories=no
+fi
+
+if test "x${enable_poison_system_directories}" = "xyes"; then
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+
+fi
# Check whether --enable-got was given.
if test "${enable_got+set}" = set; then :
diff --git a/ld/configure.ac b/ld/configure.ac
index 8ea97c43cd4..0f246db67d8 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -106,6 +106,16 @@ AC_SUBST(use_sysroot)
AC_SUBST(TARGET_SYSTEM_ROOT)
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+AC_ARG_ENABLE([poison-system-directories],
+ AS_HELP_STRING([--enable-poison-system-directories],
+ [warn for use of native system library directories]),,
+ [enable_poison_system_directories=no])
+if test "x${enable_poison_system_directories}" = "xyes"; then
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system library directories])
+fi
+
dnl Use --enable-gold to decide if this linker should be the default.
dnl "install_as_default" is set to false if gold is the default linker.
dnl "installed_linker" is the installed BFD linker name.
diff --git a/ld/ld.h b/ld/ld.h
index 35fafebfaed..74e66405de6 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -162,6 +162,14 @@ typedef struct
in the linker script. */
bool force_group_allocation;
+ /* If TRUE (the default) warn for uses of system directories when
+ cross linking. */
+ bool poison_system_directories;
+
+ /* If TRUE (default FALSE) give an error for uses of system
+ directories when cross linking instead of a warning. */
+ bool error_poison_system_directories;
+
/* Big or little endian as set on command line. */
enum endian_enum endian;
diff --git a/ld/ld.texi b/ld/ld.texi
index dd8f571d4e4..3ab210b41b9 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -2863,6 +2863,18 @@ string identifying the original linked file does not change.
Passing @code{none} for @var{style} disables the setting from any
@code{--build-id} options earlier on the command line.
+
+@kindex --no-poison-system-directories
+@item --no-poison-system-directories
+Do not warn for @option{-L} options using system directories such as
+@file{/usr/lib} when cross linking. This option is intended for use
+in chroot environments when such directories contain the correct
+libraries for the target system rather than the host.
+
+@kindex --error-poison-system-directories
+@item --error-poison-system-directories
+Give an error instead of a warning for @option{-L} options using
+system directories when cross linking.
@end table
@c man end
diff --git a/ld/ldfile.c b/ld/ldfile.c
index 9d0af06f1f6..7cdd3b1c1b1 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -117,6 +117,23 @@ ldfile_add_library_path (const char *name, bool cmdline)
new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL);
else
new_dirs->name = xstrdup (name);
+
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ if (command_line.poison_system_directories
+ && ((!strncmp (name, "/lib", 4))
+ || (!strncmp (name, "/usr/lib", 8))
+ || (!strncmp (name, "/usr/local/lib", 14))
+ || (!strncmp (name, "/usr/X11R6/lib", 14))))
+ {
+ if (command_line.error_poison_system_directories)
+ einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
+ "cross-compilation\n"), name);
+ else
+ einfo (_("%P: warning: library search path \"%s\" is unsafe for "
+ "cross-compilation\n"), name);
+ }
+#endif
+
}
/* Try to open a BFD for a lang_input_statement. */
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 9e8bf5fb835..2f0fadfe0a3 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -163,6 +163,8 @@ enum option_values
OPTION_CTF_VARIABLES,
OPTION_NO_CTF_VARIABLES,
OPTION_CTF_SHARE_TYPES,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
};
/* The initial parser states. */
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 42660eb9a3c..1aef9387f93 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -321,6 +321,8 @@ main (int argc, char **argv)
command_line.warn_mismatch = true;
command_line.warn_search_mismatch = true;
command_line.check_section_addresses = -1;
+ command_line.poison_system_directories = true;
+ command_line.error_poison_system_directories = false;
/* We initialize DEMANGLING based on the environment variable
COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 00274c500d0..4f23b3a2da2 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -595,6 +595,14 @@ static const struct ld_option ld_options[] =
" <method> is: share-unconflicted (default),\n"
" share-duplicated"),
TWO_DASHES },
+ { {"no-poison-system-directories", no_argument, NULL,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES},
+ '\0', NULL, N_("Do not warn for -L options using system directories"),
+ TWO_DASHES },
+ { {"error-poison-system-directories", no_argument, NULL,
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES},
+ '\0', NULL, N_("Give an error for -L options using system directories"),
+ TWO_DASHES },
};
#define OPTION_COUNT ARRAY_SIZE (ld_options)
@@ -607,6 +615,7 @@ parse_args (unsigned argc, char **argv)
int ingroup = 0;
char *default_dirlist = NULL;
char *shortopts;
+ char *BR_paranoid_env;
struct option *longopts;
struct option *really_longopts;
int last_optind;
@@ -1643,6 +1652,14 @@ parse_args (unsigned argc, char **argv)
}
break;
+ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
+ command_line.poison_system_directories = false;
+ break;
+
+ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
+ command_line.error_poison_system_directories = true;
+ break;
+
case OPTION_PUSH_STATE:
input_flags.pushed = xmemdup (&input_flags,
sizeof (input_flags),
@@ -1788,6 +1805,10 @@ parse_args (unsigned argc, char **argv)
command_line.soname = NULL;
}
+ BR_paranoid_env = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH");
+ if (BR_paranoid_env && strlen(BR_paranoid_env) > 0)
+ command_line.error_poison_system_directories = true;
+
while (ingroup)
{
einfo (_("%P: missing --end-group; added as last command line option\n"));
--
2.31.1

View File

@ -0,0 +1,50 @@
From ef4ba1da823e8366ea4f126f50885a44ebf4dcf0 Mon Sep 17 00:00:00 2001
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
Date: Wed, 9 Jun 2021 17:28:27 +0200
Subject: [PATCH] bfd/elf32-or1k: fix building with gcc version < 5
Gcc version >= 5 has standard C mode not set to -std=gnu11, so if we use
an old compiler(i.e. gcc 4.9) build fails on:
```
elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in
C99 or C11 mode
for (size_t i = 0; i < insn_count; i++)
^
```
So let's declare `size_t i` at the top of the function instead of inside
for loop.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
bfd/elf32-or1k.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 4ae7f324d33..32063ab0289 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -2244,9 +2244,10 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
{
unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
unsigned output_insns[PLT_MAX_INSN_COUNT];
+ size_t i;
/* Copy instructions into the output buffer. */
- for (size_t i = 0; i < insn_count; i++)
+ for (i = 0; i < insn_count; i++)
output_insns[i] = insns[i];
/* Honor the no-delay-slot setting. */
@@ -2277,7 +2278,7 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
}
/* Write out the output buffer. */
- for (size_t i = 0; i < (insn_count+1); i++)
+ for (i = 0; i < (insn_count+1); i++)
bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
}
--
2.31.1

View File

@ -0,0 +1,59 @@
From 203b80f8dbdd3ddb860114b03351a0dea28c978f Mon Sep 17 00:00:00 2001
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
Date: Sat, 10 Jul 2021 17:57:34 +0200
Subject: [PATCH] or1k: fix pc-relative relocation against dynamic on PC
relative 26 bit relocation
When building openal we were seeing the assert failure:
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
pc-relative relocation against dynamic symbol alSourcePausev
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
pc-relative relocation against dynamic symbol alSourceStopv
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
pc-relative relocation against dynamic symbol alSourceRewindv
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
pc-relative relocation against dynamic symbol alSourcePlayv
collect2: error: ld returned 1 exit status
This happens because in R_OR1K_INSN_REL_26 case we can't reference local
symbol as previously done but we need to make sure that calls to actual
symbol always call the version of current object.
bfd/Changelog:
* elf32-or1k.c (or1k_elf_relocate_section): use a separate entry
in switch case R_OR1K_INSN_REL_26 where we need to check for
!SYMBOL_CALLS_LOCAL() instead of !SYMBOL_REFERENCES_LOCAL().
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
bfd/elf32-or1k.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 32063ab0289..67252394173 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -1543,6 +1543,18 @@ or1k_elf_relocate_section (bfd *output_bfd,
break;
case R_OR1K_INSN_REL_26:
+ /* For a non-shared link, these will reference plt or call the
+ version of actual object. */
+ if (bfd_link_pic (info) && !SYMBOL_CALLS_LOCAL (info, h))
+ {
+ _bfd_error_handler
+ (_("%pB: pc-relative relocation against dynamic symbol %s"),
+ input_bfd, name);
+ ret_val = false;
+ bfd_set_error (bfd_error_bad_value);
+ }
+ break;
+
case R_OR1K_PCREL_PG21:
case R_OR1K_LO13:
case R_OR1K_SLO13:
--
2.31.1

View File

@ -0,0 +1,75 @@
From 362a20108782b87cd780a989c0dbd014fc2def8b Mon Sep 17 00:00:00 2001
From: Stafford Horne <shorne@gmail.com>
Date: Sun, 2 Jan 2022 09:03:28 +0900
Subject: [PATCH] or1k: Avoid R_OR1K_GOT16 signed overflow by using special
howto
Previously when fixing PR 21464 we masked out upper bits of the
relocation value in order to avoid overflow complaints when acceptable.
It turns out this does not work when the relocation value ends up being
signed.
To fix this this patch introduces a special howto with
complain_on_overflow set to complain_overflow_dont. This is used in
place of the normal R_OR1K_GOT16 howto when we detect R_OR1K_GOT_AHI16
relocations.
bfd/ChangeLog:
PR 28735
* elf32-or1k.c (or1k_elf_got16_no_overflow_howto): Define.
(or1k_elf_relocate_section): Use new howto instead of trying to
mask out relocation bits.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
bfd/elf32-or1k.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 4ae7f324d33..7fd88d72442 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -828,6 +828,23 @@ static reloc_howto_type or1k_elf_howto_table[] =
false), /* pcrel_offset */
};
+/* A copy of the R_OR1K_GOT16 used in the presense of R_OR1K_GOT_AHI16
+ relocations when we know we can ignore overflows. */
+static reloc_howto_type or1k_elf_got16_no_overflow_howto =
+ HOWTO (R_OR1K_GOT16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_OR1K_GOT16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false); /* pcrel_offset */
+
/* Map BFD reloc types to Or1k ELF reloc types. */
struct or1k_reloc_map
@@ -1506,12 +1523,11 @@ or1k_elf_relocate_section (bfd *output_bfd,
if (r_type == R_OR1K_GOT_AHI16)
saw_gotha = true;
- /* If we have a R_OR1K_GOT16 followed by a R_OR1K_GOT_AHI16
+ /* If we have a R_OR1K_GOT16 following a R_OR1K_GOT_AHI16
relocation we assume the code is doing the right thing to avoid
- overflows. Here we mask the lower 16-bit of the relocation to
- avoid overflow validation failures. */
+ overflows. */
if (r_type == R_OR1K_GOT16 && saw_gotha)
- relocation &= 0xffff;
+ howto = &or1k_elf_got16_no_overflow_howto;
/* Addend should be zero. */
if (rel->r_addend != 0)
--
2.25.1

View File

@ -0,0 +1,236 @@
From 1c611b40e6bfc8029bff7696814330b5bc0ee5c0 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 26 Jul 2021 05:59:55 -0700
Subject: [PATCH] bfd: Close the file descriptor if there is no archive fd
Close the file descriptor if there is no archive plugin file descriptor
to avoid running out of file descriptors on thin archives with many
archive members.
bfd/
PR ld/28138
* plugin.c (bfd_plugin_close_file_descriptor): Close the file
descriptor there is no archive plugin file descriptor.
ld/
PR ld/28138
* testsuite/ld-plugin/lto.exp: Run tmpdir/pr28138 only for
native build.
PR ld/28138
* testsuite/ld-plugin/lto.exp: Run ld/28138 tests.
* testsuite/ld-plugin/pr28138.c: New file.
* testsuite/ld-plugin/pr28138-1.c: Likewise.
* testsuite/ld-plugin/pr28138-2.c: Likewise.
* testsuite/ld-plugin/pr28138-3.c: Likewise.
* testsuite/ld-plugin/pr28138-4.c: Likewise.
* testsuite/ld-plugin/pr28138-5.c: Likewise.
* testsuite/ld-plugin/pr28138-6.c: Likewise.
* testsuite/ld-plugin/pr28138-7.c: Likewise.
(cherry picked from commit 5a98fb7513b559e20dfebdbaa2a471afda3b4742)
(cherry picked from commit 7dc37e1e1209c80e0bab784df6b6bac335e836f2)
[Upstream:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1c611b40e6bfc8029bff7696814330b5bc0ee5c0]
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
bfd/plugin.c | 8 +++++++
ld/testsuite/ld-plugin/lto.exp | 34 ++++++++++++++++++++++++++++++
ld/testsuite/ld-plugin/pr28138-1.c | 6 ++++++
ld/testsuite/ld-plugin/pr28138-2.c | 6 ++++++
ld/testsuite/ld-plugin/pr28138-3.c | 6 ++++++
ld/testsuite/ld-plugin/pr28138-4.c | 6 ++++++
ld/testsuite/ld-plugin/pr28138-5.c | 6 ++++++
ld/testsuite/ld-plugin/pr28138-6.c | 6 ++++++
ld/testsuite/ld-plugin/pr28138-7.c | 6 ++++++
ld/testsuite/ld-plugin/pr28138.c | 20 ++++++++++++++++++
10 files changed, 104 insertions(+)
create mode 100644 ld/testsuite/ld-plugin/pr28138-1.c
create mode 100644 ld/testsuite/ld-plugin/pr28138-2.c
create mode 100644 ld/testsuite/ld-plugin/pr28138-3.c
create mode 100644 ld/testsuite/ld-plugin/pr28138-4.c
create mode 100644 ld/testsuite/ld-plugin/pr28138-5.c
create mode 100644 ld/testsuite/ld-plugin/pr28138-6.c
create mode 100644 ld/testsuite/ld-plugin/pr28138-7.c
create mode 100644 ld/testsuite/ld-plugin/pr28138.c
diff --git a/bfd/plugin.c b/bfd/plugin.c
index 6cfa2b66470..3bab8febe88 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -291,6 +291,14 @@ bfd_plugin_close_file_descriptor (bfd *abfd, int fd)
&& !bfd_is_thin_archive (abfd->my_archive))
abfd = abfd->my_archive;
+ /* Close the file descriptor if there is no archive plugin file
+ descriptor. */
+ if (abfd->archive_plugin_fd == -1)
+ {
+ close (fd);
+ return;
+ }
+
abfd->archive_plugin_fd_open_count--;
/* Dup the archive plugin file descriptor for later use, which
will be closed by _bfd_archive_close_and_cleanup. */
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index def69e43ab3..999d911ce6a 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -687,6 +687,40 @@ if { [is_elf_format] && [check_lto_shared_available] } {
}
}
+run_cc_link_tests [list \
+ [list \
+ "Build pr28138.a" \
+ "-T" "" \
+ {pr28138-1.c pr28138-2.c pr28138-3.c pr28138-4.c pr28138-5.c \
+ pr28138-6.c pr28138-7.c} {} "pr28138.a" \
+ ] \
+ [list \
+ "Build pr28138.o" \
+ "" "" \
+ {pr28138.c} {} \
+ ] \
+]
+
+set exec_output [run_host_cmd "sh" \
+ "-c \"ulimit -n 20; \
+ $CC -Btmpdir/ld -o tmpdir/pr28138 \
+ tmpdir/pr28138.o tmpdir/pr28138.a\""]
+set exec_output [prune_warnings $exec_output]
+if [string match "" $exec_output] then {
+ if { [isnative] } {
+ set exec_output [run_host_cmd "tmpdir/pr28138" ""]
+ if [string match "PASS" $exec_output] then {
+ pass "PR ld/28138"
+ } else {
+ fail "PR ld/28138"
+ }
+ } else {
+ pass "PR ld/28138"
+ }
+} else {
+ fail "PR ld/28138"
+}
+
set testname "Build liblto-11.a"
remote_file host delete "tmpdir/liblto-11.a"
set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]
diff --git a/ld/testsuite/ld-plugin/pr28138-1.c b/ld/testsuite/ld-plugin/pr28138-1.c
new file mode 100644
index 00000000000..51d119e1642
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr28138-1.c
@@ -0,0 +1,6 @@
+extern int a0(void);
+int
+a1(void)
+{
+ return 1 + a0();
+}
diff --git a/ld/testsuite/ld-plugin/pr28138-2.c b/ld/testsuite/ld-plugin/pr28138-2.c
new file mode 100644
index 00000000000..1120cd797e9
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr28138-2.c
@@ -0,0 +1,6 @@
+extern int a1(void);
+int
+a2(void)
+{
+ return 1 + a1();
+}
diff --git a/ld/testsuite/ld-plugin/pr28138-3.c b/ld/testsuite/ld-plugin/pr28138-3.c
new file mode 100644
index 00000000000..ec464947ee6
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr28138-3.c
@@ -0,0 +1,6 @@
+extern int a2(void);
+int
+a3(void)
+{
+ return 1 + a2();
+}
diff --git a/ld/testsuite/ld-plugin/pr28138-4.c b/ld/testsuite/ld-plugin/pr28138-4.c
new file mode 100644
index 00000000000..475701b2c5c
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr28138-4.c
@@ -0,0 +1,6 @@
+extern int a3(void);
+int
+a4(void)
+{
+ return 1 + a3();
+}
diff --git a/ld/testsuite/ld-plugin/pr28138-5.c b/ld/testsuite/ld-plugin/pr28138-5.c
new file mode 100644
index 00000000000..e24f86c363e
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr28138-5.c
@@ -0,0 +1,6 @@
+extern int a4(void);
+int
+a5(void)
+{
+ return 1 + a4();
+}
diff --git a/ld/testsuite/ld-plugin/pr28138-6.c b/ld/testsuite/ld-plugin/pr28138-6.c
new file mode 100644
index 00000000000..b5b938bdb21
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr28138-6.c
@@ -0,0 +1,6 @@
+extern int a5(void);
+int
+a6(void)
+{
+ return 1 + a5();
+}
diff --git a/ld/testsuite/ld-plugin/pr28138-7.c b/ld/testsuite/ld-plugin/pr28138-7.c
new file mode 100644
index 00000000000..4ef75bf0f0c
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr28138-7.c
@@ -0,0 +1,6 @@
+extern int a6(void);
+int
+a7(void)
+{
+ return 1 + a6();
+}
diff --git a/ld/testsuite/ld-plugin/pr28138.c b/ld/testsuite/ld-plugin/pr28138.c
new file mode 100644
index 00000000000..68252c9f382
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr28138.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+
+extern int a7(void);
+
+int
+a0(void)
+{
+ return 0;
+}
+
+int
+main()
+{
+ if (a7() == 7)
+ {
+ printf ("PASS\n");
+ return 0;
+ }
+ return 1;
+}
--
2.34.1

View File

@ -0,0 +1,47 @@
From 30a954525f4e53a9cd50a1a8a6f201c7cf6595c7 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 7 Feb 2022 15:22:19 -0800
Subject: [PATCH] i386: Allow GOT32 relocations against ABS symbols
GOT32 relocations are allowed since absolute value + addend is stored in
the GOT slot.
Tested on glibc 2.35 build with GCC 11.2 and -Os.
bfd/
PR ld/28870
* elfxx-x86.c (_bfd_elf_x86_valid_reloc_p): Also allow GOT32
relocations.
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index 7ac2411fc80..d00dc45677b 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -1942,9 +1942,9 @@ _bfd_elf_x86_valid_reloc_p (asection *input_section,
irel = *rel;
/* Only allow relocations against absolute symbol, which can be
- resolved as absolute value + addend. GOTPCREL relocations
- are allowed since absolute value + addend is stored in the
- GOT slot. */
+ resolved as absolute value + addend. GOTPCREL and GOT32
+ relocations are allowed since absolute value + addend is
+ stored in the GOT slot. */
if (bed->target_id == X86_64_ELF_DATA)
{
r_type &= ~R_X86_64_converted_reloc_bit;
@@ -1965,7 +1965,9 @@ _bfd_elf_x86_valid_reloc_p (asection *input_section,
else
valid_p = (r_type == R_386_32
|| r_type == R_386_16
- || r_type == R_386_8);
+ || r_type == R_386_8
+ || r_type == R_386_GOT32
+ || r_type == R_386_GOT32X);
if (valid_p)
*no_dynreloc_p = true;

View File

@ -0,0 +1,48 @@
From 33f3c1f804efc2e4f97849081589efb70cda31e5 Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Fri, 25 Dec 2015 11:38:13 +0100
Subject: [PATCH] sh-conf
Likewise, binutils has no idea about any of these new targets either, so we
fix that up too.. now we're able to actually build a real toolchain for
sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more
inept targets than that one, really. Go look, I promise).
[Romain: rebase on top of 2.32]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
[Thomas: rebase on top of 2.29, in which sh64 support was removed.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
configure | 2 +-
configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 3dd206525a7..6881ce632f5 100755
--- a/configure
+++ b/configure
@@ -3892,7 +3892,7 @@ case "${target}" in
nvptx*-*-*)
noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
;;
- sh-*-*)
+ sh*-*-*)
case "${target}" in
sh*-*-elf)
;;
diff --git a/configure.ac b/configure.ac
index 797a624621e..1f9256bbf18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1175,7 +1175,7 @@ case "${target}" in
nvptx*-*-*)
noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
;;
- sh-*-*)
+ sh*-*-*)
case "${target}" in
sh*-*-elf)
;;
--
2.31.1

View File

@ -0,0 +1,306 @@
From 4d8705ddb55897e8a74b617ab95736d520d9e1ea Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Fri, 25 Dec 2015 11:45:38 +0100
Subject: [PATCH] poison-system-directories
Patch adapted to binutils 2.23.2 and extended to use
BR_COMPILER_PARANOID_UNSAFE_PATH by Thomas Petazzoni.
[Romain: rebase on top of 2.33.1]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
[Gustavo: adapt to binutils 2.25]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Upstream-Status: Inappropriate [distribution: codesourcery]
Patch originally created by Mark Hatle, forward-ported to
binutils 2.21 by Scott Garman.
purpose: warn for uses of system directories when cross linking
Code Merged from Sourcery G++ binutils 2.19 - 4.4-277
2008-07-02 Joseph Myers <joseph@codesourcery.com>
ld/
* ld.h (args_type): Add error_poison_system_directories.
* ld.texinfo (--error-poison-system-directories): Document.
* ldfile.c (ldfile_add_library_path): Check
command_line.error_poison_system_directories.
* ldmain.c (main): Initialize
command_line.error_poison_system_directories.
* lexsup.c (enum option_values): Add
OPTION_ERROR_POISON_SYSTEM_DIRECTORIES.
(ld_options): Add --error-poison-system-directories.
(parse_args): Handle new option.
2007-06-13 Joseph Myers <joseph@codesourcery.com>
ld/
* config.in: Regenerate.
* ld.h (args_type): Add poison_system_directories.
* ld.texinfo (--no-poison-system-directories): Document.
* ldfile.c (ldfile_add_library_path): Check
command_line.poison_system_directories.
* ldmain.c (main): Initialize
command_line.poison_system_directories.
* lexsup.c (enum option_values): Add
OPTION_NO_POISON_SYSTEM_DIRECTORIES.
(ld_options): Add --no-poison-system-directories.
(parse_args): Handle new option.
2007-04-20 Joseph Myers <joseph@codesourcery.com>
Merge from Sourcery G++ binutils 2.17:
2007-03-20 Joseph Myers <joseph@codesourcery.com>
Based on patch by Mark Hatle <mark.hatle@windriver.com>.
ld/
* configure.ac (--enable-poison-system-directories): New option.
* configure, config.in: Regenerate.
* ldfile.c (ldfile_add_library_path): If
ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib,
/usr/lib, /usr/local/lib or /usr/X11R6/lib.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
ld/config.in | 3 +++
ld/configure | 14 ++++++++++++++
ld/configure.ac | 10 ++++++++++
ld/ld.h | 8 ++++++++
ld/ld.texi | 12 ++++++++++++
ld/ldfile.c | 17 +++++++++++++++++
ld/ldlex.h | 2 ++
ld/ldmain.c | 2 ++
ld/lexsup.c | 21 +++++++++++++++++++++
9 files changed, 89 insertions(+)
diff --git a/ld/config.in b/ld/config.in
index 26d55a00d47..ffad464783c 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -43,6 +43,9 @@
language is requested. */
#undef ENABLE_NLS
+/* Define to warn for use of native system library directories */
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+
/* Additional extension a shared object might have. */
#undef EXTRA_SHLIB_EXTENSION
diff --git a/ld/configure b/ld/configure
index c197aaef3cb..882263aa43f 100755
--- a/ld/configure
+++ b/ld/configure
@@ -829,6 +829,7 @@ with_lib_path
enable_targets
enable_64_bit_bfd
with_sysroot
+enable_poison_system_directories
enable_gold
enable_got
enable_compressed_debug_sections
@@ -1498,6 +1499,8 @@ Optional Features:
--enable-checking enable run-time checks
--enable-targets alternative target configurations
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
+ --enable-poison-system-directories
+ warn for use of native system library directories
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-got=<type> GOT handling scheme (target, single, negative,
multigot)
@@ -15236,7 +15239,18 @@ else
fi
+# Check whether --enable-poison-system-directories was given.
+if test "${enable_poison_system_directories+set}" = set; then :
+ enableval=$enable_poison_system_directories;
+else
+ enable_poison_system_directories=no
+fi
+
+if test "x${enable_poison_system_directories}" = "xyes"; then
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+
+fi
# Check whether --enable-got was given.
if test "${enable_got+set}" = set; then :
diff --git a/ld/configure.ac b/ld/configure.ac
index 8ea97c43cd4..0f246db67d8 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -106,6 +106,16 @@ AC_SUBST(use_sysroot)
AC_SUBST(TARGET_SYSTEM_ROOT)
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+AC_ARG_ENABLE([poison-system-directories],
+ AS_HELP_STRING([--enable-poison-system-directories],
+ [warn for use of native system library directories]),,
+ [enable_poison_system_directories=no])
+if test "x${enable_poison_system_directories}" = "xyes"; then
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system library directories])
+fi
+
dnl Use --enable-gold to decide if this linker should be the default.
dnl "install_as_default" is set to false if gold is the default linker.
dnl "installed_linker" is the installed BFD linker name.
diff --git a/ld/ld.h b/ld/ld.h
index 35fafebfaed..74e66405de6 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -162,6 +162,14 @@ typedef struct
in the linker script. */
bool force_group_allocation;
+ /* If TRUE (the default) warn for uses of system directories when
+ cross linking. */
+ bool poison_system_directories;
+
+ /* If TRUE (default FALSE) give an error for uses of system
+ directories when cross linking instead of a warning. */
+ bool error_poison_system_directories;
+
/* Big or little endian as set on command line. */
enum endian_enum endian;
diff --git a/ld/ld.texi b/ld/ld.texi
index dd8f571d4e4..3ab210b41b9 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -2863,6 +2863,18 @@ string identifying the original linked file does not change.
Passing @code{none} for @var{style} disables the setting from any
@code{--build-id} options earlier on the command line.
+
+@kindex --no-poison-system-directories
+@item --no-poison-system-directories
+Do not warn for @option{-L} options using system directories such as
+@file{/usr/lib} when cross linking. This option is intended for use
+in chroot environments when such directories contain the correct
+libraries for the target system rather than the host.
+
+@kindex --error-poison-system-directories
+@item --error-poison-system-directories
+Give an error instead of a warning for @option{-L} options using
+system directories when cross linking.
@end table
@c man end
diff --git a/ld/ldfile.c b/ld/ldfile.c
index 9d0af06f1f6..7cdd3b1c1b1 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -117,6 +117,23 @@ ldfile_add_library_path (const char *name, bool cmdline)
new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL);
else
new_dirs->name = xstrdup (name);
+
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ if (command_line.poison_system_directories
+ && ((!strncmp (name, "/lib", 4))
+ || (!strncmp (name, "/usr/lib", 8))
+ || (!strncmp (name, "/usr/local/lib", 14))
+ || (!strncmp (name, "/usr/X11R6/lib", 14))))
+ {
+ if (command_line.error_poison_system_directories)
+ einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
+ "cross-compilation\n"), name);
+ else
+ einfo (_("%P: warning: library search path \"%s\" is unsafe for "
+ "cross-compilation\n"), name);
+ }
+#endif
+
}
/* Try to open a BFD for a lang_input_statement. */
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 9e8bf5fb835..2f0fadfe0a3 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -163,6 +163,8 @@ enum option_values
OPTION_CTF_VARIABLES,
OPTION_NO_CTF_VARIABLES,
OPTION_CTF_SHARE_TYPES,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
};
/* The initial parser states. */
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 42660eb9a3c..1aef9387f93 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -321,6 +321,8 @@ main (int argc, char **argv)
command_line.warn_mismatch = true;
command_line.warn_search_mismatch = true;
command_line.check_section_addresses = -1;
+ command_line.poison_system_directories = true;
+ command_line.error_poison_system_directories = false;
/* We initialize DEMANGLING based on the environment variable
COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 00274c500d0..4f23b3a2da2 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -595,6 +595,14 @@ static const struct ld_option ld_options[] =
" <method> is: share-unconflicted (default),\n"
" share-duplicated"),
TWO_DASHES },
+ { {"no-poison-system-directories", no_argument, NULL,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES},
+ '\0', NULL, N_("Do not warn for -L options using system directories"),
+ TWO_DASHES },
+ { {"error-poison-system-directories", no_argument, NULL,
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES},
+ '\0', NULL, N_("Give an error for -L options using system directories"),
+ TWO_DASHES },
};
#define OPTION_COUNT ARRAY_SIZE (ld_options)
@@ -607,6 +615,7 @@ parse_args (unsigned argc, char **argv)
int ingroup = 0;
char *default_dirlist = NULL;
char *shortopts;
+ char *BR_paranoid_env;
struct option *longopts;
struct option *really_longopts;
int last_optind;
@@ -1643,6 +1652,14 @@ parse_args (unsigned argc, char **argv)
}
break;
+ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
+ command_line.poison_system_directories = false;
+ break;
+
+ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
+ command_line.error_poison_system_directories = true;
+ break;
+
case OPTION_PUSH_STATE:
input_flags.pushed = xmemdup (&input_flags,
sizeof (input_flags),
@@ -1788,6 +1805,10 @@ parse_args (unsigned argc, char **argv)
command_line.soname = NULL;
}
+ BR_paranoid_env = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH");
+ if (BR_paranoid_env && strlen(BR_paranoid_env) > 0)
+ command_line.error_poison_system_directories = true;
+
while (ingroup)
{
einfo (_("%P: missing --end-group; added as last command line option\n"));
--
2.31.1

View File

@ -0,0 +1,50 @@
From ef4ba1da823e8366ea4f126f50885a44ebf4dcf0 Mon Sep 17 00:00:00 2001
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
Date: Wed, 9 Jun 2021 17:28:27 +0200
Subject: [PATCH] bfd/elf32-or1k: fix building with gcc version < 5
Gcc version >= 5 has standard C mode not set to -std=gnu11, so if we use
an old compiler(i.e. gcc 4.9) build fails on:
```
elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in
C99 or C11 mode
for (size_t i = 0; i < insn_count; i++)
^
```
So let's declare `size_t i` at the top of the function instead of inside
for loop.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
bfd/elf32-or1k.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 4ae7f324d33..32063ab0289 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -2244,9 +2244,10 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
{
unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
unsigned output_insns[PLT_MAX_INSN_COUNT];
+ size_t i;
/* Copy instructions into the output buffer. */
- for (size_t i = 0; i < insn_count; i++)
+ for (i = 0; i < insn_count; i++)
output_insns[i] = insns[i];
/* Honor the no-delay-slot setting. */
@@ -2277,7 +2278,7 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
}
/* Write out the output buffer. */
- for (size_t i = 0; i < (insn_count+1); i++)
+ for (i = 0; i < (insn_count+1); i++)
bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
}
--
2.31.1

View File

@ -0,0 +1,75 @@
From 362a20108782b87cd780a989c0dbd014fc2def8b Mon Sep 17 00:00:00 2001
From: Stafford Horne <shorne@gmail.com>
Date: Sun, 2 Jan 2022 09:03:28 +0900
Subject: [PATCH] or1k: Avoid R_OR1K_GOT16 signed overflow by using special
howto
Previously when fixing PR 21464 we masked out upper bits of the
relocation value in order to avoid overflow complaints when acceptable.
It turns out this does not work when the relocation value ends up being
signed.
To fix this this patch introduces a special howto with
complain_on_overflow set to complain_overflow_dont. This is used in
place of the normal R_OR1K_GOT16 howto when we detect R_OR1K_GOT_AHI16
relocations.
bfd/ChangeLog:
PR 28735
* elf32-or1k.c (or1k_elf_got16_no_overflow_howto): Define.
(or1k_elf_relocate_section): Use new howto instead of trying to
mask out relocation bits.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
bfd/elf32-or1k.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 4ae7f324d33..7fd88d72442 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -828,6 +828,23 @@ static reloc_howto_type or1k_elf_howto_table[] =
false), /* pcrel_offset */
};
+/* A copy of the R_OR1K_GOT16 used in the presense of R_OR1K_GOT_AHI16
+ relocations when we know we can ignore overflows. */
+static reloc_howto_type or1k_elf_got16_no_overflow_howto =
+ HOWTO (R_OR1K_GOT16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_OR1K_GOT16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false); /* pcrel_offset */
+
/* Map BFD reloc types to Or1k ELF reloc types. */
struct or1k_reloc_map
@@ -1506,12 +1523,11 @@ or1k_elf_relocate_section (bfd *output_bfd,
if (r_type == R_OR1K_GOT_AHI16)
saw_gotha = true;
- /* If we have a R_OR1K_GOT16 followed by a R_OR1K_GOT_AHI16
+ /* If we have a R_OR1K_GOT16 following a R_OR1K_GOT_AHI16
relocation we assume the code is doing the right thing to avoid
- overflows. Here we mask the lower 16-bit of the relocation to
- avoid overflow validation failures. */
+ overflows. */
if (r_type == R_OR1K_GOT16 && saw_gotha)
- relocation &= 0xffff;
+ howto = &or1k_elf_got16_no_overflow_howto;
/* Addend should be zero. */
if (rel->r_addend != 0)
--
2.25.1

View File

@ -0,0 +1,55 @@
From ed9b2e40ebffec835d63473367da8dd8f80d7d5b Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Mon, 21 Feb 2022 10:58:57 +1030
Subject: [PATCH] binutils 2.38 vs. ppc32 linux kernel
Commit b25f942e18d6 made .machine more strict. Weaken it again.
* config/tc-ppc.c (ppc_machine): Treat an early .machine specially,
keeping sticky options to work around gcc bugs.
(cherry picked from commit cebc89b9328eab994f6b0314c263f94e7949a553)
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
gas/config/tc-ppc.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 054f9c72161..89bc7d3f9b9 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -5965,7 +5965,30 @@ ppc_machine (int ignore ATTRIBUTE_UNUSED)
options do not count as a new machine, instead they add
to currently selected opcodes. */
ppc_cpu_t machine_sticky = 0;
- new_cpu = ppc_parse_cpu (ppc_cpu, &machine_sticky, cpu_string);
+ /* Unfortunately, some versions of gcc emit a .machine
+ directive very near the start of the compiler's assembly
+ output file. This is bad because it overrides user -Wa
+ cpu selection. Worse, there are versions of gcc that
+ emit the *wrong* cpu, not even respecting the -mcpu given
+ to gcc. See gcc pr101393. And to compound the problem,
+ as of 20220222 gcc doesn't pass the correct cpu option to
+ gas on the command line. See gcc pr59828. Hack around
+ this by keeping sticky options for an early .machine. */
+ asection *sec;
+ for (sec = stdoutput->sections; sec != NULL; sec = sec->next)
+ {
+ segment_info_type *info = seg_info (sec);
+ /* Are the frags for this section perturbed from their
+ initial state? Even .align will count here. */
+ if (info != NULL
+ && (info->frchainP->frch_root != info->frchainP->frch_last
+ || info->frchainP->frch_root->fr_type != rs_fill
+ || info->frchainP->frch_root->fr_fix != 0))
+ break;
+ }
+ new_cpu = ppc_parse_cpu (ppc_cpu,
+ sec == NULL ? &sticky : &machine_sticky,
+ cpu_string);
if (new_cpu != 0)
ppc_cpu = new_cpu;
else
--
2.30.2

View File

@ -0,0 +1,48 @@
From 33f3c1f804efc2e4f97849081589efb70cda31e5 Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Fri, 25 Dec 2015 11:38:13 +0100
Subject: [PATCH] sh-conf
Likewise, binutils has no idea about any of these new targets either, so we
fix that up too.. now we're able to actually build a real toolchain for
sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more
inept targets than that one, really. Go look, I promise).
[Romain: rebase on top of 2.32]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
[Thomas: rebase on top of 2.29, in which sh64 support was removed.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
configure | 2 +-
configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 3dd206525a7..6881ce632f5 100755
--- a/configure
+++ b/configure
@@ -3892,7 +3892,7 @@ case "${target}" in
nvptx*-*-*)
noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
;;
- sh-*-*)
+ sh*-*-*)
case "${target}" in
sh*-*-elf)
;;
diff --git a/configure.ac b/configure.ac
index 797a624621e..1f9256bbf18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1175,7 +1175,7 @@ case "${target}" in
nvptx*-*-*)
noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
;;
- sh-*-*)
+ sh*-*-*)
case "${target}" in
sh*-*-elf)
;;
--
2.31.1

View File

@ -0,0 +1,298 @@
From 4d8705ddb55897e8a74b617ab95736d520d9e1ea Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Fri, 25 Dec 2015 11:45:38 +0100
Subject: [PATCH] poison-system-directories
Patch adapted to binutils 2.23.2 and extended to use
BR_COMPILER_PARANOID_UNSAFE_PATH by Thomas Petazzoni.
[Waldemar: rebase on top of 2.39]
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
[Romain: rebase on top of 2.33.1]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
[Gustavo: adapt to binutils 2.25]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Upstream-Status: Inappropriate [distribution: codesourcery]
Patch originally created by Mark Hatle, forward-ported to
binutils 2.21 by Scott Garman.
purpose: warn for uses of system directories when cross linking
Code Merged from Sourcery G++ binutils 2.19 - 4.4-277
2008-07-02 Joseph Myers <joseph@codesourcery.com>
ld/
* ld.h (args_type): Add error_poison_system_directories.
* ld.texinfo (--error-poison-system-directories): Document.
* ldfile.c (ldfile_add_library_path): Check
command_line.error_poison_system_directories.
* ldmain.c (main): Initialize
command_line.error_poison_system_directories.
* lexsup.c (enum option_values): Add
OPTION_ERROR_POISON_SYSTEM_DIRECTORIES.
(ld_options): Add --error-poison-system-directories.
(parse_args): Handle new option.
2007-06-13 Joseph Myers <joseph@codesourcery.com>
ld/
* config.in: Regenerate.
* ld.h (args_type): Add poison_system_directories.
* ld.texinfo (--no-poison-system-directories): Document.
* ldfile.c (ldfile_add_library_path): Check
command_line.poison_system_directories.
* ldmain.c (main): Initialize
command_line.poison_system_directories.
* lexsup.c (enum option_values): Add
OPTION_NO_POISON_SYSTEM_DIRECTORIES.
(ld_options): Add --no-poison-system-directories.
(parse_args): Handle new option.
2007-04-20 Joseph Myers <joseph@codesourcery.com>
Merge from Sourcery G++ binutils 2.17:
2007-03-20 Joseph Myers <joseph@codesourcery.com>
Based on patch by Mark Hatle <mark.hatle@windriver.com>.
ld/
* configure.ac (--enable-poison-system-directories): New option.
* configure, config.in: Regenerate.
* ldfile.c (ldfile_add_library_path): If
ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib,
/usr/lib, /usr/local/lib or /usr/X11R6/lib.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
ld/config.in | 3 +++
ld/configure | 14 ++++++++++++++
ld/configure.ac | 10 ++++++++++
ld/ld.h | 8 ++++++++
ld/ld.texi | 12 ++++++++++++
ld/ldfile.c | 17 +++++++++++++++++
ld/ldlex.h | 2 ++
ld/ldmain.c | 2 ++
ld/lexsup.c | 21 +++++++++++++++++++++
9 files changed, 89 insertions(+)
diff -Nur binutils-2.39.orig/ld/config.in binutils-2.39/ld/config.in
--- binutils-2.39.orig/ld/config.in 2022-08-05 11:56:56.000000000 +0200
+++ binutils-2.39/ld/config.in 2022-08-11 13:00:55.310472243 +0200
@@ -55,6 +55,9 @@
language is requested. */
#undef ENABLE_NLS
+/* Define to warn for use of native system library directories */
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+
/* Additional extension a shared object might have. */
#undef EXTRA_SHLIB_EXTENSION
diff -Nur binutils-2.39.orig/ld/configure binutils-2.39/ld/configure
--- binutils-2.39.orig/ld/configure 2022-08-05 11:56:54.000000000 +0200
+++ binutils-2.39/ld/configure 2022-08-11 13:00:55.370470806 +0200
@@ -836,6 +836,7 @@
enable_targets
enable_64_bit_bfd
with_sysroot
+enable_poison_system_directories
enable_gold
enable_got
enable_compressed_debug_sections
@@ -1514,6 +1515,8 @@
--enable-checking enable run-time checks
--enable-targets alternative target configurations
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
+ --enable-poison-system-directories
+ warn for use of native system library directories
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-got=<type> GOT handling scheme (target, single, negative,
multigot)
@@ -15370,7 +15373,18 @@
fi
+# Check whether --enable-poison-system-directories was given.
+if test "${enable_poison_system_directories+set}" = set; then :
+ enableval=$enable_poison_system_directories;
+else
+ enable_poison_system_directories=no
+fi
+
+if test "x${enable_poison_system_directories}" = "xyes"; then
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+
+fi
# Check whether --enable-got was given.
if test "${enable_got+set}" = set; then :
diff -Nur binutils-2.39.orig/ld/configure.ac binutils-2.39/ld/configure.ac
--- binutils-2.39.orig/ld/configure.ac 2022-07-08 11:46:48.000000000 +0200
+++ binutils-2.39/ld/configure.ac 2022-08-11 13:00:55.370470806 +0200
@@ -102,6 +102,16 @@
AC_SUBST(TARGET_SYSTEM_ROOT)
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+AC_ARG_ENABLE([poison-system-directories],
+ AS_HELP_STRING([--enable-poison-system-directories],
+ [warn for use of native system library directories]),,
+ [enable_poison_system_directories=no])
+if test "x${enable_poison_system_directories}" = "xyes"; then
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system library directories])
+fi
+
dnl Use --enable-gold to decide if this linker should be the default.
dnl "install_as_default" is set to false if gold is the default linker.
dnl "installed_linker" is the installed BFD linker name.
diff -Nur binutils-2.39.orig/ld/ldfile.c binutils-2.39/ld/ldfile.c
--- binutils-2.39.orig/ld/ldfile.c 2022-07-08 11:46:48.000000000 +0200
+++ binutils-2.39/ld/ldfile.c 2022-08-11 13:00:55.394470231 +0200
@@ -117,6 +117,23 @@
new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL);
else
new_dirs->name = xstrdup (name);
+
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ if (command_line.poison_system_directories
+ && ((!strncmp (name, "/lib", 4))
+ || (!strncmp (name, "/usr/lib", 8))
+ || (!strncmp (name, "/usr/local/lib", 14))
+ || (!strncmp (name, "/usr/X11R6/lib", 14))))
+ {
+ if (command_line.error_poison_system_directories)
+ einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
+ "cross-compilation\n"), name);
+ else
+ einfo (_("%P: warning: library search path \"%s\" is unsafe for "
+ "cross-compilation\n"), name);
+ }
+#endif
+
}
/* Try to open a BFD for a lang_input_statement. */
diff -Nur binutils-2.39.orig/ld/ld.h binutils-2.39/ld/ld.h
--- binutils-2.39.orig/ld/ld.h 2022-07-08 11:46:48.000000000 +0200
+++ binutils-2.39/ld/ld.h 2022-08-11 13:00:55.382470519 +0200
@@ -162,6 +162,14 @@
in the linker script. */
bool force_group_allocation;
+ /* If TRUE (the default) warn for uses of system directories when
+ cross linking. */
+ bool poison_system_directories;
+
+ /* If TRUE (default FALSE) give an error for uses of system
+ directories when cross linking instead of a warning. */
+ bool error_poison_system_directories;
+
/* Big or little endian as set on command line. */
enum endian_enum endian;
diff -Nur binutils-2.39.orig/ld/ldlex.h binutils-2.39/ld/ldlex.h
--- binutils-2.39.orig/ld/ldlex.h 2022-07-08 11:46:48.000000000 +0200
+++ binutils-2.39/ld/ldlex.h 2022-08-11 13:03:35.462636396 +0200
@@ -164,6 +164,8 @@
OPTION_CTF_VARIABLES,
OPTION_NO_CTF_VARIABLES,
OPTION_CTF_SHARE_TYPES,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
OPTION_WARN_EXECSTACK,
OPTION_NO_WARN_EXECSTACK,
OPTION_WARN_RWX_SEGMENTS,
diff -Nur binutils-2.39.orig/ld/ldmain.c binutils-2.39/ld/ldmain.c
--- binutils-2.39.orig/ld/ldmain.c 2022-07-08 11:46:48.000000000 +0200
+++ binutils-2.39/ld/ldmain.c 2022-08-11 13:00:55.402470040 +0200
@@ -321,6 +321,8 @@
command_line.warn_mismatch = true;
command_line.warn_search_mismatch = true;
command_line.check_section_addresses = -1;
+ command_line.poison_system_directories = true;
+ command_line.error_poison_system_directories = false;
/* We initialize DEMANGLING based on the environment variable
COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
diff -Nur binutils-2.39.orig/ld/ld.texi binutils-2.39/ld/ld.texi
--- binutils-2.39.orig/ld/ld.texi 2022-07-08 11:46:48.000000000 +0200
+++ binutils-2.39/ld/ld.texi 2022-08-11 13:02:44.627853889 +0200
@@ -2936,6 +2936,18 @@
Passing @code{none} for @var{style} disables the setting from any
@code{--build-id} options earlier on the command line.
+@kindex --no-poison-system-directories
+@item --no-poison-system-directories
+Do not warn for @option{-L} options using system directories such as
+@file{/usr/lib} when cross linking. This option is intended for use
+in chroot environments when such directories contain the correct
+libraries for the target system rather than the host.
+
+@kindex --error-poison-system-directories
+@item --error-poison-system-directories
+Give an error instead of a warning for @option{-L} options using
+system directories when cross linking.
+
@kindex --package-metadata=@var{JSON}
@item --package-metadata=@var{JSON}
Request the creation of a @code{.note.package} ELF note section. The
diff -Nur binutils-2.39.orig/ld/lexsup.c binutils-2.39/ld/lexsup.c
--- binutils-2.39.orig/ld/lexsup.c 2022-07-08 11:46:48.000000000 +0200
+++ binutils-2.39/ld/lexsup.c 2022-08-11 13:00:55.434469274 +0200
@@ -608,6 +608,14 @@
" <method> is: share-unconflicted (default),\n"
" share-duplicated"),
TWO_DASHES },
+ { {"no-poison-system-directories", no_argument, NULL,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES},
+ '\0', NULL, N_("Do not warn for -L options using system directories"),
+ TWO_DASHES },
+ { {"error-poison-system-directories", no_argument, NULL,
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES},
+ '\0', NULL, N_("Give an error for -L options using system directories"),
+ TWO_DASHES },
};
#define OPTION_COUNT ARRAY_SIZE (ld_options)
@@ -620,6 +628,7 @@
int ingroup = 0;
char *default_dirlist = NULL;
char *shortopts;
+ char *BR_paranoid_env;
struct option *longopts;
struct option *really_longopts;
int last_optind;
@@ -1679,6 +1688,14 @@
}
break;
+ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
+ command_line.poison_system_directories = false;
+ break;
+
+ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
+ command_line.error_poison_system_directories = true;
+ break;
+
case OPTION_PUSH_STATE:
input_flags.pushed = xmemdup (&input_flags,
sizeof (input_flags),
@@ -1824,6 +1841,10 @@
command_line.soname = NULL;
}
+ BR_paranoid_env = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH");
+ if (BR_paranoid_env && strlen(BR_paranoid_env) > 0)
+ command_line.error_poison_system_directories = true;
+
while (ingroup)
{
einfo (_("%P: missing --end-group; added as last command line option\n"));
--
2.31.1

View File

@ -0,0 +1,50 @@
From ef4ba1da823e8366ea4f126f50885a44ebf4dcf0 Mon Sep 17 00:00:00 2001
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
Date: Wed, 9 Jun 2021 17:28:27 +0200
Subject: [PATCH] bfd/elf32-or1k: fix building with gcc version < 5
Gcc version >= 5 has standard C mode not set to -std=gnu11, so if we use
an old compiler(i.e. gcc 4.9) build fails on:
```
elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in
C99 or C11 mode
for (size_t i = 0; i < insn_count; i++)
^
```
So let's declare `size_t i` at the top of the function instead of inside
for loop.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
bfd/elf32-or1k.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 4ae7f324d33..32063ab0289 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -2244,9 +2244,10 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
{
unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
unsigned output_insns[PLT_MAX_INSN_COUNT];
+ size_t i;
/* Copy instructions into the output buffer. */
- for (size_t i = 0; i < insn_count; i++)
+ for (i = 0; i < insn_count; i++)
output_insns[i] = insns[i];
/* Honor the no-delay-slot setting. */
@@ -2277,7 +2278,7 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
}
/* Write out the output buffer. */
- for (size_t i = 0; i < (insn_count+1); i++)
+ for (i = 0; i < (insn_count+1); i++)
bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
}
--
2.31.1

30
package/third-party/binutils/Config.in vendored Normal file
View File

@ -0,0 +1,30 @@
menuconfig BR2_PACKAGE_BINUTILS
bool "binutils"
depends on !BR2_nios2
depends on BR2_USE_WCHAR
select BR2_PACKAGE_ZLIB
help
Install binutils on the target
if BR2_PACKAGE_BINUTILS
config BR2_PACKAGE_BINUTILS_USE_PREBUILT
bool "use prebuilt binary instead of building from source"
default y
config BR2_PACKAGE_BINUTILS_TARGET
bool "binutils binaries"
help
The GNU Binutils are a collection of binary tools:
ld - the GNU linker.
as - the GNU assembler.
and others...
http://www.gnu.org/software/binutils/
endif
comment "binutils needs a toolchain w/ wchar"
depends on !BR2_nios2
depends on !BR2_USE_WCHAR

View File

@ -0,0 +1,50 @@
comment "Binutils Options"
config BR2_PACKAGE_HOST_BINUTILS_SUPPORTS_CFI
bool
default y
depends on !BR2_microblaze
choice
prompt "Binutils Version"
default BR2_BINUTILS_VERSION_2_38_X if !BR2_arc
default BR2_BINUTILS_VERSION_ARC if BR2_arc
help
Select the version of binutils you wish to use.
config BR2_BINUTILS_VERSION_2_37_X
bool "binutils 2.37"
# AVX512FP16 instructions were not supported before binutils
# 2.38
depends on !BR2_X86_CPU_HAS_AVX512
config BR2_BINUTILS_VERSION_2_38_X
bool "binutils 2.38"
config BR2_BINUTILS_VERSION_2_39_X
bool "binutils 2.39"
config BR2_BINUTILS_VERSION_ARC
bool "binutils arc (2.34.50)"
depends on BR2_arc
endchoice
config BR2_BINUTILS_VERSION
string
default "arc-2020.09-release" if BR2_BINUTILS_VERSION_ARC
default "2.37" if BR2_BINUTILS_VERSION_2_37_X
default "2.38" if BR2_BINUTILS_VERSION_2_38_X
default "2.39" if BR2_BINUTILS_VERSION_2_39_X
config BR2_BINUTILS_GPROFNG
bool "gprofng support"
depends on BR2_BINUTILS_VERSION_2_39_X
help
This option enables support for gprofng, a new profiler.
config BR2_BINUTILS_EXTRA_CONFIG_OPTIONS
string "Additional binutils options"
default ""
help
Any additional binutils options you may want to include.

View File

@ -0,0 +1,310 @@
From 5f62ad7ce534e3384d6ed8892614979da297bd70 Mon Sep 17 00:00:00 2001
From: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
Date: Mon, 14 Oct 2019 16:45:15 +0300
Subject: [PATCH] [PATCH] poison-system-directories
Patch adapted to arc-binutils-gdb-2019.09
Signed-off-by: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
Patch adapted to binutils 2.23.2 and extended to use
BR_COMPILER_PARANOID_UNSAFE_PATH by Thomas Petazzoni.
[Romain: rebase on top of 2.26]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
[Gustavo: adapt to binutils 2.25]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Upstream-Status: Inappropriate [distribution: codesourcery]
Patch originally created by Mark Hatle, forward-ported to
binutils 2.21 by Scott Garman.
purpose: warn for uses of system directories when cross linking
Code Merged from Sourcery G++ binutils 2.19 - 4.4-277
2008-07-02 Joseph Myers <joseph@codesourcery.com>
ld/
* ld.h (args_type): Add error_poison_system_directories.
* ld.texinfo (--error-poison-system-directories): Document.
* ldfile.c (ldfile_add_library_path): Check
command_line.error_poison_system_directories.
* ldmain.c (main): Initialize
command_line.error_poison_system_directories.
* lexsup.c (enum option_values): Add
OPTION_ERROR_POISON_SYSTEM_DIRECTORIES.
(ld_options): Add --error-poison-system-directories.
(parse_args): Handle new option.
2007-06-13 Joseph Myers <joseph@codesourcery.com>
ld/
* config.in: Regenerate.
* ld.h (args_type): Add poison_system_directories.
* ld.texinfo (--no-poison-system-directories): Document.
* ldfile.c (ldfile_add_library_path): Check
command_line.poison_system_directories.
* ldmain.c (main): Initialize
command_line.poison_system_directories.
* lexsup.c (enum option_values): Add
OPTION_NO_POISON_SYSTEM_DIRECTORIES.
(ld_options): Add --no-poison-system-directories.
(parse_args): Handle new option.
2007-04-20 Joseph Myers <joseph@codesourcery.com>
Merge from Sourcery G++ binutils 2.17:
2007-03-20 Joseph Myers <joseph@codesourcery.com>
Based on patch by Mark Hatle <mark.hatle@windriver.com>.
ld/
* configure.ac (--enable-poison-system-directories): New option.
* configure, config.in: Regenerate.
* ldfile.c (ldfile_add_library_path): If
ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib,
/usr/lib, /usr/local/lib or /usr/X11R6/lib.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
ld/config.in | 3 +++
ld/configure | 14 ++++++++++++++
ld/configure.ac | 10 ++++++++++
ld/ld.h | 8 ++++++++
ld/ld.texi | 12 ++++++++++++
ld/ldfile.c | 17 +++++++++++++++++
ld/ldlex.h | 2 ++
ld/ldmain.c | 2 ++
ld/lexsup.c | 21 +++++++++++++++++++++
9 files changed, 89 insertions(+)
diff --git a/ld/config.in b/ld/config.in
index d93c9b08300..5da2742beac 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -31,6 +31,9 @@
language is requested. */
#undef ENABLE_NLS
+/* Define to warn for use of native system library directories */
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+
/* Additional extension a shared object might have. */
#undef EXTRA_SHLIB_EXTENSION
diff --git a/ld/configure b/ld/configure
index 2d6ca5c0445..563f9921f7f 100755
--- a/ld/configure
+++ b/ld/configure
@@ -823,6 +823,7 @@ with_lib_path
enable_targets
enable_64_bit_bfd
with_sysroot
+enable_poison_system_directories
enable_gold
enable_got
enable_compressed_debug_sections
@@ -1487,6 +1488,8 @@ Optional Features:
--disable-largefile omit support for large files
--enable-targets alternative target configurations
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
+ --enable-poison-system-directories
+ warn for use of native system library directories
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-got=<type> GOT handling scheme (target, single, negative,
multigot)
@@ -15804,7 +15807,18 @@ else
fi
+# Check whether --enable-poison-system-directories was given.
+if test "${enable_poison_system_directories+set}" = set; then :
+ enableval=$enable_poison_system_directories;
+else
+ enable_poison_system_directories=no
+fi
+
+if test "x${enable_poison_system_directories}" = "xyes"; then
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+
+fi
# Check whether --enable-got was given.
if test "${enable_got+set}" = set; then :
diff --git a/ld/configure.ac b/ld/configure.ac
index 41a51bbb7e9..dbaa98a9e17 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -94,6 +94,16 @@ AC_SUBST(use_sysroot)
AC_SUBST(TARGET_SYSTEM_ROOT)
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+AC_ARG_ENABLE([poison-system-directories],
+ AS_HELP_STRING([--enable-poison-system-directories],
+ [warn for use of native system library directories]),,
+ [enable_poison_system_directories=no])
+if test "x${enable_poison_system_directories}" = "xyes"; then
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system library directories])
+fi
+
dnl Use --enable-gold to decide if this linker should be the default.
dnl "install_as_default" is set to false if gold is the default linker.
dnl "installed_linker" is the installed BFD linker name.
diff --git a/ld/ld.h b/ld/ld.h
index 55078a9637b..511e9bc34b7 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -180,6 +180,14 @@ typedef struct
in the linker script. */
bfd_boolean force_group_allocation;
+ /* If TRUE (the default) warn for uses of system directories when
+ cross linking. */
+ bfd_boolean poison_system_directories;
+
+ /* If TRUE (default FALSE) give an error for uses of system
+ directories when cross linking instead of a warning. */
+ bfd_boolean error_poison_system_directories;
+
/* Big or little endian as set on command line. */
enum endian_enum endian;
diff --git a/ld/ld.texi b/ld/ld.texi
index fcbc335c95e..6ba7ebdb32a 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -2557,6 +2557,18 @@ string identifying the original linked file does not change.
Passing @code{none} for @var{style} disables the setting from any
@code{--build-id} options earlier on the command line.
+
+@kindex --no-poison-system-directories
+@item --no-poison-system-directories
+Do not warn for @option{-L} options using system directories such as
+@file{/usr/lib} when cross linking. This option is intended for use
+in chroot environments when such directories contain the correct
+libraries for the target system rather than the host.
+
+@kindex --error-poison-system-directories
+@item --error-poison-system-directories
+Give an error instead of a warning for @option{-L} options using
+system directories when cross linking.
@end table
@c man end
diff --git a/ld/ldfile.c b/ld/ldfile.c
index 7f60319390e..0bcc06db964 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -116,6 +116,23 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline)
new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL);
else
new_dirs->name = xstrdup (name);
+
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ if (command_line.poison_system_directories
+ && ((!strncmp (name, "/lib", 4))
+ || (!strncmp (name, "/usr/lib", 8))
+ || (!strncmp (name, "/usr/local/lib", 14))
+ || (!strncmp (name, "/usr/X11R6/lib", 14))))
+ {
+ if (command_line.error_poison_system_directories)
+ einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
+ "cross-compilation\n"), name);
+ else
+ einfo (_("%P: warning: library search path \"%s\" is unsafe for "
+ "cross-compilation\n"), name);
+ }
+#endif
+
}
/* Try to open a BFD for a lang_input_statement. */
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 32a7a6409e8..c02b64bf92f 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -152,6 +152,8 @@ enum option_values
OPTION_NO_PRINT_MAP_DISCARDED,
OPTION_NON_CONTIGUOUS_REGIONS,
OPTION_NON_CONTIGUOUS_REGIONS_WARNINGS,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
};
/* The initial parser states. */
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 34c19223137..66d2c3f4bcf 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -270,6 +270,8 @@ main (int argc, char **argv)
command_line.warn_mismatch = TRUE;
command_line.warn_search_mismatch = TRUE;
command_line.check_section_addresses = -1;
+ command_line.poison_system_directories = TRUE;
+ command_line.error_poison_system_directories = FALSE;
/* We initialize DEMANGLING based on the environment variable
COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 1c15ac29c0c..8b714e10a40 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -549,6 +549,14 @@ static const struct ld_option ld_options[] =
{ {"no-print-map-discarded", no_argument, NULL, OPTION_NO_PRINT_MAP_DISCARDED},
'\0', NULL, N_("Do not show discarded sections in map file output"),
TWO_DASHES },
+ { {"no-poison-system-directories", no_argument, NULL,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES},
+ '\0', NULL, N_("Do not warn for -L options using system directories"),
+ TWO_DASHES },
+ { {"error-poison-system-directories", no_argument, NULL,
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES},
+ '\0', NULL, N_("Give an error for -L options using system directories"),
+ TWO_DASHES },
};
#define OPTION_COUNT ARRAY_SIZE (ld_options)
@@ -561,6 +569,7 @@ parse_args (unsigned argc, char **argv)
int ingroup = 0;
char *default_dirlist = NULL;
char *shortopts;
+ char *BR_paranoid_env;
struct option *longopts;
struct option *really_longopts;
int last_optind;
@@ -1549,6 +1558,14 @@ parse_args (unsigned argc, char **argv)
}
break;
+ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
+ command_line.poison_system_directories = FALSE;
+ break;
+
+ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
+ command_line.error_poison_system_directories = TRUE;
+ break;
+
case OPTION_PUSH_STATE:
input_flags.pushed = xmemdup (&input_flags,
sizeof (input_flags),
@@ -1600,6 +1617,10 @@ parse_args (unsigned argc, char **argv)
command_line.soname = NULL;
}
+ BR_paranoid_env = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH");
+ if (BR_paranoid_env && strlen(BR_paranoid_env) > 0)
+ command_line.error_poison_system_directories = TRUE;
+
while (ingroup)
{
einfo (_("%P: missing --end-group; added as last command line option\n"));
--
2.16.2

View File

@ -0,0 +1,11 @@
# From ftp://gcc.gnu.org/pub/binutils/releases/sha512.sum
sha512 5c11aeef6935860a6819ed3a3c93371f052e52b4bdc5033da36037c1544d013b7f12cb8d561ec954fe7469a68f1b66f1a3cd53d5a3af7293635a90d69edd15e7 binutils-2.37.tar.xz
sha512 8bf0b0d193c9c010e0518ee2b2e5a830898af206510992483b427477ed178396cd210235e85fd7bd99a96fc6d5eedbeccbd48317a10f752b7336ada8b2bb826d binutils-2.38.tar.xz
sha512 68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3 binutils-2.39.tar.xz
# Locally calculated (fetched from Github)
sha512 76a8227a19218435319c660e4983ea17985194b7f496f163e97543e7f6fd3e9249241fdc05a16ba512fba96a1d846c1f7b080983404d821d6215f10e7f11e238 binutils-gdb-arc-2020.09-release.tar.gz
# locally computed
sha256 8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903 COPYING3
sha256 56bdea73b6145ef6ac5259b3da390b981d840c24cb03b8e1cbc678de7ecfa18d COPYING.LIB

147
package/third-party/binutils/binutils.mk vendored Normal file
View File

@ -0,0 +1,147 @@
################################################################################
#
# binutils
#
################################################################################
# Version is set when using buildroot toolchain.
# If not, we do like other packages
BINUTILS_VERSION = $(call qstrip,$(BR2_BINUTILS_VERSION))
ifeq ($(BINUTILS_VERSION),)
ifeq ($(BR2_arc),y)
BINUTILS_VERSION = arc-2020.09-release
else
BINUTILS_VERSION = 2.38
endif
endif # BINUTILS_VERSION
ifeq ($(BINUTILS_VERSION),arc-2020.09-release)
BINUTILS_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,binutils-gdb,$(BINUTILS_VERSION))
BINUTILS_SOURCE = binutils-gdb-$(BINUTILS_VERSION).tar.gz
BINUTILS_FROM_GIT = y
endif
BINUTILS_SITE ?= $(BR2_GNU_MIRROR)/binutils
BINUTILS_SOURCE ?= binutils-$(BINUTILS_VERSION).tar.xz
BINUTILS_EXTRA_CONFIG_OPTIONS = $(call qstrip,$(BR2_BINUTILS_EXTRA_CONFIG_OPTIONS))
BINUTILS_INSTALL_STAGING = YES
BINUTILS_DEPENDENCIES = zlib $(TARGET_NLS_DEPENDENCIES)
BINUTILS_MAKE_OPTS = LIBS=$(TARGET_NLS_LIBS)
BINUTILS_LICENSE = GPL-3.0+, libiberty LGPL-2.1+
BINUTILS_LICENSE_FILES = COPYING3 COPYING.LIB
BINUTILS_CPE_ID_VENDOR = gnu
ifeq ($(BINUTILS_FROM_GIT),y)
BINUTILS_DEPENDENCIES += host-flex host-bison
HOST_BINUTILS_DEPENDENCIES += host-flex host-bison
endif
# When binutils sources are fetched from the binutils-gdb repository,
# they also contain the gdb sources, but gdb shouldn't be built, so we
# disable it.
BINUTILS_DISABLE_GDB_CONF_OPTS = \
--disable-sim \
--disable-gdb
# We need to specify host & target to avoid breaking ARM EABI
BINUTILS_CONF_OPTS = \
--disable-multilib \
--disable-werror \
--host=$(GNU_TARGET_NAME) \
--target=$(GNU_TARGET_NAME) \
--enable-install-libiberty \
--enable-build-warnings=no \
--with-system-zlib \
--disable-gprofng \
$(BINUTILS_DISABLE_GDB_CONF_OPTS) \
$(BINUTILS_EXTRA_CONFIG_OPTIONS)
ifeq ($(BR2_STATIC_LIBS),y)
BINUTILS_CONF_OPTS += --disable-plugins
endif
# Don't build documentation. It takes up extra space / build time,
# and sometimes needs specific makeinfo versions to work
BINUTILS_CONF_ENV += MAKEINFO=true
BINUTILS_MAKE_OPTS += MAKEINFO=true
BINUTILS_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR) MAKEINFO=true install
HOST_BINUTILS_CONF_ENV += MAKEINFO=true
HOST_BINUTILS_MAKE_OPTS += MAKEINFO=true
HOST_BINUTILS_INSTALL_OPTS += MAKEINFO=true install
# Workaround a build issue with -Os for ARM Cortex-M cpus.
# (Binutils 2.25.1 and 2.26.1)
# https://sourceware.org/bugzilla/show_bug.cgi?id=20552
ifeq ($(BR2_ARM_CPU_ARMV7M)$(BR2_OPTIMIZE_S),yy)
BINUTILS_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -O2"
endif
# "host" binutils should actually be "cross"
# We just keep the convention of "host utility" for now
HOST_BINUTILS_CONF_OPTS = \
--disable-multilib \
--disable-werror \
--target=$(GNU_TARGET_NAME) \
--disable-shared \
--enable-static \
--with-sysroot=$(STAGING_DIR) \
--enable-poison-system-directories \
--without-debuginfod \
--enable-plugins \
--enable-lto \
$(BINUTILS_DISABLE_GDB_CONF_OPTS) \
$(BINUTILS_EXTRA_CONFIG_OPTIONS)
ifeq ($(BR2_BINUTILS_GPROFNG),y)
HOST_BINUTILS_DEPENDENCIES += host-bison
HOST_BINUTILS_CONF_OPTS += --enable-gprofng
else
HOST_BINUTILS_CONF_OPTS += --disable-gprofng
endif
# binutils run configure script of subdirs at make time, so ensure
# our TARGET_CONFIGURE_ARGS are taken into consideration for those
BINUTILS_MAKE_ENV = $(TARGET_CONFIGURE_ARGS)
# We just want libbfd, libiberty and libopcodes,
# not the full-blown binutils in staging
define BINUTILS_INSTALL_STAGING_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/bfd DESTDIR=$(STAGING_DIR) install
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/opcodes DESTDIR=$(STAGING_DIR) install
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/libiberty DESTDIR=$(STAGING_DIR) install
endef
# If we don't want full binutils on target
ifneq ($(BR2_PACKAGE_BINUTILS_TARGET),y)
# libiberty is static-only, so it is only installed to staging, above.
define BINUTILS_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/bfd DESTDIR=$(TARGET_DIR) install
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/opcodes DESTDIR=$(TARGET_DIR) install
endef
endif
ifneq ($(ARCH_XTENSA_OVERLAY_FILE),)
define BINUTILS_XTENSA_OVERLAY_EXTRACT
$(call arch-xtensa-overlay-extract,$(@D),binutils)
endef
BINUTILS_POST_EXTRACT_HOOKS += BINUTILS_XTENSA_OVERLAY_EXTRACT
BINUTILS_EXTRA_DOWNLOADS += $(ARCH_XTENSA_OVERLAY_URL)
HOST_BINUTILS_POST_EXTRACT_HOOKS += BINUTILS_XTENSA_OVERLAY_EXTRACT
HOST_BINUTILS_EXTRA_DOWNLOADS += $(ARCH_XTENSA_OVERLAY_URL)
endif
# Hardlinks between binaries in different directories cause a problem
# with rpath fixup, so we de-hardlink those binaries, and replace them
# with copies instead.
BINUTILS_TOOLS = ar as ld ld.bfd nm objcopy objdump ranlib readelf strip
define HOST_BINUTILS_FIXUP_HARDLINKS
$(foreach tool,$(BINUTILS_TOOLS),\
rm -f $(HOST_DIR)/$(GNU_TARGET_NAME)/bin/$(tool) && \
cp -a $(HOST_DIR)/bin/$(GNU_TARGET_NAME)-$(tool) \
$(HOST_DIR)/$(GNU_TARGET_NAME)/bin/$(tool)
)
endef
HOST_BINUTILS_POST_INSTALL_HOOKS += HOST_BINUTILS_FIXUP_HARDLINKS
$(eval $(autotools-package))
$(eval $(host-autotools-package))

View File

@ -145,6 +145,10 @@ endef
define BUSYBOX_INSTALL_MDEV_CONF
$(INSTALL) -D -m 0644 package/third-party/busybox/mdev.conf \
$(TARGET_DIR)/etc/mdev.conf
$(INSTALL) -d package/third-party/busybox/mdev \
$(TARGET_DIR)/etc/mdev
$(INSTALL) -D package/third-party/busybox/mdev/* \
$(TARGET_DIR)/etc/mdev/
endef
define BUSYBOX_SET_MDEV
$(call KCONFIG_ENABLE_OPT,CONFIG_MDEV)

View File

@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Busybox version: 1.34.1
# Mon Mar 14 15:10:30 2022
# Tue Nov 21 10:34:55 2023
#
CONFIG_HAVE_DOT_CONFIG=y
@ -18,7 +18,7 @@ CONFIG_FEATURE_VERBOSE_USAGE=y
CONFIG_FEATURE_COMPRESS_USAGE=y
# CONFIG_LFS is not set
# CONFIG_PAM is not set
# CONFIG_FEATURE_DEVPTS is not set
CONFIG_FEATURE_DEVPTS=y
# CONFIG_FEATURE_UTMP is not set
# CONFIG_FEATURE_WTMP is not set
# CONFIG_FEATURE_PIDFILE is not set
@ -951,13 +951,13 @@ CONFIG_TC=y
CONFIG_FEATURE_TC_INGRESS=y
# CONFIG_TCPSVD is not set
# CONFIG_UDPSVD is not set
# CONFIG_TELNET is not set
# CONFIG_FEATURE_TELNET_TTYPE is not set
# CONFIG_FEATURE_TELNET_AUTOLOGIN is not set
# CONFIG_FEATURE_TELNET_WIDTH is not set
# CONFIG_TELNETD is not set
# CONFIG_FEATURE_TELNETD_STANDALONE is not set
# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
CONFIG_TELNET=y
CONFIG_FEATURE_TELNET_TTYPE=y
CONFIG_FEATURE_TELNET_AUTOLOGIN=y
CONFIG_FEATURE_TELNET_WIDTH=y
CONFIG_TELNETD=y
CONFIG_FEATURE_TELNETD_STANDALONE=y
CONFIG_FEATURE_TELNETD_INETD_WAIT=y
# CONFIG_TFTP is not set
# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
# CONFIG_FEATURE_TFTP_HPA_COMPAT is not set

Some files were not shown because too many files have changed in this diff Show More