Step1: build with busybox.
Signed-off-by: Chen Wang <wangchen20@iscas.ac.cn>
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
dl/
|
||||
output/
|
||||
117
LICENSE
Normal file
117
LICENSE
Normal file
@@ -0,0 +1,117 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice
|
||||
73
Makefile
Normal file
73
Makefile
Normal file
@@ -0,0 +1,73 @@
|
||||
.PHONY: all
|
||||
all:
|
||||
@./build.sh
|
||||
|
||||
.PHONY: source
|
||||
source:
|
||||
@./package/prepare-env/make.sh || exit 1
|
||||
@./source.sh || exit 1
|
||||
|
||||
.PHONY: prepare-env
|
||||
prepare-env:
|
||||
@./package/prepare-env/make.sh || exit 1
|
||||
@./package/skeleton/make.sh || exit 1
|
||||
|
||||
.PHONY: host-tools
|
||||
host-tools:
|
||||
@./package/pkgconf/make-host.sh || exit 1
|
||||
@./package/libzlib/make-host.sh || exit 1
|
||||
@./package/m4/make-host.sh || exit 1
|
||||
@./package/libtool/make-host.sh || exit 1
|
||||
@./package/autoconf/make-host.sh || exit 1
|
||||
@./package/automake/make-host.sh || exit 1
|
||||
|
||||
.PHONY: toolchain
|
||||
toolchain:
|
||||
@./package/bison/make-host.sh || exit 1
|
||||
@./package/gawk/make-host.sh || exit 1
|
||||
@./package/gmp/make-host.sh || exit 1
|
||||
@./package/mpfr/make-host.sh || exit 1
|
||||
@./package/mpc/make-host.sh || exit 1
|
||||
@./package/binutils/make-host.sh || exit 1
|
||||
@./package/gcc/make-host-initial.sh || exit 1
|
||||
@./package/linux-headers/make.sh || exit 1
|
||||
@./package/glibc/make.sh || exit 1
|
||||
@./package/gcc/make-host-final.sh || exit 1
|
||||
@./package/gcc/make-final.sh || exit 1
|
||||
@./package/toolchain/make.sh || exit 1
|
||||
|
||||
.PHONY: opensbi
|
||||
opensbi:
|
||||
@./package/opensbi/make.sh || exit 1
|
||||
|
||||
.PHONY: linux
|
||||
linux:
|
||||
@./package/kmod/make-host.sh || exit 1
|
||||
@./package/gettext-tiny/make-host.sh || exit 1
|
||||
@./package/flex/make-host.sh || exit 1
|
||||
@./package/linux/make.sh || exit 1
|
||||
|
||||
.PHONY: busybox
|
||||
busybox:
|
||||
@./package/busybox/make.sh || exit 1
|
||||
|
||||
.PHONY: before-target-image
|
||||
before-target-image:
|
||||
@./package/util-linux/make-host.sh || exit 1
|
||||
@./package/e2fsprogs/make-host.sh || exit 1
|
||||
@./package/attr/make-host.sh || exit 1
|
||||
@./package/acl/make-host.sh || exit 1
|
||||
@./package/fakeroot/make-host.sh || exit 1
|
||||
@./package/makedevs/make-host.sh || exit 1
|
||||
@./package/patchelf/make-host.sh || exit 1
|
||||
|
||||
.PHONY: rebuild-target-image
|
||||
rebuild-target-image:
|
||||
@echo "----> Building $@ ..."
|
||||
@./package/host-finalize/make.sh || exit 1
|
||||
@./package/target-finalize/make.sh || exit 1
|
||||
@./package/rootfs-ext2/make.sh || exit 1
|
||||
@echo "<---- $@ build complete."
|
||||
|
||||
clean:
|
||||
rm -rf output/
|
||||
99
README.md
Normal file
99
README.md
Normal file
@@ -0,0 +1,99 @@
|
||||
**从零开始为 RISC-V 构建一个 Linux 系统**
|
||||
|
||||
<!-- TOC -->
|
||||
|
||||
- [1. 简介](#1-简介)
|
||||
- [2. 运行环境](#2-运行环境)
|
||||
- [3. 构建和使用说明](#3-构建和使用说明)
|
||||
- [3.1. 批量下载软件包源码压缩包](#31-批量下载软件包源码压缩包)
|
||||
- [3.2. 构建](#32-构建)
|
||||
- [3.3. 运行](#33-运行)
|
||||
- [4. 致谢](#4-致谢)
|
||||
|
||||
<!-- /TOC -->
|
||||
|
||||
# 1. 简介
|
||||
|
||||
本仓库包含课程《从零开始为 RISC-V 构建一个 Linux 系统》的配套课件和构建脚本代码。该课程用于教学演示如何从零开始为 RISC-V 平台构建一个 Linux 系统。采用 GPL v2 许可证发布(具体请阅读本仓库根目录下的 [LICENSE 文件](./LICENSE))。
|
||||
|
||||
本仓库目录文件介绍:
|
||||
|
||||
- package: 目录,用于存放每个软件包的构建素材(譬如补丁文件)和构建脚本。
|
||||
- slides: 目录,用于存放本课程对应的课件(pdf)。
|
||||
- support:目录,用于存放构建中会用到的一些辅助脚本和素材文件。
|
||||
- .gitignore: Git 配置文件,用于指定哪些文件或目录应该被 Git 忽略,不纳入版本控制。
|
||||
- build.sh: 执行 `make` 时会执行的脚本文件。
|
||||
- LICENSE: 本仓库的发布许可证文件。
|
||||
- Makefile: make 文件。
|
||||
- README.md: 本文件。
|
||||
- source.sh: 执行 `make source` 时会执行的脚本文件。
|
||||
|
||||
执行构建过程中还会创建以下目录,但不作为本仓库的一部分。
|
||||
|
||||
- dl: 目录,用于存放网络下载的软件包源码压缩包。
|
||||
- output: 目录,用于存放构建的输出,即本课程定义的 `${OUTPUT_DIR}`。
|
||||
|
||||
**注意:由于本仓库代码出于演示 Step by Step 的修改过程的目的,main 分支的 commit 仅用于演示步骤而不反应实际 git 提交历史,所以在同步本地仓库时不支持简单的 pull。建议每次同步本地时直接采用完整的 clone 方式**。
|
||||
|
||||
# 2. 运行环境
|
||||
|
||||
本仓库提供了对应课程内容的参考构建脚本,构建脚本在 Ubuntu 22.04 LTS 和 Ubuntu 24.04 LTS 上验证通过。有关运行环境的具体要求可以参考课件 “第 3 章 构建 Linux 系统之前的准备工作” 的 02 部分:“构建环境准备” 的介绍。
|
||||
|
||||
也欢迎大家在其他 Linux 发行版上尝试,原理上本仓库的参考构建脚本并不局限于 Ubuntu 系统。
|
||||
|
||||
# 3. 构建和使用说明
|
||||
|
||||
本节运行命令时假设都在 `${PROJECT_DIR}`,即本仓库所在路径下运行,不再赘述。
|
||||
|
||||
本仓库的构建命令无需 root 权限。
|
||||
|
||||
## 3.1. 批量下载软件包源码压缩包
|
||||
|
||||
批量下载软件包源码压缩包的命令如下。注意:中途可能失败,多半是因为网络超时所致,可以多试几次以下命令,直到全部成功。
|
||||
|
||||
```shell
|
||||
$ make source
|
||||
```
|
||||
|
||||
如果仍然无法完整下载软件包,也可以去 oerv 仓库克隆一份(确保在 `${PROJECT_DIR}` 下),执行如下命令:
|
||||
|
||||
```shell
|
||||
$ git clone --depth 1 --branch main https://git.oerv.ac.cn/openRuyi-tutorials/packages-for-build-linux-system-from-scratch.git dl
|
||||
```
|
||||
|
||||
## 3.2. 构建
|
||||
|
||||
本仓库的主分支 main 上有 6 个 commit,分别对应以下步骤:
|
||||
|
||||
```
|
||||
Step6: add python and snake.
|
||||
Step5: add vim.
|
||||
Step4: enhanced shell with bash.
|
||||
Step3: enhanced with coreutiles.
|
||||
Step2: enhanced with sysvinit
|
||||
Step1: build with busybox.
|
||||
```
|
||||
|
||||
学习者可以 checkout 到任意一个 commit 并运行以下命令进行构建。注意:本仓库的构建脚本不支持增量构建,只支持从零开始一次性构建(实际上执行 `make` 内部也会默认先执行 `make clean`)。
|
||||
|
||||
```shell
|
||||
$ make clean
|
||||
$ make
|
||||
```
|
||||
|
||||
## 3.3. 运行
|
||||
|
||||
构建成功后可以进入 `${IMAGES_DIR}` 执行脚本,运行 QEMU 模拟器并加载我们制作的 Linux 系统。
|
||||
|
||||
```shell
|
||||
$ cd output/images/
|
||||
$ ./start-qemu.sh
|
||||
```
|
||||
|
||||
登录系统的用户名是 root,无密码。
|
||||
|
||||
关机可以在登录系统后在控制台中输入 poweroff 命令,或者直接 "Ctrl+A X" 强制退出 QEMU(所谓 "Ctrl+A X" 是指同时按下 Ctrl 和 A,同时松开后再按 X)。
|
||||
|
||||
# 4. 致谢
|
||||
|
||||
本仓库的构建脚本参考了 [Buildroot (2025.08.1)](https://buildroot.org/)。在此表示衷心感谢!
|
||||
12
build.sh
Executable file
12
build.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
make clean
|
||||
|
||||
make prepare-env || exit 1
|
||||
make host-tools || exit 1
|
||||
make toolchain || exit 1
|
||||
make opensbi || exit 1
|
||||
make linux || exit 1
|
||||
make busybox || exit 1
|
||||
make before-target-image || exit 1
|
||||
make rebuild-target-image || exit 1
|
||||
32
package/acl/0001-Build-with-old-GCC-versions.patch
Normal file
32
package/acl/0001-Build-with-old-GCC-versions.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
From a42519dceef0493ece45538375ae1791313f16d3 Mon Sep 17 00:00:00 2001
|
||||
From: Hollis Blanchard <hollis_blanchard@mentor.com>
|
||||
Date: Mon, 30 Jul 2018 14:29:46 -0700
|
||||
Subject: [PATCH] Remove pragmas inside functions
|
||||
|
||||
GCC 4.4.7, as found in RHEL6, reports:
|
||||
libacl/acl_from_text.c:307: error: #pragma GCC diagnostic not allowed inside functions
|
||||
|
||||
Signed-off-by: Hollis Blanchard <hollis_blanchard@mentor.com>
|
||||
---
|
||||
libacl/acl_from_text.c | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/libacl/acl_from_text.c b/libacl/acl_from_text.c
|
||||
index 09790c9..fb6bc07 100644
|
||||
--- a/libacl/acl_from_text.c
|
||||
+++ b/libacl/acl_from_text.c
|
||||
@@ -304,11 +304,8 @@ parse_acl_entry(const char **text_p, acl_t *acl_p)
|
||||
create_entry:
|
||||
if (acl_create_entry(acl_p, &entry_d) != 0)
|
||||
return -1;
|
||||
-#pragma GCC diagnostic push
|
||||
-#pragma GCC diagnostic ignored "-Waddress"
|
||||
if (acl_copy_entry(entry_d, int2ext(&entry_obj)) != 0)
|
||||
return -1;
|
||||
-#pragma GCC diagnostic pop
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
--
|
||||
2.13.0
|
||||
|
||||
41
package/acl/make-host.sh
Executable file
41
package/acl/make-host.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=acl
|
||||
PKGVERSION=2.3.2
|
||||
PKGSOURCE_DIR=acl
|
||||
PKGSOURCE=acl-2.3.2.tar.xz
|
||||
PKGURL=https://download.savannah.nongnu.org/releases/acl/acl-2.3.2.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch
|
||||
step_end patch autotools
|
||||
|
||||
step_start configure
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}"
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
87
package/attr/0001-build-with-older-GCCs.patch
Normal file
87
package/attr/0001-build-with-older-GCCs.patch
Normal file
@@ -0,0 +1,87 @@
|
||||
From 3ac428794ea0f95c854166c9c0cffb0267c5e98b Mon Sep 17 00:00:00 2001
|
||||
From: Hollis Blanchard <hollis_blanchard@mentor.com>
|
||||
Date: Mon, 30 Jul 2018 14:17:21 -0700
|
||||
Subject: [PATCH] Remove messages in "deprecated" gcc attributes
|
||||
|
||||
GCC versions up through 4.4.7 (which is used in RHEL 6) do not accept
|
||||
any argument for the deprecated attribute. GCC 4.5 and later say the
|
||||
"msg" argument is optional. We don't need the messages during
|
||||
Buildroot builds anyways.
|
||||
|
||||
Signed-off-by: Hollis Blanchard <hollis_blanchard@mentor.com>
|
||||
---
|
||||
include/attributes.h | 20 ++++++++++----------
|
||||
1 file changed, 10 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/include/attributes.h b/include/attributes.h
|
||||
index 14beb8f..23c39c8 100644
|
||||
--- a/include/attributes.h
|
||||
+++ b/include/attributes.h
|
||||
@@ -127,10 +127,10 @@ typedef struct attr_multiop {
|
||||
*/
|
||||
EXPORT int attr_get (const char *__path, const char *__attrname,
|
||||
char *__attrvalue, int *__valuelength, int __flags)
|
||||
- __attribute__ ((deprecated ("Use getxattr or lgetxattr instead")));
|
||||
+ __attribute__ ((deprecated));
|
||||
EXPORT int attr_getf (int __fd, const char *__attrname, char *__attrvalue,
|
||||
int *__valuelength, int __flags)
|
||||
- __attribute__ ((deprecated ("Use fgetxattr instead")));
|
||||
+ __attribute__ ((deprecated));
|
||||
|
||||
/*
|
||||
* Set the value of an attribute, creating the attribute if necessary.
|
||||
@@ -139,11 +139,11 @@ EXPORT int attr_getf (int __fd, const char *__attrname, char *__attrvalue,
|
||||
EXPORT int attr_set (const char *__path, const char *__attrname,
|
||||
const char *__attrvalue, const int __valuelength,
|
||||
int __flags)
|
||||
- __attribute__ ((deprecated ("Use setxattr or lsetxattr instead")));
|
||||
+ __attribute__ ((deprecated));
|
||||
EXPORT int attr_setf (int __fd, const char *__attrname,
|
||||
const char *__attrvalue, const int __valuelength,
|
||||
int __flags)
|
||||
- __attribute__ ((deprecated ("Use fsetxattr instead")));
|
||||
+ __attribute__ ((deprecated));
|
||||
|
||||
/*
|
||||
* Remove an attribute.
|
||||
@@ -151,9 +151,9 @@ EXPORT int attr_setf (int __fd, const char *__attrname,
|
||||
*/
|
||||
EXPORT int attr_remove (const char *__path, const char *__attrname,
|
||||
int __flags)
|
||||
- __attribute__ ((deprecated ("Use removexattr or lremovexattr instead")));
|
||||
+ __attribute__ ((deprecated));
|
||||
EXPORT int attr_removef (int __fd, const char *__attrname, int __flags)
|
||||
- __attribute__ ((deprecated ("Use fremovexattr instead")));
|
||||
+ __attribute__ ((deprecated));
|
||||
|
||||
/*
|
||||
* List the names and sizes of the values of all the attributes of an object.
|
||||
@@ -164,10 +164,10 @@ EXPORT int attr_removef (int __fd, const char *__attrname, int __flags)
|
||||
*/
|
||||
EXPORT int attr_list(const char *__path, char *__buffer, const int __buffersize,
|
||||
int __flags, attrlist_cursor_t *__cursor)
|
||||
- __attribute__ ((deprecated ("Use listxattr or llistxattr instead")));
|
||||
+ __attribute__ ((deprecated));
|
||||
EXPORT int attr_listf(int __fd, char *__buffer, const int __buffersize,
|
||||
int __flags, attrlist_cursor_t *__cursor)
|
||||
- __attribute__ ((deprecated ("Use flistxattr instead")));
|
||||
+ __attribute__ ((deprecated));
|
||||
|
||||
/*
|
||||
* Operate on multiple attributes of the same object simultaneously.
|
||||
@@ -188,10 +188,10 @@ EXPORT int attr_listf(int __fd, char *__buffer, const int __buffersize,
|
||||
*/
|
||||
EXPORT int attr_multi (const char *__path, attr_multiop_t *__oplist,
|
||||
int __count, int __flags)
|
||||
- __attribute__ ((deprecated ("Use getxattr, setxattr, listxattr, removexattr instead")));
|
||||
+ __attribute__ ((deprecated));
|
||||
EXPORT int attr_multif (int __fd, attr_multiop_t *__oplist,
|
||||
int __count, int __flags)
|
||||
- __attribute__ ((deprecated ("Use getxattr, setxattr, listxattr, removexattr instead")));
|
||||
+ __attribute__ ((deprecated));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
--
|
||||
2.13.0
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
From 365426c28f8bf73d34d77cc06b7d5ffeae17f13a Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
Date: Tue, 6 Feb 2024 15:33:15 +0100
|
||||
Subject: [PATCH] configure.ac: add detection of symver gcc attribute
|
||||
|
||||
On non-ELF platforms, such as microblaze, builds will fail when trying
|
||||
to add symver information because __attribute__((symver ..)) is not
|
||||
supported even though __has_attribute(__symver__) returns true.
|
||||
|
||||
Support for symver needs to be detected via a compile test since
|
||||
__has_attribute can report false positives [0].
|
||||
|
||||
Add a configure compile check for __attribute__((symver ..)) to ensure
|
||||
it is supported and define a variable to advertise support.
|
||||
|
||||
[0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766#c1
|
||||
|
||||
Upstream: https://git.savannah.nongnu.org/cgit/attr.git/commit/?id=943c776089dbb24ebbfb7432ba9841f1845bf95a
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
[Giulio: rework local patch for #if nesting]
|
||||
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
configure.ac | 15 +++++++++++++++
|
||||
libattr/syscalls.c | 8 ++++----
|
||||
2 files changed, 19 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 7e362e9..98477b5 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -57,6 +57,21 @@ AS_CASE([$host_os],
|
||||
[linux*], [os_linux=yes])
|
||||
AM_CONDITIONAL([OS_LINUX], [test "x$os_linux" = "xyes"])
|
||||
|
||||
+AC_CACHE_CHECK(whether __attribute__((__symver__())) is supported,
|
||||
+ gcc_cv_symver_attribute,
|
||||
+ [cat > conftest.c <<EOF
|
||||
+void foo (void) {}
|
||||
+__typeof(foo) foo __attribute__ ((__symver__("foo@foo")));
|
||||
+EOF
|
||||
+ gcc_cv_symver_attribute=no
|
||||
+ if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then \
|
||||
+ gcc_cv_symver_attribute=yes
|
||||
+ fi
|
||||
+ rm -f conftest.[cs]
|
||||
+])
|
||||
+AS_IF([test $gcc_cv_symver_attribute = yes],
|
||||
+ [AC_DEFINE(HAVE_SYMVER_ATTRIBUTE, [], [GCC supports symver attribute])])
|
||||
+
|
||||
AC_CONFIG_COMMANDS([include/attr],
|
||||
[dnl
|
||||
rm -rf include/attr
|
||||
diff --git a/libattr/syscalls.c b/libattr/syscalls.c
|
||||
index 907560a..7ee6d39 100644
|
||||
--- a/libattr/syscalls.c
|
||||
+++ b/libattr/syscalls.c
|
||||
@@ -31,10 +31,10 @@
|
||||
* prefer symver attribute if available (since gcc 10),
|
||||
* fall back to traditional .symver asm directive otherwise.
|
||||
*/
|
||||
-#ifdef __has_attribute
|
||||
-# if __has_attribute(__symver__)
|
||||
-# define SYMVER(cn, vn) __typeof(cn) cn __attribute__((__symver__(vn)))
|
||||
-# elif __has_attribute(__no_reorder__)
|
||||
+#if defined(HAVE_SYMVER_ATTRIBUTE)
|
||||
+# define SYMVER(cn, vn) __typeof(cn) cn __attribute__((__symver__(vn)))
|
||||
+#elif defined(__has_attribute)
|
||||
+# if __has_attribute(__no_reorder__)
|
||||
/*
|
||||
* Avoid wrong partitioning with older gcc and LTO. May not work reliably
|
||||
* with all versions; use -flto-partition=none if you encounter problems.
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From 8a80d895dfd779373363c3a4b62ecce5a549efb2 Mon Sep 17 00:00:00 2001
|
||||
From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
|
||||
Date: Sat, 30 Mar 2024 10:17:10 +0100
|
||||
Subject: [PATCH] tools/attr.c: Add missing libgen.h include for basename(3)
|
||||
|
||||
Fixes compilation issue with musl and modern C99 compilers.
|
||||
|
||||
See: https://bugs.gentoo.org/926294
|
||||
|
||||
Upstream: https://git.savannah.nongnu.org/cgit/attr.git/commit/?id=8a80d895dfd779373363c3a4b62ecce5a549efb2
|
||||
|
||||
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
|
||||
Signed-off-by: Romain Naour <romain.naour@smile.fr>
|
||||
---
|
||||
tools/attr.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/tools/attr.c b/tools/attr.c
|
||||
index f12e4af..6a3c1e9 100644
|
||||
--- a/tools/attr.c
|
||||
+++ b/tools/attr.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
+#include <libgen.h>
|
||||
|
||||
#include <attr/attributes.h>
|
||||
|
||||
--
|
||||
2.45.0
|
||||
|
||||
44
package/attr/make-host.sh
Executable file
44
package/attr/make-host.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=attr
|
||||
PKGVERSION=2.5.2
|
||||
PKGSOURCE_DIR=attr
|
||||
PKGSOURCE=attr-2.5.2.tar.xz
|
||||
PKGURL=http://download.savannah.gnu.org/releases/attr/attr-2.5.2.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch
|
||||
step_end patch autotools ignore_libtool_patch
|
||||
|
||||
step_start configure
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Autoreconfiguring"
|
||||
cd ${PKGBUILD_DIR} && eval "AUTOPOINT=/bin/true ${AUTORECONF_OPTS} ${HOST_DIR}/bin/autoreconf -f -i"
|
||||
patch_libtool ${PKGBUILD_DIR}
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}"
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
28
package/autoconf/0001-dont-add-dirty-to-version.patch
Normal file
28
package/autoconf/0001-dont-add-dirty-to-version.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
autoconf: don't append -dirty to version
|
||||
|
||||
Don't append -dirty to autoconf version number if the buildroot git tree
|
||||
has uncommitted changes.
|
||||
|
||||
This script is meant for the autoconf developers, but it also activates
|
||||
if you build autoconf in a subdirectory of a git tree (E.G. like how it's
|
||||
commonly done in buildroot).
|
||||
|
||||
The affect is that autoconf gets built as being version 2.65-dirty, which
|
||||
breaks programs (like Python) which explicitly checks for autoconf-2.65.
|
||||
|
||||
[Gustavo: update for autoconf 2.69]
|
||||
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
|
||||
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
|
||||
|
||||
diff -Nura autoconf-2.69.orig/build-aux/git-version-gen autoconf-2.69/build-aux/git-version-gen
|
||||
--- autoconf-2.69.orig/build-aux/git-version-gen 2013-06-27 11:31:02.340200154 -0300
|
||||
+++ autoconf-2.69/build-aux/git-version-gen 2013-06-27 11:31:13.734577033 -0300
|
||||
@@ -210,7 +210,7 @@
|
||||
*) # Append the suffix only if there isn't one already.
|
||||
case $v in
|
||||
*-dirty) ;;
|
||||
- *) v="$v-dirty" ;;
|
||||
+ #*) v="$v-dirty" ;;
|
||||
esac ;;
|
||||
esac
|
||||
fi
|
||||
41
package/autoconf/make-host.sh
Executable file
41
package/autoconf/make-host.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=autoconf
|
||||
PKGVERSION=2.72
|
||||
PKGSOURCE_DIR=autoconf
|
||||
PKGSOURCE=autoconf-2.72.tar.xz
|
||||
PKGURL=http://mirrors.ustc.edu.cn/gnu/autoconf/autoconf-2.72.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch
|
||||
step_end patch autotools
|
||||
|
||||
step_start configure
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} EMACS=\"no\" ac_cv_path_M4=${HOST_DIR}/bin/m4 ac_cv_prog_gnu_m4_gnu=no CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}"
|
||||
step_end install-host
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
|
||||
stamp_installed
|
||||
27
package/automake/0001-noman.patch
Normal file
27
package/automake/0001-noman.patch
Normal file
@@ -0,0 +1,27 @@
|
||||
Disable manpages build and installation, seems the bundled version of
|
||||
help2man is somewhat old and breaks on modern distributions such as
|
||||
Fedora 20, as reported by Kanibal on IRC.
|
||||
|
||||
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
|
||||
|
||||
diff -Nura automake-1.14.1.orig/Makefile.in automake-1.14.1/Makefile.in
|
||||
--- automake-1.14.1.orig/Makefile.in 2014-09-10 18:40:57.554164448 -0300
|
||||
+++ automake-1.14.1/Makefile.in 2014-09-10 18:42:01.050348068 -0300
|
||||
@@ -3387,7 +3387,7 @@
|
||||
check-am: all-am
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local
|
||||
check: check-am
|
||||
-all-am: Makefile $(INFO_DEPS) $(SCRIPTS) $(MANS) $(DATA)
|
||||
+all-am: Makefile $(INFO_DEPS) $(SCRIPTS) $(DATA)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(amdir)" "$(DESTDIR)$(automake_acdir)" "$(DESTDIR)$(automake_internal_acdir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(perllibdir)" "$(DESTDIR)$(pkgvdatadir)" "$(DESTDIR)$(scriptdir)" "$(DESTDIR)$(system_acdir)" "$(DESTDIR)$(perllibdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
@@ -3454,7 +3454,7 @@
|
||||
install-dist_automake_internal_acDATA install-dist_docDATA \
|
||||
install-dist_perllibDATA install-dist_pkgvdataDATA \
|
||||
install-dist_scriptDATA install-dist_system_acDATA \
|
||||
- install-info-am install-man install-nodist_perllibDATA
|
||||
+ install-info-am install-nodist_perllibDATA
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
|
||||
install-dvi: install-dvi-am
|
||||
88
package/automake/gtk-doc.m4
Normal file
88
package/automake/gtk-doc.m4
Normal file
@@ -0,0 +1,88 @@
|
||||
dnl -*- mode: autoconf -*-
|
||||
|
||||
# serial 2
|
||||
|
||||
dnl Usage:
|
||||
dnl GTK_DOC_CHECK([minimum-gtk-doc-version])
|
||||
AC_DEFUN([GTK_DOC_CHECK],
|
||||
[
|
||||
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
|
||||
AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
|
||||
|
||||
ifelse([$1],[],[gtk_doc_requires="gtk-doc"],[gtk_doc_requires="gtk-doc >= $1"])
|
||||
AC_MSG_CHECKING([for gtk-doc])
|
||||
PKG_CHECK_EXISTS([$gtk_doc_requires],[have_gtk_doc=yes],[have_gtk_doc=no])
|
||||
AC_MSG_RESULT($have_gtk_doc)
|
||||
|
||||
if test "$have_gtk_doc" = "no"; then
|
||||
AC_MSG_WARN([
|
||||
You will not be able to create source packages with 'make dist'
|
||||
because $gtk_doc_requires is not found.])
|
||||
fi
|
||||
|
||||
dnl check for tools we added during development
|
||||
dnl Use AC_CHECK_PROG to avoid the check target using an absolute path that
|
||||
dnl may not be writable by the user. Currently, automake requires that the
|
||||
dnl test name must end in '.test'.
|
||||
dnl https://bugzilla.gnome.org/show_bug.cgi?id=701638
|
||||
AC_CHECK_PROG([GTKDOC_CHECK],[gtkdoc-check],[gtkdoc-check.test])
|
||||
AC_PATH_PROG([GTKDOC_CHECK_PATH],[gtkdoc-check])
|
||||
AC_PATH_PROGS([GTKDOC_REBASE],[gtkdoc-rebase],[true])
|
||||
AC_PATH_PROG([GTKDOC_MKPDF],[gtkdoc-mkpdf])
|
||||
|
||||
dnl for overriding the documentation installation directory
|
||||
AC_ARG_WITH([html-dir],
|
||||
AS_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
|
||||
[with_html_dir='${datadir}/gtk-doc/html'])
|
||||
HTML_DIR="$with_html_dir"
|
||||
AC_SUBST([HTML_DIR])
|
||||
|
||||
dnl enable/disable documentation building
|
||||
AC_ARG_ENABLE([gtk-doc],
|
||||
AS_HELP_STRING([--enable-gtk-doc],
|
||||
[use gtk-doc to build documentation [[default=no]]]),,
|
||||
[enable_gtk_doc=no])
|
||||
|
||||
AC_MSG_CHECKING([whether to build gtk-doc documentation])
|
||||
AC_MSG_RESULT($enable_gtk_doc)
|
||||
|
||||
if test "x$enable_gtk_doc" = "xyes" && test "$have_gtk_doc" = "no"; then
|
||||
AC_MSG_ERROR([
|
||||
You must have $gtk_doc_requires installed to build documentation for
|
||||
$PACKAGE_NAME. Please install gtk-doc or disable building the
|
||||
documentation by adding '--disable-gtk-doc' to '[$]0'.])
|
||||
fi
|
||||
|
||||
dnl don't check for glib if we build glib
|
||||
if test "x$PACKAGE_NAME" != "xglib"; then
|
||||
dnl don't fail if someone does not have glib
|
||||
PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0,,[:])
|
||||
fi
|
||||
|
||||
dnl enable/disable output formats
|
||||
AC_ARG_ENABLE([gtk-doc-html],
|
||||
AS_HELP_STRING([--enable-gtk-doc-html],
|
||||
[build documentation in html format [[default=yes]]]),,
|
||||
[enable_gtk_doc_html=yes])
|
||||
AC_ARG_ENABLE([gtk-doc-pdf],
|
||||
AS_HELP_STRING([--enable-gtk-doc-pdf],
|
||||
[build documentation in pdf format [[default=no]]]),,
|
||||
[enable_gtk_doc_pdf=no])
|
||||
|
||||
if test -z "$GTKDOC_MKPDF"; then
|
||||
enable_gtk_doc_pdf=no
|
||||
fi
|
||||
|
||||
if test -z "$AM_DEFAULT_VERBOSITY"; then
|
||||
AM_DEFAULT_VERBOSITY=1
|
||||
fi
|
||||
AC_SUBST([AM_DEFAULT_VERBOSITY])
|
||||
|
||||
AM_CONDITIONAL([HAVE_GTK_DOC], [test x$have_gtk_doc = xyes])
|
||||
AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes])
|
||||
AM_CONDITIONAL([GTK_DOC_BUILD_HTML], [test x$enable_gtk_doc_html = xyes])
|
||||
AM_CONDITIONAL([GTK_DOC_BUILD_PDF], [test x$enable_gtk_doc_pdf = xyes])
|
||||
AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], [test -n "$LIBTOOL"])
|
||||
AM_CONDITIONAL([GTK_DOC_USE_REBASE], [test -n "$GTKDOC_REBASE"])
|
||||
])
|
||||
43
package/automake/make-host.sh
Executable file
43
package/automake/make-host.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=automake
|
||||
PKGVERSION=1.16.5
|
||||
PKGSOURCE_DIR=automake
|
||||
PKGSOURCE=automake-1.16.5.tar.xz
|
||||
PKGURL=http://mirrors.ustc.edu.cn/gnu/automake/automake-1.16.5.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch
|
||||
step_end patch autotools
|
||||
|
||||
step_start configure
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}"
|
||||
/usr/bin/install -D -m 0644 ${PROJECT_DIR}/package/automake/gtk-doc.m4 ${HOST_DIR}/share/aclocal/gtk-doc.m4
|
||||
mkdir -p ${STAGING_DIR}/usr/share/aclocal
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
50
package/binutils/2.43.1/0001-sh-conf.patch
Normal file
50
package/binutils/2.43.1/0001-sh-conf.patch
Normal file
@@ -0,0 +1,50 @@
|
||||
From d71fb5a9999ee7c8963342caa0d5cbb16872ab07 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).
|
||||
|
||||
Upstream: N/A [Buildroot specific]
|
||||
|
||||
[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 670684d83d1..967c6708a0c 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -4042,7 +4042,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 88b4800e298..2c8d08ff6ec 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1269,7 +1269,7 @@ case "${target}" in
|
||||
nvptx*-*-*)
|
||||
noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
|
||||
;;
|
||||
- sh-*-*)
|
||||
+ sh*-*-*)
|
||||
case "${target}" in
|
||||
sh*-*-elf)
|
||||
;;
|
||||
--
|
||||
2.43.0
|
||||
|
||||
307
package/binutils/2.43.1/0002-poison-system-directories.patch
Normal file
307
package/binutils/2.43.1/0002-poison-system-directories.patch
Normal file
@@ -0,0 +1,307 @@
|
||||
From 00f6b0a7d31085831429834b2bc8f511b8fab6ce 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.43]
|
||||
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
|
||||
[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]
|
||||
Upstream: N/A [Buildroot specific]
|
||||
|
||||
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 f7c9da3d02a..e4fdbf6db5b 100644
|
||||
--- a/ld/config.in
|
||||
+++ b/ld/config.in
|
||||
@@ -74,6 +74,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 44d79c2445d..e28cea11977 100755
|
||||
--- a/ld/configure
|
||||
+++ b/ld/configure
|
||||
@@ -844,6 +844,7 @@ with_lib_path
|
||||
enable_targets
|
||||
enable_64_bit_bfd
|
||||
with_sysroot
|
||||
+enable_poison_system_directories
|
||||
enable_gold
|
||||
enable_got
|
||||
enable_compressed_debug_sections
|
||||
@@ -1535,6 +1536,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)
|
||||
@@ -15587,7 +15590,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 bdf51a062fa..3d370ff92ce 100644
|
||||
--- a/ld/configure.ac
|
||||
+++ b/ld/configure.ac
|
||||
@@ -102,6 +102,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 0dee944cf2a..83bd82d2a2e 100644
|
||||
--- a/ld/ld.h
|
||||
+++ b/ld/ld.h
|
||||
@@ -166,6 +166,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 89e3913317a..b80cf05617f 100644
|
||||
--- a/ld/ld.texi
|
||||
+++ b/ld/ld.texi
|
||||
@@ -3234,6 +3234,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.
|
||||
+
|
||||
@kindex --package-metadata=@var{JSON}
|
||||
@item --package-metadata=@var{JSON}
|
||||
Request the creation of a @code{.note.package} ELF note section. The
|
||||
diff --git a/ld/ldfile.c b/ld/ldfile.c
|
||||
index 87be885d31a..9bc7adca4bc 100644
|
||||
--- a/ld/ldfile.c
|
||||
+++ b/ld/ldfile.c
|
||||
@@ -327,6 +327,22 @@ ldfile_add_library_path (const char *name, enum search_dir_source source)
|
||||
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
|
||||
+
|
||||
/* Accumulate script and command line sourced
|
||||
search paths at the end of the current list. */
|
||||
#if BFD_SUPPORTS_PLUGINS
|
||||
diff --git a/ld/ldlex.h b/ld/ldlex.h
|
||||
index defe3fcbbb9..0ff12614926 100644
|
||||
--- a/ld/ldlex.h
|
||||
+++ b/ld/ldlex.h
|
||||
@@ -170,6 +170,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,
|
||||
OPTION_ERROR_EXECSTACK,
|
||||
OPTION_NO_ERROR_EXECSTACK,
|
||||
OPTION_WARN_EXECSTACK_OBJECTS,
|
||||
diff --git a/ld/ldmain.c b/ld/ldmain.c
|
||||
index 037099b9d37..204feedc6e3 100644
|
||||
--- a/ld/ldmain.c
|
||||
+++ b/ld/ldmain.c
|
||||
@@ -347,6 +347,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 4aa0124ce2f..c4d76943821 100644
|
||||
--- a/ld/lexsup.c
|
||||
+++ b/ld/lexsup.c
|
||||
@@ -648,6 +648,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)
|
||||
@@ -660,6 +668,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;
|
||||
@@ -1785,6 +1794,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),
|
||||
@@ -1938,6 +1955,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"));
|
||||
31
package/binutils/2.43.1/0003-objdump-memleak.patch
Normal file
31
package/binutils/2.43.1/0003-objdump-memleak.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
From ba6ad3a18cb26b79e0e3b84c39f707535bbc344d Mon Sep 17 00:00:00 2001
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Wed, 19 Feb 2025 07:58:54 +1030
|
||||
Subject: [PATCH] PR32716, objdump -i memory leak
|
||||
|
||||
PR binutils/32716
|
||||
* bucomm.c (display_info): Free arg.info.
|
||||
|
||||
Upstream: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ba6ad3a18cb26b79e0e3b84c39f707535bbc344d
|
||||
|
||||
CVE: CVE-2025-3198
|
||||
Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
|
||||
---
|
||||
binutils/bucomm.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/binutils/bucomm.c b/binutils/bucomm.c
|
||||
index ccf54099154..d4554737db1 100644
|
||||
--- a/binutils/bucomm.c
|
||||
+++ b/binutils/bucomm.c
|
||||
@@ -435,6 +435,7 @@ display_info (void)
|
||||
if (!arg.error)
|
||||
display_target_tables (&arg);
|
||||
|
||||
+ free (arg.info);
|
||||
return arg.error;
|
||||
}
|
||||
|
||||
--
|
||||
2.43.5
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
From 8ebe62f3f0d27806b1bf69f301f5e188b4acd2b4 Mon Sep 17 00:00:00 2001
|
||||
From: Sam James <sam@gentoo.org>
|
||||
Date: Sat, 16 Nov 2024 05:03:52 +0000
|
||||
Subject: [PATCH] opcodes: fix -std=gnu23 compatibility wrt static_assert
|
||||
|
||||
static_assert is declared in C23 so we can't reuse that identifier:
|
||||
* Define our own static_assert conditionally;
|
||||
|
||||
* Rename "static assert" hacks to _N as we do already in some places
|
||||
to avoid a conflict.
|
||||
|
||||
ChangeLog:
|
||||
PR ld/32372
|
||||
|
||||
* i386-gen.c (static_assert): Define conditionally.
|
||||
* mips-formats.h (MAPPED_INT): Rename identifier.
|
||||
(MAPPED_REG): Rename identifier.
|
||||
(OPTIONAL_MAPPED_REG): Rename identifier.
|
||||
* s390-opc.c (static_assert): Define conditionally.
|
||||
|
||||
Upstream: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=8ebe62f3f0d27806b1bf69f301f5e188b4acd2b4
|
||||
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
|
||||
---
|
||||
opcodes/i386-gen.c | 2 ++
|
||||
opcodes/mips-formats.h | 6 +++---
|
||||
opcodes/s390-opc.c | 2 ++
|
||||
3 files changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c
|
||||
index 053b66675c5..7ee8a30310c 100644
|
||||
--- a/opcodes/i386-gen.c
|
||||
+++ b/opcodes/i386-gen.c
|
||||
@@ -30,7 +30,9 @@
|
||||
|
||||
/* Build-time checks are preferrable over runtime ones. Use this construct
|
||||
in preference where possible. */
|
||||
+#ifndef static_assert
|
||||
#define static_assert(e) ((void)sizeof (struct { int _:1 - 2 * !(e); }))
|
||||
+#endif
|
||||
|
||||
static const char *program_name = NULL;
|
||||
static int debug = 0;
|
||||
diff --git a/opcodes/mips-formats.h b/opcodes/mips-formats.h
|
||||
index 90df7100803..c4dec6352bf 100644
|
||||
--- a/opcodes/mips-formats.h
|
||||
+++ b/opcodes/mips-formats.h
|
||||
@@ -49,7 +49,7 @@
|
||||
#define MAPPED_INT(SIZE, LSB, MAP, PRINT_HEX) \
|
||||
{ \
|
||||
typedef char ATTRIBUTE_UNUSED \
|
||||
- static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \
|
||||
+ static_assert_3[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \
|
||||
static const struct mips_mapped_int_operand op = { \
|
||||
{ OP_MAPPED_INT, SIZE, LSB }, MAP, PRINT_HEX \
|
||||
}; \
|
||||
@@ -83,7 +83,7 @@
|
||||
#define MAPPED_REG(SIZE, LSB, BANK, MAP) \
|
||||
{ \
|
||||
typedef char ATTRIBUTE_UNUSED \
|
||||
- static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \
|
||||
+ static_assert_4[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \
|
||||
static const struct mips_reg_operand op = { \
|
||||
{ OP_REG, SIZE, LSB }, OP_REG_##BANK, MAP \
|
||||
}; \
|
||||
@@ -93,7 +93,7 @@
|
||||
#define OPTIONAL_MAPPED_REG(SIZE, LSB, BANK, MAP) \
|
||||
{ \
|
||||
typedef char ATTRIBUTE_UNUSED \
|
||||
- static_assert[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \
|
||||
+ static_assert_5[(1 << (SIZE)) == ARRAY_SIZE (MAP)]; \
|
||||
static const struct mips_reg_operand op = { \
|
||||
{ OP_OPTIONAL_REG, SIZE, LSB }, OP_REG_##BANK, MAP \
|
||||
}; \
|
||||
diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c
|
||||
index 9d9f0973e55..49efd714157 100644
|
||||
--- a/opcodes/s390-opc.c
|
||||
+++ b/opcodes/s390-opc.c
|
||||
@@ -36,7 +36,9 @@
|
||||
|
||||
/* Build-time checks are preferrable over runtime ones. Use this construct
|
||||
in preference where possible. */
|
||||
+#ifndef static_assert
|
||||
#define static_assert(e) ((void)sizeof (struct { int _:1 - 2 * !(e); }))
|
||||
+#endif
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,801 @@
|
||||
From 3e8c6e03675963d65a2f98eb006336c5cd375ec3 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
|
||||
Date: Tue, 3 Sep 2024 21:30:31 -0700
|
||||
Subject: [PATCH] Fix 32097 Warnings when building gprofng with Clang
|
||||
|
||||
gprofng/ChangeLog
|
||||
2024-09-03 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>.
|
||||
|
||||
PR gprofng/32097
|
||||
* common/hwcdrv.c: Fix -Wempty-body warnings.
|
||||
* common/hwcentry.h: Fix -Wdeprecated-non-prototype warnings.
|
||||
* common/hwctable.c: Fix -Wdeprecated-non-prototype warnings.
|
||||
* libcollector/collector.c: Likewise.
|
||||
* libcollector/collector.h: Likewise.
|
||||
* libcollector/collectorAPI.c: Likewise.
|
||||
* libcollector/dispatcher.c: Likewise.
|
||||
* libcollector/iotrace.c: Likewise.
|
||||
* libcollector/libcol_util.c: Fix -Wunused-but-set-variable warnings.
|
||||
* libcollector/libcol_util.h: Remove unused declarations.
|
||||
* libcollector/linetrace.c: Fix -Wdeprecated-non-prototype warnings.
|
||||
* src/BaseMetricTreeNode.h: Fix -Wunused-private-field warnings.
|
||||
* src/Dbe.cc: Fix -Wself-assign warnings.
|
||||
* src/DbeSession.cc: Fix -Wunused-but-set-variable warnings.
|
||||
* src/Disasm.cc: Fix -Wunused-const-variable warnings.
|
||||
* src/Experiment.cc: Fix -Wunused-private-field warnings.
|
||||
* src/HashMap.h: Fix -Wself-assign warnings.
|
||||
* src/IOActivity.h: Fix -Wunused-private-field warnings.
|
||||
* src/collctrl.cc: Fix -Wself-assign, -Wparentheses-equality warnings.
|
||||
* src/collctrl.h: Fix -Wunused-private-field warnings.
|
||||
* src/collector_module.h: Fix -Wdeprecated-non-prototype warnings.
|
||||
* src/gp-display-src.cc: Fix -Wunused-private-field warnings.
|
||||
* src/gp-print.h: Fix -Wheader-guard warnings.
|
||||
* src/hwc_intel_icelake.h: Fix -Winitializer-overrides warnings.
|
||||
* src/util.cc: Fix -Wunused-but-set-variable warnings.
|
||||
|
||||
Upstream: b79c457ca01df82dbe1facb708e45def4584c903
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
gprofng/common/hwcdrv.c | 3 ++-
|
||||
gprofng/common/hwcentry.h | 7 +----
|
||||
gprofng/common/hwctable.c | 13 +---------
|
||||
gprofng/libcollector/collector.c | 15 ++++-------
|
||||
gprofng/libcollector/collector.h | 2 +-
|
||||
gprofng/libcollector/collectorAPI.c | 15 ++++++-----
|
||||
gprofng/libcollector/dispatcher.c | 19 ++++++++------
|
||||
gprofng/libcollector/iotrace.c | 12 ++++-----
|
||||
gprofng/libcollector/libcol_util.c | 2 --
|
||||
gprofng/libcollector/libcol_util.h | 6 -----
|
||||
gprofng/libcollector/linetrace.c | 40 +++++++++++++++++------------
|
||||
gprofng/src/BaseMetricTreeNode.h | 1 -
|
||||
gprofng/src/Dbe.cc | 12 ++++-----
|
||||
gprofng/src/DbeSession.cc | 3 ---
|
||||
gprofng/src/Disasm.cc | 1 -
|
||||
gprofng/src/Experiment.cc | 2 --
|
||||
gprofng/src/HashMap.h | 3 +--
|
||||
gprofng/src/IOActivity.h | 1 -
|
||||
gprofng/src/collctrl.cc | 14 +++++-----
|
||||
gprofng/src/collctrl.h | 1 -
|
||||
gprofng/src/collector_module.h | 20 +++++++--------
|
||||
gprofng/src/gp-display-src.cc | 8 ------
|
||||
gprofng/src/gp-print.h | 2 +-
|
||||
gprofng/src/hwc_intel_icelake.h | 6 +++--
|
||||
gprofng/src/util.cc | 10 +++-----
|
||||
25 files changed, 88 insertions(+), 130 deletions(-)
|
||||
|
||||
diff --git a/gprofng/common/hwcdrv.c b/gprofng/common/hwcdrv.c
|
||||
index aaf3acdf9cd..51492a8d35c 100644
|
||||
--- a/gprofng/common/hwcdrv.c
|
||||
+++ b/gprofng/common/hwcdrv.c
|
||||
@@ -574,6 +574,7 @@ read_sample (counter_state_t *ctr_state, int msgsz, uint64_t *rvalue,
|
||||
static void
|
||||
dump_perf_event_attr (struct perf_event_attr *at)
|
||||
{
|
||||
+#if defined(DEBUG)
|
||||
TprintfT (DBG_LT2, "dump_perf_event_attr: size=%d type=%d sample_period=%lld\n"
|
||||
" config=0x%llx config1=0x%llx config2=0x%llx wakeup_events=%lld __reserved_1=%lld\n",
|
||||
(int) at->size, (int) at->type, (unsigned long long) at->sample_period,
|
||||
@@ -589,13 +590,13 @@ dump_perf_event_attr (struct perf_event_attr *at)
|
||||
DUMP_F (exclude_kernel);
|
||||
DUMP_F (exclude_hv);
|
||||
DUMP_F (exclude_idle);
|
||||
- // DUMP_F(xmmap);
|
||||
DUMP_F (comm);
|
||||
DUMP_F (freq);
|
||||
DUMP_F (inherit_stat);
|
||||
DUMP_F (enable_on_exec);
|
||||
DUMP_F (task);
|
||||
DUMP_F (watermark);
|
||||
+#endif
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/gprofng/common/hwcentry.h b/gprofng/common/hwcentry.h
|
||||
index b2ab8b9b22c..0b923fc3576 100644
|
||||
--- a/gprofng/common/hwcentry.h
|
||||
+++ b/gprofng/common/hwcentry.h
|
||||
@@ -200,17 +200,12 @@ extern "C"
|
||||
extern char *hwc_get_docref (char *buf, size_t buflen);
|
||||
/* Return a CPU HWC document reference, or NULL. */
|
||||
|
||||
- // TBR
|
||||
- extern char *hwc_get_default_cntrs ();
|
||||
- /* Return a default HW counter string; may be NULL, or zero-length */
|
||||
- /* NULL means none is defined in the table; or zero-length means string defined could not be loaded */
|
||||
-
|
||||
extern char *hwc_get_default_cntrs2 (int forKernel, int style);
|
||||
/* like hwc_get_default_cntrs() for style==1 */
|
||||
/* but allows other styles of formatting as well */
|
||||
/* deprecate and eventually remove hwc_get_default_cntrs() */
|
||||
|
||||
- extern char *hwc_get_orig_default_cntrs ();
|
||||
+ extern char *hwc_get_orig_default_cntrs (int forKernel);
|
||||
/* Get the default HW counter string as set in the table */
|
||||
/* NULL means none is defined in the table */
|
||||
|
||||
diff --git a/gprofng/common/hwctable.c b/gprofng/common/hwctable.c
|
||||
index 0baf63b1805..338a1ea86f4 100644
|
||||
--- a/gprofng/common/hwctable.c
|
||||
+++ b/gprofng/common/hwctable.c
|
||||
@@ -1783,7 +1783,7 @@ check_tables ()
|
||||
}
|
||||
#endif
|
||||
|
||||
-static int try_a_counter ();
|
||||
+static int try_a_counter (int forKernel);
|
||||
static void hwc_process_raw_ctrs (int forKernel, Hwcentry ***pstd_out,
|
||||
Hwcentry ***praw_out, Hwcentry ***phidden_out,
|
||||
Hwcentry**static_tables,
|
||||
@@ -2824,17 +2824,6 @@ hwc_get_docref (char *buf, size_t buflen)
|
||||
return buf;
|
||||
}
|
||||
|
||||
-//TBR:
|
||||
-
|
||||
-extern char*
|
||||
-hwc_get_default_cntrs ()
|
||||
-{
|
||||
- setup_cpcx ();
|
||||
- if (cpcx_default_hwcs[0] != NULL)
|
||||
- return strdup (cpcx_default_hwcs[0]); // TBR deprecate this
|
||||
- return NULL;
|
||||
-}
|
||||
-
|
||||
extern char*
|
||||
hwc_get_default_cntrs2 (int forKernel, int style)
|
||||
{
|
||||
diff --git a/gprofng/libcollector/collector.c b/gprofng/libcollector/collector.c
|
||||
index 3a8f27a719d..2ff95e58fde 100644
|
||||
--- a/gprofng/libcollector/collector.c
|
||||
+++ b/gprofng/libcollector/collector.c
|
||||
@@ -210,15 +210,10 @@ get_collector_interface ()
|
||||
static void
|
||||
collector_module_init (CollectorInterface *col_intf)
|
||||
{
|
||||
- int nmodules = 0;
|
||||
-
|
||||
ModuleInitFunc next_init = (ModuleInitFunc) dlsym (RTLD_DEFAULT, "__collector_module_init");
|
||||
if (next_init != NULL)
|
||||
- {
|
||||
- nmodules++;
|
||||
- next_init (col_intf);
|
||||
- }
|
||||
- TprintfT (DBG_LT1, "collector_module_init: %d modules\n", nmodules);
|
||||
+ next_init (col_intf);
|
||||
+ TprintfT (DBG_LT1, "collector_module_init: %d modules\n", next_init ? 1 : 0);
|
||||
}
|
||||
|
||||
/* Routines concerned with general experiment start and stop */
|
||||
@@ -1783,7 +1778,7 @@ __collector_pause ()
|
||||
}
|
||||
|
||||
void
|
||||
-__collector_pause_m (char *reason)
|
||||
+__collector_pause_m (const char *reason)
|
||||
{
|
||||
hrtime_t now;
|
||||
char xreason[MAXPATHLEN];
|
||||
@@ -2449,8 +2444,8 @@ __collector_dlog (int tflag, int level, char *format, ...)
|
||||
|
||||
static void (*__real__exit) (int status) = NULL; /* libc only: _exit */
|
||||
static void (*__real__Exit) (int status) = NULL; /* libc only: _Exit */
|
||||
-void _exit () __attribute__ ((weak, alias ("__collector_exit")));
|
||||
-void _Exit () __attribute__ ((weak, alias ("__collector_Exit")));
|
||||
+void _exit (int status) __attribute__ ((weak, alias ("__collector_exit")));
|
||||
+void _Exit (int status) __attribute__ ((weak, alias ("__collector_Exit")));
|
||||
|
||||
void
|
||||
__collector_exit (int status)
|
||||
diff --git a/gprofng/libcollector/collector.h b/gprofng/libcollector/collector.h
|
||||
index 07a03bdd17a..eda68a0e4f5 100644
|
||||
--- a/gprofng/libcollector/collector.h
|
||||
+++ b/gprofng/libcollector/collector.h
|
||||
@@ -123,7 +123,7 @@ extern void __collector_terminate_expt ();
|
||||
extern void __collector_terminate_hook ();
|
||||
extern void __collector_sample (char *name);
|
||||
extern void __collector_pause ();
|
||||
-extern void __collector_pause_m ();
|
||||
+extern void __collector_pause_m (const char *reason);
|
||||
extern void __collector_resume ();
|
||||
extern int collector_sigemt_sigaction (const struct sigaction*,
|
||||
struct sigaction*);
|
||||
diff --git a/gprofng/libcollector/collectorAPI.c b/gprofng/libcollector/collectorAPI.c
|
||||
index 5fa6403ad49..449bbbaab65 100644
|
||||
--- a/gprofng/libcollector/collectorAPI.c
|
||||
+++ b/gprofng/libcollector/collectorAPI.c
|
||||
@@ -26,16 +26,17 @@
|
||||
#include "collectorAPI.h"
|
||||
#include "gp-experiment.h"
|
||||
|
||||
-static void *__real_collector_sample = NULL;
|
||||
-static void *__real_collector_pause = NULL;
|
||||
-static void *__real_collector_resume = NULL;
|
||||
-static void *__real_collector_terminate_expt = NULL;
|
||||
-static void *__real_collector_func_load = NULL;
|
||||
-static void *__real_collector_func_unload = NULL;
|
||||
+static void (*__real_collector_sample)(const char *) = NULL;
|
||||
+static void (*__real_collector_pause)() = NULL;
|
||||
+static void (*__real_collector_resume)() = NULL;
|
||||
+static void (*__real_collector_terminate_expt)() = NULL;
|
||||
+static void (*__real_collector_func_load)(const char *, const char *,
|
||||
+ const char *, void *, int, int, Lineno *) = NULL;
|
||||
+static void (*__real_collector_func_unload)(void *) = NULL;
|
||||
|
||||
#define INIT_API if (init_API == 0) collectorAPI_initAPI()
|
||||
#define NULL_PTR(x) (__real_##x == NULL)
|
||||
-#define CALL_REAL(x) (*(void(*)())__real_##x)
|
||||
+#define CALL_REAL(x) (__real_##x)
|
||||
#define CALL_IF_REAL(x) INIT_API; if (!NULL_PTR(x)) CALL_REAL(x)
|
||||
|
||||
static int init_API = 0;
|
||||
diff --git a/gprofng/libcollector/dispatcher.c b/gprofng/libcollector/dispatcher.c
|
||||
index 8b8ad77b5ee..f7cd46e7e6b 100644
|
||||
--- a/gprofng/libcollector/dispatcher.c
|
||||
+++ b/gprofng/libcollector/dispatcher.c
|
||||
@@ -908,8 +908,9 @@ sigset (int sig, sighandler_t handler)
|
||||
|
||||
// map interposed symbol versions
|
||||
static int
|
||||
-gprofng_timer_create (int (real_func) (), clockid_t clockid,
|
||||
- struct sigevent *sevp, timer_t *timerid)
|
||||
+gprofng_timer_create (int (real_func) (clockid_t, struct sigevent *, timer_t *),
|
||||
+ clockid_t clockid,
|
||||
+ struct sigevent *sevp, timer_t *timerid)
|
||||
{
|
||||
// collector reserves SIGPROF
|
||||
if (sevp == NULL || sevp->sigev_notify != SIGEV_SIGNAL ||
|
||||
@@ -1044,7 +1045,7 @@ __collector_thr_sigsetmask (int how, const sigset_t* iset, sigset_t* oset)
|
||||
// map interposed symbol versions
|
||||
|
||||
static int
|
||||
-gprofng_pthread_sigmask (int (real_func) (),
|
||||
+gprofng_pthread_sigmask (int (real_func) (int, const sigset_t *, sigset_t*),
|
||||
int how, const sigset_t *iset, sigset_t* oset)
|
||||
{
|
||||
sigset_t lsigset;
|
||||
@@ -1139,9 +1140,10 @@ collector_root (void *cargs)
|
||||
// map interposed symbol versions
|
||||
|
||||
static int
|
||||
-gprofng_pthread_create (int (real_func) (), pthread_t *thread,
|
||||
- const pthread_attr_t *attr,
|
||||
- void *(*func)(void*), void *arg)
|
||||
+gprofng_pthread_create (int (real_func) (pthread_t *, const pthread_attr_t *,
|
||||
+ void *(*)(void *), void *),
|
||||
+ pthread_t *thread, const pthread_attr_t *attr,
|
||||
+ void *(*func)(void*), void *arg)
|
||||
{
|
||||
TprintfT (DBG_LTT, "gprofng_pthread_create @%p\n", real_func);
|
||||
if (dispatch_mode != DISPATCH_ON)
|
||||
@@ -1276,6 +1278,7 @@ __collector_ext_clone_pthread (int (*fn)(void *), void *child_stack, int flags,
|
||||
}
|
||||
|
||||
// weak symbols:
|
||||
-int sigprocmask () __attribute__ ((weak, alias ("__collector_sigprocmask")));
|
||||
-int thr_sigsetmask () __attribute__ ((weak, alias ("__collector_thr_sigsetmask")));
|
||||
+int sigprocmask (int, const sigset_t*, sigset_t*) __attribute__ ((weak, alias ("__collector_sigprocmask")));
|
||||
+int thr_sigsetmask (int, const sigset_t*, sigset_t*) __attribute__ ((weak, alias ("__collector_thr_sigsetmask")));
|
||||
int setitimer () __attribute__ ((weak, alias ("_setitimer")));
|
||||
+
|
||||
diff --git a/gprofng/libcollector/iotrace.c b/gprofng/libcollector/iotrace.c
|
||||
index 18060864796..3deb441d9c7 100644
|
||||
--- a/gprofng/libcollector/iotrace.c
|
||||
+++ b/gprofng/libcollector/iotrace.c
|
||||
@@ -1350,7 +1350,7 @@ mkstemp (char *template)
|
||||
unsigned pktSize;
|
||||
if (NULL_PTR (mkstemp))
|
||||
init_io_intf ();
|
||||
- if (CHCK_REENTRANCE (guard) || template == NULL)
|
||||
+ if (CHCK_REENTRANCE (guard))
|
||||
return CALL_REAL (mkstemp)(template);
|
||||
PUSH_REENTRANCE (guard);
|
||||
hrtime_t reqt = gethrtime ();
|
||||
@@ -1405,7 +1405,7 @@ mkstemps (char *template, int slen)
|
||||
unsigned pktSize;
|
||||
if (NULL_PTR (mkstemps))
|
||||
init_io_intf ();
|
||||
- if (CHCK_REENTRANCE (guard) || template == NULL)
|
||||
+ if (CHCK_REENTRANCE (guard))
|
||||
return CALL_REAL (mkstemps)(template, slen);
|
||||
PUSH_REENTRANCE (guard);
|
||||
hrtime_t reqt = gethrtime ();
|
||||
@@ -1485,7 +1485,7 @@ close (int fildes)
|
||||
|
||||
/*------------------------------------------------------------- fopen */
|
||||
static FILE*
|
||||
-gprofng_fopen (FILE*(real_fopen) (), const char *filename, const char *mode)
|
||||
+gprofng_fopen (FILE*(real_fopen) (const char *, const char *), const char *filename, const char *mode)
|
||||
{
|
||||
int *guard;
|
||||
FILE *fp = NULL;
|
||||
@@ -1559,7 +1559,7 @@ DCL_FOPEN (fopen)
|
||||
|
||||
/*------------------------------------------------------------- fclose */
|
||||
static int
|
||||
-gprofng_fclose (int(real_fclose) (), FILE *stream)
|
||||
+gprofng_fclose (int(real_fclose) (FILE *), FILE *stream)
|
||||
{
|
||||
int *guard;
|
||||
int stat;
|
||||
@@ -1645,7 +1645,7 @@ fflush (FILE *stream)
|
||||
|
||||
/*------------------------------------------------------------- fdopen */
|
||||
static FILE*
|
||||
-gprofng_fdopen (FILE*(real_fdopen) (), int fildes, const char *mode)
|
||||
+gprofng_fdopen (FILE*(real_fdopen) (int, const char *), int fildes, const char *mode)
|
||||
{
|
||||
int *guard;
|
||||
FILE *fp = NULL;
|
||||
@@ -2957,7 +2957,7 @@ DCL_FGETPOS (fgetpos)
|
||||
|
||||
/*------------------------------------------------------------- fgetpos64 */
|
||||
static int
|
||||
-gprofng_fgetpos64 (int(real_fgetpos64) (), FILE *stream, fpos64_t *pos)
|
||||
+gprofng_fgetpos64 (int(real_fgetpos64) (FILE *, fpos64_t *), FILE *stream, fpos64_t *pos)
|
||||
{
|
||||
int *guard;
|
||||
int ret;
|
||||
diff --git a/gprofng/libcollector/libcol_util.c b/gprofng/libcollector/libcol_util.c
|
||||
index 1e58cf491a1..baac15db5c4 100644
|
||||
--- a/gprofng/libcollector/libcol_util.c
|
||||
+++ b/gprofng/libcollector/libcol_util.c
|
||||
@@ -1013,7 +1013,6 @@ __collector_open (const char *path, int oflag, ...)
|
||||
mode_t mode = 0;
|
||||
|
||||
hrtime_t t_timeout = __collector_gethrtime () + 5 * ((hrtime_t) NANOSEC);
|
||||
- int nretries = 0;
|
||||
long long delay = 100; /* start at some small, arbitrary value */
|
||||
|
||||
/* get optional mode argument if it's expected/required */
|
||||
@@ -1058,7 +1057,6 @@ __collector_open (const char *path, int oflag, ...)
|
||||
delay *= 2;
|
||||
if (delay > 100000000)
|
||||
delay = 100000000; /* cap at some large, arbitrary value */
|
||||
- nretries++;
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
diff --git a/gprofng/libcollector/libcol_util.h b/gprofng/libcollector/libcol_util.h
|
||||
index c8ec83ff0d9..aa30db72bcc 100644
|
||||
--- a/gprofng/libcollector/libcol_util.h
|
||||
+++ b/gprofng/libcollector/libcol_util.h
|
||||
@@ -81,12 +81,6 @@ extern int __collector_mutex_trylock (collector_mutex_t *mp);
|
||||
#define __collector_mutex_init(xx) \
|
||||
do { collector_mutex_t tmp=COLLECTOR_MUTEX_INITIALIZER; *(xx)=tmp; } while(0)
|
||||
|
||||
-void __collector_sample (char *name);
|
||||
-void __collector_terminate_expt ();
|
||||
-void __collector_pause ();
|
||||
-void __collector_pause_m ();
|
||||
-void __collector_resume ();
|
||||
-
|
||||
struct DT_lineno;
|
||||
|
||||
typedef enum
|
||||
diff --git a/gprofng/libcollector/linetrace.c b/gprofng/libcollector/linetrace.c
|
||||
index 67b2d7e9030..66844bc1337 100644
|
||||
--- a/gprofng/libcollector/linetrace.c
|
||||
+++ b/gprofng/libcollector/linetrace.c
|
||||
@@ -1207,7 +1207,7 @@ __collector_vfork (void)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------- execve */
|
||||
-int execve () __attribute__ ((weak, alias ("__collector_execve")));
|
||||
+int execve (const char *, char *const [], char *const []) __attribute__ ((weak, alias ("__collector_execve")));
|
||||
|
||||
int
|
||||
__collector_execve (const char* path, char *const argv[], char *const envp[])
|
||||
@@ -1237,7 +1237,7 @@ __collector_execve (const char* path, char *const argv[], char *const envp[])
|
||||
return ret;
|
||||
}
|
||||
|
||||
-int execvp () __attribute__ ((weak, alias ("__collector_execvp")));
|
||||
+int execvp (const char *, char *const []) __attribute__ ((weak, alias ("__collector_execvp")));
|
||||
|
||||
int
|
||||
__collector_execvp (const char* file, char *const argv[])
|
||||
@@ -1269,7 +1269,7 @@ __collector_execvp (const char* file, char *const argv[])
|
||||
return ret;
|
||||
}
|
||||
|
||||
-int execv () __attribute__ ((weak, alias ("__collector_execv")));
|
||||
+int execv (const char *, char *const []) __attribute__ ((weak, alias ("__collector_execv")));
|
||||
|
||||
int
|
||||
__collector_execv (const char* path, char *const argv[])
|
||||
@@ -1408,7 +1408,10 @@ __collector_execl (const char* path, const char *arg0, ...)
|
||||
/*-------------------------------------------------------- posix_spawn */
|
||||
// map interposed symbol versions
|
||||
static int
|
||||
-gprofng_posix_spawn (int(real_posix_spawn) (),
|
||||
+gprofng_posix_spawn (int(real_posix_spawn) (pid_t *, const char *,
|
||||
+ const posix_spawn_file_actions_t *,
|
||||
+ const posix_spawnattr_t *,
|
||||
+ char *const [], char *const []),
|
||||
pid_t *pidp, const char *path,
|
||||
const posix_spawn_file_actions_t *file_actions,
|
||||
const posix_spawnattr_t *attrp,
|
||||
@@ -1466,7 +1469,10 @@ DCL_POSIX_SPAWN (posix_spawn)
|
||||
|
||||
/*-------------------------------------------------------- posix_spawnp */
|
||||
static int
|
||||
-gprofng_posix_spawnp (int (real_posix_spawnp) (),
|
||||
+gprofng_posix_spawnp (int (real_posix_spawnp) (pid_t *, const char *,
|
||||
+ const posix_spawn_file_actions_t *,
|
||||
+ const posix_spawnattr_t *,
|
||||
+ char *const [], char *const []),
|
||||
pid_t *pidp, const char *path,
|
||||
const posix_spawn_file_actions_t *file_actions,
|
||||
const posix_spawnattr_t *attrp,
|
||||
@@ -1754,8 +1760,8 @@ __collector_clone (int (*fn)(void *), void *child_stack, int flags, void *arg,
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------- setuid */
|
||||
-int setuid () __attribute__ ((weak, alias ("__collector_setuid")));
|
||||
-int _setuid () __attribute__ ((weak, alias ("__collector_setuid")));
|
||||
+int setuid (uid_t) __attribute__ ((weak, alias ("__collector_setuid")));
|
||||
+int _setuid (uid_t) __attribute__ ((weak, alias ("__collector_setuid")));
|
||||
|
||||
int
|
||||
__collector_setuid (uid_t ruid)
|
||||
@@ -1770,8 +1776,8 @@ __collector_setuid (uid_t ruid)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------- seteuid */
|
||||
-int seteuid () __attribute__ ((weak, alias ("__collector_seteuid")));
|
||||
-int _seteuid () __attribute__ ((weak, alias ("__collector_seteuid")));
|
||||
+int seteuid (uid_t) __attribute__ ((weak, alias ("__collector_seteuid")));
|
||||
+int _seteuid (uid_t) __attribute__ ((weak, alias ("__collector_seteuid")));
|
||||
|
||||
int
|
||||
__collector_seteuid (uid_t euid)
|
||||
@@ -1786,8 +1792,8 @@ __collector_seteuid (uid_t euid)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------ setreuid */
|
||||
-int setreuid () __attribute__ ((weak, alias ("__collector_setreuid")));
|
||||
-int _setreuid () __attribute__ ((weak, alias ("__collector_setreuid")));
|
||||
+int setreuid (uid_t, uid_t) __attribute__ ((weak, alias ("__collector_setreuid")));
|
||||
+int _setreuid (uid_t, uid_t) __attribute__ ((weak, alias ("__collector_setreuid")));
|
||||
|
||||
int
|
||||
__collector_setreuid (uid_t ruid, uid_t euid)
|
||||
@@ -1802,8 +1808,8 @@ __collector_setreuid (uid_t ruid, uid_t euid)
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------- setgid */
|
||||
-int setgid () __attribute__ ((weak, alias ("__collector_setgid")));
|
||||
-int _setgid () __attribute__ ((weak, alias ("__collector_setgid")));
|
||||
+int setgid (gid_t) __attribute__ ((weak, alias ("__collector_setgid")));
|
||||
+int _setgid (gid_t) __attribute__ ((weak, alias ("__collector_setgid")));
|
||||
|
||||
int
|
||||
__collector_setgid (gid_t rgid)
|
||||
@@ -1818,8 +1824,8 @@ __collector_setgid (gid_t rgid)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------- setegid */
|
||||
-int setegid () __attribute__ ((weak, alias ("__collector_setegid")));
|
||||
-int _setegid () __attribute__ ((weak, alias ("__collector_setegid")));
|
||||
+int setegid (gid_t) __attribute__ ((weak, alias ("__collector_setegid")));
|
||||
+int _setegid (gid_t) __attribute__ ((weak, alias ("__collector_setegid")));
|
||||
|
||||
int
|
||||
__collector_setegid (gid_t egid)
|
||||
@@ -1834,8 +1840,8 @@ __collector_setegid (gid_t egid)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------ setregid */
|
||||
-int setregid () __attribute__ ((weak, alias ("__collector_setregid")));
|
||||
-int _setregid () __attribute__ ((weak, alias ("__collector_setregid")));
|
||||
+int setregid (gid_t, gid_t) __attribute__ ((weak, alias ("__collector_setregid")));
|
||||
+int _setregid (gid_t, gid_t) __attribute__ ((weak, alias ("__collector_setregid")));
|
||||
|
||||
int
|
||||
__collector_setregid (gid_t rgid, gid_t egid)
|
||||
diff --git a/gprofng/src/BaseMetricTreeNode.h b/gprofng/src/BaseMetricTreeNode.h
|
||||
index d73d244e27e..7698f9c6eaf 100644
|
||||
--- a/gprofng/src/BaseMetricTreeNode.h
|
||||
+++ b/gprofng/src/BaseMetricTreeNode.h
|
||||
@@ -85,7 +85,6 @@ private:
|
||||
|
||||
BaseMetricTreeNode *root; // root of tree
|
||||
BaseMetricTreeNode *parent; // my parent
|
||||
- bool aggregation; // value is based on children's values
|
||||
char *name; // bm->get_cmd() for metrics, unique string otherwise
|
||||
char *uname; // user-visible text
|
||||
char *unit; // see UNIT_* defines
|
||||
diff --git a/gprofng/src/Dbe.cc b/gprofng/src/Dbe.cc
|
||||
index 95daa727186..09b7f94eaa8 100644
|
||||
--- a/gprofng/src/Dbe.cc
|
||||
+++ b/gprofng/src/Dbe.cc
|
||||
@@ -9591,14 +9591,12 @@ dbeGetTLDataRepVals (VMode view_mode, hrtime_t start_ts, hrtime_t delta,
|
||||
}
|
||||
if (sampleVals != NULL)
|
||||
{
|
||||
- Sample* sample = (Sample*) packets->getObjValue (PROP_SMPLOBJ, packetIdx);
|
||||
- if (!sample || !sample->get_usage ())
|
||||
- sample = sample;
|
||||
- else
|
||||
+ Sample *sample = (Sample*) packets->getObjValue (PROP_SMPLOBJ, packetIdx);
|
||||
+ if (sample != NULL)
|
||||
{
|
||||
- PrUsage* prusage = sample->get_usage ();
|
||||
- Vector<long long> *mstateVals = prusage->getMstateValues ();
|
||||
- sampleVals->store (eventIdx, mstateVals);
|
||||
+ PrUsage *prusage = sample->get_usage ();
|
||||
+ if (prusage != NULL)
|
||||
+ sampleVals->store (eventIdx, prusage->getMstateValues ());
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/gprofng/src/DbeSession.cc b/gprofng/src/DbeSession.cc
|
||||
index a6808d8d8f6..3649357bc79 100644
|
||||
--- a/gprofng/src/DbeSession.cc
|
||||
+++ b/gprofng/src/DbeSession.cc
|
||||
@@ -1164,8 +1164,6 @@ DbeSession::open_experiment (Experiment *exp, char *path)
|
||||
closedir (exp_dir);
|
||||
exp_names->sort (dir_name_cmp);
|
||||
Experiment **t_exp_list = new Experiment *[exp_names->size ()];
|
||||
- int nsubexps = 0;
|
||||
-
|
||||
for (int j = 0, jsz = exp_names->size (); j < jsz; j++)
|
||||
{
|
||||
t_exp_list[j] = NULL;
|
||||
@@ -1222,7 +1220,6 @@ DbeSession::open_experiment (Experiment *exp, char *path)
|
||||
dexp->open (dpath);
|
||||
append (dexp);
|
||||
t_exp_list[j] = dexp;
|
||||
- nsubexps++;
|
||||
dexp->set_clock (exp->clock);
|
||||
|
||||
// DbeView add_experiment() is split into two parts
|
||||
diff --git a/gprofng/src/Disasm.cc b/gprofng/src/Disasm.cc
|
||||
index e41bf679292..19f2174d536 100644
|
||||
--- a/gprofng/src/Disasm.cc
|
||||
+++ b/gprofng/src/Disasm.cc
|
||||
@@ -49,7 +49,6 @@ struct DisContext
|
||||
};
|
||||
|
||||
static const int MAX_DISASM_STR = 2048;
|
||||
-static const int MAX_INSTR_SIZE = 8;
|
||||
|
||||
Disasm::Disasm (char *fname)
|
||||
{
|
||||
diff --git a/gprofng/src/Experiment.cc b/gprofng/src/Experiment.cc
|
||||
index a1f78fc0cde..627a755c88c 100644
|
||||
--- a/gprofng/src/Experiment.cc
|
||||
+++ b/gprofng/src/Experiment.cc
|
||||
@@ -1937,8 +1937,6 @@ private:
|
||||
}
|
||||
|
||||
Experiment *exp;
|
||||
- char *hostname;
|
||||
- hrtime_t time, tstamp;
|
||||
};
|
||||
|
||||
void
|
||||
diff --git a/gprofng/src/HashMap.h b/gprofng/src/HashMap.h
|
||||
index 918c0dc95f9..c5fdd345ba8 100644
|
||||
--- a/gprofng/src/HashMap.h
|
||||
+++ b/gprofng/src/HashMap.h
|
||||
@@ -78,9 +78,8 @@ copy_key (uint64_t a)
|
||||
}
|
||||
|
||||
template<> inline void
|
||||
-delete_key (uint64_t a)
|
||||
+delete_key (uint64_t)
|
||||
{
|
||||
- a = a;
|
||||
}
|
||||
|
||||
template<> inline int
|
||||
diff --git a/gprofng/src/IOActivity.h b/gprofng/src/IOActivity.h
|
||||
index cf462cf8d55..f3a22ada6b1 100644
|
||||
--- a/gprofng/src/IOActivity.h
|
||||
+++ b/gprofng/src/IOActivity.h
|
||||
@@ -78,7 +78,6 @@ private:
|
||||
Hist_data *hist_data_file_all;
|
||||
Hist_data *hist_data_vfd_all;
|
||||
Hist_data *hist_data_callstack_all;
|
||||
- Hist_data *hist_data_callstack;
|
||||
|
||||
DbeView *dbev;
|
||||
};
|
||||
diff --git a/gprofng/src/collctrl.cc b/gprofng/src/collctrl.cc
|
||||
index 029c0387f19..c0234130f00 100644
|
||||
--- a/gprofng/src/collctrl.cc
|
||||
+++ b/gprofng/src/collctrl.cc
|
||||
@@ -880,9 +880,7 @@ Coll_Ctrl::set_clkprof (const char *string, char** warn)
|
||||
double dval = strtod (string, &endchar);
|
||||
if (*endchar == 'm' || *endchar == 0) /* user specified milliseconds */
|
||||
dval = dval * 1000.;
|
||||
- else if (*endchar == 'u') /* user specified microseconds */
|
||||
- dval = dval;
|
||||
- else
|
||||
+ else if (*endchar != 'u')
|
||||
return dbe_sprintf (GTXT ("Unrecognized clock-profiling interval `%s'\n"), string);
|
||||
nclkprof_timer = (int) (dval + 0.5);
|
||||
}
|
||||
@@ -2791,7 +2789,7 @@ Coll_Ctrl::get (char * control)
|
||||
}
|
||||
if (!strncmp (control, ipc_str_javaprof, len))
|
||||
{
|
||||
- if ((java_mode == 0))
|
||||
+ if (java_mode == 0)
|
||||
return strdup (ipc_str_off);
|
||||
return strdup (ipc_str_on);
|
||||
}
|
||||
@@ -2807,7 +2805,7 @@ Coll_Ctrl::get (char * control)
|
||||
}
|
||||
if (!strncmp (control, ipc_str_sample_sig, len))
|
||||
{
|
||||
- if ((sample_sig == 0))
|
||||
+ if (sample_sig == 0)
|
||||
return strdup (ipc_str_off);
|
||||
char *str_signal = find_signal_name (sample_sig);
|
||||
if (str_signal != NULL)
|
||||
@@ -2841,15 +2839,15 @@ Coll_Ctrl::get (char * control)
|
||||
}
|
||||
if (!strncmp (control, ipc_str_iotrace, len))
|
||||
{
|
||||
- if ((iotrace_enabled == 0))
|
||||
+ if (iotrace_enabled == 0)
|
||||
return strdup (ipc_str_off);
|
||||
return strdup (ipc_str_on);
|
||||
}
|
||||
if (!strncmp (control, ipc_str_count, len))
|
||||
{
|
||||
- if ((count_enabled == 0))
|
||||
+ if (count_enabled == 0)
|
||||
return strdup (ipc_str_off);
|
||||
- if ((count_enabled < 0))
|
||||
+ if (count_enabled < 0)
|
||||
return strdup ("on\nstatic");
|
||||
return strdup (ipc_str_on);
|
||||
}
|
||||
diff --git a/gprofng/src/collctrl.h b/gprofng/src/collctrl.h
|
||||
index a41647440ac..e2a8e450890 100644
|
||||
--- a/gprofng/src/collctrl.h
|
||||
+++ b/gprofng/src/collctrl.h
|
||||
@@ -272,7 +272,6 @@ private:
|
||||
char *node_name; /* name of machine on which experiment is run */
|
||||
long ncpus; /* number of online CPUs */
|
||||
int cpu_clk_freq; /* chip clock (MHz.), as reported from processor_info */
|
||||
- int cpc_cpuver; /* chip version, as reported from libcpc */
|
||||
long sys_resolution; /* system clock resolution */
|
||||
int sample_period; /* period for sampling, seconds */
|
||||
int sample_default; /* if period for sampling set by default */
|
||||
diff --git a/gprofng/src/collector_module.h b/gprofng/src/collector_module.h
|
||||
index bb48eadb9f8..ebcdbca561f 100644
|
||||
--- a/gprofng/src/collector_module.h
|
||||
+++ b/gprofng/src/collector_module.h
|
||||
@@ -40,12 +40,12 @@ struct tm;
|
||||
* If you add any, please put it in the right place */
|
||||
typedef struct CollectorUtilFuncs
|
||||
{
|
||||
- int (*access)();
|
||||
+ int (*access)(const char *, int);
|
||||
int (*atoi)(const char *nptr);
|
||||
void *(*calloc)(size_t nelem, size_t elsize);
|
||||
int (*clearenv)(void);
|
||||
int (*close)(int);
|
||||
- int (*closedir)();
|
||||
+ int (*closedir)(DIR *);
|
||||
int (*execv)(const char *path, char *const argv[]);
|
||||
void (*exit)(int status);
|
||||
int (*fclose)(FILE *stream);
|
||||
@@ -66,20 +66,20 @@ typedef struct CollectorUtilFuncs
|
||||
off_t (*lseek)(int fd, off_t offset, int whence);
|
||||
void *(*malloc)(size_t size);
|
||||
void *(*memset)(void *s1, int c, size_t n);
|
||||
- int (*mkdir)();
|
||||
+ int (*mkdir)(const char *, mode_t);
|
||||
time_t (*mktime)(struct tm *timeptr);
|
||||
void *(*mmap)(void *, size_t, int, int, int, off_t);
|
||||
- void *(*mmap64_)();
|
||||
- int (*munmap)();
|
||||
+ void *(*mmap64_)(void *, size_t, int, int, int, off_t);
|
||||
+ int (*munmap)(void *, size_t);
|
||||
int (*open)(const char *, int, ...);
|
||||
int (*open_bare)(const char *, int, ...);
|
||||
- DIR *(*opendir)();
|
||||
+ DIR *(*opendir)(const char *);
|
||||
int (*pclose)(FILE *stream);
|
||||
FILE *(*popen)(const char *command, const char *mode);
|
||||
int (*putenv)(char *string);
|
||||
- ssize_t (*pwrite)();
|
||||
- ssize_t (*pwrite64_)();
|
||||
- ssize_t (*read)();
|
||||
+ ssize_t (*pwrite)(int, const void *, size_t, off_t);
|
||||
+ ssize_t (*pwrite64_)(int, const void *, size_t, off_t);
|
||||
+ ssize_t (*read)(int, void *, size_t);
|
||||
int (*setenv)(const char *name, const char *value, int overwrite);
|
||||
int (*sigfillset)(sigset_t *set);
|
||||
int (*sigprocmask)(int how, const sigset_t *set, sigset_t *oldset);
|
||||
@@ -112,7 +112,7 @@ typedef struct CollectorUtilFuncs
|
||||
int (*unsetenv)(const char *name);
|
||||
int (*vsnprintf)(char *str, size_t size, const char *format, va_list ap);
|
||||
pid_t (*waitpid)(pid_t pid, int *stat_loc, int options);
|
||||
- ssize_t (*write)();
|
||||
+ ssize_t (*write)(int, void *, size_t);
|
||||
double (*atof)();
|
||||
void *n_a;
|
||||
} CollectorUtilFuncs;
|
||||
diff --git a/gprofng/src/gp-display-src.cc b/gprofng/src/gp-display-src.cc
|
||||
index 200e6080d2e..24af375edf1 100644
|
||||
--- a/gprofng/src/gp-display-src.cc
|
||||
+++ b/gprofng/src/gp-display-src.cc
|
||||
@@ -75,14 +75,6 @@ private:
|
||||
bool v_opt;
|
||||
int multiple;
|
||||
char *str_compcom;
|
||||
- bool hex_visible;
|
||||
- int src_visible;
|
||||
- int vis_src;
|
||||
- int vis_dis;
|
||||
- int threshold_src;
|
||||
- int threshold_dis;
|
||||
- int threshold;
|
||||
- int vis_bits;
|
||||
};
|
||||
|
||||
static int
|
||||
diff --git a/gprofng/src/gp-print.h b/gprofng/src/gp-print.h
|
||||
index 1b748ea60a3..1a8ad3b6c13 100644
|
||||
--- a/gprofng/src/gp-print.h
|
||||
+++ b/gprofng/src/gp-print.h
|
||||
@@ -19,7 +19,7 @@
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _GP_PRINT_H
|
||||
-#define _ER_PRINT_H
|
||||
+#define _GP_PRINT_H
|
||||
|
||||
#include "Command.h"
|
||||
#include "DbeApplication.h"
|
||||
diff --git a/gprofng/src/hwc_intel_icelake.h b/gprofng/src/hwc_intel_icelake.h
|
||||
index 46f4ac5005f..4fe2e26f63b 100644
|
||||
--- a/gprofng/src/hwc_intel_icelake.h
|
||||
+++ b/gprofng/src/hwc_intel_icelake.h
|
||||
@@ -24,8 +24,10 @@
|
||||
#define SH(val, n) (((unsigned long long) (val)) << n)
|
||||
#define I(nm, event, umask, edge, cmask, inv, \
|
||||
offcore_rsp, ldlat, frontend, period, mtr) \
|
||||
- INIT_HWC(nm, mtr, SH(event, 0) | SH(umask, 8) | SH(edge, 18) \
|
||||
- | SH(cmask, 24) | SH(inv, 23), PERF_TYPE_RAW), \
|
||||
+ .use_perf_event_type = 1, .type = PERF_TYPE_RAW, \
|
||||
+ .name = (nm), .metric = (mtr), .reg_num = REGNO_ANY, \
|
||||
+ .config = SH(event, 0) | SH(umask, 8) | SH(edge, 18) | SH(cmask, 24) \
|
||||
+ | SH(inv, 23), \
|
||||
.config1 = SH(offcore_rsp, 0) | SH(ldlat, 0) | SH(frontend, 0), \
|
||||
.val = period
|
||||
|
||||
diff --git a/gprofng/src/util.cc b/gprofng/src/util.cc
|
||||
index 201f7088b66..228140b61ae 100644
|
||||
--- a/gprofng/src/util.cc
|
||||
+++ b/gprofng/src/util.cc
|
||||
@@ -741,17 +741,13 @@ get_relative_link (const char *path_from, const char *path_to)
|
||||
s2 = canonical_path (s2);
|
||||
long l = dbe_sstrlen (s1);
|
||||
// try to find common directories
|
||||
- int common_slashes = 0;
|
||||
int last_common_slash = -1;
|
||||
for (int i = 0; i < l; i++)
|
||||
{
|
||||
- if (s1[i] != s2[i]) break;
|
||||
- if (s1[i] == 0) break;
|
||||
+ if (s1[i] != s2[i] || s1[i] == 0)
|
||||
+ break;
|
||||
if (s1[i] == '/')
|
||||
- {
|
||||
- common_slashes++;
|
||||
- last_common_slash = i;
|
||||
- }
|
||||
+ last_common_slash = i;
|
||||
}
|
||||
// find slashes in remaining path_to
|
||||
int slashes = 0;
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -0,0 +1,619 @@
|
||||
From a5be89126b9bee78224be842e3086ce99dc045e6 Mon Sep 17 00:00:00 2001
|
||||
From: Sam James <sam@gentoo.org>
|
||||
Date: Sat, 16 Nov 2024 05:13:48 +0000
|
||||
Subject: [PATCH] gprofng: fix -std=gnu23 compatibility wrt unprototyped
|
||||
functions
|
||||
|
||||
C23 removes support for unprototyped functions. Fix function pointer types
|
||||
accordingly.
|
||||
|
||||
This does not fix all instances, there's a few left as I commented on in
|
||||
PR32374 (e.g. setitimer which I have a local workaround for but it involves
|
||||
a glibc implementation detail; the Linaro precommit CI tester pointed that
|
||||
out too, so dropped that).
|
||||
|
||||
ChangeLog:
|
||||
PR gprofng/32374
|
||||
|
||||
* libcollector/collector.c (collector_sample): Fix prototype.
|
||||
* libcollector/envmgmt.c (putenv): Ditto.
|
||||
(_putenv): Ditto.
|
||||
(__collector_putenv): Ditto.
|
||||
(setenv): Ditto.
|
||||
(_setenv): Ditto.
|
||||
(__collector_setenv): Ditto.
|
||||
(unsetenv): Ditto.
|
||||
(_unsetenv): Ditto.
|
||||
(__collector_unsetenv): Ditto.
|
||||
* libcollector/jprofile.c (open_experiment): Ditto.
|
||||
(__collector_jprofile_enable_synctrace): Ditto.
|
||||
(jprof_find_asyncgetcalltrace): Ditto.
|
||||
* libcollector/libcol_util.c (__collector_util_init): Ditto.
|
||||
(ARCH): Ditto.
|
||||
* libcollector/mmaptrace.c (collector_func_load): Ditto.
|
||||
(collector_func_unload): Ditto.
|
||||
* libcollector/unwind.c (__collector_ext_unwind_init): Ditto.
|
||||
* src/collector_module.h: Ditto.
|
||||
|
||||
Upstream: a2f774427e078f3da2c06bdea25f77a61979a695
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
gprofng/libcollector/collector.c | 2 +-
|
||||
gprofng/libcollector/dispatcher.c | 1 -
|
||||
gprofng/libcollector/envmgmt.c | 24 ++++-----
|
||||
gprofng/libcollector/jprofile.c | 10 ++--
|
||||
gprofng/libcollector/libcol_util.c | 84 +++++++++++++++---------------
|
||||
gprofng/libcollector/mmaptrace.c | 4 +-
|
||||
gprofng/libcollector/unwind.c | 2 +-
|
||||
gprofng/src/collector_module.h | 2 +-
|
||||
8 files changed, 64 insertions(+), 65 deletions(-)
|
||||
|
||||
diff --git a/gprofng/libcollector/collector.c b/gprofng/libcollector/collector.c
|
||||
index 2ff95e58fde..3cab346e7dc 100644
|
||||
--- a/gprofng/libcollector/collector.c
|
||||
+++ b/gprofng/libcollector/collector.c
|
||||
@@ -1578,7 +1578,7 @@ __collector_resume_experiment ()
|
||||
}
|
||||
|
||||
/* Code to support Samples and Pause/Resume */
|
||||
-void collector_sample () __attribute__ ((weak, alias ("__collector_sample")));
|
||||
+void collector_sample (char *name) __attribute__ ((weak, alias ("__collector_sample")));
|
||||
void
|
||||
__collector_sample (char *name)
|
||||
{
|
||||
diff --git a/gprofng/libcollector/dispatcher.c b/gprofng/libcollector/dispatcher.c
|
||||
index f7cd46e7e6b..4eda18ec324 100644
|
||||
--- a/gprofng/libcollector/dispatcher.c
|
||||
+++ b/gprofng/libcollector/dispatcher.c
|
||||
@@ -1281,4 +1281,3 @@ __collector_ext_clone_pthread (int (*fn)(void *), void *child_stack, int flags,
|
||||
int sigprocmask (int, const sigset_t*, sigset_t*) __attribute__ ((weak, alias ("__collector_sigprocmask")));
|
||||
int thr_sigsetmask (int, const sigset_t*, sigset_t*) __attribute__ ((weak, alias ("__collector_thr_sigsetmask")));
|
||||
int setitimer () __attribute__ ((weak, alias ("_setitimer")));
|
||||
-
|
||||
diff --git a/gprofng/libcollector/envmgmt.c b/gprofng/libcollector/envmgmt.c
|
||||
index a399c0d0cb4..f2bf2c41bfb 100644
|
||||
--- a/gprofng/libcollector/envmgmt.c
|
||||
+++ b/gprofng/libcollector/envmgmt.c
|
||||
@@ -685,8 +685,8 @@ __collector_env_update (char *envp[])
|
||||
|
||||
|
||||
/*------------------------------------------------------------- putenv */
|
||||
-int putenv () __attribute__ ((weak, alias ("__collector_putenv")));
|
||||
-int _putenv () __attribute__ ((weak, alias ("__collector_putenv")));
|
||||
+int putenv (char*) __attribute__ ((weak, alias ("__collector_putenv")));
|
||||
+int _putenv (char*) __attribute__ ((weak, alias ("__collector_putenv")));
|
||||
|
||||
int
|
||||
__collector_putenv (char * string)
|
||||
@@ -694,9 +694,9 @@ __collector_putenv (char * string)
|
||||
if (CALL_UTIL (putenv) == __collector_putenv ||
|
||||
CALL_UTIL (putenv) == NULL)
|
||||
{ // __collector_libc_funcs_init failed
|
||||
- CALL_UTIL (putenv) = (int(*)())dlsym (RTLD_NEXT, "putenv");
|
||||
+ CALL_UTIL (putenv) = (int(*)(char*))dlsym (RTLD_NEXT, "putenv");
|
||||
if (CALL_UTIL (putenv) == NULL || CALL_UTIL (putenv) == __collector_putenv)
|
||||
- CALL_UTIL (putenv) = (int(*)())dlsym (RTLD_DEFAULT, "putenv");
|
||||
+ CALL_UTIL (putenv) = (int(*)(char*))dlsym (RTLD_DEFAULT, "putenv");
|
||||
if (CALL_UTIL (putenv) == NULL || CALL_UTIL (putenv) == __collector_putenv)
|
||||
{
|
||||
TprintfT (DBG_LT2, "__collector_putenv(): ERROR: no pointer found.\n");
|
||||
@@ -712,8 +712,8 @@ __collector_putenv (char * string)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------- setenv */
|
||||
-int setenv () __attribute__ ((weak, alias ("__collector_setenv")));
|
||||
-int _setenv () __attribute__ ((weak, alias ("__collector_setenv")));
|
||||
+int setenv (const char*, const char*, int) __attribute__ ((weak, alias ("__collector_setenv")));
|
||||
+int _setenv (const char*, const char*, int) __attribute__ ((weak, alias ("__collector_setenv")));
|
||||
|
||||
int
|
||||
__collector_setenv (const char *name, const char *value, int overwrite)
|
||||
@@ -721,9 +721,9 @@ __collector_setenv (const char *name, const char *value, int overwrite)
|
||||
if (CALL_UTIL (setenv) == __collector_setenv ||
|
||||
CALL_UTIL (setenv) == NULL)
|
||||
{ // __collector_libc_funcs_init failed
|
||||
- CALL_UTIL (setenv) = (int(*)())dlsym (RTLD_NEXT, "setenv");
|
||||
+ CALL_UTIL (setenv) = (int(*)(const char*, const char*, int))dlsym (RTLD_NEXT, "setenv");
|
||||
if (CALL_UTIL (setenv) == NULL || CALL_UTIL (setenv) == __collector_setenv)
|
||||
- CALL_UTIL (setenv) = (int(*)())dlsym (RTLD_DEFAULT, "setenv");
|
||||
+ CALL_UTIL (setenv) = (int(*)(const char*, const char*, int))dlsym (RTLD_DEFAULT, "setenv");
|
||||
if (CALL_UTIL (setenv) == NULL || CALL_UTIL (setenv) == __collector_setenv)
|
||||
{
|
||||
TprintfT (DBG_LT2, "__collector_setenv(): ERROR: no pointer found.\n");
|
||||
@@ -758,8 +758,8 @@ __collector_setenv (const char *name, const char *value, int overwrite)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------- unsetenv */
|
||||
-int unsetenv () __attribute__ ((weak, alias ("__collector_unsetenv")));
|
||||
-int _unsetenv () __attribute__ ((weak, alias ("__collector_unsetenv")));
|
||||
+int unsetenv (const char*) __attribute__ ((weak, alias ("__collector_unsetenv")));
|
||||
+int _unsetenv (const char*) __attribute__ ((weak, alias ("__collector_unsetenv")));
|
||||
|
||||
int
|
||||
__collector_unsetenv (const char *name)
|
||||
@@ -767,9 +767,9 @@ __collector_unsetenv (const char *name)
|
||||
if (CALL_UTIL (unsetenv) == __collector_unsetenv ||
|
||||
CALL_UTIL (unsetenv) == NULL)
|
||||
{ // __collector_libc_funcs_init failed
|
||||
- CALL_UTIL (unsetenv) = (int(*)())dlsym (RTLD_NEXT, "unsetenv");
|
||||
+ CALL_UTIL (unsetenv) = (int(*)(const char*))dlsym (RTLD_NEXT, "unsetenv");
|
||||
if (CALL_UTIL (unsetenv) == NULL || CALL_UTIL (unsetenv) == __collector_unsetenv)
|
||||
- CALL_UTIL (unsetenv) = (int(*)())dlsym (RTLD_DEFAULT, "unsetenv");
|
||||
+ CALL_UTIL (unsetenv) = (int(*)(const char*))dlsym (RTLD_DEFAULT, "unsetenv");
|
||||
if (CALL_UTIL (unsetenv) == NULL || CALL_UTIL (unsetenv) == __collector_unsetenv)
|
||||
{
|
||||
TprintfT (DBG_LT2, "__collector_unsetenv(): ERROR: no pointer found.\n");
|
||||
diff --git a/gprofng/libcollector/jprofile.c b/gprofng/libcollector/jprofile.c
|
||||
index cd498bed0a3..d8f2d049a84 100644
|
||||
--- a/gprofng/libcollector/jprofile.c
|
||||
+++ b/gprofng/libcollector/jprofile.c
|
||||
@@ -99,8 +99,8 @@ static void rwrite (int fd, const void *buf, size_t nbyte);
|
||||
static void addToDynamicArchive (const char* name, const unsigned char* class_data, int class_data_len);
|
||||
static void (*AsyncGetCallTrace)(JVMPI_CallTrace*, jint, ucontext_t*) = NULL;
|
||||
static void (*collector_heap_record)(int, int, void*) = NULL;
|
||||
-static void (*collector_jsync_begin)() = NULL;
|
||||
-static void (*collector_jsync_end)(hrtime_t, void *) = NULL;
|
||||
+static void (*collector_jsync_begin)(void) = NULL;
|
||||
+static void (*collector_jsync_end)(hrtime_t, void*) = NULL;
|
||||
|
||||
#define gethrtime collector_interface->getHiResTime
|
||||
|
||||
@@ -224,7 +224,7 @@ open_experiment (const char *exp)
|
||||
else if (__collector_strStartWith (args, "s:") == 0)
|
||||
{
|
||||
java_sync_mode = 1;
|
||||
- collector_jsync_begin = (void(*)(hrtime_t, void *))dlsym (RTLD_DEFAULT, "__collector_jsync_begin");
|
||||
+ collector_jsync_begin = (void(*)(void))dlsym (RTLD_DEFAULT, "__collector_jsync_begin");
|
||||
collector_jsync_end = (void(*)(hrtime_t, void *))dlsym (RTLD_DEFAULT, "__collector_jsync_end");
|
||||
}
|
||||
#endif
|
||||
@@ -249,7 +249,7 @@ __collector_jprofile_enable_synctrace ()
|
||||
return;
|
||||
}
|
||||
java_sync_mode = 1;
|
||||
- collector_jsync_begin = (void(*)(hrtime_t, void *))dlsym (RTLD_DEFAULT, "__collector_jsync_begin");
|
||||
+ collector_jsync_begin = (void(*)(void))dlsym (RTLD_DEFAULT, "__collector_jsync_begin");
|
||||
collector_jsync_end = (void(*)(hrtime_t, void *))dlsym (RTLD_DEFAULT, "__collector_jsync_end");
|
||||
TprintfT (DBG_LT1, "jprofile: turning on Java synctrace, and requesting events\n");
|
||||
}
|
||||
@@ -1123,7 +1123,7 @@ jprof_find_asyncgetcalltrace ()
|
||||
{
|
||||
void *jvmhandle;
|
||||
if (__collector_VM_ReadByteInstruction == NULL)
|
||||
- __collector_VM_ReadByteInstruction = (int(*)()) dlsym (RTLD_DEFAULT, "Async_VM_ReadByteInstruction");
|
||||
+ __collector_VM_ReadByteInstruction = (int(*)(unsigned char*)) dlsym (RTLD_DEFAULT, "Async_VM_ReadByteInstruction");
|
||||
|
||||
/* look for stack unwind function using default path */
|
||||
AsyncGetCallTrace = (void (*)(JVMPI_CallTrace*, jint, ucontext_t*))
|
||||
diff --git a/gprofng/libcollector/libcol_util.c b/gprofng/libcollector/libcol_util.c
|
||||
index baac15db5c4..a73488e3f60 100644
|
||||
--- a/gprofng/libcollector/libcol_util.c
|
||||
+++ b/gprofng/libcollector/libcol_util.c
|
||||
@@ -1114,7 +1114,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "munmap");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.munmap = (int(*)())ptr;
|
||||
+ __collector_util_funcs.munmap = (int(*)(void *, size_t))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT munmap: %s\n", dlerror ());
|
||||
@@ -1123,7 +1123,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "close");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.close = (int(*)())ptr;
|
||||
+ __collector_util_funcs.close = (int(*)(int))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT close: %s\n", dlerror ());
|
||||
@@ -1158,7 +1158,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "close");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.close = (int(*)())ptr;
|
||||
+ __collector_util_funcs.close = (int(*)(int))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT close: %s\n", dlerror ());
|
||||
@@ -1167,7 +1167,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "read");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.read = (ssize_t (*)())ptr;
|
||||
+ __collector_util_funcs.read = (ssize_t (*)(int, void*, size_t))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT read: %s\n", dlerror ());
|
||||
@@ -1176,7 +1176,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "write");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.write = (ssize_t (*)())ptr;
|
||||
+ __collector_util_funcs.write = (ssize_t (*)(int, void*, size_t))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT write: %s\n", dlerror ());
|
||||
@@ -1186,14 +1186,14 @@ __collector_util_init ()
|
||||
#if ARCH(Intel) && WSIZE(32)
|
||||
ptr = dlvsym (libc, "pwrite", "GLIBC_2.2"); // it is in /lib/libpthread.so.0
|
||||
if (ptr)
|
||||
- __collector_util_funcs.pwrite = (ssize_t (*)())ptr;
|
||||
+ __collector_util_funcs.pwrite = (ssize_t (*)(int, void*, size_t, off_t))ptr;
|
||||
else
|
||||
{
|
||||
Tprintf (DBG_LT0, "libcol_util: WARNING: dlvsym for %s@%s failed. Using dlsym() instead.", "pwrite", "GLIBC_2.2");
|
||||
#endif /* ARCH(Intel) && WSIZE(32) */
|
||||
ptr = dlsym (libc, "pwrite");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.pwrite = (ssize_t (*)())ptr;
|
||||
+ __collector_util_funcs.pwrite = (ssize_t (*)(int, const void*, size_t, off_t))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT pwrite: %s\n", dlerror ());
|
||||
@@ -1213,7 +1213,7 @@ __collector_util_init ()
|
||||
#endif /* ARCH(Intel) && WSIZE(32) */
|
||||
ptr = dlsym (libc, "pwrite64");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.pwrite64_ = (ssize_t (*)())ptr;
|
||||
+ __collector_util_funcs.pwrite64_ = (ssize_t (*)(int, const void*, size_t, off_t))ptr;
|
||||
else
|
||||
__collector_util_funcs.pwrite64_ = __collector_util_funcs.pwrite;
|
||||
#if ARCH(Intel) && WSIZE(32)
|
||||
@@ -1222,7 +1222,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "lseek");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.lseek = (off_t (*)())ptr;
|
||||
+ __collector_util_funcs.lseek = (off_t (*)(int, off_t, int))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT lseek: %s\n", dlerror ());
|
||||
@@ -1231,7 +1231,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "access");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.access = (int(*)())ptr;
|
||||
+ __collector_util_funcs.access = (int(*)(const char*, int))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT access: %s\n", dlerror ());
|
||||
@@ -1240,7 +1240,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "mkdir");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.mkdir = (int(*)())ptr;
|
||||
+ __collector_util_funcs.mkdir = (int(*)(const char*, mode_t))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT mkdir: %s\n", dlerror ());
|
||||
@@ -1249,7 +1249,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "opendir");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.opendir = (DIR * (*)())ptr;
|
||||
+ __collector_util_funcs.opendir = (DIR * (*)(const char*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT opendir: %s\n", dlerror ());
|
||||
@@ -1258,7 +1258,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "closedir");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.closedir = (int(*)())ptr;
|
||||
+ __collector_util_funcs.closedir = (int(*)(DIR*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT closedir: %s\n", dlerror ());
|
||||
@@ -1267,7 +1267,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "execv");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.execv = (int(*)())ptr;
|
||||
+ __collector_util_funcs.execv = (int(*)(const char*, char* const*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT execv: %s\n", dlerror ());
|
||||
@@ -1276,7 +1276,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "exit");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.exit = (void(*)())ptr;
|
||||
+ __collector_util_funcs.exit = (void(*)(int))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT exit: %s\n", dlerror ());
|
||||
@@ -1285,7 +1285,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "vfork");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.vfork = (pid_t (*)())ptr;
|
||||
+ __collector_util_funcs.vfork = (pid_t (*)(void))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT vfork: %s\n", dlerror ());
|
||||
@@ -1294,7 +1294,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "waitpid");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.waitpid = (pid_t (*)())ptr;
|
||||
+ __collector_util_funcs.waitpid = (pid_t (*)(pid_t, int*, int))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT waitpid: %s\n", dlerror ());
|
||||
@@ -1313,7 +1313,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "getcontext");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.getcontext = (int(*)())ptr;
|
||||
+ __collector_util_funcs.getcontext = (int(*)(ucontext_t*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT getcontext: %s\n", dlerror ());
|
||||
@@ -1331,7 +1331,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "putenv");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.putenv = (int(*)())ptr;
|
||||
+ __collector_util_funcs.putenv = (int(*)(char*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT putenv: %s\n", dlerror ());
|
||||
@@ -1340,7 +1340,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "getenv");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.getenv = (char*(*)())ptr;
|
||||
+ __collector_util_funcs.getenv = (char*(*)(const char*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT getenv: %s\n", dlerror ());
|
||||
@@ -1349,7 +1349,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "time");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.time = (time_t (*)())ptr;
|
||||
+ __collector_util_funcs.time = (time_t (*)(time_t*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT time: %s\n", dlerror ());
|
||||
@@ -1358,7 +1358,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "mktime");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.mktime = (time_t (*)())ptr;
|
||||
+ __collector_util_funcs.mktime = (time_t (*)(struct tm*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT mktime: %s\n", dlerror ());
|
||||
@@ -1372,7 +1372,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "gmtime_r");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.gmtime_r = (struct tm * (*)())ptr;
|
||||
+ __collector_util_funcs.gmtime_r = (struct tm * (*)(const time_t*, struct tm*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT gmtime_r: %s\n", dlerror ());
|
||||
@@ -1381,7 +1381,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "strtol");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.strtol = (long (*)())ptr;
|
||||
+ __collector_util_funcs.strtol = (long (*)(const char*, char**, int))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strtol: %s\n", dlerror ());
|
||||
@@ -1390,7 +1390,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "strtoll");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.strtoll = (long long (*)())ptr;
|
||||
+ __collector_util_funcs.strtoll = (long long (*)(const char*, char**, int))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strtoll: %s\n", dlerror ());
|
||||
@@ -1402,7 +1402,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "setenv");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.setenv = (int(*)())ptr;
|
||||
+ __collector_util_funcs.setenv = (int(*)(const char*, const char*, int))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT setenv: %s\n", dlerror ());
|
||||
@@ -1411,7 +1411,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "unsetenv");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.unsetenv = (int(*)())ptr;
|
||||
+ __collector_util_funcs.unsetenv = (int(*)(const char*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT unsetenv: %s\n", dlerror ());
|
||||
@@ -1507,7 +1507,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "pclose");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.pclose = (int(*)())ptr;
|
||||
+ __collector_util_funcs.pclose = (int(*)(FILE*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT pclose: %s\n", dlerror ());
|
||||
@@ -1516,7 +1516,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "fgets");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.fgets = (char*(*)())ptr;
|
||||
+ __collector_util_funcs.fgets = (char*(*)(char*, int, FILE*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT fgets: %s\n", dlerror ());
|
||||
@@ -1543,7 +1543,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "vsnprintf");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.vsnprintf = (int(*)())ptr;
|
||||
+ __collector_util_funcs.vsnprintf = (int(*)(char*, size_t, const char*, ...))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT vsnprintf: %s\n", dlerror ());
|
||||
@@ -1552,7 +1552,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "atoi");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.atoi = (int(*)())ptr;
|
||||
+ __collector_util_funcs.atoi = (int(*)(const char*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT atoi: %s\n", dlerror ());
|
||||
@@ -1561,7 +1561,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "calloc");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.calloc = (void*(*)())ptr;
|
||||
+ __collector_util_funcs.calloc = (void*(*)(size_t, size_t))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT calloc: %s\n", dlerror ());
|
||||
@@ -1571,7 +1571,7 @@ __collector_util_init ()
|
||||
ptr = dlsym (libc, "free");
|
||||
if (ptr)
|
||||
{
|
||||
- __collector_util_funcs.free = (void(*)())ptr;
|
||||
+ __collector_util_funcs.free = (void(*)(void*))ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1581,7 +1581,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "strdup");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.libc_strdup = (char*(*)())ptr;
|
||||
+ __collector_util_funcs.libc_strdup = (char*(*)(const char*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strdup: %s\n", dlerror ());
|
||||
@@ -1594,7 +1594,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "strerror");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.strerror = (char*(*)())ptr;
|
||||
+ __collector_util_funcs.strerror = (char*(*)(int))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strerror: %s\n", dlerror ());
|
||||
@@ -1602,7 +1602,7 @@ __collector_util_init ()
|
||||
}
|
||||
ptr = dlsym (libc, "strerror_r");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.strerror_r = (int(*)())ptr;
|
||||
+ __collector_util_funcs.strerror_r = (int(*)(int, char*, size_t))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strerror_r: %s\n", dlerror ());
|
||||
@@ -1610,7 +1610,7 @@ __collector_util_init ()
|
||||
}
|
||||
ptr = dlsym (libc, "strspn");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.strspn = (size_t (*)())ptr;
|
||||
+ __collector_util_funcs.strspn = (size_t (*)(const char*, const char*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strspn: %s\n", dlerror ());
|
||||
@@ -1619,7 +1619,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "strtoul");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.strtoul = (unsigned long int(*)())ptr;
|
||||
+ __collector_util_funcs.strtoul = (unsigned long int(*)(const char*, char**, int))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strtoul: %s\n", dlerror ());
|
||||
@@ -1628,7 +1628,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "strtoull");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.strtoull = (unsigned long long int(*)())ptr;
|
||||
+ __collector_util_funcs.strtoull = (unsigned long long int(*)(const char*, char**, int))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strtoull: %s\n", dlerror ());
|
||||
@@ -1673,7 +1673,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "sysconf");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.sysconf = (long(*)())ptr;
|
||||
+ __collector_util_funcs.sysconf = (long(*)(int))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT sysconf: %s\n", dlerror ());
|
||||
@@ -1682,7 +1682,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "sigfillset");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.sigfillset = (int(*)())ptr;
|
||||
+ __collector_util_funcs.sigfillset = (int(*)(sigset_t*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT sigfillset: %s\n", dlerror ());
|
||||
@@ -1691,7 +1691,7 @@ __collector_util_init ()
|
||||
|
||||
ptr = dlsym (libc, "sigprocmask");
|
||||
if (ptr)
|
||||
- __collector_util_funcs.sigprocmask = (int(*)())ptr;
|
||||
+ __collector_util_funcs.sigprocmask = (int(*)(int, const sigset_t*, sigset_t*))ptr;
|
||||
else
|
||||
{
|
||||
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT sigprocmask: %s\n", dlerror ());
|
||||
diff --git a/gprofng/libcollector/mmaptrace.c b/gprofng/libcollector/mmaptrace.c
|
||||
index f07f4d76513..2a6857ab58e 100644
|
||||
--- a/gprofng/libcollector/mmaptrace.c
|
||||
+++ b/gprofng/libcollector/mmaptrace.c
|
||||
@@ -1209,7 +1209,7 @@ process_vsyscall_page ()
|
||||
/*
|
||||
* collector API for dynamic functions
|
||||
*/
|
||||
-void collector_func_load () __attribute__ ((weak, alias ("__collector_func_load")));
|
||||
+void collector_func_load (char*, char*, char*, void*, int, int, DT_lineno *) __attribute__ ((weak, alias ("__collector_func_load")));
|
||||
void
|
||||
__collector_func_load (char *name, char *alias, char *sourcename,
|
||||
void *vaddr, int size, int lntsize, DT_lineno *lntable)
|
||||
@@ -1218,7 +1218,7 @@ __collector_func_load (char *name, char *alias, char *sourcename,
|
||||
vaddr, size, lntsize, lntable);
|
||||
}
|
||||
|
||||
-void collector_func_unload () __attribute__ ((weak, alias ("__collector_func_unload")));
|
||||
+void collector_func_unload (void *vaddr) __attribute__ ((weak, alias ("__collector_func_unload")));
|
||||
void
|
||||
__collector_func_unload (void *vaddr)
|
||||
{
|
||||
diff --git a/gprofng/libcollector/unwind.c b/gprofng/libcollector/unwind.c
|
||||
index 55fa2e9e9e7..e08afa165d1 100644
|
||||
--- a/gprofng/libcollector/unwind.c
|
||||
+++ b/gprofng/libcollector/unwind.c
|
||||
@@ -421,7 +421,7 @@ __collector_ext_unwind_init (int record)
|
||||
omp_no_walk = 1;
|
||||
|
||||
if (__collector_VM_ReadByteInstruction == NULL)
|
||||
- __collector_VM_ReadByteInstruction = (int(*)()) dlsym (RTLD_DEFAULT, "Async_VM_ReadByteInstruction");
|
||||
+ __collector_VM_ReadByteInstruction = (int(*)(unsigned char*)) dlsym (RTLD_DEFAULT, "Async_VM_ReadByteInstruction");
|
||||
|
||||
#if ARCH(SPARC)
|
||||
#if WSIZE(64)
|
||||
diff --git a/gprofng/src/collector_module.h b/gprofng/src/collector_module.h
|
||||
index ebcdbca561f..fd888cd58dd 100644
|
||||
--- a/gprofng/src/collector_module.h
|
||||
+++ b/gprofng/src/collector_module.h
|
||||
@@ -110,7 +110,7 @@ typedef struct CollectorUtilFuncs
|
||||
long (*sysinfo)(int command, char *buf, long count);
|
||||
time_t (*time)(time_t *tloc);
|
||||
int (*unsetenv)(const char *name);
|
||||
- int (*vsnprintf)(char *str, size_t size, const char *format, va_list ap);
|
||||
+ int (*vsnprintf)(char *str, size_t size, const char *format, ...);
|
||||
pid_t (*waitpid)(pid_t pid, int *stat_loc, int options);
|
||||
ssize_t (*write)(int, void *, size_t);
|
||||
double (*atof)();
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
From 9ca25799ea0e92855d19adc46634e6dd0675a0b7 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
|
||||
Date: Thu, 21 Nov 2024 14:48:20 -0800
|
||||
Subject: [PATCH] gprofng: fix build with -std=gnu23
|
||||
|
||||
Fix function pointer types accordingly.
|
||||
Remove unused function pointers.
|
||||
|
||||
gprofng/ChangeLog
|
||||
2024-11-21 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
|
||||
|
||||
PR gprofng/32374
|
||||
PR gprofng/32373
|
||||
* common/cpuid.c: Define ATTRIBUTE_UNUSED if necessary.
|
||||
* libcollector/libcol_util.c (sysinfo): Remove unused pointer.
|
||||
* src/collector_module.h: Likewise.
|
||||
* libcollector/dispatcher.c (setitimer): Fix prototype.
|
||||
* libcollector/linetrace.c (system, grantpt, ptsname): Likewise.
|
||||
* testsuite/gprofng.display/mttest/mttest.c (dump_arrays): Likewise.
|
||||
* testsuite/gprofng.display/synprog/endcases.c (xinline_code,
|
||||
s_inline_code): Likewise.
|
||||
* testsuite/gprofng.display/synprog/inc_inline.h (ext_inline_code):
|
||||
Likewise.
|
||||
* testsuite/gprofng.display/synprog/synprog.c (doabort): Rename nullptr.
|
||||
|
||||
Upstream: 4e943705e3e8a5a9448d087502bcb390a694ad02
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
gprofng/common/cpuid.c | 2 ++
|
||||
gprofng/libcollector/dispatcher.c | 2 +-
|
||||
gprofng/libcollector/libcol_util.c | 9 ---------
|
||||
gprofng/libcollector/linetrace.c | 10 +++++-----
|
||||
gprofng/src/collector_module.h | 1 -
|
||||
gprofng/testsuite/gprofng.display/mttest/mttest.c | 2 +-
|
||||
gprofng/testsuite/gprofng.display/synprog/endcases.c | 4 ++--
|
||||
gprofng/testsuite/gprofng.display/synprog/inc_inline.h | 2 +-
|
||||
gprofng/testsuite/gprofng.display/synprog/synprog.c | 4 ++--
|
||||
9 files changed, 14 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/gprofng/common/cpuid.c b/gprofng/common/cpuid.c
|
||||
index 891d5471335..b4caef54f57 100644
|
||||
--- a/gprofng/common/cpuid.c
|
||||
+++ b/gprofng/common/cpuid.c
|
||||
@@ -21,7 +21,9 @@
|
||||
#if defined(__i386__) || defined(__x86_64)
|
||||
#include <cpuid.h> /* GCC-provided */
|
||||
#elif defined(__aarch64__)
|
||||
+#if !defined(ATTRIBUTE_UNUSED)
|
||||
#define ATTRIBUTE_UNUSED __attribute__((unused))
|
||||
+#endif
|
||||
|
||||
static inline uint_t __attribute_const__
|
||||
__get_cpuid (unsigned int op ATTRIBUTE_UNUSED, unsigned int *eax,
|
||||
diff --git a/gprofng/libcollector/dispatcher.c b/gprofng/libcollector/dispatcher.c
|
||||
index 4eda18ec324..6f0364cc52c 100644
|
||||
--- a/gprofng/libcollector/dispatcher.c
|
||||
+++ b/gprofng/libcollector/dispatcher.c
|
||||
@@ -1280,4 +1280,4 @@ __collector_ext_clone_pthread (int (*fn)(void *), void *child_stack, int flags,
|
||||
// weak symbols:
|
||||
int sigprocmask (int, const sigset_t*, sigset_t*) __attribute__ ((weak, alias ("__collector_sigprocmask")));
|
||||
int thr_sigsetmask (int, const sigset_t*, sigset_t*) __attribute__ ((weak, alias ("__collector_thr_sigsetmask")));
|
||||
-int setitimer () __attribute__ ((weak, alias ("_setitimer")));
|
||||
+__typeof(setitimer) setitimer __attribute__ ((weak, alias ("_setitimer")));
|
||||
diff --git a/gprofng/libcollector/libcol_util.c b/gprofng/libcollector/libcol_util.c
|
||||
index a73488e3f60..77dc886be22 100644
|
||||
--- a/gprofng/libcollector/libcol_util.c
|
||||
+++ b/gprofng/libcollector/libcol_util.c
|
||||
@@ -1427,15 +1427,6 @@ __collector_util_init ()
|
||||
err = COL_ERROR_UTIL_INIT;
|
||||
}
|
||||
|
||||
- ptr = dlsym (libc, "sysinfo");
|
||||
- if (ptr)
|
||||
- __collector_util_funcs.sysinfo = (long (*)())ptr;
|
||||
- else
|
||||
- {
|
||||
- CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT sysinfo: %s\n", dlerror ());
|
||||
- err = COL_ERROR_UTIL_INIT;
|
||||
- }
|
||||
-
|
||||
ptr = dlsym (libc, "clearenv");
|
||||
if (ptr)
|
||||
__collector_util_funcs.clearenv = (int(*)())ptr;
|
||||
diff --git a/gprofng/libcollector/linetrace.c b/gprofng/libcollector/linetrace.c
|
||||
index 66844bc1337..c81ae1a2272 100644
|
||||
--- a/gprofng/libcollector/linetrace.c
|
||||
+++ b/gprofng/libcollector/linetrace.c
|
||||
@@ -1527,7 +1527,7 @@ DCL_FUNC_VER (DCL_POSIX_SPAWNP, posix_spawnp_2_2, posix_spawnp@GLIBC_2.2)
|
||||
DCL_POSIX_SPAWNP (posix_spawnp)
|
||||
|
||||
/*------------------------------------------------------------- system */
|
||||
-int system () __attribute__ ((weak, alias ("__collector_system")));
|
||||
+int system (const char *cmd) __attribute__ ((weak, alias ("__collector_system")));
|
||||
|
||||
int
|
||||
__collector_system (const char *cmd)
|
||||
@@ -1582,10 +1582,10 @@ DCL_FUNC_VER (DCL_POPEN, popen_2_0, popen@GLIBC_2.0)
|
||||
DCL_POPEN (popen)
|
||||
|
||||
/*------------------------------------------------------------- grantpt */
|
||||
-int grantpt () __attribute__ ((weak, alias ("__collector_grantpt")));
|
||||
+int grantpt (int fildes) __attribute__ ((weak, alias ("__collector_grantpt")));
|
||||
|
||||
int
|
||||
-__collector_grantpt (const int fildes)
|
||||
+__collector_grantpt (int fildes)
|
||||
{
|
||||
if (NULL_PTR (grantpt))
|
||||
init_lineage_intf ();
|
||||
@@ -1607,10 +1607,10 @@ __collector_grantpt (const int fildes)
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------- ptsname */
|
||||
-char *ptsname () __attribute__ ((weak, alias ("__collector_ptsname")));
|
||||
+char *ptsname (int fildes) __attribute__ ((weak, alias ("__collector_ptsname")));
|
||||
|
||||
char *
|
||||
-__collector_ptsname (const int fildes)
|
||||
+__collector_ptsname (int fildes)
|
||||
{
|
||||
if (NULL_PTR (ptsname))
|
||||
init_lineage_intf ();
|
||||
diff --git a/gprofng/src/collector_module.h b/gprofng/src/collector_module.h
|
||||
index fd888cd58dd..6640f12fa3c 100644
|
||||
--- a/gprofng/src/collector_module.h
|
||||
+++ b/gprofng/src/collector_module.h
|
||||
@@ -107,7 +107,6 @@ typedef struct CollectorUtilFuncs
|
||||
int (*symlink)(const char *s1, const char *s2);
|
||||
int (*syscall)(int number, ...);
|
||||
long (*sysconf)(int name);
|
||||
- long (*sysinfo)(int command, char *buf, long count);
|
||||
time_t (*time)(time_t *tloc);
|
||||
int (*unsetenv)(const char *name);
|
||||
int (*vsnprintf)(char *str, size_t size, const char *format, ...);
|
||||
diff --git a/gprofng/testsuite/gprofng.display/mttest/mttest.c b/gprofng/testsuite/gprofng.display/mttest/mttest.c
|
||||
index e0835c833e5..3db5b8d8e86 100644
|
||||
--- a/gprofng/testsuite/gprofng.display/mttest/mttest.c
|
||||
+++ b/gprofng/testsuite/gprofng.display/mttest/mttest.c
|
||||
@@ -171,7 +171,7 @@ void computeJ (workStruct_t *x);
|
||||
void computeK (workStruct_t *x);
|
||||
void addone (workCtr_t *x);
|
||||
void init_arrays (int strat);
|
||||
-void dump_arrays ();
|
||||
+void dump_arrays (hrtime_t real, hrtime_t cpu, int case_index);
|
||||
void *do_work (void *v);
|
||||
void thread_work ();
|
||||
void nothreads (Workblk *array, struct scripttab *k);
|
||||
diff --git a/gprofng/testsuite/gprofng.display/synprog/endcases.c b/gprofng/testsuite/gprofng.display/synprog/endcases.c
|
||||
index a6a1389658a..6f1c83b6859 100644
|
||||
--- a/gprofng/testsuite/gprofng.display/synprog/endcases.c
|
||||
+++ b/gprofng/testsuite/gprofng.display/synprog/endcases.c
|
||||
@@ -40,8 +40,8 @@ static void s_inline_code (int);
|
||||
void ext_inline_code (int);
|
||||
|
||||
#ifndef NO_INLINE
|
||||
-void xinline_code () __attribute__ ((always_inline));
|
||||
-void s_inline_code () __attribute__ ((always_inline));
|
||||
+void xinline_code (int) __attribute__ ((always_inline));
|
||||
+void s_inline_code (int) __attribute__ ((always_inline));
|
||||
#endif
|
||||
|
||||
#include "inc_inline.h"
|
||||
diff --git a/gprofng/testsuite/gprofng.display/synprog/inc_inline.h b/gprofng/testsuite/gprofng.display/synprog/inc_inline.h
|
||||
index da42563c828..6600eacb66d 100644
|
||||
--- a/gprofng/testsuite/gprofng.display/synprog/inc_inline.h
|
||||
+++ b/gprofng/testsuite/gprofng.display/synprog/inc_inline.h
|
||||
@@ -19,7 +19,7 @@
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#ifndef NO_INLINE
|
||||
-void ext_inline_code() __attribute__ ((always_inline));
|
||||
+void ext_inline_code(int) __attribute__ ((always_inline));
|
||||
#endif
|
||||
|
||||
void
|
||||
diff --git a/gprofng/testsuite/gprofng.display/synprog/synprog.c b/gprofng/testsuite/gprofng.display/synprog/synprog.c
|
||||
index cf1bc5b0909..05920dc7419 100644
|
||||
--- a/gprofng/testsuite/gprofng.display/synprog/synprog.c
|
||||
+++ b/gprofng/testsuite/gprofng.display/synprog/synprog.c
|
||||
@@ -528,14 +528,14 @@ reapchildren ()
|
||||
int
|
||||
doabort (int k)
|
||||
{
|
||||
- char *nullptr = NULL;
|
||||
+ char *p = NULL;
|
||||
char c;
|
||||
|
||||
/* Log the event */
|
||||
wlog ("start of doabort", NULL);
|
||||
|
||||
/* and dereference a NULL */
|
||||
- c = *nullptr;
|
||||
+ c = *p;
|
||||
|
||||
/* this should never be reached */
|
||||
return (int) c;
|
||||
--
|
||||
2.50.1
|
||||
|
||||
49
package/binutils/make-host.sh
Executable file
49
package/binutils/make-host.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=binutils
|
||||
PKGVERSION=2.43.1
|
||||
PKGSOURCE_DIR=binutils
|
||||
PKGSOURCE=binutils-2.43.1.tar.xz
|
||||
PKGURL=http://mirrors.ustc.edu.cn/gnu/binutils/binutils-2.43.1.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME}/${PKGVERSION} \*.patch
|
||||
step_end patch autotools
|
||||
|
||||
step_start configure
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} MAKEINFO=true CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking --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 --disable-sim --disable-gdb --without-zstd --with-system-readline --disable-gprofng")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} MAKEINFO=true -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} MAKEINFO=true install -C ${PKGBUILD_DIR}"
|
||||
# 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"
|
||||
for tool in ${BINUTILS_TOOLS}; do
|
||||
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}
|
||||
done
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
40
package/bison/make-host.sh
Executable file
40
package/bison/make-host.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=bison
|
||||
PKGVERSION=3.8.2
|
||||
PKGSOURCE_DIR=bison
|
||||
PKGSOURCE=bison-3.8.2.tar.xz
|
||||
PKGURL=http://mirrors.ustc.edu.cn/gnu/bison/bison-3.8.2.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
stamp_patched autotools
|
||||
|
||||
step_start configure
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} ac_cv_libtextstyle=no CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking --enable-relocatable")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
# parallel build issue in examples/c/reccalc/, so use -j1
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j1 -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j1 install -C ${PKGBUILD_DIR}"
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
@@ -0,0 +1,37 @@
|
||||
From e1690453cd84c798ca88cc4370710f65da86d986 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
Date: Sat, 5 Oct 2013 15:55:06 +0200
|
||||
Subject: [PATCH] networking/libiproute: use <linux/if_packet.h> instead of
|
||||
<net/if_packet.h>
|
||||
|
||||
The musl C library doesn't provide the <net/if_packet.h> since the
|
||||
corresponding kernel headers <linux/if_packet.h> already provides the
|
||||
necessary definitions. Replacing <net/if_packet.h> by
|
||||
<linux/if_packet.h> also removes the need to include
|
||||
<netpacket/packet.h>
|
||||
|
||||
This commit fixes the build of iplink with the musl C library.
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
[Gustavo: update for busybox 1.22.0]
|
||||
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
|
||||
---
|
||||
networking/libiproute/iplink.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
|
||||
index 37ed114bc..bc526d89c 100644
|
||||
--- a/networking/libiproute/iplink.c
|
||||
+++ b/networking/libiproute/iplink.c
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
#include <net/if.h>
|
||||
/*#include <net/if_packet.h> - not needed? */
|
||||
-#include <netpacket/packet.h>
|
||||
+#include <linux/if_packet.h>
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
#include <linux/if_vlan.h>
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From df20ae1280a2601a4c233ec12372d1e17db21e96 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
Date: Mon, 25 Nov 2013 22:51:53 +0100
|
||||
Subject: [PATCH] Makefile.flags: strip non -l arguments returned by pkg-config
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
[yann.morin.1998@free.fr: refresh for 1.29.0]
|
||||
[petr.vorel@gmail.com: refresh for 1.32.0]
|
||||
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
|
||||
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
|
||||
---
|
||||
Makefile.flags | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile.flags b/Makefile.flags
|
||||
index 97cb4dca2..92a9063d9 100644
|
||||
--- a/Makefile.flags
|
||||
+++ b/Makefile.flags
|
||||
@@ -181,7 +181,9 @@ ifeq ($(CONFIG_SELINUX),y)
|
||||
SELINUX_PC_MODULES = libselinux libsepol
|
||||
$(eval $(call pkg_check_modules,SELINUX,$(SELINUX_PC_MODULES)))
|
||||
CPPFLAGS += $(SELINUX_CFLAGS)
|
||||
-LDLIBS += $(if $(SELINUX_LIBS),$(SELINUX_LIBS:-l%=%),$(SELINUX_PC_MODULES:lib%=%))
|
||||
+LDLIBS += $(if $(SELINUX_LIBS),\
|
||||
+ $(patsubst -l%,%,$(filter -l%,$(SELINUX_LIBS))),\
|
||||
+ $(SELINUX_PC_MODULES:lib%=%))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FEATURE_NSLOOKUP_BIG),y)
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
From 68eaf20d86d4fe0f16a914817217f386155157cc Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Mon, 19 Sep 2022 14:15:12 +0200
|
||||
Subject: [PATCH] libbb: sockaddr2str: ensure only printable characters are
|
||||
returned for the hostname part
|
||||
|
||||
CVE: CVE-2022-28391
|
||||
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Tested-by: Radoslav Kolev <radoslav.kolev@suse.com>
|
||||
Backport from ML: http://lists.busybox.net/pipermail/busybox/2022-July/089796.html
|
||||
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
|
||||
---
|
||||
libbb/xconnect.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libbb/xconnect.c b/libbb/xconnect.c
|
||||
index 0e0b247b8..02c061e67 100644
|
||||
--- a/libbb/xconnect.c
|
||||
+++ b/libbb/xconnect.c
|
||||
@@ -497,8 +497,9 @@ static char* FAST_FUNC sockaddr2str(const struct sockaddr *sa, int flags)
|
||||
);
|
||||
if (rc)
|
||||
return NULL;
|
||||
+ /* ensure host contains only printable characters */
|
||||
if (flags & IGNORE_PORT)
|
||||
- return xstrdup(host);
|
||||
+ return xstrdup(printable_string(host));
|
||||
#if ENABLE_FEATURE_IPV6
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
if (strchr(host, ':')) /* heh, it's not a resolved hostname */
|
||||
@@ -509,7 +510,7 @@ static char* FAST_FUNC sockaddr2str(const struct sockaddr *sa, int flags)
|
||||
#endif
|
||||
/* For now we don't support anything else, so it has to be INET */
|
||||
/*if (sa->sa_family == AF_INET)*/
|
||||
- return xasprintf("%s:%s", host, serv);
|
||||
+ return xasprintf("%s:%s", printable_string(host), serv);
|
||||
/*return xstrdup(host);*/
|
||||
}
|
||||
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
From 56b84c6efb9a06ae294eb92cf9634f70af443b0a Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Mon, 19 Sep 2022 14:15:12 +0200
|
||||
Subject: [PATCH] nslookup: sanitize all printed strings with printable_string
|
||||
|
||||
Otherwise, terminal sequences can be injected, which enables various terminal injection
|
||||
attacks from DNS results.
|
||||
|
||||
CVE: CVE-2022-28391
|
||||
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Tested-by: Radoslav Kolev <radoslav.kolev@suse.com>
|
||||
Backport from ML: http://lists.busybox.net/pipermail/busybox/2022-July/089795.html
|
||||
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
|
||||
---
|
||||
networking/nslookup.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/networking/nslookup.c b/networking/nslookup.c
|
||||
index b67d354f7..79412477c 100644
|
||||
--- a/networking/nslookup.c
|
||||
+++ b/networking/nslookup.c
|
||||
@@ -784,7 +784,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
//printf("Unable to uncompress domain: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
- printf(format, ns_rr_name(rr), dname);
|
||||
+ printf(format, ns_rr_name(rr), printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_mx:
|
||||
@@ -799,7 +799,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
//printf("Cannot uncompress MX domain: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
- printf("%s\tmail exchanger = %d %s\n", ns_rr_name(rr), n, dname);
|
||||
+ printf("%s\tmail exchanger = %d %s\n", ns_rr_name(rr), n, printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_txt:
|
||||
@@ -811,7 +811,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
if (n > 0) {
|
||||
memset(dname, 0, sizeof(dname));
|
||||
memcpy(dname, ns_rr_rdata(rr) + 1, n);
|
||||
- printf("%s\ttext = \"%s\"\n", ns_rr_name(rr), dname);
|
||||
+ printf("%s\ttext = \"%s\"\n", ns_rr_name(rr), printable_string(dname));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -831,7 +831,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
}
|
||||
|
||||
printf("%s\tservice = %u %u %u %s\n", ns_rr_name(rr),
|
||||
- ns_get16(cp), ns_get16(cp + 2), ns_get16(cp + 4), dname);
|
||||
+ ns_get16(cp), ns_get16(cp + 2), ns_get16(cp + 4), printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_soa:
|
||||
@@ -860,7 +860,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- printf("\tmail addr = %s\n", dname);
|
||||
+ printf("\tmail addr = %s\n", printable_string(dname));
|
||||
cp += n;
|
||||
|
||||
printf("\tserial = %lu\n", ns_get32(cp));
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
From 9fed109be1f811069cb2f727e04c6996cd44b017 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@mind.be>
|
||||
Date: Tue, 18 Apr 2023 15:54:43 +0200
|
||||
Subject: [PATCH] seedrng: fix getrandom() detection for non-glibc libc
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
glibc <= 2.24 does not provide getrandom(). A check for it has been
|
||||
added in 200a9669fbf6f06894e4243cccc9fc11a1a6073a and fixed in
|
||||
cb57abb46f06f4ede8d9ccbdaac67377fdf416cf.
|
||||
|
||||
However, building with a libc other than glibc can lead to the same
|
||||
problem as not every other libc has getrandom() either:
|
||||
|
||||
- uClibc provides it from v1.0.2 onwards, but requires to define
|
||||
_GNU_SOURCE (all versions - we already define it by default), and
|
||||
stddef to be included first (when using uClibc < 1.0.35 - we already
|
||||
include it through libbb.h).
|
||||
|
||||
- musl libc has getrandom(), but only from version 1.1.20 onwards. As
|
||||
musl does not provide __MUSL__ or version information, it's not
|
||||
possible to check for it like we did for glibc.
|
||||
|
||||
All of this makes it difficult (or impossible in case of musl) to
|
||||
check what we need to do to have getrandom() based on each libc
|
||||
versions.
|
||||
|
||||
On top of that, getrandom() is also not available on older kernels. As
|
||||
an example, when using a 3.10 kernel with uClibc 1.0.26, getrandom()
|
||||
is declared so compiling works, but it fails at link time because
|
||||
getrandom() is not defined.
|
||||
|
||||
To make it easier, take a similar approach to what was done for the
|
||||
crypt library: try to build a sample program to see if we have
|
||||
getrandom(). To keep it compatible with different versions of
|
||||
make (for reference see [1]), a variable for '#' is also introduced.
|
||||
|
||||
Based on the new Makefile variable, we now either use the
|
||||
libc-provided getrandom() when it's available, or use our own
|
||||
implementation when it's not (like it was the case already for glibc <
|
||||
2.25).
|
||||
|
||||
This should fix compiling with many libc/kernel combinations.
|
||||
|
||||
[1]: https://git.savannah.gnu.org/cgit/make.git/commit/?id=c6966b323811c37acedff05b576b907b06aea5f4
|
||||
|
||||
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2023-May/090317.html
|
||||
---
|
||||
Makefile.flags | 12 ++++++++++++
|
||||
miscutils/seedrng.c | 8 ++++----
|
||||
2 files changed, 16 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Makefile.flags b/Makefile.flags
|
||||
index 92a9063d9..c8f601308 100644
|
||||
--- a/Makefile.flags
|
||||
+++ b/Makefile.flags
|
||||
@@ -162,6 +162,18 @@ ifeq ($(RT_AVAILABLE),y)
|
||||
LDLIBS += rt
|
||||
endif
|
||||
|
||||
+# GNU Make version 4.2.1 and earlier require number signs ('#')
|
||||
+# inside function invocations to be escaped, while versions 4.3+
|
||||
+# require them to be unescaped. Use a variable for it so that it works
|
||||
+# for both versions:
|
||||
+C := \#
|
||||
+# Not all libc versions have getrandom, so check for it:
|
||||
+HAVE_GETRANDOM := $(shell printf '$Cdefine _GNU_SOURCE\n$Cinclude <stddef.h>\n$Cinclude <sys/random.h>\nint main(void){char buf[256];\ngetrandom(buf,sizeof(buf),0);}' >bb_libtest.c; $(CC) $(CFLAGS) $(CFLAGS_busybox) -o /dev/null bb_libtest.c >/dev/null 2>&1 && echo "y"; rm bb_libtest.c)
|
||||
+
|
||||
+ifeq ($(HAVE_GETRANDOM),y)
|
||||
+CFLAGS += -DHAVE_GETRANDOM
|
||||
+endif
|
||||
+
|
||||
# libpam may use libpthread, libdl and/or libaudit.
|
||||
# On some platforms that requires an explicit -lpthread, -ldl, -laudit.
|
||||
# However, on *other platforms* it fails when some of those flags
|
||||
diff --git a/miscutils/seedrng.c b/miscutils/seedrng.c
|
||||
index 7a2331cb1..ba98f4d19 100644
|
||||
--- a/miscutils/seedrng.c
|
||||
+++ b/miscutils/seedrng.c
|
||||
@@ -44,8 +44,10 @@
|
||||
#include <linux/random.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
-/* Fix up glibc <= 2.24 not having getrandom() */
|
||||
-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ <= 24
|
||||
+/* Fix up some libc (e.g. glibc <= 2.24) not having getrandom() */
|
||||
+#if defined HAVE_GETRANDOM
|
||||
+#include <sys/random.h>
|
||||
+#else /* No getrandom */
|
||||
#include <sys/syscall.h>
|
||||
static ssize_t getrandom(void *buffer, size_t length, unsigned flags)
|
||||
{
|
||||
@@ -56,8 +58,6 @@ static ssize_t getrandom(void *buffer, size_t length, unsigned flags)
|
||||
return -1;
|
||||
# endif
|
||||
}
|
||||
-#else
|
||||
-#include <sys/random.h>
|
||||
#endif
|
||||
|
||||
/* Apparently some headers don't ship with this yet. */
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From 7f0bb7f69f38298971aa8153d3fbe9b1fdda8ae7 Mon Sep 17 00:00:00 2001
|
||||
From: ctxnop <ctxnop@gmail.com>
|
||||
Date: Sun, 26 Jan 2025 20:59:20 +0100
|
||||
Subject: [PATCH] menuconfig: GCC failing saying ncurses is not found
|
||||
|
||||
Newer GCC increased diagnostics levels resulting in considering the
|
||||
test code to be invalid. The resulting message was misleading, saying
|
||||
that ncurses was not found, while the check failed for an unrelated
|
||||
reason which was hidden because GCC stderr was redirected to
|
||||
/dev/null.
|
||||
|
||||
Signed-off-by: ctxnop <ctxnop@gmail.com>
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2024-July/090840.html
|
||||
[Fiona: rephrased commit message for clarity]
|
||||
Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
|
||||
---
|
||||
scripts/kconfig/lxdialog/check-lxdialog.sh | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
|
||||
index 5075ebf2d..08e4da3de 100755
|
||||
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
|
||||
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
|
||||
@@ -45,9 +45,9 @@ trap "rm -f $tmp" 0 1 2 3 15
|
||||
|
||||
# Check if we can link to ncurses
|
||||
check() {
|
||||
- $cc -x c - -o $tmp 2>/dev/null <<'EOF'
|
||||
+ $cc -x c - -o $tmp <<'EOF'
|
||||
#include CURSES_LOC
|
||||
-main() {}
|
||||
+int main() { return 0; }
|
||||
EOF
|
||||
if [ $? != 0 ]; then
|
||||
echo " *** Unable to find the ncurses libraries or the" 1>&2
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
From 1dbb3073a3a8856b9446b882f797be1bb2e21a26 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
|
||||
Date: Mon, 23 Sep 2024 18:56:00 +0200
|
||||
Subject: [PATCH] tc: Fix compilation with Linux v6.8-rc1
|
||||
|
||||
Linux v6.8-rc1 removed the definitions related to CBQ:
|
||||
https://github.com/torvalds/linux/commit/33241dca486264193ed68167c8eeae1fb197f3df
|
||||
making tc fail to build.
|
||||
Add some #ifdefs to handle this missing support.
|
||||
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2024-March/090678.html
|
||||
Bug report: https://bugs.busybox.net/show_bug.cgi?id=15931
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
||||
---
|
||||
networking/tc.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/networking/tc.c b/networking/tc.c
|
||||
index 3a79fd2d9..d08fd1359 100644
|
||||
--- a/networking/tc.c
|
||||
+++ b/networking/tc.c
|
||||
@@ -231,6 +231,13 @@ static int cbq_parse_opt(int argc, char **argv, struct nlmsghdr *n)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
+
|
||||
+#ifndef TCA_CBQ_MAX
|
||||
+/*
|
||||
+ * Linux v6.8-rc1~131^2~60^2^2 removed the uapi definitions for CBQ.
|
||||
+ * See https://git.kernel.org/linus/33241dca48626
|
||||
+ */
|
||||
+#else
|
||||
static int cbq_print_opt(struct rtattr *opt)
|
||||
{
|
||||
struct rtattr *tb[TCA_CBQ_MAX+1];
|
||||
@@ -322,6 +329,7 @@ static int cbq_print_opt(struct rtattr *opt)
|
||||
done:
|
||||
return 0;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static FAST_FUNC int print_qdisc(
|
||||
const struct sockaddr_nl *who UNUSED_PARAM,
|
||||
@@ -372,8 +380,10 @@ static FAST_FUNC int print_qdisc(
|
||||
int qqq = index_in_strings(_q_, name);
|
||||
if (qqq == 0) { /* pfifo_fast aka prio */
|
||||
prio_print_opt(tb[TCA_OPTIONS]);
|
||||
+#ifdef TCA_CBQ_MAX
|
||||
} else if (qqq == 1) { /* class based queuing */
|
||||
cbq_print_opt(tb[TCA_OPTIONS]);
|
||||
+#endif
|
||||
} else {
|
||||
/* don't know how to print options for this qdisc */
|
||||
printf("(options for %s)", name);
|
||||
@@ -442,9 +452,11 @@ static FAST_FUNC int print_class(
|
||||
int qqq = index_in_strings(_q_, name);
|
||||
if (qqq == 0) { /* pfifo_fast aka prio */
|
||||
/* nothing. */ /*prio_print_opt(tb[TCA_OPTIONS]);*/
|
||||
+#ifdef TCA_CBQ_MAX
|
||||
} else if (qqq == 1) { /* class based queuing */
|
||||
/* cbq_print_copt() is identical to cbq_print_opt(). */
|
||||
cbq_print_opt(tb[TCA_OPTIONS]);
|
||||
+#endif
|
||||
} else {
|
||||
/* don't know how to print options for this class */
|
||||
printf("(options for %s)", name);
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From 88f8a046f27cb81ccc30d038465e963b8300cf1b Mon Sep 17 00:00:00 2001
|
||||
From: Valery Ushakov <uwe@stderr.spb.ru>
|
||||
Date: Wed, 24 Jan 2024 22:24:41 +0300
|
||||
Subject: [PATCH] awk.c: fix CVE-2023-42366 (bug #15874)
|
||||
|
||||
Make sure we don't read past the end of the string in next_token()
|
||||
when backslash is the last character in an (invalid) regexp.
|
||||
a fix and issue reported in bugzilla
|
||||
|
||||
https://bugs.busybox.net/show_bug.cgi?id=15874
|
||||
|
||||
Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2024-May/090766.html]
|
||||
|
||||
CVE: CVE-2023-42366
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
[Thomas: https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/busybox/busybox/0001-awk.c-fix-CVE-2023-42366-bug-15874.patch?id=e0ff4813b1cf4df0d851c857d57fb88d7db51bdd]
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2024-May/090766.html
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
editors/awk.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/editors/awk.c b/editors/awk.c
|
||||
index 64e752f4b..222e6298d 100644
|
||||
--- a/editors/awk.c
|
||||
+++ b/editors/awk.c
|
||||
@@ -1234,9 +1234,11 @@ static uint32_t next_token(uint32_t expected)
|
||||
s[-1] = bb_process_escape_sequence((const char **)&pp);
|
||||
if (*p == '\\')
|
||||
*s++ = '\\';
|
||||
- if (pp == p)
|
||||
+ if (pp == p) {
|
||||
+ if (*p == '\0')
|
||||
+ syntax_error(EMSG_UNEXP_EOS);
|
||||
*s++ = *p++;
|
||||
- else
|
||||
+ } else
|
||||
p = pp;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
From 0583f8eda94f97e15e371e12458877b738439e8c Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sun, 7 Mar 2021 17:30:24 -0800
|
||||
Subject: [PATCH] hwclock: Check for SYS_settimeofday before calling syscall
|
||||
|
||||
Some newer architectures e.g. RISCV32 have 64bit time_t from get go and
|
||||
thusly do not have gettimeofday_time64/settimeofday_time64 implemented
|
||||
therefore check for SYS_settimeofday definition before making the
|
||||
syscall. Fixes build for riscv32 and it will bail out at runtime.
|
||||
|
||||
Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2021-March/088583.html]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2021-March/088583.html
|
||||
[Thomas: this issue has been discussed on the musl mailing list, and
|
||||
the musl developers' opinion is that Busybox is wrong:
|
||||
https://www.openwall.com/lists/musl/2024/03/03/2
|
||||
https://www.openwall.com/lists/musl/2024/04/07/2. The correct fix
|
||||
isn't clear, and in the mean time, the patch from Khem turns the build
|
||||
issue into a runtime error only on the problematic architecture, which
|
||||
seems like a reasonable trade-off]
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
util-linux/hwclock.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
|
||||
index c3fd0eb57..dea9c9a55 100644
|
||||
--- a/util-linux/hwclock.c
|
||||
+++ b/util-linux/hwclock.c
|
||||
@@ -132,6 +132,7 @@ static void show_clock(const char **pp_rtcname, int utc)
|
||||
|
||||
static void set_kernel_tz(const struct timezone *tz)
|
||||
{
|
||||
+ int ret = 1;
|
||||
#if LIBC_IS_MUSL
|
||||
/* musl libc does not pass tz argument to syscall
|
||||
* because "it's deprecated by POSIX, therefore it's fine
|
||||
@@ -140,9 +141,11 @@ static void set_kernel_tz(const struct timezone *tz)
|
||||
#if !defined(SYS_settimeofday) && defined(SYS_settimeofday_time32)
|
||||
# define SYS_settimeofday SYS_settimeofday_time32
|
||||
#endif
|
||||
- int ret = syscall(SYS_settimeofday, NULL, tz);
|
||||
+#if defined(SYS_settimeofday)
|
||||
+ ret = syscall(SYS_settimeofday, NULL, tz);
|
||||
+#endif
|
||||
#else
|
||||
- int ret = settimeofday(NULL, tz);
|
||||
+ ret = settimeofday(NULL, tz);
|
||||
#endif
|
||||
if (ret)
|
||||
bb_simple_perror_msg_and_die("settimeofday");
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
From bba9e99026a3dafe75f608459533e0b6d8cf3874 Mon Sep 17 00:00:00 2001
|
||||
From: Andre Przywara <andre.przywara@arm.com>
|
||||
Date: Tue, 10 Sep 2024 14:32:46 +0100
|
||||
Subject: [PATCH] libbb/sha: add missing sha-NI guard
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The ENABLE_SHA1_HWACCEL Kconfig symbol is meant to be archicture
|
||||
agnostic, so can be enabled regardless of whether your build
|
||||
architecture provides hardware acceleration or not. At the moment only
|
||||
x86 implements this, so every piece of optimised code should be guarded
|
||||
by both ENABLE_SHA1_HWACCEL and (__x86_64__ || __i386__). This is missing
|
||||
at one place, so compiling for arm64 breaks when ENABLE_SHA1_HWACCEL is
|
||||
enabled:
|
||||
================================
|
||||
libbb/hash_md5_sha.c: In function ‘sha1_end’:
|
||||
libbb/hash_md5_sha.c:1316:28: error: ‘sha1_process_block64_shaNI’ undeclared (first use in this function); did you mean ‘sha1_process_block64’?
|
||||
1316 | || ctx->process_block == sha1_process_block64_shaNI
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| sha1_process_block64
|
||||
libbb/hash_md5_sha.c:1316:28: note: each undeclared identifier is reported only once for each function it appears in
|
||||
make[1]: *** [scripts/Makefile.build:197: libbb/hash_md5_sha.o] Error 1
|
||||
make: *** [Makefile:744: libbb] Error 2
|
||||
================================
|
||||
|
||||
Add the missing guards around the call to sha1_process_block64_shaNI to
|
||||
fix the build on other architectures with ENABLE_SHA1_HWACCEL enabled.
|
||||
|
||||
Change-Id: I40bba388422625f4230abf15a5de23e1fdc654fc
|
||||
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
|
||||
Upstream: https://lists.busybox.net/pipermail/busybox/2024-September/090899.html
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
libbb/hash_md5_sha.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/libbb/hash_md5_sha.c b/libbb/hash_md5_sha.c
|
||||
index 57a801459..75a61c32c 100644
|
||||
--- a/libbb/hash_md5_sha.c
|
||||
+++ b/libbb/hash_md5_sha.c
|
||||
@@ -1313,7 +1313,9 @@ unsigned FAST_FUNC sha1_end(sha1_ctx_t *ctx, void *resbuf)
|
||||
hash_size = 8;
|
||||
if (ctx->process_block == sha1_process_block64
|
||||
#if ENABLE_SHA1_HWACCEL
|
||||
+# if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
|| ctx->process_block == sha1_process_block64_shaNI
|
||||
+# endif
|
||||
#endif
|
||||
) {
|
||||
hash_size = 5;
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From 34d331d642c3312e1c04e4650f547f1a67abee24 Mon Sep 17 00:00:00 2001
|
||||
From: Andrej Valek <andrej.v@skyrain.eu>
|
||||
Date: Wed, 16 Oct 2024 10:15:08 +0200
|
||||
Subject: [PATCH] syslogd: fix wrong OPT_locallog flag detection
|
||||
|
||||
The OPT_locallog was set on "option_mask32" but checked on local
|
||||
"opts" variable. While this flag it's used on multiple places can't be
|
||||
has to be used with "option_mask32". Without this change syslogd
|
||||
is more-less unusable while no messages are logged locally.
|
||||
|
||||
Signed-off-by: Andrej Valek <andrej.v@skyrain.eu>
|
||||
Upstream: https://lists.busybox.net/pipermail/busybox/2024-October/090969.html
|
||||
[Thomas: this was reported as beeing needed by Bernd Kuhls at
|
||||
https://lore.kernel.org/buildroot/pan$de0bb$35c5a64$ca9b6f21$2408ff40@ID-313208.user.individual.net/,
|
||||
but also on the Busybox mailing list at
|
||||
https://lists.busybox.net/pipermail/busybox/2023-September/090499.html]
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
sysklogd/syslogd.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
|
||||
index 7558051f0..fa03aa280 100644
|
||||
--- a/sysklogd/syslogd.c
|
||||
+++ b/sysklogd/syslogd.c
|
||||
@@ -1179,7 +1179,7 @@ int syslogd_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
- if (!ENABLE_FEATURE_REMOTE_LOG || (opts & OPT_locallog)) {
|
||||
+ if (!ENABLE_FEATURE_REMOTE_LOG || (option_mask32 & OPT_locallog)) {
|
||||
recvbuf[sz] = '\0'; /* ensure it *is* NUL terminated */
|
||||
split_escape_and_log(recvbuf, sz);
|
||||
}
|
||||
--
|
||||
2.48.1
|
||||
|
||||
60
package/busybox/S01syslogd
Normal file
60
package/busybox/S01syslogd
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="syslogd"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
SYSLOGD_ARGS=""
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
# BusyBox' syslogd does not create a pidfile, so pass "-n" in the command line
|
||||
# and use "--make-pidfile" to instruct start-stop-daemon to create one.
|
||||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon --start --background --make-pidfile \
|
||||
--pidfile "$PIDFILE" --exec "/sbin/$DAEMON" \
|
||||
-- -n $SYSLOGD_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s: ' "$DAEMON"
|
||||
start-stop-daemon --stop --pidfile "$PIDFILE" --exec "/sbin/$DAEMON"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
return "$status"
|
||||
fi
|
||||
while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
|
||||
--exec "/sbin/$DAEMON"; do
|
||||
sleep 0.1
|
||||
done
|
||||
rm -f "$PIDFILE"
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
55
package/busybox/S02klogd
Normal file
55
package/busybox/S02klogd
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="klogd"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
KLOGD_ARGS=""
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
# BusyBox' klogd does not create a pidfile, so pass "-n" in the command line
|
||||
# and use "-m" to instruct start-stop-daemon to create one.
|
||||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/sbin/$DAEMON" \
|
||||
-- -n $KLOGD_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s: ' "$DAEMON"
|
||||
start-stop-daemon -K -q -p "$PIDFILE"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
rm -f "$PIDFILE"
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
94
package/busybox/S02sysctl
Normal file
94
package/busybox/S02sysctl
Normal file
@@ -0,0 +1,94 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This script is used by busybox and procps-ng.
|
||||
#
|
||||
# With procps-ng, the "--system" option of sysctl also enables "--ignore", so
|
||||
# errors are not reported via syslog. Use the run_logger function to mimic the
|
||||
# --system behavior, still reporting errors via syslog. Users not interested
|
||||
# on error reports can add "-e" to SYSCTL_ARGS.
|
||||
#
|
||||
# busybox does not have a "--system" option neither reports errors via syslog,
|
||||
# so the scripting provides a consistent behavior between the implementations.
|
||||
# Testing the busybox sysctl exit code is fruitless, as at the moment, since
|
||||
# its exit status is zero even if errors happen. Hopefully this will be fixed
|
||||
# in a future busybox version.
|
||||
|
||||
PROGRAM="sysctl"
|
||||
|
||||
SYSCTL_ARGS=""
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$PROGRAM" ] && . "/etc/default/$PROGRAM"
|
||||
|
||||
# Files are read from directories in the SYSCTL_SOURCES list, in the given
|
||||
# order. A file may be used more than once, since there can be multiple
|
||||
# symlinks to it. No attempt is made to prevent this.
|
||||
SYSCTL_SOURCES="/etc/sysctl.d/ /usr/local/lib/sysctl.d/ /usr/lib/sysctl.d/ /lib/sysctl.d/ /etc/sysctl.conf"
|
||||
|
||||
# If the logger utility is available all messages are sent to syslog, except
|
||||
# for the final status. The file redirections do the following:
|
||||
#
|
||||
# - stdout is redirected to syslog with facility.level "kern.info"
|
||||
# - stderr is redirected to syslog with facility.level "kern.err"
|
||||
# - file dscriptor 4 is used to pass the result to the "start" function.
|
||||
#
|
||||
run_logger() {
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
find $SYSCTL_SOURCES -maxdepth 1 -name '*.conf' -print0 2> /dev/null | \
|
||||
xargs -0 -r -n 1 readlink -f | {
|
||||
prog_status="OK"
|
||||
while :; do
|
||||
read -r file || {
|
||||
echo "$prog_status" >&4
|
||||
break
|
||||
}
|
||||
echo "* Applying $file ..."
|
||||
/sbin/sysctl $SYSCTL_ARGS -p "$file" || prog_status="FAIL"
|
||||
done 2>&1 >&3 | /usr/bin/logger -t sysctl -p kern.err
|
||||
} 3>&1 | /usr/bin/logger -t sysctl -p kern.info
|
||||
}
|
||||
|
||||
# If logger is not available all messages are sent to stdout/stderr.
|
||||
run_std() {
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
find $SYSCTL_SOURCES -maxdepth 1 -name '*.conf' -print0 2> /dev/null | \
|
||||
xargs -0 -r -n 1 readlink -f | {
|
||||
prog_status="OK"
|
||||
while :; do
|
||||
read -r file || {
|
||||
echo "$prog_status" >&4
|
||||
break
|
||||
}
|
||||
echo "* Applying $file ..."
|
||||
/sbin/sysctl $SYSCTL_ARGS -p "$file" || prog_status="FAIL"
|
||||
done
|
||||
}
|
||||
}
|
||||
|
||||
if [ -x /usr/bin/logger ]; then
|
||||
run_program="run_logger"
|
||||
else
|
||||
run_program="run_std"
|
||||
fi
|
||||
|
||||
start() {
|
||||
printf '%s %s: ' "$1" "$PROGRAM"
|
||||
status=$("$run_program" 4>&1)
|
||||
echo "$status"
|
||||
if [ "$status" = "OK" ]; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start "Running";;
|
||||
restart|reload)
|
||||
start "Rerunning";;
|
||||
stop)
|
||||
:;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
85
package/busybox/S41ifplugd
Normal file
85
package/busybox/S41ifplugd
Normal file
@@ -0,0 +1,85 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="ifplugd"
|
||||
|
||||
# Each ifplugd instance handles only one interface, so this script is
|
||||
# designed to be symlinked per interface. For each interface create a
|
||||
# symlink with .IFACE appended to the name. E.g. to launch ifplugd for
|
||||
# eth1 create a symlink from /etc/init.d/S41ifplugd.eth1 to this
|
||||
# script. DEFAULT_IFACE sets the interface the non-symlink script will
|
||||
# use, set it to empty in /etc/default/ifplugd to disable the default
|
||||
# instance and use symlinked instances only.
|
||||
DEFAULT_IFACE="eth0"
|
||||
# If your action script is not in the default location
|
||||
# /etc/ifplugd/ifplugd.action, use the "-r" option to set the
|
||||
# location.
|
||||
IFPLUGD_ARGS="-M"
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
NAME_IFACE="$(basename "$0" | cut -s -d. -f2)"
|
||||
if [ -n "$NAME_IFACE" ]; then
|
||||
IFACE="${NAME_IFACE}"
|
||||
elif [ -n "$DEFAULT_IFACE" ]; then
|
||||
IFACE="${DEFAULT_IFACE}"
|
||||
else
|
||||
# no interface configured
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# check-package disable Variables
|
||||
PIDFILE="/var/run/${DAEMON}.${IFACE}.pid"
|
||||
IFPLUGD_ARGS="${IFPLUGD_ARGS} -i ${IFACE}"
|
||||
|
||||
# BusyBox' ifplugd does not create a pidfile, so pass "-n" in the
|
||||
# command line and use "--make-pidfile" to instruct start-stop-daemon
|
||||
# to create one.
|
||||
start() {
|
||||
printf 'Starting %s for %s: ' "$DAEMON" "$IFACE"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon --start --background --make-pidfile \
|
||||
--pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON" \
|
||||
-- -n $IFPLUGD_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s for %s: ' "$DAEMON" "$IFACE"
|
||||
start-stop-daemon --stop --pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
return "$status"
|
||||
fi
|
||||
while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
|
||||
--exec "/sbin/$DAEMON"; do
|
||||
sleep 0.1
|
||||
done
|
||||
rm -f "$PIDFILE"
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
60
package/busybox/S50crond
Normal file
60
package/busybox/S50crond
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="crond"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
CROND_ARGS=""
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
# BusyBox' crond does not create a pidfile, so pass "-f" on the crond
|
||||
# command line and use "--make-pidfile" to instruct start-stop-daemon
|
||||
# to create one.
|
||||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon --start --background --make-pidfile \
|
||||
--pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON" \
|
||||
-- -f $CROND_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s: ' "$DAEMON"
|
||||
start-stop-daemon --stop --pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
|
||||
--exec "/usr/sbin/$DAEMON"; do
|
||||
sleep 0.1
|
||||
done
|
||||
rm -f "$PIDFILE"
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
39
package/busybox/S50telnet
Normal file
39
package/busybox/S50telnet
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Start telnet....
|
||||
#
|
||||
|
||||
TELNETD_ARGS=-F
|
||||
[ -r /etc/default/telnet ] && . /etc/default/telnet
|
||||
|
||||
start() {
|
||||
printf "Starting telnetd: "
|
||||
start-stop-daemon -S -q -m -b -p /var/run/telnetd.pid \
|
||||
-x /usr/sbin/telnetd -- $TELNETD_ARGS
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping telnetd: "
|
||||
start-stop-daemon -K -q -p /var/run/telnetd.pid \
|
||||
-x /usr/sbin/telnetd
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
1227
package/busybox/busybox.config
Normal file
1227
package/busybox/busybox.config
Normal file
File diff suppressed because it is too large
Load Diff
40
package/busybox/inittab
Normal file
40
package/busybox/inittab
Normal file
@@ -0,0 +1,40 @@
|
||||
# /etc/inittab
|
||||
#
|
||||
# Copyright (C) 2001 Erik Andersen <andersen@codepoet.org>
|
||||
#
|
||||
# Note: BusyBox init doesn't support runlevels. The runlevels field is
|
||||
# completely ignored by BusyBox init. If you want runlevels, use
|
||||
# sysvinit.
|
||||
#
|
||||
# Format for each entry: <id>:<runlevels>:<action>:<process>
|
||||
#
|
||||
# id == tty to run on, or empty for /dev/console
|
||||
# runlevels == ignored
|
||||
# action == one of sysinit, respawn, askfirst, wait, and once
|
||||
# process == program to run
|
||||
|
||||
# Startup the system
|
||||
::sysinit:/bin/mount -t proc proc /proc
|
||||
::sysinit:/bin/mount -o remount,rw /
|
||||
::sysinit:/bin/mkdir -p /dev/pts /dev/shm
|
||||
::sysinit:/bin/mount -a
|
||||
::sysinit:/bin/mkdir -p /run/lock/subsys
|
||||
::sysinit:/sbin/swapon -a
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
|
||||
::sysinit:/bin/hostname -F /etc/hostname
|
||||
# now run any rc scripts
|
||||
::sysinit:/etc/init.d/rcS
|
||||
|
||||
# Put a getty on the serial port
|
||||
#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL
|
||||
|
||||
# Stuff to do for the 3-finger salute
|
||||
#::ctrlaltdel:/sbin/reboot
|
||||
|
||||
# Stuff to do before rebooting
|
||||
::shutdown:/etc/init.d/rcK
|
||||
::shutdown:/sbin/swapoff -a
|
||||
::shutdown:/bin/umount -a -r
|
||||
86
package/busybox/make.sh
Executable file
86
package/busybox/make.sh
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=busybox
|
||||
PKGVERSION=1.37.0
|
||||
PKGSOURCE_DIR=busybox
|
||||
PKGSOURCE=busybox-1.37.0.tar.bz2
|
||||
PKGURL=https://www.busybox.net/downloads/busybox-1.37.0.tar.bz2
|
||||
|
||||
PKGBUILDNAME=${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
bzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch
|
||||
step_end patch
|
||||
|
||||
# Before running configure, the configuration file should be present and fixed
|
||||
# busybox 这里的动作分以下几步:
|
||||
# 先用 busybox.config 替换 .config 文件,busybox.config 基于 1.36.1,这里直接参考了 buildroot (2025.08.1) 维护的一套针对 busybox 的默认配置
|
||||
# 然后执行 yes = "" | make oldconfig,目的是基于我们当前的 busybox 版本(1.37.0)升级 .config 文件
|
||||
# 然后执行 fix,即手动调整一些配置
|
||||
# 最后再执行一遍 yes = "" | make oldconfig,确保配置正确
|
||||
/usr/bin/install -m 0644 -D ${PROJECT_DIR}/package/busybox/busybox.config ${PKGBUILD_DIR}/.config
|
||||
yes "" | eval "${TARGET_MAKE_ENV} CFLAGS=\"-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1\" CFLAGS_busybox=\"\" /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR} HOSTCC=\"/usr/bin/gcc\" AR=\"${CROSS_COMPILE}gcc-ar\" NM=\"${CROSS_COMPILE}gcc-nm\" RANLIB=\"${CROSS_COMPILE}gcc-ranlib\" CC=\"${CROSS_COMPILE}gcc\" ARCH=riscv PREFIX=\"${TARGET_DIR}\" EXTRA_LDFLAGS=\"\" CROSS_COMPILE=\"${CROSS_COMPILE}\" CONFIG_PREFIX=\"${TARGET_DIR}\" SKIP_STRIP=y oldconfig"
|
||||
touch ${PKGBUILD_DIR}/.stamp_dotconfig
|
||||
# fixup
|
||||
kconfig_disable_option CONFIG_NOMMU
|
||||
kconfig_enable_option CONFIG_USE_BB_CRYPT_SHA
|
||||
kconfig_disable_option CONFIG_PAM
|
||||
kconfig_enable_option CONFIG_INIT
|
||||
yes "" | eval "${TARGET_MAKE_ENV} CFLAGS=\"-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1\" CFLAGS_busybox=\"\" /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR} HOSTCC=\"/usr/bin/gcc\" AR=\"${CROSS_COMPILE}gcc-ar\" NM=\"${CROSS_COMPILE}gcc-nm\" RANLIB=\"${CROSS_COMPILE}gcc-ranlib\" CC=\"${CROSS_COMPILE}gcc\" ARCH=riscv PREFIX=\"${TARGET_DIR}\" EXTRA_LDFLAGS=\"\" CROSS_COMPILE=\"${CROSS_COMPILE}\" CONFIG_PREFIX=\"${TARGET_DIR}\" SKIP_STRIP=y oldconfig"
|
||||
touch ${PKGBUILD_DIR}/.stamp_kconfig_fixup_done
|
||||
|
||||
# 对于 busybox 来说没有使用 configure 脚本
|
||||
stamp_configured
|
||||
|
||||
step_start build
|
||||
eval "${TARGET_MAKE_ENV} CFLAGS=\"-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1\" CFLAGS_busybox=\"\" /usr/bin/make -j${MAXNUM_CPUS} AR=\"${CROSS_COMPILE}gcc-ar\" NM=\"${CROSS_COMPILE}${CROSS_COMPILE}gcc-nm\" RANLIB=\"${CROSS_COMPILE}gcc-ranlib\" CC=\"${CROSS_COMPILE}gcc\" ARCH=riscv PREFIX=\"${TARGET_DIR}\" EXTRA_LDFLAGS=\"\" CROSS_COMPILE=\"${CROSS_COMPILE}\" CONFIG_PREFIX=\"${TARGET_DIR}\" SKIP_STRIP=y -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-target
|
||||
eval "${TARGET_MAKE_ENV} CFLAGS=\"-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1\" CFLAGS_busybox=\"\" /usr/bin/make -j${MAXNUM_CPUS} AR=\"${CROSS_COMPILE}gcc-ar\" NM=\"${CROSS_COMPILE}gcc-nm\" RANLIB=\"${CROSS_COMPILE}gcc-ranlib\" CC=\"${CROSS_COMPILE}gcc\" ARCH=riscv PREFIX=\"${TARGET_DIR}\" EXTRA_LDFLAGS=\"\" CROSS_COMPILE=\"${CROSS_COMPILE}\" CONFIG_PREFIX=\"${TARGET_DIR}\" SKIP_STRIP=y -C ${PKGBUILD_DIR} install-noclobber"
|
||||
if test ! -e ${TARGET_DIR}/etc/inittab; then
|
||||
/usr/bin/install -D -m 0644 ${PROJECT_DIR}/package/busybox/inittab ${TARGET_DIR}/etc/inittab;
|
||||
fi
|
||||
if grep -q CONFIG_UDHCPC=y ${PKGBUILD_DIR}/.config; then
|
||||
/usr/bin/install -m 0755 -D ${PROJECT_DIR}/package/busybox/udhcpc.script ${TARGET_DIR}/usr/share/udhcpc/default.script;
|
||||
/usr/bin/install -m 0755 -d ${TARGET_DIR}/usr/share/udhcpc/default.script.d;
|
||||
fi
|
||||
if grep -q CONFIG_ZCIP=y ${PKGBUILD_DIR}/.config; then
|
||||
/usr/bin/install -m 0755 -D ${PKGBUILD_DIR}/examples/zcip.script ${TARGET_DIR}/usr/share/zcip/default.script;
|
||||
fi
|
||||
if grep -q CONFIG_SYSLOGD=y ${PKGBUILD_DIR}/.config; then
|
||||
/usr/bin/install -m 0755 -D ${PROJECT_DIR}/package/busybox/S01syslogd ${TARGET_DIR}/etc/init.d/S01syslogd;
|
||||
fi;
|
||||
if grep -q CONFIG_KLOGD=y ${PKGBUILD_DIR}/.config; then
|
||||
/usr/bin/install -m 0755 -D ${PROJECT_DIR}/package/busybox/S02klogd ${TARGET_DIR}/etc/init.d/S02klogd;
|
||||
fi
|
||||
if grep -q CONFIG_BB_SYSCTL=y ${PKGBUILD_DIR}/.config; then
|
||||
/usr/bin/install -m 0755 -D ${PROJECT_DIR}/package/busybox/S02sysctl ${TARGET_DIR}/etc/init.d/S02sysctl ;
|
||||
fi
|
||||
if grep -q CONFIG_IFPLUGD=y ${PKGBUILD_DIR}/.config; then
|
||||
/usr/bin/install -m 0755 -D ${PROJECT_DIR}/package/busybox/S41ifplugd ${TARGET_DIR}/etc/init.d/S41ifplugd;
|
||||
fi;
|
||||
if grep -q CONFIG_CROND=y ${PKGBUILD_DIR}/.config; then
|
||||
mkdir -p ${TARGET_DIR}/etc/cron/crontabs
|
||||
/usr/bin/install -m 0755 -D ${PROJECT_DIR}/package/busybox/S50crond ${TARGET_DIR}/etc/init.d/S50crond
|
||||
fi;
|
||||
if grep -q CONFIG_FEATURE_TELNETD_STANDALONE=y ${PKGBUILD_DIR}/.config; then
|
||||
/usr/bin/install -m 0755 -D ${PROJECT_DIR}/package/busybox/S50telnet ${TARGET_DIR}/etc/init.d/S50telnet ;
|
||||
fi
|
||||
step_end install-target
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
122
package/busybox/udhcpc.script
Executable file
122
package/busybox/udhcpc.script
Executable file
@@ -0,0 +1,122 @@
|
||||
#!/bin/sh
|
||||
|
||||
# udhcpc script edited by Tim Riker <Tim@Rikers.org>
|
||||
|
||||
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
|
||||
|
||||
ACTION="$1"
|
||||
RESOLV_CONF="/etc/resolv.conf"
|
||||
[ -e $RESOLV_CONF ] || touch $RESOLV_CONF
|
||||
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
|
||||
[ -n "$subnet" ] && NETMASK="netmask $subnet"
|
||||
# Handle stateful DHCPv6 like DHCPv4
|
||||
[ -n "$ipv6" ] && ip="$ipv6/128"
|
||||
|
||||
if [ -z "${IF_WAIT_DELAY}" ]; then
|
||||
IF_WAIT_DELAY=10
|
||||
fi
|
||||
|
||||
wait_for_ipv6_default_route() {
|
||||
printf "Waiting for IPv6 default route to appear"
|
||||
while [ $IF_WAIT_DELAY -gt 0 ]; do
|
||||
if ip -6 route list | grep -q default; then
|
||||
printf "\n"
|
||||
return
|
||||
fi
|
||||
sleep 1
|
||||
printf "."
|
||||
: $((IF_WAIT_DELAY -= 1))
|
||||
done
|
||||
printf " timeout!\n"
|
||||
}
|
||||
|
||||
case "$ACTION" in
|
||||
deconfig)
|
||||
/sbin/ifconfig $interface up
|
||||
/sbin/ifconfig $interface 0.0.0.0
|
||||
|
||||
# drop info from this interface
|
||||
# resolv.conf may be a symlink to /tmp/, so take care
|
||||
TMPFILE=$(mktemp)
|
||||
grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE
|
||||
cat $TMPFILE > $RESOLV_CONF
|
||||
rm -f $TMPFILE
|
||||
|
||||
if [ -x /usr/sbin/avahi-autoipd ]; then
|
||||
/usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface
|
||||
fi
|
||||
;;
|
||||
|
||||
leasefail|nak)
|
||||
if [ -x /usr/sbin/avahi-autoipd ]; then
|
||||
/usr/sbin/avahi-autoipd -c $interface || /usr/sbin/avahi-autoipd -wD $interface --no-chroot
|
||||
fi
|
||||
;;
|
||||
|
||||
renew|bound)
|
||||
if [ -x /usr/sbin/avahi-autoipd ]; then
|
||||
/usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface
|
||||
fi
|
||||
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
|
||||
if [ -n "$ipv6" ] ; then
|
||||
wait_for_ipv6_default_route
|
||||
fi
|
||||
|
||||
# RFC3442: If the DHCP server returns both a Classless
|
||||
# Static Routes option and a Router option, the DHCP
|
||||
# client MUST ignore the Router option.
|
||||
if [ -n "$staticroutes" ]; then
|
||||
echo "deleting routers"
|
||||
route -n | while read dest gw mask flags metric ref use iface; do
|
||||
[ "$iface" != "$interface" -o "$gw" = "0.0.0.0" ] || \
|
||||
route del -net "$dest" netmask "$mask" gw "$gw" dev "$interface"
|
||||
done
|
||||
|
||||
# format: dest1/mask gw1 ... destn/mask gwn
|
||||
set -- $staticroutes
|
||||
while [ -n "$1" -a -n "$2" ]; do
|
||||
route add -net "$1" gw "$2" dev "$interface"
|
||||
shift 2
|
||||
done
|
||||
elif [ -n "$router" ] ; then
|
||||
echo "deleting routers"
|
||||
while route del default gw 0.0.0.0 dev $interface 2> /dev/null; do
|
||||
:
|
||||
done
|
||||
|
||||
for i in $router ; do
|
||||
route add default gw $i dev $interface
|
||||
done
|
||||
fi
|
||||
|
||||
# drop info from this interface
|
||||
# resolv.conf may be a symlink to /tmp/, so take care
|
||||
TMPFILE=$(mktemp)
|
||||
grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE
|
||||
cat $TMPFILE > $RESOLV_CONF
|
||||
rm -f $TMPFILE
|
||||
|
||||
# prefer rfc3397 domain search list (option 119) if available
|
||||
if [ -n "$search" ]; then
|
||||
search_list=$search
|
||||
elif [ -n "$domain" ]; then
|
||||
search_list=$domain
|
||||
fi
|
||||
|
||||
[ -n "$search_list" ] &&
|
||||
echo "search $search_list # $interface" >> $RESOLV_CONF
|
||||
|
||||
for i in $dns ; do
|
||||
echo adding dns $i
|
||||
echo "nameserver $i # $interface" >> $RESOLV_CONF
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
HOOK_DIR="$0.d"
|
||||
for hook in "${HOOK_DIR}/"*; do
|
||||
[ -f "${hook}" -a -x "${hook}" ] || continue
|
||||
"${hook}" "$ACTION"
|
||||
done
|
||||
|
||||
exit 0
|
||||
341
package/common.sh
Normal file
341
package/common.sh
Normal file
@@ -0,0 +1,341 @@
|
||||
if [ "${TRACE}" = "1" ] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${DEBUG}" = "1" ] ; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
ARCH=riscv64
|
||||
TARGET_VENDOR=unknown
|
||||
TARGET_OS=linux
|
||||
LIBC=gnu
|
||||
ABI=
|
||||
# riscv64-unknown-linux-gnu
|
||||
GNU_TARGET_NAME=${ARCH}-${TARGET_VENDOR}-${TARGET_OS}-${LIBC}${ABI}
|
||||
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
PROJECT_DIR=$(realpath "${SCRIPT_DIR}/../..")
|
||||
OUTPUT_DIR=${PROJECT_DIR}/output
|
||||
DL_DIR=${PROJECT_DIR}/dl
|
||||
HOST_DIR=${OUTPUT_DIR}/host
|
||||
BUILD_DIR=${OUTPUT_DIR}/build
|
||||
TARGET_DIR=${OUTPUT_DIR}/target
|
||||
IMAGES_DIR=${OUTPUT_DIR}/images
|
||||
STAGING_DIR=${HOST_DIR}/${GNU_TARGET_NAME}/sysroot
|
||||
STAGING_SUBDIR=${GNU_TARGET_NAME}/sysroot
|
||||
|
||||
MAXNUM_CPUS=$(nproc)
|
||||
|
||||
CROSS_COMPILE=${HOST_DIR}/bin/${GNU_TARGET_NAME}-
|
||||
|
||||
export HOST_DIR TARGET_DIR STAGING_DIR
|
||||
|
||||
# FIXME: 我们目前假设 DL_DIR 已经存在, 其创建不作为构建的一部分。
|
||||
# 以后获取可以考虑为 download 专门写个脚本来创建 DL_DIR 并下载所需的所有的包。
|
||||
|
||||
# UPDATE_CONFIG_HOOK
|
||||
function update_config_guess_sub() {
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Updating config.sub and config.guess"
|
||||
for file in config.guess config.sub; do
|
||||
for i in $(find $1 -name $file); do
|
||||
cp ${PROJECT_DIR}/support/gnuconfig/$file $i
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
# LIBTOOL_PATCH_HOOK
|
||||
function patch_libtool() {
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Patching libtool"
|
||||
for i in `find $1 -name ltmain.sh`; do
|
||||
ltmain_version=`sed -n '/^[ \t]*VERSION=/{s/^[ \t]*VERSION=//;p;q;}' $i | \
|
||||
sed -e 's/\([0-9]*\.[0-9]*\).*/\1/' -e 's/\"//'`;
|
||||
ltmain_patchlevel=`sed -n '/^[ \t]*VERSION=/{s/^[ \t]*VERSION=//;p;q;}' $i | \
|
||||
sed -e 's/\([0-9]*\.[0-9]*\.*\)\([0-9]*\).*/\2/' -e 's/\"//'`;
|
||||
if test ${ltmain_version} = '1.5'; then
|
||||
patch -i ${PROJECT_DIR}/support/libtool/buildroot-libtool-v1.5.patch ${i};
|
||||
elif test ${ltmain_version} = "2.2"; then
|
||||
patch -i ${PROJECT_DIR}/support/libtool/buildroot-libtool-v2.2.patch ${i};
|
||||
elif test ${ltmain_version} = "2.4"; then
|
||||
if test ${ltmain_patchlevel:-0} -gt 2; then
|
||||
patch -i ${PROJECT_DIR}/support/libtool/buildroot-libtool-v2.4.4.patch ${i};
|
||||
else
|
||||
patch -i ${PROJECT_DIR}/support/libtool/buildroot-libtool-v2.4.patch ${i};
|
||||
fi
|
||||
elif test ${ltmain_version} = "2.5"; then
|
||||
patch -i ${PROJECT_DIR}/support/libtool/buildroot-libtool-v2.4.4.patch ${i};
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Fixing package configuration files when do staging installing.
|
||||
# parameter: 1 - the package config file name, e.g., pkg-config, cmake
|
||||
function fix_package_config_files_for_staging_install() {
|
||||
if [ -n "${1}" ] ; then
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Fixing package configuration files" ;\
|
||||
/usr/bin/sed -i -e "s,${HOST_DIR},@HOST_DIR@,g" \
|
||||
-e "s,${OUTPUT_DIR},@BASE_DIR@,g" \
|
||||
-e "s,^\(exec_\)\?prefix=.*,\1prefix=@STAGING_DIR@/usr,g" \
|
||||
-e "s,-I/usr/,-I@STAGING_DIR@/usr/,g" \
|
||||
-e "s,-L/usr/,-L@STAGING_DIR@/usr/,g" \
|
||||
-e 's,@STAGING_DIR@,$(dirname $(readlink -e $0))/../..,g' \
|
||||
-e 's,@HOST_DIR@,$(dirname $(readlink -e $0))/../../../..,g' \
|
||||
-e "s,@BASE_DIR@,${OUTPUT_DIR},g" \
|
||||
${STAGING_DIR}/usr/bin/${1} ;
|
||||
fi
|
||||
}
|
||||
|
||||
# Fixing libtool files when do staging installing.
|
||||
function fix_libtool_files_for_staging_install() {
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Fixing libtool files"
|
||||
for la in $(find ${STAGING_DIR}/usr/lib* -name "*.la"); do
|
||||
cp -a "${la}" "${la}.fixed" && \
|
||||
/usr/bin/sed -i -e "s:${OUTPUT_DIR}:@BASE_DIR@:g" \
|
||||
-e "s:${STAGING_DIR}:@STAGING_DIR@:g" \
|
||||
-e "s:\(['= ]\)/usr:\\1@STAGING_DIR@/usr:g" \
|
||||
-e "s:\(['= ]\)/lib:\\1@STAGING_DIR@/lib:g" \
|
||||
-e "s:@STAGING_DIR@:${STAGING_DIR}:g" \
|
||||
-e "s:@BASE_DIR@:${OUTPUT_DIR}:g" \
|
||||
"${la}.fixed" && \
|
||||
if cmp -s "${la}" "${la}.fixed"; then \
|
||||
rm -f "${la}.fixed"; \
|
||||
else \
|
||||
mv "${la}.fixed" "${la}"; \
|
||||
fi || exit 1;
|
||||
done
|
||||
}
|
||||
|
||||
# Check the specified kernel headers version actually matches the
|
||||
# version in the toolchain.
|
||||
# toolchain/helpers.mk
|
||||
function check_kernel_headers_version() {
|
||||
if ! ${PROJECT_DIR}/support/scripts/check-kernel-headers.sh ${1} ${2} ${3} ${4}; then
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
# Defined in toolchain/helpers.mk
|
||||
function copy_toolchain_lib_root() {
|
||||
LIBPATTERN="${1}"
|
||||
LIBPATHS=`find ${STAGING_DIR} -name "${LIBPATTERN}" 2>/dev/null`
|
||||
for LIBPATH in ${LIBPATHS} ; do
|
||||
while true ; do
|
||||
LIBNAME=`basename ${LIBPATH}`
|
||||
DESTDIR=`echo ${LIBPATH} | sed "s,^${STAGING_DIR},," | xargs dirname`
|
||||
mkdir -p ${TARGET_DIR}/${DESTDIR}
|
||||
rm -fr ${TARGET_DIR}/${DESTDIR}/${LIBNAME}
|
||||
if test -h ${LIBPATH} ; then
|
||||
cp -d ${LIBPATH} ${TARGET_DIR}/${DESTDIR}/${LIBNAME}
|
||||
OLD_LIBPATH="${LIBPATH}"
|
||||
LIBPATH="`readlink -f ${LIBPATH}`"
|
||||
if [ "${LIBPATH}" = "" ]; then
|
||||
echo "LIBPATH empty after trying to resolve symlink ${OLD_LIBPATH}" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
elif test -f ${LIBPATH}; then
|
||||
/usr/bin/install -D -m0755 ${LIBPATH} ${TARGET_DIR}/${DESTDIR}/${LIBNAME}
|
||||
break
|
||||
else
|
||||
exit -1
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
function kconfig_enable_option() {
|
||||
if ! grep -q "^${1}=[my]" ${PKGBUILD_DIR}/.config; then
|
||||
/usr/bin/sed -i -e "/^\(# \)\?${1}\>/d" ${PKGBUILD_DIR}/.config && echo "${1}=y" >> ${PKGBUILD_DIR}/.config;
|
||||
fi
|
||||
}
|
||||
|
||||
function kconfig_disable_option() {
|
||||
/usr/bin/sed -i -e "/^\(# \)\?${1}\>/d" ${PKGBUILD_DIR}/.config && echo "# ${1} is not set" >> ${PKGBUILD_DIR}/.config
|
||||
}
|
||||
|
||||
# ${1}: base directory to search in
|
||||
# ${2}: suffix of file (optional)
|
||||
# example:
|
||||
# cd ${TARGET_DIR};
|
||||
# LC_ALL=C find . -not -path './riscv64-unknown-linux-gnu/sysroot/*' \( -type f -o -type l \) -printf '%T@:%i:%#m:%y:%s,%p\n' \
|
||||
# | LC_ALL=C sort > ${PKGBUILD_DIR}/.files-list.before
|
||||
function pkg_size_before() {
|
||||
cd ${1};
|
||||
LC_ALL=C find . -not -path "./${STAGING_SUBDIR}/*" \( -type f -o -type l \) -printf '%T@:%i:%#m:%y:%s,%p\n' \
|
||||
| LC_ALL=C sort > ${PKGBUILD_DIR}/.files-list${2}.before;
|
||||
}
|
||||
|
||||
# ${1}: base directory to search in
|
||||
# ${2}: suffix of file (optional)
|
||||
function pkg_size_after() {
|
||||
cd ${1}; \
|
||||
LC_ALL=C find . -not -path "./${STAGING_SUBDIR}/*" \( -type f -o -type l \) -printf '%T@:%i:%#m:%y:%s,%p\n' \
|
||||
| LC_ALL=C sort > ${PKGBUILD_DIR}/.files-list${2}.after
|
||||
LC_ALL=C comm -13 \
|
||||
${PKGBUILD_DIR}/.files-list${2}.before \
|
||||
${PKGBUILD_DIR}/.files-list${2}.after \
|
||||
| sed -r -e "s/^[^,]+/${PKGBUILDNAME}/" \
|
||||
> ${PKGBUILD_DIR}/.files-list${2}.txt
|
||||
rm -f ${PKGBUILD_DIR}/.files-list${2}.before
|
||||
rm -f ${PKGBUILD_DIR}/.files-list${2}.after
|
||||
}
|
||||
|
||||
# ${1} step name
|
||||
function step_start() {
|
||||
printf "%s:%-5.5s:%-20.20s: %s\n" "$(date +%s.%N)" "start" "${1}" "${PKGBUILDNAME}" >>"${BUILD_DIR}/build-time.log"
|
||||
if [ "${1}" == "download" ]; then
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Downloading"
|
||||
elif [ "${1}" == "extract" ]; then
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Extracting"
|
||||
elif [ "${1}" == "patch" ]; then
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Patching"
|
||||
elif [ "${1}" == "configure" ]; then
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Configuring"
|
||||
elif [ "${1}" == "build" ]; then
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Building"
|
||||
elif [ "${1}" == "install-host" ]; then
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Installing to host directory"
|
||||
elif [ "${1}" == "install-staging" ]; then
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Installing to staging directory"
|
||||
elif [ "${1}" == "install-target" ]; then
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Installing to target"
|
||||
elif [ "${1}" == "install-image" ]; then
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Installing to images directory"
|
||||
fi
|
||||
|
||||
if [ "${1}" == "configure" ]; then
|
||||
mkdir -p ${HOST_DIR} ${TARGET_DIR} ${STAGING_DIR} ${IMAGES_DIR}
|
||||
pkg_size_before ${TARGET_DIR}
|
||||
pkg_size_before ${STAGING_DIR} -staging
|
||||
pkg_size_before ${IMAGES_DIR} -images
|
||||
pkg_size_before ${HOST_DIR} -host
|
||||
fi
|
||||
}
|
||||
|
||||
# ${1} step name
|
||||
# ${2} 如果 ${1} 为 "patch", 则可能存在 ${2},用于标识构建类型;目前支持的有效值为
|
||||
# "autotool", 其他情况不给出则默认为不适用 autotools,譬如采用 kconfig 的,
|
||||
# 如 linux,busybox 等。
|
||||
# 对于该分支,如果 ${2} 为空则 ${3} 也必须为空
|
||||
# 如果 ${1} 为 "install-staging", 则可能存在 ${2}
|
||||
# ${3} 如果 ${1} 为 "patch" 并且 ${2} 为 "autotools",则可以继续指定 ${3} 用于指
|
||||
# 定是否需要忽略给 libtool 打补丁,"ignore_libtool_patch" 表示忽略。默认如果
|
||||
# 不指明则缺省要给 libtool 打补丁
|
||||
function step_end() {
|
||||
if [ "${1}" == "patch" ]; then
|
||||
# 如果是采用 autotools 方式构建才有可能需要更新 config.guess
|
||||
# 以及对 libtool 打补丁。
|
||||
# 但也有几种情况是不需要在 patch 阶段对 libtool 打补丁的
|
||||
# 一种是 configure 阶段会运行 autoreconf,对该种情况我们会在
|
||||
# 运行完 autoreconf 后再对 libtool 打补丁
|
||||
# 还有一种情况是明确不需要对 libtool 打补丁的,譬如本身就是在
|
||||
# 构建 libtool。
|
||||
if [ "${2}" == "autotools" ]; then
|
||||
update_config_guess_sub ${PKGBUILD_DIR}
|
||||
if [ "${3}" != "ignore_libtool_patch" ]; then
|
||||
patch_libtool ${PKGBUILD_DIR}
|
||||
fi
|
||||
fi
|
||||
elif [ "${1}" == "install-host" ]; then
|
||||
rm -f -rf ${HOST_DIR}/share/info/dir
|
||||
elif [ "${1}" == "install-staging" ]; then
|
||||
rm -f -rf ${STAGING_DIR}/share/info/dir
|
||||
fix_package_config_files_for_staging_install ${2}
|
||||
fix_libtool_files_for_staging_install
|
||||
elif [ "${1}" == "install-target" ]; then
|
||||
rm -f -rf ${TARGET_DIR}/share/info/dir
|
||||
fi
|
||||
printf "%s:%-5.5s:%-20.20s: %s\n" "$(date +%s.%N)" "end" "${1}" "${PKGBUILDNAME}" >>"${BUILD_DIR}/build-time.log"
|
||||
if [ "${1}" == "install-host" ]; then
|
||||
${PROJECT_DIR}/support/scripts/check-host-rpath ${PKGBUILDNAME} ${HOST_DIR} ${OUTPUT_DIR}/per-package
|
||||
fi
|
||||
# 这里应该有一步 step_check_build_dir,但从 make 的 log 看感觉这里传入的 $(STAGING_DIR)/$(O) 会有问题
|
||||
# FIXME,先不加这个 check
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
if [ "${1}" == "download" ]; then
|
||||
touch ${PKGBUILD_DIR}/.stamp_downloaded
|
||||
elif [ "${1}" == "extract" ]; then
|
||||
touch ${PKGBUILD_DIR}/.stamp_extracted
|
||||
elif [ "${1}" == "patch" ]; then
|
||||
touch ${PKGBUILD_DIR}/.stamp_patched
|
||||
elif [ "${1}" == "configure" ]; then
|
||||
touch ${PKGBUILD_DIR}/.stamp_configured
|
||||
elif [ "${1}" == "build" ]; then
|
||||
touch ${PKGBUILD_DIR}/.stamp_built
|
||||
elif [ "${1}" == "install-host" ]; then
|
||||
touch ${PKGBUILD_DIR}/.stamp_host_installed
|
||||
elif [ "${1}" == "install-staging" ]; then
|
||||
touch ${PKGBUILD_DIR}/.stamp_staging_installed
|
||||
elif [ "${1}" == "install-target" ]; then
|
||||
touch ${PKGBUILD_DIR}/.stamp_target_installed
|
||||
elif [ "${1}" == "install-image" ]; then
|
||||
touch ${PKGBUILD_DIR}/.stamp_images_installed
|
||||
fi
|
||||
}
|
||||
|
||||
function stamp_downloaded() {
|
||||
local STARTED=n
|
||||
# PKGSOURCE is MUST to have; PKGSOURCE2 is OPTIONAL
|
||||
if [ ! -z "${PKGSOURCE}" ]; then
|
||||
for p in ${PKGURL}; do
|
||||
f=`basename ${p}`
|
||||
if [ ! -e "${DL_DIR}/${PKGSOURCE_DIR}/${f}" ] ; then
|
||||
if [ ${STARTED} = "n" ]; then
|
||||
step_start download
|
||||
STARTED=y
|
||||
fi
|
||||
mkdir -p ${DL_DIR}/${PKGSOURCE_DIR}
|
||||
(cd ${DL_DIR}/${PKGSOURCE_DIR}; wget ${PKGURL})
|
||||
if [ $? -ne 0 ]; then
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Downloading FAILED!!!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ ${STARTED} = "y" ]; then
|
||||
step_end download
|
||||
fi
|
||||
fi
|
||||
if [ "${ONLY_DOWNLOAD}" = "y" ] ; then
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
function stamp_extracted() {
|
||||
step_start extract
|
||||
step_end extract
|
||||
}
|
||||
|
||||
# ${1}: see comments for ${2} of step_end
|
||||
function stamp_patched() {
|
||||
step_start patch
|
||||
step_end patch ${1}
|
||||
}
|
||||
|
||||
function stamp_configured() {
|
||||
step_start configure
|
||||
step_end configure
|
||||
}
|
||||
|
||||
function stamp_built() {
|
||||
step_start build
|
||||
step_end build
|
||||
}
|
||||
|
||||
function stamp_installed() {
|
||||
pkg_size_after ${TARGET_DIR}
|
||||
pkg_size_after ${STAGING_DIR} -staging
|
||||
pkg_size_after ${IMAGES_DIR} -images
|
||||
pkg_size_after ${HOST_DIR} -host
|
||||
${PROJECT_DIR}/support/scripts/check-bin-arch -p ${PKGBUILDNAME} -l ${PKGBUILD_DIR}/.files-list.txt -r ${CROSS_COMPILE}readelf -a "RISC-V"
|
||||
touch ${PKGBUILD_DIR}/.stamp_installed
|
||||
}
|
||||
|
||||
HOST_MAKE_ENV='GIT_DIR=. PATH="${HOST_DIR}/bin:${HOST_DIR}/sbin:${PATH}" PKG_CONFIG="${HOST_DIR}/bin/pkg-config" PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_LIBDIR="${HOST_DIR}/lib/pkgconfig:${HOST_DIR}/share/pkgconfig"'
|
||||
|
||||
HOST_CONFIGURE_OPTS='GIT_DIR=. PATH="${HOST_DIR}/bin:${HOST_DIR}/sbin:${PATH}" PKG_CONFIG="${HOST_DIR}/bin/pkg-config" PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_LIBDIR="${HOST_DIR}/lib/pkgconfig:${HOST_DIR}/share/pkgconfig" AR="/usr/bin/ar" AS="/usr/bin/as" LD="/usr/bin/ld" NM="/usr/bin/nm" CC="/usr/bin/gcc" GCC="/usr/bin/gcc" CXX="/usr/bin/g++" CPP="/usr/bin/cpp" OBJCOPY="/usr/bin/objcopy" RANLIB="/usr/bin/ranlib" CPPFLAGS="-I${HOST_DIR}/include" CFLAGS="-O2 -I${HOST_DIR}/include" CXXFLAGS="-O2 -I${HOST_DIR}/include" LDFLAGS="-L${HOST_DIR}/lib -Wl,-rpath,${HOST_DIR}/lib" INTLTOOL_PERL=/usr/bin/perl'
|
||||
|
||||
AUTORECONF_OPTS='GIT_DIR=. PATH="${HOST_DIR}/bin:${HOST_DIR}/sbin:${PATH}" PKG_CONFIG="${HOST_DIR}/bin/pkg-config" PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_LIBDIR="${HOST_DIR}/lib/pkgconfig:${HOST_DIR}/share/pkgconfig" AR="/usr/bin/ar" AS="/usr/bin/as" LD="/usr/bin/ld" NM="/usr/bin/nm" CC="/usr/bin/gcc" GCC="/usr/bin/gcc" CXX="/usr/bin/g++" CPP="/usr/bin/cpp" OBJCOPY="/usr/bin/objcopy" RANLIB="/usr/bin/ranlib" CPPFLAGS="-I${HOST_DIR}/include" CFLAGS="-O2 -I${HOST_DIR}/include" CXXFLAGS="-O2 -I${HOST_DIR}/include" LDFLAGS="-L${HOST_DIR}/lib -Wl,-rpath,${HOST_DIR}/lib" INTLTOOL_PERL=/usr/bin/perl ACLOCAL="${HOST_DIR}/bin/aclocal" AUTOCONF="${HOST_DIR}/bin/autoconf -I "${STAGING_DIR}/usr/share/aclocal" -I "${HOST_DIR}/share/aclocal"" AUTOHEADER="${HOST_DIR}/bin/autoheader -I "${STAGING_DIR}/usr/share/aclocal" -I "${HOST_DIR}/share/aclocal"" AUTOMAKE="${HOST_DIR}/bin/automake" GTKDOCIZE=/bin/true'
|
||||
|
||||
TARGET_MAKE_ENV='GIT_DIR=. PATH="${HOST_DIR}/bin:${HOST_DIR}/sbin:${PATH}"'
|
||||
|
||||
TARGET_CONFIGURE_OPTS='GIT_DIR=. PATH="${HOST_DIR}/bin:${HOST_DIR}/sbin:${PATH}" AR="${CROSS_COMPILE}gcc-ar" AS="${CROSS_COMPILE}as" LD="${CROSS_COMPILE}ld" NM="${CROSS_COMPILE}gcc-nm" CC="${CROSS_COMPILE}gcc" GCC="${CROSS_COMPILE}gcc" CPP="${CROSS_COMPILE}cpp" CXX="${CROSS_COMPILE}g++" FC="${CROSS_COMPILE}gfortran" F77="${CROSS_COMPILE}gfortran" RANLIB="${CROSS_COMPILE}gcc-ranlib" READELF="${CROSS_COMPILE}readelf" STRIP="${CROSS_COMPILE}strip" OBJCOPY="${CROSS_COMPILE}objcopy" OBJDUMP="${CROSS_COMPILE}objdump" AR_FOR_BUILD="/usr/bin/ar" AS_FOR_BUILD="/usr/bin/as" CC_FOR_BUILD="/usr/bin/gcc" GCC_FOR_BUILD="/usr/bin/gcc" CXX_FOR_BUILD="/usr/bin/g++" LD_FOR_BUILD="/usr/bin/ld" CPPFLAGS_FOR_BUILD="-I${HOST_DIR}/include" CFLAGS_FOR_BUILD="-O2 -I${HOST_DIR}/include" CXXFLAGS_FOR_BUILD="-O2 -I${HOST_DIR}/include" LDFLAGS_FOR_BUILD="-L${HOST_DIR}/lib -Wl,-rpath,${HOST_DIR}/lib" FCFLAGS_FOR_BUILD="" DEFAULT_ASSEMBLER="${CROSS_COMPILE}as" DEFAULT_LINKER="${CROSS_COMPILE}ld" CPPFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1" CXXFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1" LDFLAGS="" FCFLAGS=" -O2 -g0" FFLAGS=" -O2 -g0" PKG_CONFIG="${HOST_DIR}/bin/pkg-config" STAGING_DIR="${STAGING_DIR}" INTLTOOL_PERL=/usr/bin/perl'
|
||||
41
package/e2fsprogs/make-host.sh
Executable file
41
package/e2fsprogs/make-host.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=e2fsprogs
|
||||
PKGVERSION=1.47.2
|
||||
PKGSOURCE_DIR=e2fsprogs
|
||||
PKGSOURCE=e2fsprogs-1.47.2.tar.xz
|
||||
PKGURL=http://mirrors.ustc.edu.cn/kernel.org/linux/kernel/people/tytso/e2fsprogs/v1.47.2/e2fsprogs-1.47.2.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
stamp_patched autotools
|
||||
|
||||
step_start configure
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} ac_cv_path_LDCONFIG=true CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking --disable-defrag --disable-e2initrd-helper --disable-fuse2fs --disable-fsck --disable-libblkid --disable-libuuid --disable-testio-debug --enable-symlink-install --enable-elf-shlibs --with-crond-dir=no --with-udev-rules-dir=no --with-systemd-unit-dir=no")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j1 -C ${PKGBUILD_DIR} install install-libs"
|
||||
# Remove compile_et which raises a build failure with samba4
|
||||
rm -f ${HOST_DIR}/bin/compile_et
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
41
package/fakeroot/make-host.sh
Executable file
41
package/fakeroot/make-host.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=fakeroot
|
||||
PKGVERSION=1.37.1.1
|
||||
PKGSOURCE_DIR=fakeroot
|
||||
PKGSOURCE=fakeroot_1.37.1.1.orig.tar.gz
|
||||
PKGURL=https://snapshot.debian.org/archive/debian/20250329T150348Z/pool/main/f/fakeroot/fakeroot_1.37.1.1.orig.tar.gz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
gzip -d -c ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch
|
||||
step_end patch autotools
|
||||
|
||||
step_start configure
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} ac_cv_header_sys_capability_h=no ac_cv_func_capset=no CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}"
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
@@ -0,0 +1,35 @@
|
||||
From ffa886a580929f26fd5e5a40c9c5334955c48553 Mon Sep 17 00:00:00 2001
|
||||
From: Explorer09 <explorer09@gmail.com>
|
||||
Date: Mon, 4 Sep 2017 10:47:33 +0800
|
||||
Subject: [PATCH] build: AC_USE_SYSTEM_EXTENSIONS in configure.ac.
|
||||
|
||||
This would, e.g. define _GNU_SOURCE in config.h, enabling the
|
||||
reallocarray() prototype in glibc 2.26+ on Linux systems with that
|
||||
version of glibc.
|
||||
|
||||
Fixes #241.
|
||||
|
||||
Backported from: 24fd0551333e7eded87b64dd36062da3df2f6380
|
||||
Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
|
||||
---
|
||||
configure.ac | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 55e774b..c879fe1 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -25,8 +25,10 @@
|
||||
# autoconf requirements and initialization
|
||||
|
||||
AC_INIT([the fast lexical analyser generator],[2.6.4],[flex-help@lists.sourceforge.net],[flex])
|
||||
+AC_PREREQ([2.60])
|
||||
AC_CONFIG_SRCDIR([src/scan.l])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
+AC_USE_SYSTEM_EXTENSIONS
|
||||
LT_INIT
|
||||
AM_INIT_AUTOMAKE([1.11.3 -Wno-portability foreign check-news std-options dist-lzip parallel-tests subdir-objects])
|
||||
AC_CONFIG_HEADER([src/config.h])
|
||||
--
|
||||
2.14.1
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
From da21733178b34eea303964db5a05e8a3ee4095b4 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
Date: Sat, 26 Aug 2017 15:17:06 +0200
|
||||
Subject: [PATCH] build: make it possible to disable the build of the flex
|
||||
program
|
||||
|
||||
The flex program uses fork(), which isn't available on noMMU
|
||||
systems. However, the libfl library does not use fork(), and be used
|
||||
by other programs/libraries.
|
||||
|
||||
Therefore, it makes sense to provide an option to disable the build of
|
||||
the flex program.
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
|
||||
|
||||
---
|
||||
Submitted-upstream: https://github.com/westes/flex/pull/256
|
||||
Refused. We'll have to adapt when they do a new release...
|
||||
---
|
||||
Makefile.am | 2 ++
|
||||
configure.ac | 6 ++++++
|
||||
doc/Makefile.am | 4 ++++
|
||||
src/Makefile.am | 3 +++
|
||||
4 files changed, 15 insertions(+)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index e790e9d..8b57bc9 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -62,8 +62,10 @@ ChangeLog: $(srcdir)/tools/git2cl
|
||||
indent:
|
||||
cd src && $(MAKE) $(AM_MAKEFLAGS) indent
|
||||
|
||||
+if ENABLE_PROGRAM
|
||||
install-exec-hook:
|
||||
cd $(DESTDIR)$(bindir) && \
|
||||
$(LN_S) -f flex$(EXEEXT) flex++$(EXEEXT)
|
||||
+endif
|
||||
|
||||
.PHONY: ChangeLog indent
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 8882016..f49872b 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -75,6 +75,12 @@ AC_ARG_ENABLE([libfl],
|
||||
[], [enable_libfl=yes])
|
||||
AM_CONDITIONAL([ENABLE_LIBFL], [test "x$enable_libfl" = xyes])
|
||||
|
||||
+AC_ARG_ENABLE([program],
|
||||
+ [AS_HELP_STRING([--disable-program],
|
||||
+ [do not build the flex program, only the libfl library])],
|
||||
+ [], [enable_program=yes])
|
||||
+AM_CONDITIONAL([ENABLE_PROGRAM], [test "x$enable_program" = xyes])
|
||||
+
|
||||
# --disable-bootstrap is intended only to workaround problems with bootstrap
|
||||
# (e.g. when cross-compiling flex or when bootstrapping has bugs).
|
||||
# Ideally we should be able to bootstrap even when cross-compiling.
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index 0d13a5a..c73bc17 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -4,7 +4,10 @@ LIBS = @LIBS@
|
||||
|
||||
m4 = @M4@
|
||||
|
||||
+if ENABLE_PROGRAM
|
||||
bin_PROGRAMS = flex
|
||||
+endif
|
||||
+
|
||||
if ENABLE_BOOTSTRAP
|
||||
noinst_PROGRAMS = stage1flex
|
||||
endif
|
||||
--
|
||||
2.9.4
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
From b89b8475a5b2f9444c32f7d254b35968da3c8a23 Mon Sep 17 00:00:00 2001
|
||||
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
|
||||
Date: Fri, 29 Sep 2017 18:03:51 +0200
|
||||
Subject: [PATCH] build: make it possible to disable the build of the
|
||||
documentation
|
||||
|
||||
When targeting embedded devices, the documentation is not needed.
|
||||
|
||||
Building the documentation default to whether the program is built.
|
||||
|
||||
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
|
||||
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
---
|
||||
Makefile.am | 8 +++++++-
|
||||
configure.ac | 6 ++++++
|
||||
2 files changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index fce30b2..ee75b64 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -41,9 +41,15 @@ EXTRA_DIST = \
|
||||
.indent.pro \
|
||||
autogen.sh
|
||||
|
||||
+MAYBE_SUBDIRS =
|
||||
+
|
||||
+if ENABLE_DOC
|
||||
+MAYBE_SUBDIRS += doc
|
||||
+endif
|
||||
+
|
||||
SUBDIRS = \
|
||||
src \
|
||||
- doc \
|
||||
+ $(MAYBE_SUBDIRS) \
|
||||
examples \
|
||||
po \
|
||||
tests \
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index c54e98f..b3ae450 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -80,6 +80,12 @@ AC_ARG_ENABLE([program],
|
||||
[], [enable_program=yes])
|
||||
AM_CONDITIONAL([ENABLE_PROGRAM], [test "x$enable_program" = xyes])
|
||||
|
||||
+AC_ARG_ENABLE([doc],
|
||||
+ [AS_HELP_STRING([--disable-doc],
|
||||
+ [do not build the documentation])],
|
||||
+ [], [enable_doc=${enable_program}])
|
||||
+AM_CONDITIONAL([ENABLE_DOC], [test "x$enable_doc" = xyes -a "x$enable_program" = xyes])
|
||||
+
|
||||
# --disable-bootstrap is intended only to workaround problems with bootstrap
|
||||
# (e.g. when cross-compiling flex or when bootstrapping has bugs).
|
||||
# Ideally we should be able to bootstrap even when cross-compiling.
|
||||
--
|
||||
2.11.0
|
||||
|
||||
27
package/flex/0004-Match-malloc-signature-to-its-use.patch
Normal file
27
package/flex/0004-Match-malloc-signature-to-its-use.patch
Normal file
@@ -0,0 +1,27 @@
|
||||
From 4b142954b54a57a9b0af0a9661056a9c39a8fa95 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Barnes <rbarnes@umn.edu>
|
||||
Date: Wed, 2 Oct 2024 10:35:09 -0700
|
||||
Subject: [PATCH] Match `malloc` signature to its use
|
||||
|
||||
Upstream: https://github.com/westes/flex/pull/674
|
||||
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
|
||||
---
|
||||
lib/malloc.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/malloc.c b/lib/malloc.c
|
||||
index 75e8ef9..701b9b3 100755
|
||||
--- a/lib/malloc.c
|
||||
+++ b/lib/malloc.c
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
- void *malloc ();
|
||||
+ void *malloc (size_t n);
|
||||
|
||||
/* Allocate an N-byte block of memory from the heap.
|
||||
If N is zero, allocate a 1-byte block. */
|
||||
--
|
||||
2.39.5
|
||||
|
||||
44
package/flex/make-host.sh
Executable file
44
package/flex/make-host.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=flex
|
||||
PKGVERSION=2.6.4
|
||||
PKGSOURCE_DIR=flex
|
||||
PKGSOURCE=flex-2.6.4.tar.gz
|
||||
PKGURL=https://github.com/westes/flex/files/981163/flex-2.6.4.tar.gz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
gzip -d -c ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch
|
||||
step_end patch autotools ignore_libtool_patch
|
||||
|
||||
step_start configure
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Autoreconfiguring"
|
||||
cd ${PKGBUILD_DIR} && eval "AUTOPOINT=${HOST_DIR}/bin/autopoint ${AUTORECONF_OPTS} ${HOST_DIR}/bin/autoreconf -f -i"
|
||||
patch_libtool ${PKGBUILD_DIR}
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking --disable-doc")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}"
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
40
package/gawk/make-host.sh
Executable file
40
package/gawk/make-host.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=gawk
|
||||
PKGVERSION=5.3.1
|
||||
PKGSOURCE_DIR=gawk
|
||||
PKGSOURCE=gawk-5.3.1.tar.xz
|
||||
PKGURL=http://mirrors.ustc.edu.cn/gnu/gawk/gawk-5.3.1.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
stamp_patched autotools
|
||||
|
||||
step_start configure
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking --without-readline --without-mpfr")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}"
|
||||
ln -sf gawk ${HOST_DIR}/bin/awk
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
@@ -0,0 +1,26 @@
|
||||
From 4f67134e0b1404fef4ea72342be8fab4c37ca8c8 Mon Sep 17 00:00:00 2001
|
||||
From: Waldemar Brodkorb <wbx@openadk.org>
|
||||
Date: Mon, 25 Jul 2022 00:29:55 +0200
|
||||
Subject: [PATCH] disable split-stack for non-thread builds
|
||||
|
||||
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
|
||||
[Romain: convert to git format]
|
||||
Signed-off-by: Romain Naour <romain.naour@smile.fr>
|
||||
---
|
||||
libgcc/config/t-stack | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/libgcc/config/t-stack b/libgcc/config/t-stack
|
||||
index cc0366b4cd8..f3f97e86d60 100644
|
||||
--- a/libgcc/config/t-stack
|
||||
+++ b/libgcc/config/t-stack
|
||||
@@ -1,4 +1,6 @@
|
||||
# Makefile fragment to provide generic support for -fsplit-stack.
|
||||
# This should be used in config.host for any host which supports
|
||||
# -fsplit-stack.
|
||||
+ifeq ($(enable_threads),yes)
|
||||
LIB2ADD_ST += $(srcdir)/generic-morestack.c $(srcdir)/generic-morestack-thread.c
|
||||
+endif
|
||||
--
|
||||
2.34.3
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
From 71de45698f60f8feabc0e91336f1e2fb387902df Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
Date: Thu, 18 Jul 2024 23:13:41 +0200
|
||||
Subject: [PATCH] libsanitizer: also undef _TIME_BITS in
|
||||
sanitizer_procmaps_solaris.cpp
|
||||
|
||||
Upstream commit
|
||||
https://github.com/llvm/llvm-project/commit/26800a2c7e7996dc773b4e990dd5cca41c45e1a9
|
||||
of LLVM added a #undef _TIME_BITS in
|
||||
libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp to
|
||||
fix the build on 32-bit Linux platforms that have enabled 64-bit
|
||||
time_t using _TIME_BITS=64.
|
||||
|
||||
Indeed, _TIME_BITS=64 can only be used when _FILE_OFFSET_BITS=64, but
|
||||
sanitizer_platform_limits_posix.cpp undefines _FILE_OFFSET_BITS before
|
||||
including any header file. To fix this, the upstream fix was to also
|
||||
undef _TIME_BITS.
|
||||
|
||||
This commit simply does the same in sanitizer_procmaps_solaris.cpp,
|
||||
which also gets compiled under Linux (despite what the file name
|
||||
says). In practice on Linux hosts (where _TIME_BITS=64 matters),
|
||||
sanitizer_procmaps_solaris.cpp will expand to nothing, as pretty much
|
||||
the rest of the file is inside a #ifdef SANITIZER_SOLARIS...#endif. So
|
||||
the #undef _FILE_OFFSET_BITS and #undef _TIME_BITS are only here
|
||||
before including sanitizer_platform.h, which will set the
|
||||
SANITIZER_LINUX/SANITIZER_SOLARIS define depending on the platform.
|
||||
|
||||
Fixes:
|
||||
|
||||
armeb-buildroot-linux-gnueabi/sysroot/usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
|
||||
26 | # error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
|
||||
|
||||
Upstream: https://gcc.gnu.org/pipermail/gcc-patches/2024-July/657811.html
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp b/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp
|
||||
index eeb49e2afe3..1b23fd4d512 100644
|
||||
--- a/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp
|
||||
+++ b/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
// Before Solaris 11.4, <procfs.h> doesn't work in a largefile environment.
|
||||
#undef _FILE_OFFSET_BITS
|
||||
+#undef _TIME_BITS
|
||||
#include "sanitizer_platform.h"
|
||||
#if SANITIZER_SOLARIS
|
||||
# include <fcntl.h>
|
||||
--
|
||||
2.45.2
|
||||
|
||||
@@ -0,0 +1,286 @@
|
||||
From cd01b277c4a9e03c83427290228e4b289a169431 Mon Sep 17 00:00:00 2001
|
||||
From: Gopi Kumar Bulusu <gopi@sankhya.com>
|
||||
Date: Thu, 10 Jul 2025 12:44:44 +0530
|
||||
Subject: [PATCH] MicroBlaze : Enhance support for atomics. Fix PR118280
|
||||
|
||||
Atomic support enhanced to fix existing atomic_compare_and_swapsi pattern
|
||||
to handle side effects; new patterns atomic_fetch_op and atomic_test_and_set
|
||||
added. As MicroBlaze has no QImode test/set instruction, use shift magic
|
||||
to implement atomic_test_and_set. This fixes PR118280.
|
||||
|
||||
Files Changed
|
||||
|
||||
* gcc/config/microblaze/iterators.md: New
|
||||
* microblaze-protos.h/microblaze.cc : Add microblaze_subword_address
|
||||
* gcc/config/microblaze/microblaze.md: constants: Add UNSPECV_CAS_BOOL,
|
||||
UNSPECV_CAS_MEM, UNSPECV_CAS_VAL, UNSPECV_ATOMIC_FETCH_OP
|
||||
type: add atomic
|
||||
* gcc/config/microblaze/sync.md: Add atomic_fetch_<atomic_optab>si
|
||||
atomic_test_and_set
|
||||
|
||||
Fixes: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118280
|
||||
Upstream: https://patchwork.ozlabs.org/project/gcc/list/?series=466193
|
||||
|
||||
Signed-off-by: Kirk Meyer <kirk.meyer@sencore.com>
|
||||
Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
|
||||
Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
|
||||
---
|
||||
gcc/config/microblaze/iterators.md | 25 +++++
|
||||
gcc/config/microblaze/microblaze-protos.h | 1 +
|
||||
gcc/config/microblaze/microblaze.cc | 28 ++++++
|
||||
gcc/config/microblaze/microblaze.h | 2 +-
|
||||
gcc/config/microblaze/microblaze.md | 7 +-
|
||||
gcc/config/microblaze/sync.md | 107 ++++++++++++++++++----
|
||||
6 files changed, 150 insertions(+), 20 deletions(-)
|
||||
create mode 100644 gcc/config/microblaze/iterators.md
|
||||
|
||||
diff --git a/gcc/config/microblaze/iterators.md b/gcc/config/microblaze/iterators.md
|
||||
new file mode 100644
|
||||
index 00000000000..2ffc2422a0a
|
||||
--- /dev/null
|
||||
+++ b/gcc/config/microblaze/iterators.md
|
||||
@@ -0,0 +1,25 @@
|
||||
+;; Iterator definitions for GCC MicroBlaze machine description files.
|
||||
+;; Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
||||
+;;
|
||||
+;; This file is part of GCC.
|
||||
+;;
|
||||
+;; GCC is free software; you can redistribute it and/or modify
|
||||
+;; it under the terms of the GNU General Public License as published by
|
||||
+;; the Free Software Foundation; either version 3, or (at your option)
|
||||
+;; any later version.
|
||||
+;;
|
||||
+;; GCC is distributed in the hope that it will be useful,
|
||||
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+;; GNU General Public License for more details.
|
||||
+;;
|
||||
+;; You should have received a copy of the GNU General Public License
|
||||
+;; along with GCC; see the file COPYING3. If not see
|
||||
+;; <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+; atomics code iterator
|
||||
+(define_code_iterator any_atomic [plus ior xor and])
|
||||
+
|
||||
+; atomics code attribute
|
||||
+(define_code_attr atomic_optab
|
||||
+ [(plus "add") (ior "or") (xor "xor") (and "and")])
|
||||
diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h
|
||||
index 90b79cfe716..1cee0b3096c 100644
|
||||
--- a/gcc/config/microblaze/microblaze-protos.h
|
||||
+++ b/gcc/config/microblaze/microblaze-protos.h
|
||||
@@ -62,6 +62,7 @@ extern int symbol_mentioned_p (rtx);
|
||||
extern int label_mentioned_p (rtx);
|
||||
extern bool microblaze_cannot_force_const_mem (machine_mode, rtx);
|
||||
extern void microblaze_eh_return (rtx op0);
|
||||
+extern void microblaze_subword_address (rtx, rtx *, rtx *);
|
||||
#endif /* RTX_CODE */
|
||||
|
||||
/* Declare functions in microblaze-c.cc. */
|
||||
diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
|
||||
index 2ab5ada4ec9..80d10ab60e0 100644
|
||||
--- a/gcc/config/microblaze/microblaze.cc
|
||||
+++ b/gcc/config/microblaze/microblaze.cc
|
||||
@@ -1299,6 +1299,34 @@ microblaze_expand_block_move (rtx dest, rtx src, rtx length, rtx align_rtx)
|
||||
return false;
|
||||
}
|
||||
|
||||
+/* Compute memory address *aligned_mem and corresponding shift value (*shift)
|
||||
+ from a QImode memory reference MEM */
|
||||
+void
|
||||
+microblaze_subword_address (rtx mem, rtx *aligned_mem, rtx *shift)
|
||||
+{
|
||||
+ /* Align the memory address to a word. */
|
||||
+ rtx addr = force_reg (Pmode, XEXP (mem, 0));
|
||||
+
|
||||
+ rtx addr_mask = gen_int_mode (-4, Pmode);
|
||||
+
|
||||
+ rtx aligned_addr = gen_reg_rtx (Pmode);
|
||||
+
|
||||
+ emit_move_insn (aligned_addr, gen_rtx_AND (Pmode, addr, addr_mask));
|
||||
+
|
||||
+ *aligned_mem = change_address (mem, SImode, aligned_addr);
|
||||
+
|
||||
+ /* Calculate the shift amount. */
|
||||
+ emit_move_insn (*shift, gen_rtx_AND (SImode, addr, gen_int_mode (3, SImode)));
|
||||
+
|
||||
+ if (TARGET_LITTLE_ENDIAN == 0) {
|
||||
+ emit_move_insn (*shift,
|
||||
+ gen_rtx_MINUS (SImode, gen_int_mode (3, SImode), *shift));
|
||||
+ }
|
||||
+
|
||||
+ emit_move_insn (*shift, gen_rtx_ASHIFT (SImode, *shift,
|
||||
+ gen_int_mode (3, SImode)));
|
||||
+}
|
||||
+
|
||||
static bool
|
||||
microblaze_rtx_costs (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
|
||||
int opno ATTRIBUTE_UNUSED, int *total,
|
||||
diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
|
||||
index 2390542434b..b2e9ccde363 100644
|
||||
--- a/gcc/config/microblaze/microblaze.h
|
||||
+++ b/gcc/config/microblaze/microblaze.h
|
||||
@@ -57,7 +57,7 @@ extern enum pipeline_type microblaze_pipe;
|
||||
|
||||
/* Default target_flags if no switches are specified */
|
||||
#define TARGET_DEFAULT (MASK_SOFT_MUL | MASK_SOFT_DIV | MASK_SOFT_FLOAT \
|
||||
- | TARGET_ENDIAN_DEFAULT)
|
||||
+ | TARGET_ENDIAN_DEFAULT)
|
||||
|
||||
/* Do we have CLZ? */
|
||||
#define TARGET_HAS_CLZ (TARGET_PATTERN_COMPARE && microblaze_has_clz)
|
||||
diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
|
||||
index 45c48a71e8d..270df8da0c5 100644
|
||||
--- a/gcc/config/microblaze/microblaze.md
|
||||
+++ b/gcc/config/microblaze/microblaze.md
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
(include "constraints.md")
|
||||
(include "predicates.md")
|
||||
+(include "iterators.md")
|
||||
|
||||
;;----------------------------------------------------
|
||||
;; Constants
|
||||
@@ -43,6 +44,10 @@
|
||||
(UNSPEC_TLS 106) ;; jump table
|
||||
(UNSPEC_SET_TEXT 107) ;; set text start
|
||||
(UNSPEC_TEXT 108) ;; data text relative
|
||||
+ (UNSPECV_CAS_BOOL 201) ;; compare and swap (bool)
|
||||
+ (UNSPECV_CAS_VAL 202) ;; compare and swap (val)
|
||||
+ (UNSPECV_CAS_MEM 203) ;; compare and swap (mem)
|
||||
+ (UNSPECV_ATOMIC_FETCH_OP 204) ;; atomic fetch op
|
||||
])
|
||||
|
||||
(define_c_enum "unspec" [
|
||||
@@ -79,7 +84,7 @@
|
||||
;; bshift Shift operations
|
||||
|
||||
(define_attr "type"
|
||||
- "unknown,branch,jump,call,load,store,move,arith,darith,imul,idiv,icmp,multi,nop,no_delay_arith,no_delay_load,no_delay_store,no_delay_imul,no_delay_move,bshift,fadd,frsub,fmul,fdiv,fcmp,fsl,fsqrt,fcvt,trap"
|
||||
+ "unknown,branch,jump,call,load,store,move,arith,darith,imul,idiv,icmp,multi,nop,no_delay_arith,no_delay_load,no_delay_store,no_delay_imul,no_delay_move,bshift,fadd,frsub,fmul,fdiv,fcmp,fsl,fsqrt,fcvt,trap,atomic"
|
||||
(const_string "unknown"))
|
||||
|
||||
;; Main data type used by the insn
|
||||
diff --git a/gcc/config/microblaze/sync.md b/gcc/config/microblaze/sync.md
|
||||
index db7b11e5379..6478ab6dcac 100644
|
||||
--- a/gcc/config/microblaze/sync.md
|
||||
+++ b/gcc/config/microblaze/sync.md
|
||||
@@ -18,26 +18,97 @@
|
||||
;; <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define_insn "atomic_compare_and_swapsi"
|
||||
- [(match_operand:SI 0 "register_operand" "=&d") ;; bool output
|
||||
- (match_operand:SI 1 "register_operand" "=&d") ;; val output
|
||||
- (match_operand:SI 2 "nonimmediate_operand" "+Q") ;; memory
|
||||
- (match_operand:SI 3 "register_operand" "d") ;; expected value
|
||||
- (match_operand:SI 4 "register_operand" "d") ;; desired value
|
||||
- (match_operand:SI 5 "const_int_operand" "") ;; is_weak
|
||||
- (match_operand:SI 6 "const_int_operand" "") ;; mod_s
|
||||
- (match_operand:SI 7 "const_int_operand" "") ;; mod_f
|
||||
+ [(set (match_operand:SI 0 "register_operand" "=&d") ;; bool output
|
||||
+ (unspec_volatile:SI
|
||||
+ [(match_operand:SI 2 "nonimmediate_operand" "+Q") ;; memory
|
||||
+ (match_operand:SI 3 "register_operand" "d") ;; expected value
|
||||
+ (match_operand:SI 4 "register_operand" "d")] ;; desired value
|
||||
+ UNSPECV_CAS_BOOL))
|
||||
+ (set (match_operand:SI 1 "register_operand" "=&d") ;; val output
|
||||
+ (unspec_volatile:SI [(const_int 0)] UNSPECV_CAS_VAL))
|
||||
+ (set (match_dup 2)
|
||||
+ (unspec_volatile:SI [(const_int 0)] UNSPECV_CAS_MEM))
|
||||
+ (match_operand:SI 5 "const_int_operand" "") ;; is_weak
|
||||
+ (match_operand:SI 6 "const_int_operand" "") ;; mod_s
|
||||
+ (match_operand:SI 7 "const_int_operand" "") ;; mod_f
|
||||
(clobber (match_scratch:SI 8 "=&d"))]
|
||||
""
|
||||
{
|
||||
- output_asm_insn ("addc \tr0,r0,r0", operands);
|
||||
- output_asm_insn ("lwx \t%1,%y2,r0", operands);
|
||||
- output_asm_insn ("addic\t%8,r0,0", operands);
|
||||
- output_asm_insn ("bnei \t%8,.-8", operands);
|
||||
- output_asm_insn ("cmp \t%0,%1,%3", operands);
|
||||
- output_asm_insn ("bnei \t%0,.+16", operands);
|
||||
- output_asm_insn ("swx \t%4,%y2,r0", operands);
|
||||
- output_asm_insn ("addic\t%8,r0,0", operands);
|
||||
- output_asm_insn ("bnei \t%8,.-28", operands);
|
||||
- return "";
|
||||
+ return "add \t%0,r0,r0\n\t"
|
||||
+ "lwx \t%1,%y2,r0\n\t"
|
||||
+ "addic\t%8,r0,0\n\t"
|
||||
+ "bnei \t%8,.-8\n\t"
|
||||
+ "cmp \t%8,%1,%3\n\t"
|
||||
+ "bnei \t%8,.+20\n\t"
|
||||
+ "swx \t%4,%y2,r0\n\t"
|
||||
+ "addic\t%8,r0,0\n\t"
|
||||
+ "bnei \t%8,.-28\n\t"
|
||||
+ "addi \t%0,r0,1";
|
||||
}
|
||||
+ [(set_attr "type" "atomic")
|
||||
+ (set_attr "mode" "SI")
|
||||
+ (set_attr "length" "40")]
|
||||
)
|
||||
+
|
||||
+;;
|
||||
+;;
|
||||
+;;
|
||||
+;;
|
||||
+(define_insn "atomic_fetch_<atomic_optab>si"
|
||||
+ [(set (match_operand:SI 0 "register_operand" "=&d")
|
||||
+ (match_operand:SI 1 "memory_operand" "+Q"))
|
||||
+ (set (match_dup 1)
|
||||
+ (unspec_volatile:SI
|
||||
+ [(any_atomic:SI (match_dup 1)
|
||||
+ (match_operand:SI 2 "register_operand" "d"))
|
||||
+ (match_operand:SI 3 "const_int_operand")] ;; model
|
||||
+ UNSPECV_ATOMIC_FETCH_OP))
|
||||
+ (clobber (match_scratch:SI 4 "=&d"))] ;; tmp_1
|
||||
+ ""
|
||||
+ {
|
||||
+ return
|
||||
+ "lwx \t%0,%y1,r0\n\t"
|
||||
+ "addic\t%4,r0,0\n\t"
|
||||
+ "bnei \t%4,.-8\n\t"
|
||||
+ "<atomic_optab>\t%4,%0,%2\n\t"
|
||||
+ "swx \t%4,%y1,r0\n\t"
|
||||
+ "addic\t%4,r0,0\n\t"
|
||||
+ "bnei \t%4,.-24";
|
||||
+ }
|
||||
+ [(set_attr "type" "atomic")
|
||||
+ (set_attr "mode" "SI")
|
||||
+ (set_attr "length" "28")])
|
||||
+
|
||||
+;;
|
||||
+;; MicroBlaze only supports lx/sx instructions for word mode only
|
||||
+;;
|
||||
+;; Use shift|mask magic to implement atomic_test_and_set using lwx/swx
|
||||
+;;
|
||||
+(define_expand "atomic_test_and_set"
|
||||
+ [(match_operand:QI 0 "register_operand" "") ;; bool output
|
||||
+ (match_operand:QI 1 "memory_operand" "m") ;; memory
|
||||
+ (match_operand:SI 2 "const_int_operand" "")] ;; model
|
||||
+ ""
|
||||
+{
|
||||
+ rtx old = gen_reg_rtx (SImode);
|
||||
+ rtx mem = operands[1];
|
||||
+ rtx model = operands[2];
|
||||
+ rtx set = gen_reg_rtx (SImode);
|
||||
+ rtx aligned_mem = gen_reg_rtx (SImode);
|
||||
+ rtx shift = gen_reg_rtx (SImode);
|
||||
+
|
||||
+ microblaze_subword_address (mem, &aligned_mem, &shift);
|
||||
+
|
||||
+ emit_move_insn (set, GEN_INT (1));
|
||||
+ rtx shifted_set = gen_reg_rtx (SImode);
|
||||
+
|
||||
+ emit_move_insn (shifted_set, gen_rtx_ASHIFT (SImode, set, shift));
|
||||
+
|
||||
+ emit_insn (gen_atomic_fetch_orsi (old, aligned_mem, shifted_set, model));
|
||||
+
|
||||
+ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old, shift));
|
||||
+
|
||||
+ emit_move_insn (operands[0], gen_lowpart (QImode, old));
|
||||
+
|
||||
+ DONE;
|
||||
+})
|
||||
--
|
||||
2.43.5
|
||||
|
||||
41
package/gcc/make-final.sh
Executable file
41
package/gcc/make-final.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=gcc
|
||||
PKGVERSION=14.3.0
|
||||
PKGSOURCE_DIR=gcc
|
||||
PKGSOURCE=gcc-14.3.0.tar.xz
|
||||
PKGURL=http://mirrors.ustc.edu.cn/gnu/gcc/gcc-14.3.0/gcc-14.3.0.tar.xz
|
||||
|
||||
PKGBUILDNAME=${PKGNAME}-final
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
stamp_patched
|
||||
|
||||
stamp_configured
|
||||
|
||||
stamp_built
|
||||
|
||||
step_start install-staging
|
||||
cp -dpf ${HOST_DIR}/${GNU_TARGET_NAME}/lib*/libatomic* ${STAGING_DIR}/lib/
|
||||
cp -dpf ${HOST_DIR}/${GNU_TARGET_NAME}/lib*/libgcc_s* ${STAGING_DIR}/lib/
|
||||
step_end install-staging
|
||||
|
||||
step_start install-target
|
||||
mkdir -p ${TARGET_DIR}/lib ${TARGET_DIR}/usr/lib
|
||||
cp -dpf ${HOST_DIR}/${GNU_TARGET_NAME}/lib*/libatomic.so* ${TARGET_DIR}/lib/
|
||||
cp -dpf ${HOST_DIR}/${GNU_TARGET_NAME}/lib*/libgcc_s.so* ${TARGET_DIR}/lib/
|
||||
step_end install-target
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
68
package/gcc/make-host-final.sh
Executable file
68
package/gcc/make-host-final.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=gcc
|
||||
PKGVERSION=14.3.0
|
||||
PKGSOURCE_DIR=gcc
|
||||
PKGSOURCE=gcc-14.3.0.tar.xz
|
||||
PKGURL=http://mirrors.ustc.edu.cn/gnu/gcc/gcc-14.3.0/gcc-14.3.0.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}-final
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} --exclude='libjava/*' --exclude='libgo/*' -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME}/14.3.0 \*.patch || exit 1
|
||||
step_end patch autotools
|
||||
|
||||
step_start configure
|
||||
mkdir -p ${PKGBUILD_DIR}/build
|
||||
ln -sf ../configure ${PKGBUILD_DIR}/build/configure
|
||||
(cd ${PKGBUILD_DIR}/build && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} CFLAGS=\"-O2 -I${HOST_DIR}/include\" LDFLAGS=\"-L${HOST_DIR}/lib -Wl,-rpath,${HOST_DIR}/lib\" MAKEINFO=missing CFLAGS_FOR_TARGET=\"-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1 \" CXXFLAGS_FOR_TARGET=\"-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1 \" LDFLAGS_FOR_TARGET=\" \" AR_FOR_TARGET=gcc-ar NM_FOR_TARGET=gcc-nm RANLIB_FOR_TARGET=gcc-ranlib ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --enable-static --target=${GNU_TARGET_NAME} --with-sysroot=${STAGING_DIR} --enable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib --disable-decimal-float --enable-plugins --enable-lto --with-gmp=${HOST_DIR} --with-mpc=${HOST_DIR} --with-mpfr=${HOST_DIR} --without-zstd --disable-libquadmath --disable-libquadmath-support --enable-tls --enable-threads --without-isl --without-cloog --with-arch=\"rv64imafd_zicsr_zifencei\" --with-abi=\"lp64d\" --enable-languages=c --with-build-time-tools=${HOST_DIR}/${GNU_TARGET_NAME}/bin --enable-shared --disable-libgomp")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} gcc_cv_prog_makeinfo_modern=no gcc_cv_libc_provides_ssp=yes -C ${PKGBUILD_DIR}/build"
|
||||
/usr/bin/gcc -O2 -I${HOST_DIR}/include -DBR_CROSS_PATH_SUFFIX='".br_real"' -DBR_SYSROOT="\"${STAGING_SUBDIR}\"" -DBR_ADDITIONAL_CFLAGS='"-fstack-protector-strong",' -DBR2_PIC_PIE -DBR2_RELRO_FULL -s -Wl,--hash-style=both ${PROJECT_DIR}/package/${PKGNAME}/toolchain-wrapper.c -o ${PKGBUILD_DIR}/toolchain-wrapper
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}/build"
|
||||
if [ ! -e ${HOST_DIR}/bin/${GNU_TARGET_NAME}-cc ]; then
|
||||
ln -f ${HOST_DIR}/bin/${GNU_TARGET_NAME}-gcc ${HOST_DIR}/bin/${GNU_TARGET_NAME}-cc;
|
||||
fi
|
||||
/usr/bin/install -D -m 0755 ${PKGBUILD_DIR}/toolchain-wrapper ${HOST_DIR}/bin/toolchain-wrapper
|
||||
cd ${HOST_DIR}/bin;
|
||||
for i in ${GNU_TARGET_NAME}-*; do
|
||||
case "$i" in
|
||||
*.br_real)
|
||||
;;
|
||||
*-ar|*-ranlib|*-nm)
|
||||
ln -snf $i ${ARCH}-linux${i##${GNU_TARGET_NAME}};
|
||||
;;
|
||||
*cc|*cc-*|*++|*++-*|*cpp|*-gfortran|*-gdc)
|
||||
rm -f $i.br_real;
|
||||
mv $i $i.br_real;
|
||||
ln -sf toolchain-wrapper $i;
|
||||
ln -sf toolchain-wrapper ${ARCH}-linux${i##${GNU_TARGET_NAME}};
|
||||
ln -snf $i.br_real ${ARCH}-linux${i##${GNU_TARGET_NAME}}.br_real;
|
||||
;;
|
||||
*)
|
||||
ln -snf $i ${ARCH}-linux${i##${GNU_TARGET_NAME}};
|
||||
;;
|
||||
esac;
|
||||
done
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
65
package/gcc/make-host-initial.sh
Executable file
65
package/gcc/make-host-initial.sh
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=gcc
|
||||
PKGVERSION=14.3.0
|
||||
PKGSOURCE_DIR=gcc
|
||||
PKGSOURCE=gcc-14.3.0.tar.xz
|
||||
PKGURL=http://mirrors.ustc.edu.cn/gnu/gcc/gcc-14.3.0/gcc-14.3.0.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}-initial
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} --exclude='libjava/*' --exclude='libgo/*' -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME}/14.3.0 \*.patch || exit 1
|
||||
step_end patch autotools
|
||||
|
||||
step_start configure
|
||||
mkdir -p ${PKGBUILD_DIR}/build
|
||||
ln -sf ../configure ${PKGBUILD_DIR}/build/configure
|
||||
(cd ${PKGBUILD_DIR}/build && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} MAKEINFO=missing CFLAGS_FOR_TARGET=\"-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1 \" CXXFLAGS_FOR_TARGET=\"-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1 \" LDFLAGS_FOR_TARGET=\" \" AR_FOR_TARGET=gcc-ar NM_FOR_TARGET=gcc-nm RANLIB_FOR_TARGET=gcc-ranlib CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking --target=${GNU_TARGET_NAME} --with-sysroot=${STAGING_DIR} --enable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib --disable-decimal-float --enable-plugins --enable-lto --with-gmp=${HOST_DIR} --with-mpc=${HOST_DIR} --with-mpfr=${HOST_DIR} --without-zstd --disable-libquadmath --disable-libquadmath-support --enable-tls --enable-threads --without-isl --without-cloog --with-arch=\"rv64imafd_zicsr_zifencei\" --with-abi=\"lp64d\" --enable-languages=c --disable-shared --without-headers --disable-threads --with-newlib --disable-largefile")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} gcc_cv_prog_makeinfo_modern=no gcc_cv_libc_provides_ssp=yes all-gcc all-target-libgcc -C ${PKGBUILD_DIR}/build"
|
||||
/usr/bin/gcc -O2 -I${HOST_DIR}/include -DBR_CROSS_PATH_SUFFIX='".br_real"' -DBR_SYSROOT="\"${STAGING_SUBDIR}\"" -DBR_ADDITIONAL_CFLAGS='"-fstack-protector-strong",' -DBR2_PIC_PIE -DBR2_RELRO_FULL -s -Wl,--hash-style=both ${PROJECT_DIR}/package/${PKGNAME}/toolchain-wrapper.c -o ${PKGBUILD_DIR}/toolchain-wrapper
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install-gcc install-target-libgcc -C ${PKGBUILD_DIR}/build"
|
||||
/usr/bin/install -D -m 0755 ${PKGBUILD_DIR}/toolchain-wrapper ${HOST_DIR}/bin/toolchain-wrapper
|
||||
cd ${HOST_DIR}/bin;
|
||||
for i in ${GNU_TARGET_NAME}-*; do
|
||||
case "$i" in
|
||||
*.br_real)
|
||||
;;
|
||||
*-ar|*-ranlib|*-nm)
|
||||
ln -snf $i ${ARCH}-linux${i##${GNU_TARGET_NAME}};
|
||||
;;
|
||||
*cc|*cc-*|*++|*++-*|*cpp|*-gfortran|*-gdc)
|
||||
rm -f $i.br_real;
|
||||
mv $i $i.br_real;
|
||||
ln -sf toolchain-wrapper $i;
|
||||
ln -sf toolchain-wrapper ${ARCH}-linux${i##${GNU_TARGET_NAME}};
|
||||
ln -snf $i.br_real ${ARCH}-linux${i##${GNU_TARGET_NAME}}.br_real;
|
||||
;;
|
||||
*)
|
||||
ln -snf $i ${ARCH}-linux${i##${GNU_TARGET_NAME}};
|
||||
;;
|
||||
esac;
|
||||
done
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
554
package/gcc/toolchain-wrapper.c
Normal file
554
package/gcc/toolchain-wrapper.c
Normal file
@@ -0,0 +1,554 @@
|
||||
/**
|
||||
* Buildroot wrapper for toolchains. This simply executes the real toolchain
|
||||
* with a number of arguments (sysroot/arch/..) hardcoded, to ensure the
|
||||
* toolchain uses the correct configuration.
|
||||
* The hardcoded path arguments are defined relative to the actual location
|
||||
* of the binary.
|
||||
*
|
||||
* (C) 2011 Peter Korsgaard <jacmet@sunsite.dk>
|
||||
* (C) 2011 Daniel Nyström <daniel.nystrom@timeterminal.se>
|
||||
* (C) 2012 Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
|
||||
* (C) 2013 Spenser Gilliland <spenser@gillilanding.com>
|
||||
*
|
||||
* This file is licensed under the terms of the GNU General Public License
|
||||
* version 2. This program is licensed "as is" without any warranty of any
|
||||
* kind, whether express or implied.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef BR_CCACHE
|
||||
static char ccache_path[PATH_MAX];
|
||||
#endif
|
||||
static char path[PATH_MAX];
|
||||
static char sysroot[PATH_MAX];
|
||||
/* As would be defined by gcc:
|
||||
* https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
|
||||
* sizeof() on string literals includes the terminating \0. */
|
||||
static char _time_[sizeof("-D__TIME__=\"HH:MM:SS\"")];
|
||||
static char _date_[sizeof("-D__DATE__=\"MMM DD YYYY\"")];
|
||||
|
||||
/* Maximum amount of arguments to reserve space for by default.
|
||||
Must be > predef_args */
|
||||
#define DEFAULT_MAX_ARGS 1024
|
||||
|
||||
static char *predef_args[] = {
|
||||
#ifdef BR_CCACHE
|
||||
ccache_path,
|
||||
#endif
|
||||
path,
|
||||
"--sysroot", sysroot,
|
||||
#ifdef BR_CLANG_CONFIG_FILE
|
||||
BR_CLANG_CONFIG_FILE,
|
||||
#endif
|
||||
#ifdef BR_ABI
|
||||
"-mabi=" BR_ABI,
|
||||
#endif
|
||||
#ifdef BR_NAN
|
||||
"-mnan=" BR_NAN,
|
||||
#endif
|
||||
#ifdef BR_FPU
|
||||
"-mfpu=" BR_FPU,
|
||||
#endif
|
||||
#ifdef BR_SOFTFLOAT
|
||||
"-msoft-float",
|
||||
#endif /* BR_SOFTFLOAT */
|
||||
#ifdef BR_SIMD
|
||||
"-msimd=" BR_SIMD,
|
||||
#endif
|
||||
#ifdef BR_MODE
|
||||
"-m" BR_MODE,
|
||||
#endif
|
||||
#ifdef BR_64
|
||||
"-m64",
|
||||
#endif
|
||||
#ifdef BR_OMIT_LOCK_PREFIX
|
||||
"-Wa,-momit-lock-prefix=yes",
|
||||
#endif
|
||||
#ifdef BR_NO_FUSED_MADD
|
||||
"-mno-fused-madd",
|
||||
#endif
|
||||
#ifdef BR_FP_CONTRACT_OFF
|
||||
"-ffp-contract=off",
|
||||
#endif
|
||||
#ifdef BR_BINFMT_FLAT
|
||||
"-Wl,-elf2flt",
|
||||
#endif
|
||||
#ifdef BR_MIPS_TARGET_LITTLE_ENDIAN
|
||||
"-EL",
|
||||
#endif
|
||||
#if defined(BR_MIPS_TARGET_BIG_ENDIAN) || defined(BR_ARC_TARGET_BIG_ENDIAN)
|
||||
"-EB",
|
||||
#endif
|
||||
#ifdef BR_ADDITIONAL_CFLAGS
|
||||
BR_ADDITIONAL_CFLAGS
|
||||
#endif
|
||||
};
|
||||
|
||||
/* A {string,length} tuple, to avoid computing strlen() on constants.
|
||||
* - str must be a \0-terminated string
|
||||
* - len does not account for the terminating '\0'
|
||||
*/
|
||||
struct str_len_s {
|
||||
const char *str;
|
||||
size_t len;
|
||||
};
|
||||
|
||||
/* Define a {string,length} tuple. Takes an unquoted constant string as
|
||||
* parameter. sizeof() on a string literal includes the terminating \0,
|
||||
* but we don't want to count it.
|
||||
*/
|
||||
#define STR_LEN(s) { #s, sizeof(#s)-1 }
|
||||
|
||||
/* List of paths considered unsafe for cross-compilation.
|
||||
*
|
||||
* An unsafe path is one that points to a directory with libraries or
|
||||
* headers for the build machine, which are not suitable for the target.
|
||||
*/
|
||||
static const struct str_len_s unsafe_paths[] = {
|
||||
STR_LEN(/lib),
|
||||
STR_LEN(/usr/include),
|
||||
STR_LEN(/usr/lib),
|
||||
STR_LEN(/usr/local/include),
|
||||
STR_LEN(/usr/local/lib),
|
||||
STR_LEN(/usr/X11R6/include),
|
||||
STR_LEN(/usr/X11R6/lib),
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
/* Unsafe options are options that specify a potentially unsafe path,
|
||||
* that will be checked by check_unsafe_path(), below.
|
||||
*/
|
||||
static const struct str_len_s unsafe_opts[] = {
|
||||
STR_LEN(-I),
|
||||
STR_LEN(-idirafter),
|
||||
STR_LEN(-iquote),
|
||||
STR_LEN(-isystem),
|
||||
STR_LEN(-L),
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
/* Check if path is unsafe for cross-compilation. Unsafe paths are those
|
||||
* pointing to the standard native include or library paths.
|
||||
*
|
||||
* We print the arguments leading to the failure. For some options, gcc
|
||||
* accepts the path to be concatenated to the argument (e.g. -I/foo/bar)
|
||||
* or separated (e.g. -I /foo/bar). In the first case, we need only print
|
||||
* the argument as it already contains the path (arg_has_path), while in
|
||||
* the second case we need to print both (!arg_has_path).
|
||||
*/
|
||||
static void check_unsafe_path(const char *arg,
|
||||
const char *path,
|
||||
int arg_has_path)
|
||||
{
|
||||
const struct str_len_s *p;
|
||||
|
||||
for (p=unsafe_paths; p->str; p++) {
|
||||
if (strncmp(path, p->str, p->len))
|
||||
continue;
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: unsafe header/library path used in cross-compilation: '%s%s%s'\n",
|
||||
program_invocation_short_name,
|
||||
arg,
|
||||
arg_has_path ? "" : "' '", /* close single-quote, space, open single-quote */
|
||||
arg_has_path ? "" : path); /* so that arg and path are properly quoted. */
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BR_NEED_SOURCE_DATE_EPOCH
|
||||
/* Returns false if SOURCE_DATE_EPOCH was not defined in the environment.
|
||||
*
|
||||
* Returns true if SOURCE_DATE_EPOCH is in the environment and represent
|
||||
* a valid timestamp, in which case the timestamp is formatted into the
|
||||
* global variables _date_ and _time_.
|
||||
*
|
||||
* Aborts if SOURCE_DATE_EPOCH was set in the environment but did not
|
||||
* contain a valid timestamp.
|
||||
*
|
||||
* Valid values are defined in the spec:
|
||||
* https://reproducible-builds.org/specs/source-date-epoch/
|
||||
* but we further restrict them to be positive or null.
|
||||
*/
|
||||
bool parse_source_date_epoch_from_env(void)
|
||||
{
|
||||
char *epoch_env, *endptr;
|
||||
time_t epoch;
|
||||
struct tm epoch_tm;
|
||||
|
||||
if ((epoch_env = getenv("SOURCE_DATE_EPOCH")) == NULL)
|
||||
return false;
|
||||
errno = 0;
|
||||
epoch = (time_t) strtoll(epoch_env, &endptr, 10);
|
||||
/* We just need to test if it is incorrect, but we do not
|
||||
* care why it is incorrect.
|
||||
*/
|
||||
if ((errno != 0) || !*epoch_env || *endptr || (epoch < 0)) {
|
||||
fprintf(stderr, "%s: invalid SOURCE_DATE_EPOCH='%s'\n",
|
||||
program_invocation_short_name,
|
||||
epoch_env);
|
||||
exit(1);
|
||||
}
|
||||
tzset(); /* For localtime_r(), below. */
|
||||
if (localtime_r(&epoch, &epoch_tm) == NULL) {
|
||||
fprintf(stderr, "%s: cannot parse SOURCE_DATE_EPOCH=%s\n",
|
||||
program_invocation_short_name,
|
||||
getenv("SOURCE_DATE_EPOCH"));
|
||||
exit(1);
|
||||
}
|
||||
if (!strftime(_time_, sizeof(_time_), "-D__TIME__=\"%T\"", &epoch_tm)) {
|
||||
fprintf(stderr, "%s: cannot set time from SOURCE_DATE_EPOCH=%s\n",
|
||||
program_invocation_short_name,
|
||||
getenv("SOURCE_DATE_EPOCH"));
|
||||
exit(1);
|
||||
}
|
||||
if (!strftime(_date_, sizeof(_date_), "-D__DATE__=\"%b %e %Y\"", &epoch_tm)) {
|
||||
fprintf(stderr, "%s: cannot set date from SOURCE_DATE_EPOCH=%s\n",
|
||||
program_invocation_short_name,
|
||||
getenv("SOURCE_DATE_EPOCH"));
|
||||
exit(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
bool parse_source_date_epoch_from_env(void)
|
||||
{
|
||||
/* The compiler is recent enough to handle SOURCE_DATE_EPOCH itself
|
||||
* so we do not need to do anything here.
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char **args, **cur, **exec_args;
|
||||
char *relbasedir, *absbasedir;
|
||||
char *progpath = argv[0];
|
||||
char *basename;
|
||||
char *env_debug;
|
||||
int ret, i, count = 0, debug = 0, found_shared = 0, found_nonoption = 0;
|
||||
size_t n_args;
|
||||
|
||||
/* Debug the wrapper to see arguments it was called with.
|
||||
* If environment variable BR2_DEBUG_WRAPPER is:
|
||||
* unset, empty, or 0: do not trace
|
||||
* set to 1 : trace all arguments on a single line
|
||||
* set to 2 : trace one argument per line
|
||||
*/
|
||||
if ((env_debug = getenv("BR2_DEBUG_WRAPPER"))) {
|
||||
debug = atoi(env_debug);
|
||||
}
|
||||
if (debug > 0) {
|
||||
fprintf(stderr, "Toolchain wrapper was called with:");
|
||||
for (i = 0; i < argc; i++)
|
||||
fprintf(stderr, "%s'%s'",
|
||||
(debug == 2) ? "\n " : " ", argv[i]);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
/* Calculate the relative paths */
|
||||
basename = strrchr(progpath, '/');
|
||||
if (basename) {
|
||||
*basename = '\0';
|
||||
basename++;
|
||||
relbasedir = malloc(strlen(progpath) + 7);
|
||||
if (relbasedir == NULL) {
|
||||
perror(__FILE__ ": malloc");
|
||||
return 2;
|
||||
}
|
||||
sprintf(relbasedir, "%s/..", argv[0]);
|
||||
absbasedir = realpath(relbasedir, NULL);
|
||||
} else {
|
||||
basename = progpath;
|
||||
absbasedir = malloc(PATH_MAX + 1);
|
||||
ret = readlink("/proc/self/exe", absbasedir, PATH_MAX);
|
||||
if (ret < 0) {
|
||||
perror(__FILE__ ": readlink");
|
||||
return 2;
|
||||
}
|
||||
absbasedir[ret] = '\0';
|
||||
for (i = ret; i > 0; i--) {
|
||||
if (absbasedir[i] == '/') {
|
||||
absbasedir[i] = '\0';
|
||||
if (++count == 2)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (absbasedir == NULL) {
|
||||
perror(__FILE__ ": realpath");
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Fill in the relative paths */
|
||||
#ifdef BR_CROSS_PATH_REL
|
||||
ret = snprintf(path, sizeof(path), "%s/" BR_CROSS_PATH_REL "/%s" BR_CROSS_PATH_SUFFIX, absbasedir, basename);
|
||||
#elif defined(BR_CROSS_PATH_ABS)
|
||||
ret = snprintf(path, sizeof(path), BR_CROSS_PATH_ABS "/%s" BR_CROSS_PATH_SUFFIX, basename);
|
||||
#else
|
||||
ret = snprintf(path, sizeof(path), "%s/bin/%s" BR_CROSS_PATH_SUFFIX, absbasedir, basename);
|
||||
#endif
|
||||
if (ret >= sizeof(path)) {
|
||||
perror(__FILE__ ": overflow");
|
||||
return 3;
|
||||
}
|
||||
|
||||
/* any non-option (E.G. source / object files) arguments passed? */
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (argv[i][0] != '-') {
|
||||
found_nonoption = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for unsafe library and header paths */
|
||||
for (i = 1; i < argc; i++) {
|
||||
const struct str_len_s *opt;
|
||||
for (opt=unsafe_opts; opt->str; opt++ ) {
|
||||
/* Skip any non-unsafe option. */
|
||||
if (strncmp(argv[i], opt->str, opt->len))
|
||||
continue;
|
||||
|
||||
/* Handle both cases:
|
||||
* - path is a separate argument,
|
||||
* - path is concatenated with option.
|
||||
*/
|
||||
if (argv[i][opt->len] == '\0') {
|
||||
i++;
|
||||
if (i == argc)
|
||||
break;
|
||||
check_unsafe_path(argv[i-1], argv[i], 0);
|
||||
} else
|
||||
check_unsafe_path(argv[i], argv[i] + opt->len, 1);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BR_CCACHE
|
||||
ret = snprintf(ccache_path, sizeof(ccache_path), "%s/bin/ccache", absbasedir);
|
||||
if (ret >= sizeof(ccache_path)) {
|
||||
perror(__FILE__ ": overflow");
|
||||
return 3;
|
||||
}
|
||||
#endif
|
||||
ret = snprintf(sysroot, sizeof(sysroot), "%s/" BR_SYSROOT, absbasedir);
|
||||
if (ret >= sizeof(sysroot)) {
|
||||
perror(__FILE__ ": overflow");
|
||||
return 3;
|
||||
}
|
||||
|
||||
cur = args = malloc(DEFAULT_MAX_ARGS * sizeof(char *));
|
||||
if (args == NULL) {
|
||||
perror(__FILE__ ": malloc");
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* start with predefined args */
|
||||
for (i = 0; i < sizeof(predef_args) / sizeof(predef_args[0]); i++) {
|
||||
/* skip linker flags when we know we are not linking */
|
||||
if (found_nonoption || strncmp(predef_args[i], "-Wl,", strlen("-Wl,")))
|
||||
*cur++ = predef_args[i];
|
||||
}
|
||||
|
||||
#ifdef BR_FLOAT_ABI
|
||||
/* add float abi if not overridden in args */
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strncmp(argv[i], "-mfloat-abi=", strlen("-mfloat-abi=")) ||
|
||||
!strcmp(argv[i], "-msoft-float") ||
|
||||
!strcmp(argv[i], "-mhard-float"))
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == argc)
|
||||
*cur++ = "-mfloat-abi=" BR_FLOAT_ABI;
|
||||
#endif
|
||||
|
||||
#ifdef BR_FP32_MODE
|
||||
/* add fp32 mode if soft-float is not args or hard-float overrides soft-float */
|
||||
int add_fp32_mode = 1;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "-msoft-float"))
|
||||
add_fp32_mode = 0;
|
||||
else if (!strcmp(argv[i], "-mhard-float"))
|
||||
add_fp32_mode = 1;
|
||||
}
|
||||
|
||||
if (add_fp32_mode == 1)
|
||||
*cur++ = "-mfp" BR_FP32_MODE;
|
||||
#endif
|
||||
|
||||
#if defined(BR_ARCH) || \
|
||||
defined(BR_CPU)
|
||||
/* Add our -march/cpu flags, but only if none of
|
||||
* -march/mtune/mcpu are already specified on the commandline
|
||||
*/
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strncmp(argv[i], "-march=", strlen("-march=")) ||
|
||||
!strncmp(argv[i], "-mtune=", strlen("-mtune=")) ||
|
||||
!strncmp(argv[i], "-mcpu=", strlen("-mcpu=" )))
|
||||
break;
|
||||
}
|
||||
if (i == argc) {
|
||||
#ifdef BR_ARCH
|
||||
*cur++ = "-march=" BR_ARCH;
|
||||
#endif
|
||||
#ifdef BR_CPU
|
||||
*cur++ = "-mcpu=" BR_CPU;
|
||||
#endif
|
||||
}
|
||||
#endif /* ARCH || CPU */
|
||||
|
||||
if (parse_source_date_epoch_from_env()) {
|
||||
*cur++ = _time_;
|
||||
*cur++ = _date_;
|
||||
/* This has existed since gcc-4.4.0. */
|
||||
*cur++ = "-Wno-builtin-macro-redefined";
|
||||
}
|
||||
|
||||
#ifdef BR2_PIC_PIE
|
||||
/* Patterned after Fedora/Gentoo hardening approaches.
|
||||
* https://fedoraproject.org/wiki/Changes/Harden_All_Packages
|
||||
* https://wiki.gentoo.org/wiki/Hardened/Toolchain#Position_Independent_Executables_.28PIEs.29
|
||||
*
|
||||
* A few checks are added to allow disabling of PIE
|
||||
* 1) -fno-pie and -no-pie are used by other distros to disable PIE in
|
||||
* cases where the compiler enables it by default. The logic below
|
||||
* maintains that behavior.
|
||||
* Ref: https://wiki.ubuntu.com/SecurityTeam/PIE
|
||||
* 2) A check for -fno-PIE has been used in older Linux Kernel builds
|
||||
* in a similar way to -fno-pie or -no-pie.
|
||||
* 3) A check is added for Kernel and U-boot defines
|
||||
* (-D__KERNEL__ and -D__UBOOT__).
|
||||
*/
|
||||
for (i = 1; i < argc; i++) {
|
||||
/* Apply all incompatible link flag and disable checks first */
|
||||
if (!strcmp(argv[i], "-r") ||
|
||||
!strcmp(argv[i], "-Wl,-r") ||
|
||||
!strcmp(argv[i], "-static") ||
|
||||
!strcmp(argv[i], "-D__KERNEL__") ||
|
||||
!strcmp(argv[i], "-D__UBOOT__") ||
|
||||
!strcmp(argv[i], "-fno-pie") ||
|
||||
!strcmp(argv[i], "-fno-PIE") ||
|
||||
!strcmp(argv[i], "-no-pie"))
|
||||
break;
|
||||
/* Record that shared was present which disables -pie but don't
|
||||
* break out of loop as a check needs to occur that possibly
|
||||
* still allows -fPIE to be set
|
||||
*/
|
||||
if (!strcmp(argv[i], "-shared"))
|
||||
found_shared = 1;
|
||||
}
|
||||
|
||||
if (i == argc) {
|
||||
/* Compile and link condition checking have been kept split
|
||||
* between these two loops, as there maybe already are valid
|
||||
* compile flags set for position independence. In that case
|
||||
* the wrapper just adds the -pie for link.
|
||||
*/
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "-fpie") ||
|
||||
!strcmp(argv[i], "-fPIE") ||
|
||||
!strcmp(argv[i], "-fpic") ||
|
||||
!strcmp(argv[i], "-fPIC"))
|
||||
break;
|
||||
}
|
||||
/* Both args below can be set at compile/link time
|
||||
* and are ignored correctly when not used
|
||||
*/
|
||||
if (i == argc)
|
||||
*cur++ = "-fPIE";
|
||||
|
||||
if (!found_shared)
|
||||
*cur++ = "-pie";
|
||||
}
|
||||
#endif
|
||||
/* Are we building the Linux Kernel or U-Boot? */
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "-D__KERNEL__") ||
|
||||
!strcmp(argv[i], "-D__UBOOT__"))
|
||||
break;
|
||||
}
|
||||
if (i == argc && found_nonoption) {
|
||||
/* https://wiki.gentoo.org/wiki/Hardened/Toolchain#Mark_Read-Only_Appropriate_Sections */
|
||||
#ifdef BR2_RELRO_PARTIAL
|
||||
*cur++ = "-Wl,-z,relro";
|
||||
#endif
|
||||
#ifdef BR2_RELRO_FULL
|
||||
*cur++ = "-Wl,-z,now";
|
||||
*cur++ = "-Wl,-z,relro";
|
||||
#endif
|
||||
}
|
||||
|
||||
n_args = (cur - args);
|
||||
if ((n_args + argc) > DEFAULT_MAX_ARGS) {
|
||||
args = realloc(args, (n_args + argc) * sizeof(char *));
|
||||
if (args == NULL) {
|
||||
perror(__FILE__ ": realloc");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
/* append forward args and terminating NULL */
|
||||
memcpy(&args[n_args], &argv[1], sizeof(char *) * argc);
|
||||
|
||||
exec_args = args;
|
||||
#ifdef BR_CCACHE
|
||||
/* If BR2_USE_CCACHE is set and its value is 1, enable ccache
|
||||
* usage */
|
||||
char *br_use_ccache = getenv("BR2_USE_CCACHE");
|
||||
bool ccache_enabled = br_use_ccache && !strncmp(br_use_ccache, "1", strlen("1"));
|
||||
|
||||
if (ccache_enabled) {
|
||||
#ifdef BR_CCACHE_HASH
|
||||
/* Allow compilercheck to be overridden through the environment */
|
||||
if (setenv("CCACHE_COMPILERCHECK", "string:" BR_CCACHE_HASH, 0)) {
|
||||
perror(__FILE__ ": Failed to set CCACHE_COMPILERCHECK");
|
||||
return 3;
|
||||
}
|
||||
#endif
|
||||
#ifdef BR_CCACHE_BASEDIR
|
||||
/* Allow basedir to be overridden through the environment */
|
||||
if (setenv("CCACHE_BASEDIR", BR_CCACHE_BASEDIR, 0)) {
|
||||
perror(__FILE__ ": Failed to set CCACHE_BASEDIR");
|
||||
return 3;
|
||||
}
|
||||
#endif
|
||||
} else
|
||||
/* ccache is disabled, skip it */
|
||||
exec_args++;
|
||||
#endif
|
||||
|
||||
/* Debug the wrapper to see final arguments passed to the real compiler. */
|
||||
if (debug > 0) {
|
||||
fprintf(stderr, "Toolchain wrapper executing:");
|
||||
#ifdef BR_CCACHE_HASH
|
||||
if (ccache_enabled)
|
||||
fprintf(stderr, "%sCCACHE_COMPILERCHECK='string:" BR_CCACHE_HASH "'",
|
||||
(debug == 2) ? "\n " : " ");
|
||||
#endif
|
||||
#ifdef BR_CCACHE_BASEDIR
|
||||
if (ccache_enabled)
|
||||
fprintf(stderr, "%sCCACHE_BASEDIR='" BR_CCACHE_BASEDIR "'",
|
||||
(debug == 2) ? "\n " : " ");
|
||||
#endif
|
||||
for (i = 0; exec_args[i]; i++)
|
||||
fprintf(stderr, "%s'%s'",
|
||||
(debug == 2) ? "\n " : " ", exec_args[i]);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
if (execv(exec_args[0], exec_args))
|
||||
perror(path);
|
||||
|
||||
free(args);
|
||||
|
||||
return 2;
|
||||
}
|
||||
81
package/gettext-tiny/make-host.sh
Executable file
81
package/gettext-tiny/make-host.sh
Executable file
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=gettext-tiny
|
||||
PKGVERSION=0.3.2
|
||||
PKGSOURCE_DIR=gettext-tiny
|
||||
PKGSOURCE=gettext-tiny-0.3.2.tar.gz
|
||||
PKGSOURCE2=gettext-0.22.4.tar.xz
|
||||
PKGURL="https://github.com/sabotage-linux/gettext-tiny/archive/v0.3.2/gettext-tiny-0.3.2.tar.gz http://mirrors.ustc.edu.cn/gnu/gettext/gettext-0.22.4.tar.xz"
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
gzip -d -c ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
mkdir -p ${PKGBUILD_DIR}/gettext-gnu
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE2} | tar --strip-components=1 -C ${PKGBUILD_DIR}/gettext-gnu -xf -
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
/usr/bin/install -D -m 0644 ${PKGBUILD_DIR}/gettext-gnu/gettext-tools/misc/gettextize.in ${PKGBUILD_DIR}/extra/gettextize.in
|
||||
/usr/bin/install -D -m 0644 ${PKGBUILD_DIR}/gettext-gnu/gettext-tools/po/Makevars.template ${PKGBUILD_DIR}/extra/Makevars.template
|
||||
/usr/bin/install -D -m 0644 ${PKGBUILD_DIR}/gettext-gnu/gettext-runtime/po/boldquot.sed ${PKGBUILD_DIR}/extra/boldquot.sed
|
||||
/usr/bin/install -D -m 0644 ${PKGBUILD_DIR}/gettext-gnu/gettext-runtime/po/en@boldquot.header ${PKGBUILD_DIR}/extra/en@boldquot.header
|
||||
/usr/bin/install -D -m 0644 ${PKGBUILD_DIR}/gettext-gnu/gettext-runtime/po/en@quot.header ${PKGBUILD_DIR}/extra/en@quot.header
|
||||
/usr/bin/install -D -m 0644 ${PKGBUILD_DIR}/gettext-gnu/gettext-runtime/po/insert-header.sin ${PKGBUILD_DIR}/extra/insert-header.sin
|
||||
/usr/bin/install -D -m 0644 ${PKGBUILD_DIR}/gettext-gnu/gettext-runtime/po/quot.sed ${PKGBUILD_DIR}/extra/quot.sed
|
||||
/usr/bin/install -D -m 0644 ${PKGBUILD_DIR}/gettext-gnu/gettext-runtime/po/remove-potcdate.sin ${PKGBUILD_DIR}/extra/remove-potcdate.sin
|
||||
/usr/bin/install -D -m 0644 ${PKGBUILD_DIR}/gettext-gnu/gettext-runtime/po/Rules-quot ${PKGBUILD_DIR}/extra/Rules-quot
|
||||
/usr/bin/install -D -m 0644 ${PKGBUILD_DIR}/gettext-gnu/gettext-runtime/po/Makefile.in.in ${PKGBUILD_DIR}/extra/Makefile.in.in
|
||||
/usr/bin/install -D -m 0644 ${PKGBUILD_DIR}/gettext-gnu/COPYING ${PKGBUILD_DIR}/extra/COPYING
|
||||
/usr/bin/install -D -m 0755 ${PKGBUILD_DIR}/gettext-gnu/build-aux/config.rpath ${PKGBUILD_DIR}/build-aux/config.rpath
|
||||
step_end patch
|
||||
|
||||
stamp_configured
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR} ${HOST_CONFIGURE_OPTS} prefix=${HOST_DIR} CFLAGS=\"-O2 -I${HOST_DIR}/include -fPIC\" LIBINTL=NONE"
|
||||
cp ${PKGBUILD_DIR}/extra/gettextize.in ${PKGBUILD_DIR}/gettextize
|
||||
/usr/bin/sed -i -e 's,@PACKAGE@,gettext-tools,g;' ${PKGBUILD_DIR}/gettextize
|
||||
/usr/bin/sed -i -e 's,@VERSION@,0.22.4,g;' ${PKGBUILD_DIR}/gettextize
|
||||
/usr/bin/sed -i -e 's,@ARCHIVE_VERSION@,0.22.4,' ${PKGBUILD_DIR}/gettextize
|
||||
/usr/bin/sed -i -e "s,@prefix@,${HOST_DIR},g;" ${PKGBUILD_DIR}/gettextize
|
||||
/usr/bin/sed -i -e 's,@datarootdir@,${prefix}/share,g;' ${PKGBUILD_DIR}/gettextize
|
||||
/usr/bin/sed -i -e 's,@datadir@,${prefix}/share,g;' ${PKGBUILD_DIR}/gettextize
|
||||
/usr/bin/sed -i -e 's,@PATH_SEPARATOR@,:,g;' ${PKGBUILD_DIR}/gettextize
|
||||
/usr/bin/sed -i -e 's,@RELOCATABLE@,no,g;' ${PKGBUILD_DIR}/gettextize
|
||||
/usr/bin/sed -i -e 's,@exec_prefix@,${prefix},g;' ${PKGBUILD_DIR}/gettextize
|
||||
/usr/bin/sed -i -e 's,@bindir@,${exec_prefix}/bin,g;' ${PKGBUILD_DIR}/gettextize
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
mkdir -p ${HOST_DIR}/share/gettext-tiny/po
|
||||
mkdir -p ${HOST_DIR}/share/gettext-tiny/m4
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR} ${HOST_CONFIGURE_OPTS} prefix=${HOST_DIR} LIBINTL=NONE install"
|
||||
/usr/bin/sed -i -e '/read dummy/d' ${PKGBUILD_DIR}/gettextize
|
||||
/usr/bin/install -m 0755 -D ${PKGBUILD_DIR}/gettextize ${HOST_DIR}/bin/gettextize
|
||||
/usr/bin/install -m 0644 -D ${PKGBUILD_DIR}/build-aux/config.rpath ${HOST_DIR}/share/gettext-tiny/config.rpath
|
||||
/usr/bin/install -m 0644 -D ${PKGBUILD_DIR}/extra/Makefile.in.in ${HOST_DIR}/share/gettext-tiny/po/Makefile.in.in
|
||||
/usr/bin/install -m 0644 -D ${PKGBUILD_DIR}/extra/boldquot.sed ${HOST_DIR}/share/gettext-tiny/po/boldquot.sed
|
||||
/usr/bin/install -m 0644 -D ${PKGBUILD_DIR}/extra/en@boldquot.header ${HOST_DIR}/share/gettext-tiny/po/en@boldquot.header
|
||||
/usr/bin/install -m 0644 -D ${PKGBUILD_DIR}/extra/en@quot.header ${HOST_DIR}/share/gettext-tiny/po/en@quot.header
|
||||
/usr/bin/install -m 0644 -D ${PKGBUILD_DIR}/extra/insert-header.sin ${HOST_DIR}/share/gettext-tiny/po/insert-header.sin
|
||||
/usr/bin/install -m 0644 -D ${PKGBUILD_DIR}/extra/quot.sed ${HOST_DIR}/share/gettext-tiny/po/quot.sed
|
||||
/usr/bin/install -m 0644 -D ${PKGBUILD_DIR}/extra/remove-potcdate.sin ${HOST_DIR}/share/gettext-tiny/po/remove-potcdate.sin
|
||||
/usr/bin/install -m 0644 -D ${PKGBUILD_DIR}/extra/Rules-quot ${HOST_DIR}/share/gettext-tiny/po/Rules-quot
|
||||
/usr/bin/install -m 0644 -D ${PKGBUILD_DIR}/extra/Makevars.template ${HOST_DIR}/share/gettext-tiny/po/Makevars.template
|
||||
touch ${HOST_DIR}/share/gettext-tiny/ABOUT-NLS
|
||||
# for gettextize
|
||||
ln -sf ${HOST_DIR}/share/gettext-tiny ${HOST_DIR}/share/gettext
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
50
package/glibc/make.sh
Executable file
50
package/glibc/make.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=glibc
|
||||
PKGVERSION=2.41-70-g1502c248d58cb99a203731707987a4342926e830
|
||||
PKGSOURCE_DIR=glibc
|
||||
PKGSOURCE=glibc-2.41-70-g1502c248d58cb99a203731707987a4342926e830.tar.gz
|
||||
PKGURL=https://github.com/bminor/glibc/archive/2.41-70-g1502c248d58cb99a203731707987a4342926e830/glibc-2.41-70-g1502c248d58cb99a203731707987a4342926e830.tar.gz
|
||||
|
||||
PKGBUILDNAME=${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
gzip -d -c ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
/usr/bin/sed -i -e 's/$"/"/g' ${PKGBUILD_DIR}/elf/ldd.bash.in
|
||||
step_end patch autotools
|
||||
|
||||
tep_start configure
|
||||
mkdir -p ${PKGBUILD_DIR}/build
|
||||
(cd ${PKGBUILD_DIR}/build; eval "${TARGET_CONFIGURE_OPTS} CXX=no CFLAGS=\"-O2 -fno-lto\" CPPFLAGS=\"\" CXXFLAGS=\"-O2 -fno-lto\" ac_cv_path_BASH_SHELL=/bin/sh libc_cv_forced_unwind=yes libc_cv_ssp=no libc_cv_slibdir=/lib64 libc_cv_rtlddir=/lib ac_cv_prog_MAKE=\"/usr/bin/make -j9\" /bin/bash ${PKGBUILD_DIR}/configure --target=${GNU_TARGET_NAME} --host=${GNU_TARGET_NAME} --build=x86_64-pc-linux-gnu --prefix=/usr --enable-shared --disable-profile --disable-werror --without-gd --with-headers=${STAGING_DIR}/usr/include --enable-kernel=6.12")
|
||||
mkdir -p ${STAGING_DIR}/usr/include/gnu
|
||||
touch ${STAGING_DIR}/usr/include/gnu/stubs.h
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${TARGET_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}/build"
|
||||
step_end build
|
||||
|
||||
step_start install-staging
|
||||
eval "${TARGET_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install_root=${STAGING_DIR} install -C ${PKGBUILD_DIR}/build"
|
||||
step_end install-staging
|
||||
|
||||
step_start install-target
|
||||
for libpattern in ld*.so.* libanl.so.* libc.so.* libdl.so.* libgcc_s.so.* libm.so.* libpthread.so.* libresolv.so.* librt.so.* libutil.so.* libnss_files.so.* libnss_dns.so.* libmvec.so.*; do
|
||||
copy_toolchain_lib_root ${libpattern}
|
||||
done
|
||||
step_end install-target
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
13
package/glibc/nsswitch.conf
Normal file
13
package/glibc/nsswitch.conf
Normal file
@@ -0,0 +1,13 @@
|
||||
# /etc/nsswitch.conf
|
||||
|
||||
passwd: files
|
||||
group: files
|
||||
shadow: files
|
||||
|
||||
hosts: files dns
|
||||
networks: files dns
|
||||
|
||||
protocols: files
|
||||
services: files
|
||||
ethers: files
|
||||
rpc: files
|
||||
@@ -0,0 +1,51 @@
|
||||
From 9cd0c36d0110191a5f42e268d7bd21a95a2aa883 Mon Sep 17 00:00:00 2001
|
||||
From: Marc Glisse <marc.glisse@inria.fr>
|
||||
Date: Wed, 29 Jan 2025 22:38:02 +0100
|
||||
Subject: [PATCH] Complete function prototype in acinclude.m4 for C23
|
||||
compatibility
|
||||
|
||||
Add parameter names to function prototype
|
||||
|
||||
Upstream: https://gmplib.org/repo/gmp/rev/d66d66d82dbb
|
||||
Upstream: https://gmplib.org/repo/gmp/rev/8e7bb4ae7a18
|
||||
Signed-off-by: Marc Glisse <marc.glisse@inria.fr>
|
||||
[Julien: git patch adapted from two upstream mercurial changesets]
|
||||
Signed-off-by: Julien Olivain <ju.o@free.fr>
|
||||
---
|
||||
ChangeLog | 9 +++++++++
|
||||
acinclude.m4 | 2 +-
|
||||
2 files changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ChangeLog b/ChangeLog
|
||||
index 2902cd2..d808a8b 100644
|
||||
--- a/ChangeLog
|
||||
+++ b/ChangeLog
|
||||
@@ -1,3 +1,12 @@
|
||||
+2025-03-15 Khem Raj <raj.khem@gmail.com>
|
||||
+
|
||||
+ * acinclude.m4: Add parameter names to function prototype.
|
||||
+
|
||||
+2025-01-29 Rudi Heitbaum <rudi@heitbaum.com>
|
||||
+ Marc Glisse <marc.glisse@inria.fr>
|
||||
+
|
||||
+ * acinclude.m4: Complete function prototype.
|
||||
+
|
||||
2023-07-29 Torbjörn Granlund <tg@gmplib.org>
|
||||
|
||||
* Version 6.3.0 released.
|
||||
diff --git a/acinclude.m4 b/acinclude.m4
|
||||
index 9cf9483..b79a431 100644
|
||||
--- a/acinclude.m4
|
||||
+++ b/acinclude.m4
|
||||
@@ -609,7 +609,7 @@ GMP_PROG_CC_WORKS_PART([$1], [long long reliability test 1],
|
||||
|
||||
#if defined (__GNUC__) && ! defined (__cplusplus)
|
||||
typedef unsigned long long t1;typedef t1*t2;
|
||||
-void g(){}
|
||||
+void g(int a,t1 const*b,t1 c,t2 d,t1 const*e,int f){}
|
||||
void h(){}
|
||||
static __inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
|
||||
{t1 c,x,r;int i;if(v0){c=1;for(i=1;i<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}
|
||||
--
|
||||
2.49.0
|
||||
|
||||
44
package/gmp/make-host.sh
Executable file
44
package/gmp/make-host.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=gmp
|
||||
PKGVERSION=6.3.0
|
||||
PKGSOURCE_DIR=gmp
|
||||
PKGSOURCE=gmp-6.3.0.tar.xz
|
||||
PKGURL=http://mirrors.ustc.edu.cn/gnu/gmp/gmp-6.3.0.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch
|
||||
step_end patch autotools ignore_libtool_patch
|
||||
|
||||
step_start configure
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Autoreconfiguring"
|
||||
cd ${PKGBUILD_DIR} && eval "AUTOPOINT=/bin/true ${AUTORECONF_OPTS} ${HOST_DIR}/bin/autoreconf -f -i"
|
||||
patch_libtool ${PKGBUILD_DIR}
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}"
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
15
package/host-finalize/make.sh
Executable file
15
package/host-finalize/make.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
echo ">>> Finalizing host directory"
|
||||
|
||||
# see host-finalize in Makefile
|
||||
PATCHELF=${HOST_DIR}/bin/patchelf \
|
||||
PARALLEL_JOBS=${MAXNUM_CPUS} \
|
||||
PER_PACKAGE_DIR=${OUTPUT_DIR}/per-package \
|
||||
${PROJECT_DIR}/support/scripts/fix-rpath host
|
||||
|
||||
PATCHELF=${HOST_DIR}/bin/patchelf \
|
||||
PARALLEL_JOBS=${MAXNUM_CPUS} \
|
||||
PER_PACKAGE_DIR=${OUTPUT_DIR}/per-package \
|
||||
${PROJECT_DIR}/support/scripts/fix-rpath staging
|
||||
48
package/kmod/0001-fix-O_CLOEXEC.patch
Normal file
48
package/kmod/0001-fix-O_CLOEXEC.patch
Normal file
@@ -0,0 +1,48 @@
|
||||
From b39a62f6682463bcd47480348fac3dcd209a19a5 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Yang <liezhi.yang@windriver.com>
|
||||
Date: Wed, 22 Jan 2014 01:06:40 -0500
|
||||
Subject: [PATCH] Add dummy definition of O_CLOEXEC
|
||||
|
||||
O_CLOEXEC is introduced from Linux 2.6.23, so old kernel doesn't have
|
||||
it, we need check before use.
|
||||
|
||||
This patch is much more like a workaround, since it may need fcntl() use
|
||||
FD_CLOEXEC to replace.
|
||||
|
||||
This problem was reported by "Ting Liu <b28495@freescale.com>"
|
||||
|
||||
[Thomas De Schampheleire <thomas.de.schampheleire@gmail.com:
|
||||
- move dummy definition from libkmod-internal.h to missing.h
|
||||
- update commit title]
|
||||
|
||||
[Vicente: Adapt this patch to version 19.]
|
||||
|
||||
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
|
||||
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
|
||||
|
||||
Upstream-status: rejected, suggests to add in buildroot instead [1]
|
||||
|
||||
[1] http://news.gmane.org/find-root.php?message_id=1412062906%2d27378%2d1%2dgit%2dsend%2demail%2dpatrickdepinguin%40gmail.com
|
||||
|
||||
---
|
||||
shared/missing.h | 4 ++++
|
||||
1 files changed, 4 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/shared/missing.h b/shared/missing.h
|
||||
index 4c0d136..e123e98 100644
|
||||
--- a/shared/missing.h
|
||||
+++ b/shared/missing.h
|
||||
@@ -19,6 +19,10 @@
|
||||
# define __NR_finit_module -1
|
||||
#endif
|
||||
|
||||
+#ifndef O_CLOEXEC
|
||||
+#define O_CLOEXEC 0
|
||||
+#endif
|
||||
+
|
||||
#ifndef HAVE_FINIT_MODULE
|
||||
#include <errno.h>
|
||||
|
||||
--
|
||||
1.7.1
|
||||
|
||||
43
package/kmod/make-host.sh
Executable file
43
package/kmod/make-host.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=kmod
|
||||
PKGVERSION=33
|
||||
PKGSOURCE_DIR=kmod
|
||||
PKGSOURCE=kmod-33.tar.xz
|
||||
PKGURL=http://mirrors.ustc.edu.cn/kernel.org/linux/utils/kernel/kmod/kmod-33.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch
|
||||
step_end patch autotools
|
||||
|
||||
step_start configure
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking --disable-manpages --without-zlib --without-zstd --without-xz")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}"
|
||||
mkdir -p ${HOST_DIR}/sbin/
|
||||
ln -sf ../bin/kmod ${HOST_DIR}/sbin/depmod
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
48
package/libtool/make-host.sh
Executable file
48
package/libtool/make-host.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=libtool
|
||||
PKGVERSION=2.4.6
|
||||
PKGSOURCE_DIR=libtool
|
||||
PKGSOURCE=libtool-2.4.6.tar.xz
|
||||
PKGURL=http://mirrors.ustc.edu.cn/gnu/libtool/libtool-2.4.6.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
step_end patch autotools ignore_libtool_patch
|
||||
|
||||
step_start configure
|
||||
# 下面四条语句的含义是在 ${PKGBUILD_DIR} 目录及其子目录中搜索 -name
|
||||
# 指定的同名文件,对每个找到的文件执行 touch 命令,'{}':被替换为找到的文件路径
|
||||
# 注意需要在最后加上 \; 或 + 来结束
|
||||
# 这个命令通常在软件包构建过程中使用,通过更新文件的时间戳来防止因文件时间戳问题导致的构建错误。
|
||||
find ${PKGBUILD_DIR} -name aclocal.m4 -exec touch '{}' \;
|
||||
find ${PKGBUILD_DIR} -name config-h.in -exec touch '{}' \;
|
||||
find ${PKGBUILD_DIR} -name configure -exec touch '{}' \;
|
||||
find ${PKGBUILD_DIR} -name Makefile.in -exec touch '{}' \;
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} MAKEINFO=true CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}"
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
39
package/libzlib/make-host.sh
Executable file
39
package/libzlib/make-host.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=libzlib
|
||||
PKGVERSION=1.3.1
|
||||
PKGSOURCE_DIR=libzlib
|
||||
PKGSOURCE=zlib-1.3.1.tar.xz
|
||||
PKGURL=https://www.zlib.net/zlib-1.3.1.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
stamp_patched
|
||||
|
||||
step_start configure
|
||||
(cd ${PKGBUILD_DIR}; rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\"")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j1 -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j1 -C ${PKGBUILD_DIR} LDCONFIG=true install"
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
36
package/linux-headers/make.sh
Executable file
36
package/linux-headers/make.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=linux-headers
|
||||
PKGVERSION=6.12.47
|
||||
PKGSOURCE_DIR=linux
|
||||
PKGSOURCE=linux-6.12.47.tar.xz
|
||||
PKGURL=http://mirrors.ustc.edu.cn/kernel.org/linux/kernel/v6.x/linux-6.12.47.tar.xz
|
||||
|
||||
PKGBUILDNAME=${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
stamp_patched
|
||||
|
||||
stamp_configured
|
||||
|
||||
stamp_built
|
||||
|
||||
step_start install-staging
|
||||
(cd ${PKGBUILD_DIR}; eval "${TARGET_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} ARCH=riscv HOSTCC=\"/usr/bin/gcc\" HOSTCFLAGS=\"\" HOSTCXX=\"/usr/bin/g++\" INSTALL_HDR_PATH=${STAGING_DIR}/usr headers_install")
|
||||
HOSTCC="/usr/bin/gcc" check_kernel_headers_version ${BUILD_DIR} ${STAGING_DIR} 6.12 strict
|
||||
step_end install-staging
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
74
package/linux/make.sh
Executable file
74
package/linux/make.sh
Executable file
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=linux
|
||||
PKGVERSION=6.12.47
|
||||
PKGSOURCE_DIR=linux
|
||||
PKGSOURCE=linux-6.12.47.tar.xz
|
||||
PKGURL=http://mirrors.ustc.edu.cn/kernel.org/linux/kernel/v6.x/linux-6.12.47.tar.xz
|
||||
|
||||
PKGBUILDNAME=${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
stamp_patched
|
||||
|
||||
# Before running configure, the configuration file should be present and fixed
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR} ARCH=riscv KCFLAGS=\"-Wno-attribute-alias\" INSTALL_MOD_PATH=${TARGET_DIR} CROSS_COMPILE=\"${CROSS_COMPILE}\" WERROR=0 REGENERATE_PARSERS=1 DEPMOD=${HOST_DIR}/sbin/depmod INSTALL_MOD_STRIP=1 HOSTCC=\"/usr/bin/gcc\" defconfig"
|
||||
touch ${PKGBUILD_DIR}/.stamp_dotconfig
|
||||
echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Updating kernel config with fixups"
|
||||
kconfig_enable_option CONFIG_KERNEL_GZIP
|
||||
kconfig_enable_option CONFIG_CPU_LITTLE_ENDIAN
|
||||
kconfig_enable_option CONFIG_DEVTMPFS
|
||||
kconfig_enable_option CONFIG_DEVTMPFS_MOUNT
|
||||
kconfig_disable_option CONFIG_KERNEL_LZ4
|
||||
kconfig_disable_option CONFIG_KERNEL_LZMA
|
||||
kconfig_disable_option CONFIG_KERNEL_LZO
|
||||
kconfig_disable_option CONFIG_KERNEL_XZ
|
||||
kconfig_disable_option CONFIG_KERNEL_ZSTD
|
||||
kconfig_disable_option CONFIG_KERNEL_UNCOMPRESSED
|
||||
kconfig_disable_option CONFIG_GCC_PLUGINS
|
||||
kconfig_disable_option CONFIG_WERROR
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR} ARCH=riscv KCFLAGS=\"-Wno-attribute-alias\" INSTALL_MOD_PATH=${TARGET_DIR} CROSS_COMPILE=\"${CROSS_COMPILE}\" WERROR=0 REGENERATE_PARSERS=1 DEPMOD=${HOST_DIR}/sbin/depmod INSTALL_MOD_STRIP=1 HOSTCC=\"/usr/bin/gcc\" olddefconfig"
|
||||
touch ${PKGBUILD_DIR}/.stamp_kconfig_fixup_done
|
||||
|
||||
# 对于 linux 来说没有使用 configure 脚本
|
||||
stamp_configured
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} HOSTCC=\"/usr/bin/gcc -O2 -isystem ${HOST_DIR}/include -L${HOST_DIR}/lib -Wl,-rpath,${HOST_DIR}/lib\" ARCH=riscv KCFLAGS=\"-Wno-attribute-alias\" INSTALL_MOD_PATH=${TARGET_DIR} CROSS_COMPILE=\"${CROSS_COMPILE}\" WERROR=0 REGENERATE_PARSERS=1 DEPMOD=${HOST_DIR}/sbin/depmod INSTALL_MOD_STRIP=1 -C ${PKGBUILD_DIR} all"
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} HOSTCC=\"/usr/bin/gcc -O2 -isystem ${HOST_DIR}/include -L${HOST_DIR}/lib -Wl,-rpath,${HOST_DIR}/lib\" ARCH=riscv KCFLAGS=\"-Wno-attribute-alias\" INSTALL_MOD_PATH=${TARGET_DIR} CROSS_COMPILE=\"${CROSS_COMPILE}\" WERROR=0 REGENERATE_PARSERS=1 DEPMOD=${HOST_DIR}/sbin/depmod INSTALL_MOD_STRIP=1 -C ${PKGBUILD_DIR} Image"
|
||||
step_end build
|
||||
|
||||
step_start install-target
|
||||
# Install modules and remove symbolic links pointing to build
|
||||
# directories, not relevant on the target
|
||||
if grep -q "CONFIG_MODULES=y" ${PKGBUILD_DIR}/.config; then
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} HOSTCC=\"/usr/bin/gcc -O2 -isystem ${HOST_DIR}/include -L${HOST_DIR}/lib -Wl,-rpath,${HOST_DIR}/lib\" ARCH=riscv KCFLAGS=\"-Wno-attribute-alias\" INSTALL_MOD_PATH=${TARGET_DIR} CROSS_COMPILE=\"${CROSS_COMPILE}\" WERROR=0 REGENERATE_PARSERS=1 DEPMOD=${HOST_DIR}/sbin/depmod INSTALL_MOD_STRIP=1 -C ${PKGBUILD_DIR} modules_install" ;
|
||||
rm -f ${TARGET_DIR}/lib/modules/${PKGVERSION}/build ;
|
||||
rm -f ${TARGET_DIR}/lib/modules/${PKGVERSION}/source ;
|
||||
fi
|
||||
# Installing dtc (device tree compiler) as host tool, if selected
|
||||
if grep -q "CONFIG_DTC=y" ${PKGBUILD_DIR}/.config; then
|
||||
/usr/bin/install -D -m 0755 ${PKGBUILD_DIR}/scripts/dtc/dtc ${HOST_DIR}/bin/linux-dtc ;
|
||||
ln -sf linux-dtc ${HOST_DIR}/bin/dtc;
|
||||
fi
|
||||
step_end install-target
|
||||
|
||||
# Image Install
|
||||
step_start install-image
|
||||
/usr/bin/install -m 0644 -D ${PKGBUILD_DIR}/arch/riscv/boot/Image ${IMAGES_DIR}/Image
|
||||
step_end install-image
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
39
package/m4/make-host.sh
Executable file
39
package/m4/make-host.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=m4
|
||||
PKGVERSION=1.4.20
|
||||
PKGSOURCE_DIR=m4
|
||||
PKGSOURCE=m4-1.4.20.tar.xz
|
||||
PKGURL=http://mirrors.ustc.edu.cn/gnu/m4/m4-1.4.20.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
stamp_patched autotools
|
||||
|
||||
step_start configure
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}"
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
36
package/makedevs/make-host.sh
Executable file
36
package/makedevs/make-host.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=makedevs
|
||||
PKGVERSION=
|
||||
PKGSOURCE_DIR=makedevs
|
||||
PKGSOURCE=
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
cp ${PROJECT_DIR}/package/${PKGNAME}/makedevs.c ${PKGBUILD_DIR}
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
stamp_patched
|
||||
|
||||
stamp_configured
|
||||
|
||||
step_start build
|
||||
/usr/bin/gcc -O2 -I${HOST_DIR}/include ${PKGBUILD_DIR}/makedevs.c -o ${PKGBUILD_DIR}/makedevs -L${HOST_DIR}/lib -Wl,-rpath,${HOST_DIR}/lib
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
/usr/bin/install -D -m 755 ${PKGBUILD_DIR}/makedevs ${HOST_DIR}/bin/makedevs
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
650
package/makedevs/makedevs.c
Normal file
650
package/makedevs/makedevs.c
Normal file
@@ -0,0 +1,650 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <getopt.h>
|
||||
#include <time.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <libgen.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef __APPLE__
|
||||
#include <sys/sysmacros.h> /* major() and minor() */
|
||||
#endif
|
||||
#include <ftw.h>
|
||||
#ifdef EXTENDED_ATTRIBUTES
|
||||
#include <sys/capability.h>
|
||||
#endif /* EXTENDED_ATTRIBUTES */
|
||||
|
||||
const char *bb_applet_name;
|
||||
uid_t recursive_uid;
|
||||
gid_t recursive_gid;
|
||||
unsigned int recursive_mode;
|
||||
#define PASSWD_PATH "etc/passwd" /* MUST be relative */
|
||||
#define GROUP_PATH "etc/group" /* MUST be relative */
|
||||
|
||||
void bb_verror_msg(const char *s, va_list p)
|
||||
{
|
||||
fflush(stdout);
|
||||
fprintf(stderr, "%s: ", bb_applet_name);
|
||||
vfprintf(stderr, s, p);
|
||||
}
|
||||
|
||||
void bb_error_msg(const char *s, ...)
|
||||
{
|
||||
va_list p;
|
||||
|
||||
va_start(p, s);
|
||||
bb_verror_msg(s, p);
|
||||
va_end(p);
|
||||
putc('\n', stderr);
|
||||
}
|
||||
|
||||
void bb_error_msg_and_die(const char *s, ...)
|
||||
{
|
||||
va_list p;
|
||||
|
||||
va_start(p, s);
|
||||
bb_verror_msg(s, p);
|
||||
va_end(p);
|
||||
putc('\n', stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void bb_vperror_msg(const char *s, va_list p)
|
||||
{
|
||||
int err=errno;
|
||||
if(s == 0) s = "";
|
||||
bb_verror_msg(s, p);
|
||||
if (*s) s = ": ";
|
||||
fprintf(stderr, "%s%s\n", s, strerror(err));
|
||||
}
|
||||
|
||||
void bb_perror_msg(const char *s, ...)
|
||||
{
|
||||
va_list p;
|
||||
|
||||
va_start(p, s);
|
||||
bb_vperror_msg(s, p);
|
||||
va_end(p);
|
||||
}
|
||||
|
||||
void bb_perror_msg_and_die(const char *s, ...)
|
||||
{
|
||||
va_list p;
|
||||
|
||||
va_start(p, s);
|
||||
bb_vperror_msg(s, p);
|
||||
va_end(p);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
FILE *bb_xfopen(const char *path, const char *mode)
|
||||
{
|
||||
FILE *fp;
|
||||
if ((fp = fopen(path, mode)) == NULL)
|
||||
bb_perror_msg_and_die("%s", path);
|
||||
return fp;
|
||||
}
|
||||
|
||||
enum {
|
||||
FILEUTILS_PRESERVE_STATUS = 1,
|
||||
FILEUTILS_DEREFERENCE = 2,
|
||||
FILEUTILS_RECUR = 4,
|
||||
FILEUTILS_FORCE = 8,
|
||||
FILEUTILS_INTERACTIVE = 16
|
||||
};
|
||||
int bb_make_directory (char *path, long mode, int flags)
|
||||
{
|
||||
mode_t mask;
|
||||
const char *fail_msg;
|
||||
char *s = path;
|
||||
char c;
|
||||
struct stat st;
|
||||
|
||||
mask = umask(0);
|
||||
if (mode == -1) {
|
||||
umask(mask);
|
||||
mode = (S_IXUSR | S_IXGRP | S_IXOTH |
|
||||
S_IWUSR | S_IWGRP | S_IWOTH |
|
||||
S_IRUSR | S_IRGRP | S_IROTH) & ~mask;
|
||||
} else {
|
||||
umask(mask & ~0300);
|
||||
}
|
||||
|
||||
do {
|
||||
c = 0;
|
||||
|
||||
if (flags & FILEUTILS_RECUR) { /* Get the parent. */
|
||||
/* Bypass leading non-'/'s and then subsequent '/'s. */
|
||||
while (*s) {
|
||||
if (*s == '/') {
|
||||
do {
|
||||
++s;
|
||||
} while (*s == '/');
|
||||
c = *s; /* Save the current char */
|
||||
*s = 0; /* and replace it with nul. */
|
||||
break;
|
||||
}
|
||||
++s;
|
||||
}
|
||||
}
|
||||
|
||||
if (mkdir(path, 0777) < 0) {
|
||||
/* If we failed for any other reason than the directory
|
||||
* already exists, output a diagnostic and return -1.*/
|
||||
if ((errno != EEXIST && errno != EISDIR)
|
||||
|| !(flags & FILEUTILS_RECUR)
|
||||
|| (stat(path, &st) < 0 || !S_ISDIR(st.st_mode))) {
|
||||
fail_msg = "create";
|
||||
umask(mask);
|
||||
break;
|
||||
}
|
||||
/* Since the directory exists, don't attempt to change
|
||||
* permissions if it was the full target. Note that
|
||||
* this is not an error condition. */
|
||||
if (!c) {
|
||||
umask(mask);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!c) {
|
||||
/* Done. If necessary, updated perms on the newly
|
||||
* created directory. Failure to update here _is_
|
||||
* an error.*/
|
||||
umask(mask);
|
||||
if ((mode != -1) && (chmod(path, mode) < 0)){
|
||||
fail_msg = "set permissions of";
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Remove any inserted nul from the path (recursive mode). */
|
||||
*s = c;
|
||||
|
||||
} while (1);
|
||||
|
||||
bb_perror_msg ("Cannot %s directory `%s'", fail_msg, path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char * const bb_msg_memory_exhausted = "memory exhausted";
|
||||
|
||||
void *xmalloc(size_t size)
|
||||
{
|
||||
void *ptr = malloc(size);
|
||||
if (ptr == NULL && size != 0)
|
||||
bb_error_msg_and_die(bb_msg_memory_exhausted);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *xcalloc(size_t nmemb, size_t size)
|
||||
{
|
||||
void *ptr = calloc(nmemb, size);
|
||||
if (ptr == NULL && nmemb != 0 && size != 0)
|
||||
bb_error_msg_and_die(bb_msg_memory_exhausted);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *xrealloc(void *ptr, size_t size)
|
||||
{
|
||||
ptr = realloc(ptr, size);
|
||||
if (ptr == NULL && size != 0)
|
||||
bb_error_msg_and_die(bb_msg_memory_exhausted);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
char *private_get_line_from_file(FILE *file, int c)
|
||||
{
|
||||
#define GROWBY (80) /* how large we will grow strings by */
|
||||
|
||||
int ch;
|
||||
int idx = 0;
|
||||
char *linebuf = NULL;
|
||||
int linebufsz = 0;
|
||||
|
||||
while ((ch = getc(file)) != EOF) {
|
||||
/* grow the line buffer as necessary */
|
||||
if (idx > linebufsz - 2) {
|
||||
linebuf = xrealloc(linebuf, linebufsz += GROWBY);
|
||||
}
|
||||
linebuf[idx++] = (char)ch;
|
||||
if (!ch) return linebuf;
|
||||
if (c<2 && ch == '\n') {
|
||||
if (c) {
|
||||
--idx;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (linebuf) {
|
||||
if (ferror(file)) {
|
||||
free(linebuf);
|
||||
return NULL;
|
||||
}
|
||||
linebuf[idx] = 0;
|
||||
}
|
||||
return linebuf;
|
||||
}
|
||||
|
||||
char *bb_get_chomped_line_from_file(FILE *file)
|
||||
{
|
||||
return private_get_line_from_file(file, 1);
|
||||
}
|
||||
|
||||
long my_getpwnam(const char *name)
|
||||
{
|
||||
struct passwd *myuser;
|
||||
FILE *stream;
|
||||
|
||||
stream = bb_xfopen(PASSWD_PATH, "r");
|
||||
while(1) {
|
||||
errno = 0;
|
||||
myuser = fgetpwent(stream);
|
||||
if (myuser == NULL)
|
||||
bb_error_msg_and_die("unknown user name: %s", name);
|
||||
if (errno)
|
||||
bb_perror_msg_and_die("fgetpwent");
|
||||
if (!strcmp(name, myuser->pw_name))
|
||||
break;
|
||||
}
|
||||
fclose(stream);
|
||||
|
||||
return myuser->pw_uid;
|
||||
}
|
||||
|
||||
long my_getgrnam(const char *name)
|
||||
{
|
||||
struct group *mygroup;
|
||||
FILE *stream;
|
||||
|
||||
stream = bb_xfopen(GROUP_PATH, "r");
|
||||
while(1) {
|
||||
errno = 0;
|
||||
mygroup = fgetgrent(stream);
|
||||
if (mygroup == NULL)
|
||||
bb_error_msg_and_die("unknown group name: %s", name);
|
||||
if (errno)
|
||||
bb_perror_msg_and_die("fgetgrent");
|
||||
if (!strcmp(name, mygroup->gr_name))
|
||||
break;
|
||||
}
|
||||
fclose(stream);
|
||||
|
||||
return mygroup->gr_gid;
|
||||
}
|
||||
|
||||
unsigned long get_ug_id(const char *s, long (*my_getxxnam)(const char *))
|
||||
{
|
||||
unsigned long r;
|
||||
char *p;
|
||||
|
||||
r = strtoul(s, &p, 10);
|
||||
if (*p || (s == p)) {
|
||||
r = my_getxxnam(s);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
char * last_char_is(const char *s, int c)
|
||||
{
|
||||
char *sret = (char *)s;
|
||||
if (sret) {
|
||||
sret = strrchr(sret, c);
|
||||
if(sret != NULL && *(sret+1) != 0)
|
||||
sret = NULL;
|
||||
}
|
||||
return sret;
|
||||
}
|
||||
|
||||
void bb_xasprintf(char **string_ptr, const char *format, ...)
|
||||
{
|
||||
va_list p;
|
||||
int r;
|
||||
|
||||
va_start(p, format);
|
||||
r = vasprintf(string_ptr, format, p);
|
||||
va_end(p);
|
||||
|
||||
if (r < 0) {
|
||||
bb_perror_msg_and_die("bb_xasprintf");
|
||||
}
|
||||
}
|
||||
|
||||
char *concat_path_file(const char *path, const char *filename)
|
||||
{
|
||||
char *outbuf;
|
||||
char *lc;
|
||||
|
||||
if (!path)
|
||||
path = "";
|
||||
lc = last_char_is(path, '/');
|
||||
while (*filename == '/')
|
||||
filename++;
|
||||
bb_xasprintf(&outbuf, "%s%s%s", path, (lc==NULL ? "/" : ""), filename);
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
#ifdef EXTENDED_ATTRIBUTES
|
||||
int bb_set_xattr(const char *fpath, const char *xattr)
|
||||
{
|
||||
cap_t cap, cap_file, cap_new;
|
||||
char *cap_file_text, *cap_new_text;
|
||||
ssize_t length;
|
||||
|
||||
cap = cap_from_text(xattr);
|
||||
if (cap == NULL)
|
||||
bb_perror_msg_and_die("cap_from_text failed for %s", xattr);
|
||||
|
||||
cap_file = cap_get_file(fpath);
|
||||
if (cap_file == NULL) {
|
||||
/* if no capability was set before, we initialize cap_file */
|
||||
if (errno != ENODATA)
|
||||
bb_perror_msg_and_die("cap_get_file failed on %s", fpath);
|
||||
|
||||
cap_file = cap_init();
|
||||
if (!cap_file)
|
||||
bb_perror_msg_and_die("cap_init failed");
|
||||
}
|
||||
|
||||
if ((cap_file_text = cap_to_text(cap_file, &length)) == NULL)
|
||||
bb_perror_msg_and_die("cap_to_name failed on %s", fpath);
|
||||
|
||||
bb_xasprintf(&cap_new_text, "%s %s", cap_file_text, xattr);
|
||||
|
||||
if ((cap_new = cap_from_text(cap_new_text)) == NULL)
|
||||
bb_perror_msg_and_die("cap_from_text failed on %s", cap_new_text);
|
||||
|
||||
if (cap_set_file(fpath, cap_new) == -1)
|
||||
bb_perror_msg_and_die("cap_set_file failed for %s (xattr = %s)", fpath, xattr);
|
||||
|
||||
cap_free(cap);
|
||||
cap_free(cap_file);
|
||||
cap_free(cap_file_text);
|
||||
cap_free(cap_new);
|
||||
cap_free(cap_new_text);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* EXTENDED_ATTRIBUTES */
|
||||
|
||||
void bb_show_usage(void)
|
||||
{
|
||||
fprintf(stderr, "%s: [-d device_table] rootdir\n\n", bb_applet_name);
|
||||
fprintf(stderr, "Creates a batch of special files as specified in a device table.\n");
|
||||
fprintf(stderr, "Device table entries take the form of:\n");
|
||||
fprintf(stderr, "name type mode user group major minor start increment count\n\n");
|
||||
fprintf(stderr, "Where name is the file name, type can be one of:\n");
|
||||
fprintf(stderr, " f A regular file\n");
|
||||
fprintf(stderr, " d Directory\n");
|
||||
fprintf(stderr, " r Directory recursively\n");
|
||||
fprintf(stderr, " c Character special device file\n");
|
||||
fprintf(stderr, " b Block special device file\n");
|
||||
fprintf(stderr, " p Fifo (named pipe)\n");
|
||||
fprintf(stderr, "uid is the user id for the target file, gid is the group id for the\n");
|
||||
fprintf(stderr, "target file. The rest of the entries (major, minor, etc) apply to\n");
|
||||
fprintf(stderr, "to device special files. A '-' may be used for blank entries.\n\n");
|
||||
fprintf(stderr, "For example:\n");
|
||||
fprintf(stderr, "<name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>\n");
|
||||
fprintf(stderr, "/dev d 755 0 0 - - - - -\n");
|
||||
fprintf(stderr, "/dev/console c 666 0 0 5 1 - - -\n");
|
||||
fprintf(stderr, "/dev/null c 666 0 0 1 3 0 0 -\n");
|
||||
fprintf(stderr, "/dev/zero c 666 0 0 1 5 0 0 -\n");
|
||||
fprintf(stderr, "/dev/hda b 640 0 0 3 0 0 0 -\n");
|
||||
fprintf(stderr, "/dev/hda b 640 0 0 3 1 1 1 15\n");
|
||||
fprintf(stderr, "/dev/rtp b 640 0 0 250 0 0 1 5\n");
|
||||
fprintf(stderr, "/dev/gps b 640 0 0 251 0 1 1 5\n");
|
||||
fprintf(stderr, "/dev/uio b 640 0 0 252 0 1 2 5\n");
|
||||
fprintf(stderr, "/dev/uio b 640 0 0 252 1 6 2 5\n\n");
|
||||
fprintf(stderr, "Will Produce:\n");
|
||||
fprintf(stderr, "/dev\n");
|
||||
fprintf(stderr, "/dev/console\n");
|
||||
fprintf(stderr, "/dev/null\n");
|
||||
fprintf(stderr, "/dev/zero\n");
|
||||
fprintf(stderr, "/dev/hda\n");
|
||||
fprintf(stderr, "/dev/hda[1-15] with minor numbers [1-15]\n");
|
||||
fprintf(stderr, "/dev/rtp[0-4] with minor numbers [0-4]\n");
|
||||
fprintf(stderr, "/dev/gps[1-5] with minor numbers [0-4]\n");
|
||||
fprintf(stderr, "/dev/uio[1-5] with minor numbers 0,2,4,6,8\n");
|
||||
fprintf(stderr, "/dev/uio[6-10] with minor numbers 1,3,5,7,9\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int bb_recursive(const char *fpath, const struct stat *sb,
|
||||
int tflag, struct FTW *ftwbuf){
|
||||
|
||||
if (lchown(fpath, recursive_uid, recursive_gid) == -1) {
|
||||
bb_perror_msg("chown failed for %s", fpath);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* chmod() is optional, also skip if dangling symlink */
|
||||
if (recursive_mode == -1 || (tflag == FTW_SL && !access(fpath, F_OK)))
|
||||
return 0;
|
||||
|
||||
if (chmod(fpath, recursive_mode) < 0) {
|
||||
bb_perror_msg("chmod failed for %s", fpath);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
FILE *table = stdin;
|
||||
char *rootdir = NULL;
|
||||
char *full_name = NULL;
|
||||
char *line = NULL;
|
||||
int linenum = 0;
|
||||
int ret = EXIT_SUCCESS;
|
||||
|
||||
bb_applet_name = basename(argv[0]);
|
||||
|
||||
while ((opt = getopt(argc, argv, "d:")) != -1) {
|
||||
switch(opt) {
|
||||
case 'd':
|
||||
table = bb_xfopen((line=optarg), "r");
|
||||
break;
|
||||
default:
|
||||
bb_show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (optind >= argc || (rootdir=argv[optind])==NULL) {
|
||||
bb_error_msg_and_die("root directory not specified");
|
||||
}
|
||||
|
||||
if (chdir(rootdir) != 0) {
|
||||
bb_perror_msg_and_die("Could not chdir to %s", rootdir);
|
||||
}
|
||||
|
||||
umask(0);
|
||||
|
||||
printf("rootdir=%s\n", rootdir);
|
||||
if (line) {
|
||||
printf("table='%s'\n", line);
|
||||
} else {
|
||||
printf("table=<stdin>\n");
|
||||
}
|
||||
|
||||
while ((line = bb_get_chomped_line_from_file(table))) {
|
||||
char type;
|
||||
unsigned int mode = 0755;
|
||||
unsigned int major = 0;
|
||||
unsigned int minor = 0;
|
||||
unsigned int count = 0;
|
||||
unsigned int increment = 0;
|
||||
unsigned int start = 0;
|
||||
char xattr[255];
|
||||
char name[4096];
|
||||
char user[41];
|
||||
char group[41];
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
|
||||
linenum++;
|
||||
|
||||
if (1 == sscanf(line, " |xattr %254s", xattr)) {
|
||||
#ifdef EXTENDED_ATTRIBUTES
|
||||
if (!full_name)
|
||||
bb_error_msg_and_die("line %d should be after a file\n", linenum);
|
||||
|
||||
if (bb_set_xattr(full_name, xattr) < 0)
|
||||
bb_error_msg_and_die("can't set cap %s on file %s\n", xattr, full_name);
|
||||
#else
|
||||
bb_error_msg_and_die("line %d not supported: '%s'\nDid you forget to enable "
|
||||
"BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES?\n",
|
||||
linenum, line);
|
||||
#endif /* EXTENDED_ATTRIBUTES */
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((2 > sscanf(line, "%4095s %c %o %40s %40s %u %u %u %u %u", name,
|
||||
&type, &mode, user, group, &major,
|
||||
&minor, &start, &increment, &count)) ||
|
||||
((major | minor | start | count | increment) > 0xfffff))
|
||||
{
|
||||
if (*line=='\0' || *line=='#' || isspace(*line))
|
||||
continue;
|
||||
bb_error_msg("line %d invalid: '%s'\n", linenum, line);
|
||||
ret = EXIT_FAILURE;
|
||||
continue;
|
||||
}
|
||||
if (name[0] == '#') {
|
||||
continue;
|
||||
}
|
||||
if (*group) {
|
||||
gid = get_ug_id(group, my_getgrnam);
|
||||
} else {
|
||||
gid = getgid();
|
||||
}
|
||||
if (*user) {
|
||||
uid = get_ug_id(user, my_getpwnam);
|
||||
} else {
|
||||
uid = getuid();
|
||||
}
|
||||
|
||||
/*
|
||||
* free previous full name
|
||||
* we don't de-allocate full_name at the end of the parsing,
|
||||
* because we may need it if the next line is an xattr.
|
||||
*/
|
||||
free(full_name);
|
||||
full_name = concat_path_file(rootdir, name);
|
||||
|
||||
if (type == 'd') {
|
||||
bb_make_directory(full_name, mode | S_IFDIR, FILEUTILS_RECUR);
|
||||
if (chown(full_name, uid, gid) == -1) {
|
||||
bb_perror_msg("line %d: chown failed for %s", linenum, full_name);
|
||||
ret = EXIT_FAILURE;
|
||||
goto loop;
|
||||
}
|
||||
if ((mode != -1) && (chmod(full_name, mode) < 0)){
|
||||
bb_perror_msg("line %d: chmod failed for %s", linenum, full_name);
|
||||
ret = EXIT_FAILURE;
|
||||
goto loop;
|
||||
}
|
||||
} else if (type == 'f' || type == 'F') {
|
||||
struct stat st;
|
||||
if ((stat(full_name, &st) < 0 || !S_ISREG(st.st_mode))) {
|
||||
if (type == 'F') {
|
||||
continue; /*Ignore optional files*/
|
||||
}
|
||||
bb_perror_msg("line %d: regular file '%s' does not exist", linenum, full_name);
|
||||
ret = EXIT_FAILURE;
|
||||
goto loop;
|
||||
}
|
||||
if (chown(full_name, uid, gid) == -1) {
|
||||
bb_perror_msg("line %d: chown failed for %s", linenum, full_name);
|
||||
ret = EXIT_FAILURE;
|
||||
goto loop;
|
||||
}
|
||||
if ((mode != -1) && (chmod(full_name, mode) < 0)){
|
||||
bb_perror_msg("line %d: chmod failed for %s", linenum, full_name);
|
||||
ret = EXIT_FAILURE;
|
||||
goto loop;
|
||||
}
|
||||
} else if (type == 'r') {
|
||||
recursive_uid = uid;
|
||||
recursive_gid = gid;
|
||||
recursive_mode = mode;
|
||||
if (nftw(full_name, bb_recursive, 20, FTW_MOUNT | FTW_PHYS) < 0) {
|
||||
bb_perror_msg("line %d: recursive failed for %s", linenum, full_name);
|
||||
ret = EXIT_FAILURE;
|
||||
goto loop;
|
||||
}
|
||||
} else
|
||||
{
|
||||
dev_t rdev;
|
||||
unsigned i;
|
||||
char *full_name_inc;
|
||||
|
||||
if (type == 'p') {
|
||||
mode |= S_IFIFO;
|
||||
}
|
||||
else if (type == 'c') {
|
||||
mode |= S_IFCHR;
|
||||
}
|
||||
else if (type == 'b') {
|
||||
mode |= S_IFBLK;
|
||||
} else {
|
||||
bb_error_msg("line %d: Unsupported file type %c", linenum, type);
|
||||
ret = EXIT_FAILURE;
|
||||
goto loop;
|
||||
}
|
||||
|
||||
full_name_inc = xmalloc(strlen(full_name) + sizeof(int)*3 + 2);
|
||||
if (count)
|
||||
count--;
|
||||
for (i = start; i <= start + count; i++) {
|
||||
sprintf(full_name_inc, count ? "%s%u" : "%s", full_name, i);
|
||||
rdev = makedev(major, minor + (i - start) * increment);
|
||||
if (mknod(full_name_inc, mode, rdev) < 0) {
|
||||
bb_perror_msg("line %d: can't create node %s", linenum, full_name_inc);
|
||||
ret = EXIT_FAILURE;
|
||||
} else if (lchown(full_name_inc, uid, gid) < 0) {
|
||||
bb_perror_msg("line %d: can't chown %s", linenum, full_name_inc);
|
||||
ret = EXIT_FAILURE;
|
||||
} else if (chmod(full_name_inc, mode) < 0) {
|
||||
bb_perror_msg("line %d: can't chmod %s", linenum, full_name_inc);
|
||||
ret = EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
free(full_name_inc);
|
||||
}
|
||||
loop:
|
||||
free(line);
|
||||
}
|
||||
fclose(table);
|
||||
|
||||
return ret;
|
||||
}
|
||||
39
package/mpc/make-host.sh
Executable file
39
package/mpc/make-host.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=mpc
|
||||
PKGVERSION=1.3.1
|
||||
PKGSOURCE_DIR=mpc
|
||||
PKGSOURCE=mpc-1.3.1.tar.gz
|
||||
PKGURL=http://mirrors.ustc.edu.cn/gnu/mpc/mpc-1.3.1.tar.gz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
gzip -d -c ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
stamp_patched autotools
|
||||
|
||||
step_start configure
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}"
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
39
package/mpfr/make-host.sh
Executable file
39
package/mpfr/make-host.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=mpfr
|
||||
PKGVERSION=4.1.1
|
||||
PKGSOURCE_DIR=mpfr
|
||||
PKGSOURCE=mpfr-4.1.1.tar.xz
|
||||
PKGURL=http://www.mpfr.org/mpfr-4.1.1/mpfr-4.1.1.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
stamp_patched autotools
|
||||
|
||||
step_start configure
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}"
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
79
package/opensbi/hello.s
Normal file
79
package/opensbi/hello.s
Normal file
@@ -0,0 +1,79 @@
|
||||
# hello.s - RISC-V 64 位裸机程序, 打印 "hello world!" 到控制台
|
||||
|
||||
.section .text
|
||||
.global _start
|
||||
_start:
|
||||
# 0x80000000 <- OpenSBI
|
||||
# 0x80200000 <- hello.bin
|
||||
# 0x80210000 <- 栈顶
|
||||
|
||||
# 设置栈指针
|
||||
li sp, 0x80210000
|
||||
|
||||
# 调用打印函数
|
||||
call print_hello
|
||||
|
||||
# 无限循环(退出 qemu 需要按 Ctrl+A X)
|
||||
1: j 1b
|
||||
|
||||
# 打印 "hello world!" 函数
|
||||
print_hello:
|
||||
# 保存返回地址
|
||||
addi sp, sp, -8
|
||||
sd ra, 0(sp)
|
||||
|
||||
# 加载字符串地址
|
||||
la a0, hello_string
|
||||
|
||||
# 调用字符串打印函数
|
||||
call puts
|
||||
|
||||
# 恢复返回地址
|
||||
ld ra, 0(sp)
|
||||
addi sp, sp, 8
|
||||
ret
|
||||
|
||||
# 字符串打印函数 void puts(char *str)
|
||||
# a0: 字符串地址
|
||||
puts:
|
||||
# 保存寄存器
|
||||
addi sp, sp, -16
|
||||
sd ra, 8(sp)
|
||||
sd s0, 0(sp)
|
||||
|
||||
mv s0, a0 # 保存字符串地址
|
||||
|
||||
PRINT_LOOP:
|
||||
# 读取一个字符
|
||||
lb a0, 0(s0)
|
||||
beq a0, zero, PRINT_DONE # 直到遇到 '\0' 结束
|
||||
|
||||
# 调用字符打印函数
|
||||
call putc
|
||||
|
||||
# 下一个字符
|
||||
addi s0, s0, 1
|
||||
j PRINT_LOOP
|
||||
|
||||
PRINT_DONE:
|
||||
# 恢复寄存器
|
||||
ld s0, 0(sp)
|
||||
ld ra, 8(sp)
|
||||
addi sp, sp, 16
|
||||
ret
|
||||
|
||||
# 字符打印函数 void putc(char c)
|
||||
# a0: 要打印的字符
|
||||
putc:
|
||||
# 使用 SBI 调用 (console_putchar)
|
||||
li a7, 0x01 # SBI_EXT_0_1_CONSOLE_PUTCHAR
|
||||
ecall
|
||||
ret
|
||||
|
||||
# 数据段
|
||||
.section .rodata
|
||||
hello_string:
|
||||
.asciz "\nHello RISC-V world!\n"
|
||||
|
||||
# 对齐到4字节边界
|
||||
.align 2
|
||||
19
package/opensbi/hello.sh
Executable file
19
package/opensbi/hello.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
rm -f hello.o hello.elf hello.bin
|
||||
|
||||
# 编译
|
||||
${CROSS_COMPILE}as hello.s -o hello.o
|
||||
${CROSS_COMPILE}ld hello.o -Ttext=0x80200000 -o hello.elf
|
||||
${CROSS_COMPILE}objcopy -O binary hello.elf hello.bin
|
||||
|
||||
# 运行
|
||||
echo "Running in QEMU..."
|
||||
echo "Press Ctrl+A then X to exit"
|
||||
qemu-system-riscv64 \
|
||||
-M virt \
|
||||
-m 256M \
|
||||
-nographic \
|
||||
-bios ${IMAGES_DIR}/fw_jump.bin \
|
||||
-kernel hello.bin
|
||||
37
package/opensbi/make.sh
Executable file
37
package/opensbi/make.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=opensbi
|
||||
PKGVERSION=1.6
|
||||
PKGSOURCE_DIR=opensbi
|
||||
PKGSOURCE=opensbi-1.6.tar.gz
|
||||
PKGURL=https://github.com/riscv-software-src/opensbi/archive/v1.6/opensbi-1.6.tar.gz
|
||||
|
||||
PKGBUILDNAME=${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
gzip -d -c ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
stamp_patched
|
||||
|
||||
stamp_configured
|
||||
|
||||
step_start build
|
||||
eval "${TARGET_MAKE_ENV} CROSS_COMPILE=${CROSS_COMPILE} PLATFORM=generic /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-image
|
||||
/usr/bin/install -m 0644 -D ${PKGBUILD_DIR}/build/platform/generic/firmware/fw_jump.bin ${IMAGES_DIR}/fw_jump.bin
|
||||
step_end install-image
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
@@ -0,0 +1,340 @@
|
||||
From 6e8915572db65cf63b7a82f9b24af6f9cad92ba7 Mon Sep 17 00:00:00 2001
|
||||
From: Wolfgang Grandegger <wg@grandegger.com>
|
||||
Date: Mon, 20 Feb 2017 16:29:24 +0100
|
||||
Subject: [PATCH] Add option to make the rpath relative under a specified root
|
||||
directory
|
||||
|
||||
Running "patchelf" with the option "--make-rpath-relative ROOTDIR" will
|
||||
modify or delete the RPATHDIRs according the following rules
|
||||
similar to Martin's patches [1] making the Buildroot toolchaing/SDK
|
||||
relocatable.
|
||||
|
||||
RPATHDIR starts with "$ORIGIN":
|
||||
The original build-system already took care of setting a relative
|
||||
RPATH, resolve it and test if it's valid (does exist)
|
||||
|
||||
RPATHDIR starts with ROOTDIR:
|
||||
The original build-system added some absolute RPATH (absolute on
|
||||
the build machine). Test if it's valid (does exist).
|
||||
|
||||
ROOTDIR/RPATHDIR exists:
|
||||
The original build-system already took care of setting an absolute
|
||||
RPATH (absolute in the final rootfs), resolve it and test if it's
|
||||
valid (does exist).
|
||||
|
||||
RPATHDIR points somewhere else:
|
||||
(can be anywhere: build trees, staging tree, host location,
|
||||
non-existing location, etc.). Just discard such a path.
|
||||
|
||||
The option "--no-standard-libs" will discard RPATHDIRs ROOTDIR/lib and
|
||||
ROOTDIR/usr/lib. Like "--shrink-rpath", RPATHDIRs are also discarded
|
||||
if the directories do not contain a library referenced by the
|
||||
DT_NEEDED fields.
|
||||
If the option "--relative-to-file" is given, the rpath will start
|
||||
with "$ORIGIN" making it relative to the ELF file, otherwise an
|
||||
absolute path relative to ROOTDIR will be used.
|
||||
|
||||
A pull request for a similar patch [2] for mainline inclusion is
|
||||
pending.
|
||||
|
||||
[1] http://lists.busybox.net/pipermail/buildroot/2016-April/159422.html
|
||||
[2] https://github.com/NixOS/patchelf/pull/118
|
||||
|
||||
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
|
||||
[Fabrice: update for 0.13]
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
[Dario: make the patch to be applied with fuzz factor 0]
|
||||
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
|
||||
---
|
||||
src/patchelf.cc | 199 +++++++++++++++++++++++++++++++++++++++++-------
|
||||
1 file changed, 171 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/src/patchelf.cc b/src/patchelf.cc
|
||||
index fd1e7b7b61c3..f3b7ba8867bf 100644
|
||||
--- a/src/patchelf.cc
|
||||
+++ b/src/patchelf.cc
|
||||
@@ -45,6 +45,10 @@ static bool debugMode = false;
|
||||
|
||||
static bool forceRPath = false;
|
||||
|
||||
+static bool noStandardLibDirs = false;
|
||||
+
|
||||
+static bool relativeToFile = false;
|
||||
+
|
||||
static std::vector<std::string> fileNames;
|
||||
static std::string outputFileName;
|
||||
static bool alwaysWrite = false;
|
||||
@@ -81,6 +85,49 @@ static bool hasAllowedPrefix(const std::string & s, const std::vector<std::strin
|
||||
return std::any_of(allowedPrefixes.begin(), allowedPrefixes.end(), [&](const std::string & i) { return !s.compare(0, i.size(), i); });
|
||||
}
|
||||
|
||||
+static bool absolutePathExists(const std::string & path, std::string & canonicalPath)
|
||||
+{
|
||||
+ char *cpath = realpath(path.c_str(), NULL);
|
||||
+ if (cpath) {
|
||||
+ canonicalPath = cpath;
|
||||
+ free(cpath);
|
||||
+ return true;
|
||||
+ } else {
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static std::string makePathRelative(const std::string & path,
|
||||
+ const std::string & refPath)
|
||||
+{
|
||||
+ std::string relPath = "$ORIGIN";
|
||||
+ std::string p = path, refP = refPath;
|
||||
+ size_t pos;
|
||||
+
|
||||
+ /* Strip the common part of path and refPath */
|
||||
+ while (true) {
|
||||
+ pos = p.find_first_of('/', 1);
|
||||
+ if (refP.find_first_of('/', 1) != pos)
|
||||
+ break;
|
||||
+ if (p.substr(0, pos) != refP.substr(0, pos))
|
||||
+ break;
|
||||
+ if (pos == std::string::npos)
|
||||
+ break;
|
||||
+ p = p.substr(pos);
|
||||
+ refP = refP.substr(pos);
|
||||
+ }
|
||||
+ /* Check if both pathes are equal */
|
||||
+ if (p != refP) {
|
||||
+ pos = 0;
|
||||
+ while (pos != std::string::npos) {
|
||||
+ pos =refP.find_first_of('/', pos + 1);
|
||||
+ relPath.append("/..");
|
||||
+ }
|
||||
+ relPath.append(p);
|
||||
+ }
|
||||
+
|
||||
+ return relPath;
|
||||
+}
|
||||
|
||||
template<ElfFileParams>
|
||||
class ElfFile
|
||||
@@ -197,9 +244,13 @@ public:
|
||||
|
||||
void setInterpreter(const std::string & newInterpreter);
|
||||
|
||||
- typedef enum { rpPrint, rpShrink, rpSet, rpAdd, rpRemove } RPathOp;
|
||||
+ typedef enum { rpPrint, rpShrink, rpMakeRelative, rpSet, rpAdd, rpRemove} RPathOp;
|
||||
|
||||
- void modifyRPath(RPathOp op, const std::vector<std::string> & allowedRpathPrefixes, std::string newRPath);
|
||||
+ bool libFoundInRPath(const std::string & dirName,
|
||||
+ const std::vector<std::string> neededLibs,
|
||||
+ std::vector<bool> & neededLibFound);
|
||||
+
|
||||
+ void modifyRPath(RPathOp op, std::string rootDir, const std::vector<std::string> & allowedRpathPrefixes, std::string newRPath, const std::string & fileName);
|
||||
|
||||
void addNeeded(const std::set<std::string> & libs);
|
||||
|
||||
@@ -1267,8 +1318,28 @@ static void concatToRPath(std::string & rpath, const std::string & path)
|
||||
|
||||
|
||||
template<ElfFileParams>
|
||||
-void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op,
|
||||
- const std::vector<std::string> & allowedRpathPrefixes, std::string newRPath)
|
||||
+bool ElfFile<ElfFileParamNames>::libFoundInRPath(const std::string & dirName,
|
||||
+ const std::vector<std::string> neededLibs, std::vector<bool> & neededLibFound)
|
||||
+{
|
||||
+ /* For each library that we haven't found yet, see if it
|
||||
+ exists in this directory. */
|
||||
+ bool libFound = false;
|
||||
+ for (unsigned int j = 0; j < neededLibs.size(); ++j)
|
||||
+ if (!neededLibFound[j]) {
|
||||
+ std::string libName = dirName + "/" + neededLibs[j];
|
||||
+ struct stat st;
|
||||
+ if (stat(libName.c_str(), &st) == 0) {
|
||||
+ neededLibFound[j] = true;
|
||||
+ libFound = true;
|
||||
+ }
|
||||
+ }
|
||||
+ return libFound;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+template<ElfFileParams>
|
||||
+void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op, std::string rootDir,
|
||||
+ const std::vector<std::string> & allowedRpathPrefixes, std::string newRPath, const std::string & fileName)
|
||||
{
|
||||
auto shdrDynamic = findSection(".dynamic");
|
||||
|
||||
@@ -1314,6 +1385,11 @@ void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op,
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (op == rpMakeRelative && !rpath) {
|
||||
+ debug("no RPATH to make relative\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (op == rpShrink && !rpath) {
|
||||
debug("no RPATH to shrink\n");
|
||||
return;
|
||||
@@ -1343,31 +1419,80 @@ void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op,
|
||||
continue;
|
||||
}
|
||||
|
||||
- /* For each library that we haven't found yet, see if it
|
||||
- exists in this directory. */
|
||||
- bool libFound = false;
|
||||
- for (unsigned int j = 0; j < neededLibs.size(); ++j)
|
||||
- if (!neededLibFound[j]) {
|
||||
- std::string libName = dirName + "/" + neededLibs[j];
|
||||
- try {
|
||||
- Elf32_Half library_e_machine = getElfType(readFile(libName, sizeof(Elf32_Ehdr))).machine;
|
||||
- if (rdi(library_e_machine) == rdi(hdr->e_machine)) {
|
||||
- neededLibFound[j] = true;
|
||||
- libFound = true;
|
||||
- } else
|
||||
- debug("ignoring library '%s' because its machine type differs\n", libName.c_str());
|
||||
- } catch (SysError & e) {
|
||||
- if (e.errNo != ENOENT) throw;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (!libFound)
|
||||
+ if (!libFoundInRPath(dirName, neededLibs, neededLibFound))
|
||||
debug("removing directory '%s' from RPATH\n", dirName.c_str());
|
||||
else
|
||||
concatToRPath(newRPath, dirName);
|
||||
}
|
||||
}
|
||||
|
||||
+ /* Make the the RPATH relative to the specified path */
|
||||
+ if (op == rpMakeRelative) {
|
||||
+ std::vector<bool> neededLibFound(neededLibs.size(), false);
|
||||
+ std::string fileDir = fileName.substr(0, fileName.find_last_of("/"));
|
||||
+
|
||||
+ newRPath = "";
|
||||
+
|
||||
+ std::vector<std::string> rpathDirs = splitColonDelimitedString(rpath);
|
||||
+ for (std::vector<std::string>::iterator it = rpathDirs.begin(); it != rpathDirs.end(); ++it) {
|
||||
+ const std::string & dirName = *it;
|
||||
+
|
||||
+ std::string canonicalPath;
|
||||
+
|
||||
+ /* Figure out if we should keep or discard the path. There are several
|
||||
+ cases to be handled:
|
||||
+ "dirName" starts with "$ORIGIN":
|
||||
+ The original build-system already took care of setting a relative
|
||||
+ RPATH. Resolve it and test if it's valid (does exist).
|
||||
+ "dirName" start with "rootDir":
|
||||
+ The original build-system added some absolute RPATH (absolute on
|
||||
+ the build machine). Test if it's valid (does exist).
|
||||
+ "rootDir"/"dirName" exists:
|
||||
+ The original build-system already took care of setting an absolute
|
||||
+ RPATH (absolute in the final rootfs). Resolve it and test if it's
|
||||
+ valid (does exist).
|
||||
+ "dirName" points somewhere else:
|
||||
+ (can be anywhere: build trees, staging tree, host location,
|
||||
+ non-existing location, etc.). Just discard such a path. */
|
||||
+ if (!dirName.compare(0, 7, "$ORIGIN")) {
|
||||
+ std::string path = fileDir + dirName.substr(7);
|
||||
+ if (!absolutePathExists(path, canonicalPath)) {
|
||||
+ debug("removing directory '%s' from RPATH because '%s' doesn't exist\n",
|
||||
+ dirName.c_str(), path.c_str());
|
||||
+ continue;
|
||||
+ }
|
||||
+ } else if (!dirName.compare(0, rootDir.length(), rootDir)) {
|
||||
+ if (!absolutePathExists(dirName, canonicalPath)) {
|
||||
+ debug("removing directory '%s' from RPATH because it doesn't exist\n", dirName.c_str());
|
||||
+ continue;
|
||||
+ }
|
||||
+ } else {
|
||||
+ std::string path = rootDir + dirName;
|
||||
+ if (!absolutePathExists(path, canonicalPath)) {
|
||||
+ debug("removing directory '%s' from RPATH because it's not in rootdir\n",
|
||||
+ dirName.c_str());
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (noStandardLibDirs) {
|
||||
+ if (!canonicalPath.compare(rootDir + "/lib") ||
|
||||
+ !canonicalPath.compare(rootDir + "/usr/lib")) {
|
||||
+ debug("removing directory '%s' from RPATH because it's a standard library directory\n",
|
||||
+ dirName.c_str());
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Finally make "canonicalPath" relative to "filedir" in "rootDir" */
|
||||
+ if (relativeToFile)
|
||||
+ concatToRPath(newRPath, makePathRelative(canonicalPath, fileDir));
|
||||
+ else
|
||||
+ concatToRPath(newRPath, canonicalPath.substr(rootDir.length()));
|
||||
+ debug("keeping relative path of %s\n", canonicalPath.c_str());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (op == rpRemove) {
|
||||
if (!rpath) {
|
||||
debug("no RPATH to delete\n");
|
||||
@@ -1736,7 +1861,9 @@ static bool removeRPath = false;
|
||||
static bool setRPath = false;
|
||||
static bool addRPath = false;
|
||||
static bool printRPath = false;
|
||||
+static bool makeRPathRelative = false;
|
||||
static std::string newRPath;
|
||||
+static std::string rootDir;
|
||||
static std::set<std::string> neededLibsToRemove;
|
||||
static std::map<std::string, std::string> neededLibsToReplace;
|
||||
static std::set<std::string> neededLibsToAdd;
|
||||
@@ -1760,16 +1887,18 @@ static void patchElf2(ElfFile && elfFile, const FileContents & fileContents, con
|
||||
elfFile.setInterpreter(newInterpreter);
|
||||
|
||||
if (printRPath)
|
||||
- elfFile.modifyRPath(elfFile.rpPrint, {}, "");
|
||||
+ elfFile.modifyRPath(elfFile.rpPrint, "", {}, "", fileName);
|
||||
|
||||
if (shrinkRPath)
|
||||
- elfFile.modifyRPath(elfFile.rpShrink, allowedRpathPrefixes, "");
|
||||
+ elfFile.modifyRPath(elfFile.rpShrink, "", allowedRpathPrefixes, "", fileName);
|
||||
else if (removeRPath)
|
||||
- elfFile.modifyRPath(elfFile.rpRemove, {}, "");
|
||||
+ elfFile.modifyRPath(elfFile.rpRemove, "", {}, "", fileName);
|
||||
else if (setRPath)
|
||||
- elfFile.modifyRPath(elfFile.rpSet, {}, newRPath);
|
||||
+ elfFile.modifyRPath(elfFile.rpSet, "", {}, newRPath, fileName);
|
||||
else if (addRPath)
|
||||
- elfFile.modifyRPath(elfFile.rpAdd, {}, newRPath);
|
||||
+ elfFile.modifyRPath(elfFile.rpAdd, "", {}, newRPath, fileName);
|
||||
+ else if (makeRPathRelative)
|
||||
+ elfFile.modifyRPath(elfFile.rpMakeRelative, rootDir, {}, "", fileName);
|
||||
|
||||
if (printNeeded) elfFile.printNeededLibs();
|
||||
|
||||
@@ -1821,6 +1950,9 @@ void showHelp(const std::string & progName)
|
||||
[--remove-rpath]\n\
|
||||
[--shrink-rpath]\n\
|
||||
[--allowed-rpath-prefixes PREFIXES]\t\tWith '--shrink-rpath', reject rpath entries not starting with the allowed prefix\n\
|
||||
+ [--make-rpath-relative ROOTDIR]\n\
|
||||
+ [--no-standard-lib-dirs]\n\
|
||||
+ [--relative-to-file]\n\
|
||||
[--print-rpath]\n\
|
||||
[--force-rpath]\n\
|
||||
[--add-needed LIBRARY]\n\
|
||||
@@ -1889,6 +2021,17 @@ int mainWrapped(int argc, char * * argv)
|
||||
addRPath = true;
|
||||
newRPath = argv[i];
|
||||
}
|
||||
+ else if (arg == "--make-rpath-relative") {
|
||||
+ if (++i == argc) error("missing argument to --make-rpath-relative");
|
||||
+ makeRPathRelative = true;
|
||||
+ rootDir = argv[i];
|
||||
+ }
|
||||
+ else if (arg == "--no-standard-lib-dirs") {
|
||||
+ noStandardLibDirs = true;
|
||||
+ }
|
||||
+ else if (arg == "--relative-to-file") {
|
||||
+ relativeToFile = true;
|
||||
+ }
|
||||
else if (arg == "--print-rpath") {
|
||||
printRPath = true;
|
||||
}
|
||||
--
|
||||
2.43.0
|
||||
|
||||
41
package/patchelf/make-host.sh
Executable file
41
package/patchelf/make-host.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=patchelf
|
||||
PKGVERSION=0.13
|
||||
PKGSOURCE_DIR=patchelf
|
||||
PKGSOURCE=patchelf-0.13.tar.bz2
|
||||
PKGURL=https://github.com/NixOS/patchelf/releases/download/0.13/patchelf-0.13.tar.bz2
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
bzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch
|
||||
step_end patch autotools
|
||||
|
||||
step_start configure
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}"
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
@@ -0,0 +1,150 @@
|
||||
From c912e9bb8d5be414fda74b2019deb2a6d2d041a0 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
Date: Sun, 16 Dec 2018 11:52:18 +0100
|
||||
Subject: [PATCH] Only prefix with the sysroot a subset of variables
|
||||
|
||||
The standard logic of pkg-config is to prefix all absolute paths by
|
||||
the sysroot defined in PKG_CONFIG_SYSROOT_DIR. However, while some
|
||||
paths (like includedir, libdir, and paths used in -L and -I options)
|
||||
indeed need to be prefixed by the sysroot, it is not necessarily the
|
||||
case for paths that are used on the target. If they get prefixed by
|
||||
the sysroot, the runtime path on the target is incorrect.
|
||||
|
||||
Unfortunately, pkg-config doesn't have a sense of which path needs to
|
||||
be prefixed by the sysroot, and which path should not be prefixed by
|
||||
the sysroot.
|
||||
|
||||
So, let's simply have a whitelist of paths that should be prefixed:
|
||||
g_ir_scanner, g_ir_compiler, g_ir_generate, includedir, libdir, mapdir,
|
||||
pkgdatadir and sdkdir. This list of variables was collected over years of
|
||||
Buildroot development. All other paths are not prefixed by the sysroot.
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
[Updated to include gobject-introspection paths]
|
||||
Signed-off-by: Adam Duskett <aduskett@gmail.com>
|
||||
[Dropped the pkgdatadir path]
|
||||
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
|
||||
---
|
||||
libpkgconf/tuple.c | 64 ++++++++++++++++++++++++++++++++--------------
|
||||
1 file changed, 45 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/libpkgconf/tuple.c b/libpkgconf/tuple.c
|
||||
index 83f6a47..d56fcec 100644
|
||||
--- a/libpkgconf/tuple.c
|
||||
+++ b/libpkgconf/tuple.c
|
||||
@@ -178,6 +178,20 @@ dequote(const char *value)
|
||||
return buf;
|
||||
}
|
||||
|
||||
+static char *
|
||||
+pkgconf_tuple_parse_sysroot(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags, bool add_sysroot);
|
||||
+
|
||||
+const char *sysrooted_keys[] = {
|
||||
+ "g_ir_scanner",
|
||||
+ "g_ir_compiler",
|
||||
+ "g_ir_generate",
|
||||
+ "includedir",
|
||||
+ "libdir",
|
||||
+ "mapdir",
|
||||
+ "sdkdir",
|
||||
+ NULL,
|
||||
+};
|
||||
+
|
||||
static const char *
|
||||
find_sysroot(const pkgconf_client_t *client, pkgconf_list_t *vars)
|
||||
{
|
||||
@@ -237,14 +251,20 @@ pkgconf_tuple_add(const pkgconf_client_t *client, pkgconf_list_t *list, const ch
|
||||
{
|
||||
char *dequote_value;
|
||||
pkgconf_tuple_t *tuple = calloc(1, sizeof(pkgconf_tuple_t));
|
||||
+ bool add_sysroot = false;
|
||||
+ int i;
|
||||
|
||||
pkgconf_tuple_find_delete(list, key);
|
||||
|
||||
dequote_value = dequote(value);
|
||||
|
||||
+ for (i = 0; sysrooted_keys[i] != NULL; i++)
|
||||
+ if (!strcmp(key, sysrooted_keys[i]))
|
||||
+ add_sysroot = true;
|
||||
+
|
||||
tuple->key = strdup(key);
|
||||
if (parse)
|
||||
- tuple->value = pkgconf_tuple_parse(client, list, dequote_value, flags);
|
||||
+ tuple->value = pkgconf_tuple_parse_sysroot(client, list, dequote_value, flags, add_sysroot);
|
||||
else
|
||||
tuple->value = strdup(dequote_value);
|
||||
|
||||
@@ -294,22 +314,8 @@ pkgconf_tuple_find(const pkgconf_client_t *client, pkgconf_list_t *list, const c
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-/*
|
||||
- * !doc
|
||||
- *
|
||||
- * .. c:function:: char *pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags)
|
||||
- *
|
||||
- * Parse an expression for variable substitution.
|
||||
- *
|
||||
- * :param pkgconf_client_t* client: The pkgconf client object to access.
|
||||
- * :param pkgconf_list_t* list: The variable list to search for variables (along side the global variable list).
|
||||
- * :param char* value: The ``key=value`` string to parse.
|
||||
- * :param uint flags: Any flags to consider while parsing.
|
||||
- * :return: the variable data with any variables substituted
|
||||
- * :rtype: char *
|
||||
- */
|
||||
-char *
|
||||
-pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags)
|
||||
+static char *
|
||||
+pkgconf_tuple_parse_sysroot(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags, bool add_sysroot)
|
||||
{
|
||||
char buf[PKGCONF_BUFSIZE];
|
||||
const char *ptr;
|
||||
@@ -318,7 +324,7 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
|
||||
if (!(client->flags & PKGCONF_PKG_PKGF_FDO_SYSROOT_RULES) &&
|
||||
(!(flags & PKGCONF_PKG_PROPF_UNINSTALLED) || (client->flags & PKGCONF_PKG_PKGF_PKGCONF1_SYSROOT_RULES)))
|
||||
{
|
||||
- if (*value == '/' && client->sysroot_dir != NULL && strncmp(value, client->sysroot_dir, strlen(client->sysroot_dir)))
|
||||
+ if (add_sysroot && *value == '/' && client->sysroot_dir != NULL && strncmp(value, client->sysroot_dir, strlen(client->sysroot_dir)))
|
||||
bptr += pkgconf_strlcpy(buf, client->sysroot_dir, sizeof buf);
|
||||
}
|
||||
|
||||
@@ -381,7 +387,7 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
|
||||
{
|
||||
size_t nlen;
|
||||
|
||||
- parsekv = pkgconf_tuple_parse(client, vars, kv, flags);
|
||||
+ parsekv = pkgconf_tuple_parse_sysroot(client, vars, kv, flags, add_sysroot);
|
||||
nlen = pkgconf_strlcpy(bptr, parsekv, remain);
|
||||
free(parsekv);
|
||||
|
||||
@@ -432,6 +438,26 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
|
||||
return strdup(buf);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * !doc
|
||||
+ *
|
||||
+ * .. c:function:: char *pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags)
|
||||
+ *
|
||||
+ * Parse an expression for variable substitution.
|
||||
+ *
|
||||
+ * :param pkgconf_client_t* client: The pkgconf client object to access.
|
||||
+ * :param pkgconf_list_t* list: The variable list to search for variables (along side the global variable list).
|
||||
+ * :param char* value: The ``key=value`` string to parse.
|
||||
+ * :param uint flags: Any flags to consider while parsing.
|
||||
+ * :return: the variable data with any variables substituted
|
||||
+ * :rtype: char *
|
||||
+ */
|
||||
+char *
|
||||
+pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags)
|
||||
+{
|
||||
+ return pkgconf_tuple_parse_sysroot(client, vars, value, flags, true);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* !doc
|
||||
*
|
||||
--
|
||||
2.43.0
|
||||
|
||||
44
package/pkgconf/make-host.sh
Executable file
44
package/pkgconf/make-host.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=pkgconf
|
||||
PKGVERSION=2.3.0
|
||||
PKGSOURCE_DIR=pkgconf
|
||||
PKGSOURCE=pkgconf-2.3.0.tar.xz
|
||||
PKGURL=https://distfiles.ariadne.space/pkgconf/pkgconf-2.3.0.tar.xz
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
step_start extract
|
||||
mkdir -p ${PKGBUILD_DIR}
|
||||
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
|
||||
chmod -R +rw ${PKGBUILD_DIR}
|
||||
step_end extract
|
||||
|
||||
step_start patch
|
||||
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch
|
||||
step_end patch autotools
|
||||
|
||||
step_start configure
|
||||
(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} CC=\"/usr/bin/gcc\" CXX=\"/usr/bin/g++\" CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking")
|
||||
step_end configure
|
||||
|
||||
step_start build
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
|
||||
step_end build
|
||||
|
||||
step_start install-host
|
||||
eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}"
|
||||
/usr/bin/install -m 0755 -D ${PROJECT_DIR}/package/pkgconf/pkg-config.in ${HOST_DIR}/bin/pkg-config
|
||||
/usr/bin/sed -i -e "s,@STAGING_SUBDIR@,${STAGING_SUBDIR},g" ${HOST_DIR}/bin/pkg-config
|
||||
/usr/bin/sed -i -e 's,@STATIC@,,' ${HOST_DIR}/bin/pkg-config
|
||||
step_end install-host
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
12
package/pkgconf/pkg-config.in
Normal file
12
package/pkgconf/pkg-config.in
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
PKGCONFDIR=$(dirname $0)
|
||||
DEFAULT_PKG_CONFIG_LIBDIR=${PKGCONFDIR}/../@STAGING_SUBDIR@/usr/lib/pkgconfig:${PKGCONFDIR}/../@STAGING_SUBDIR@/usr/share/pkgconfig
|
||||
DEFAULT_PKG_CONFIG_SYSROOT_DIR=${PKGCONFDIR}/../@STAGING_SUBDIR@
|
||||
DEFAULT_PKG_CONFIG_SYSTEM_INCLUDE_PATH=${PKGCONFDIR}/../@STAGING_SUBDIR@/usr/include
|
||||
DEFAULT_PKG_CONFIG_SYSTEM_LIBRARY_PATH=${PKGCONFDIR}/../@STAGING_SUBDIR@/usr/lib
|
||||
|
||||
PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-${DEFAULT_PKG_CONFIG_LIBDIR}} \
|
||||
PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-${DEFAULT_PKG_CONFIG_SYSROOT_DIR}} \
|
||||
PKG_CONFIG_SYSTEM_INCLUDE_PATH=${PKG_CONFIG_SYSTEM_INCLUDE_PATH:-${DEFAULT_PKG_CONFIG_SYSTEM_INCLUDE_PATH}} \
|
||||
PKG_CONFIG_SYSTEM_LIBRARY_PATH=${PKG_CONFIG_SYSTEM_LIBRARY_PATH:-${DEFAULT_PKG_CONFIG_SYSTEM_LIBRARY_PATH}} \
|
||||
exec ${PKGCONFDIR}/pkgconf --keep-system-libs @STATIC@ "$@"
|
||||
11
package/prepare-env/make.sh
Executable file
11
package/prepare-env/make.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
mkdir -p ${BUILD_DIR}
|
||||
if [ -f ${BUILD_DIR}/build-time.log ]; then
|
||||
touch ${BUILD_DIR}/build-time.log
|
||||
fi
|
||||
mkdir -p ${HOST_DIR}
|
||||
mkdir -p ${STAGING_DIR}
|
||||
ln -snf ${STAGING_DIR} ${OUTPUT_DIR}/staging
|
||||
mkdir -p ${TARGET_DIR}
|
||||
21
package/rootfs-ext2/device_table.txt
Normal file
21
package/rootfs-ext2/device_table.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
# See package/makedevs/README for details
|
||||
#
|
||||
# This device table is used to assign proper ownership and permissions
|
||||
# on various files. It doesn't create any device file, as it is used
|
||||
# in both static device configurations (where /dev/ is static) and in
|
||||
# dynamic configurations (where devtmpfs, mdev or udev are used).
|
||||
#
|
||||
# <name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
|
||||
/dev d 755 0 0 - - - - -
|
||||
/tmp d 1777 0 0 - - - - -
|
||||
/etc d 755 0 0 - - - - -
|
||||
/root d 700 0 0 - - - - -
|
||||
/var/www d 755 33 33 - - - - -
|
||||
/etc/shadow f 600 0 0 - - - - -
|
||||
/etc/passwd f 644 0 0 - - - - -
|
||||
/etc/network/if-up.d d 755 0 0 - - - - -
|
||||
/etc/network/if-pre-up.d d 755 0 0 - - - - -
|
||||
/etc/network/if-down.d d 755 0 0 - - - - -
|
||||
/etc/network/if-post-down.d d 755 0 0 - - - - -
|
||||
# uncomment this to allow starting x as non-root
|
||||
#/usr/X11R6/bin/Xfbdev f 4755 0 0 - - - - -
|
||||
69
package/rootfs-ext2/make.sh
Executable file
69
package/rootfs-ext2/make.sh
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
ROOTFS_EXT2_SIZE=60M
|
||||
|
||||
echo ">>> Generating root filesystems common tables"
|
||||
rm -rf ${BUILD_DIR}/buildroot-fs
|
||||
mkdir -p ${BUILD_DIR}/buildroot-fs
|
||||
printf ' \n' >> ${BUILD_DIR}/buildroot-fs/full_users_table.txt
|
||||
printf ' /bin/busybox f 4755 0 0 - - - - -\n\n' > ${BUILD_DIR}/buildroot-fs/full_devices_table.txt
|
||||
cat ${PROJECT_DIR}/package/rootfs-ext2/device_table.txt >> ${BUILD_DIR}/buildroot-fs/full_devices_table.txt
|
||||
|
||||
echo ">>> Generating filesystem image rootfs.ext2"
|
||||
mkdir -p ${IMAGES_DIR}
|
||||
rm -rf ${BUILD_DIR}/buildroot-fs/ext2
|
||||
mkdir -p ${BUILD_DIR}/buildroot-fs/ext2
|
||||
rsync -auH --exclude=/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM ${TARGET_DIR}/ ${BUILD_DIR}/buildroot-fs/ext2/target
|
||||
echo '#!/bin/sh' > ${BUILD_DIR}/buildroot-fs/ext2/fakeroot
|
||||
echo "set -e" >> ${BUILD_DIR}/buildroot-fs/ext2/fakeroot
|
||||
echo "chown -h -R 0:0 ${BUILD_DIR}/buildroot-fs/ext2/target" >> ${BUILD_DIR}/buildroot-fs/ext2/fakeroot
|
||||
PATH="${HOST_DIR}/bin:${HOST_DIR}/sbin:${PATH}" ${PROJECT_DIR}/support/scripts/mkusers ${BUILD_DIR}/buildroot-fs/full_users_table.txt ${BUILD_DIR}/buildroot-fs/ext2/target >> ${BUILD_DIR}/buildroot-fs/ext2/fakeroot
|
||||
echo "${HOST_DIR}/bin/makedevs -d ${BUILD_DIR}/buildroot-fs/full_devices_table.txt ${BUILD_DIR}/buildroot-fs/ext2/target" >> ${BUILD_DIR}/buildroot-fs/ext2/fakeroot
|
||||
printf " rm -rf ${BUILD_DIR}/buildroot-fs/ext2/target/usr/lib/udev/hwdb.d/ ${BUILD_DIR}/buildroot-fs/ext2/target/etc/udev/hwdb.d/\n" >>${BUILD_DIR}/buildroot-fs/ext2/fakeroot
|
||||
echo "find ${BUILD_DIR}/buildroot-fs/ext2/target/run/ -mindepth 1 -prune -print0 | xargs -0r rm -rf --" >> ${BUILD_DIR}/buildroot-fs/ext2/fakeroot
|
||||
echo "find ${BUILD_DIR}/buildroot-fs/ext2/target/tmp/ -mindepth 1 -prune -print0 | xargs -0r rm -rf --" >> ${BUILD_DIR}/buildroot-fs/ext2/fakeroot
|
||||
printf ' \n' >> ${BUILD_DIR}/buildroot-fs/ext2/fakeroot
|
||||
printf ' \n' >> ${BUILD_DIR}/buildroot-fs/ext2/fakeroot
|
||||
printf " rm -f ${IMAGES_DIR}/rootfs.ext2\n ${HOST_DIR}/sbin/mkfs.ext2 -d ${BUILD_DIR}/buildroot-fs/ext2/target -N 0 -m 5 -L \"rootfs\" -I 256 -O ^64bit ${IMAGES_DIR}/rootfs.ext2 \"${ROOTFS_EXT2_SIZE}\" || { ret=\$?; echo \"*** Maybe you need to increase the filesystem size (ROOTFS_EXT2_SIZE)\" 1>&2; exit \$ret; }\n" >> ${BUILD_DIR}/buildroot-fs/ext2/fakeroot
|
||||
chmod a+x ${BUILD_DIR}/buildroot-fs/ext2/fakeroot
|
||||
PATH="${HOST_DIR}/bin:${HOST_DIR}/sbin:${PATH}" FAKEROOTDONTTRYCHOWN=1 ${HOST_DIR}/bin/fakeroot -- ${BUILD_DIR}/buildroot-fs/ext2/fakeroot
|
||||
rm -rf ${BUILD_DIR}/buildroot-fs/ext2/target
|
||||
|
||||
echo ">>> Generating filesystem image rootfs.tar"
|
||||
mkdir -p ${IMAGES_DIR}
|
||||
rm -rf ${BUILD_DIR}/buildroot-fs/tar
|
||||
mkdir -p ${BUILD_DIR}/buildroot-fs/tar
|
||||
rsync -auH --exclude=/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM ${TARGET_DIR}/ ${BUILD_DIR}/buildroot-fs/tar/target
|
||||
echo '#!/bin/sh' > ${BUILD_DIR}/buildroot-fs/tar/fakeroot
|
||||
echo "set -e" >> ${BUILD_DIR}/buildroot-fs/tar/fakeroot
|
||||
echo "chown -h -R 0:0 ${BUILD_DIR}/buildroot-fs/tar/target" >> ${BUILD_DIR}/buildroot-fs/tar/fakeroot
|
||||
PATH="${HOST_DIR}/bin:${HOST_DIR}/sbin:${PATH}" ${PROJECT_DIR}/support/scripts/mkusers ${BUILD_DIR}/buildroot-fs/full_users_table.txt ${BUILD_DIR}/buildroot-fs/tar/target >> ${BUILD_DIR}/buildroot-fs/tar/fakeroot
|
||||
echo "${HOST_DIR}/bin/makedevs -d ${BUILD_DIR}/buildroot-fs/full_devices_table.txt ${BUILD_DIR}/buildroot-fs/tar/target" >> ${BUILD_DIR}/buildroot-fs/tar/fakeroot
|
||||
printf " rm -rf ${BUILD_DIR}/buildroot-fs/tar/target/usr/lib/udev/hwdb.d/ ${BUILD_DIR}/buildroot-fs/tar/target/etc/udev/hwdb.d/\n" >> ${BUILD_DIR}/buildroot-fs/tar/fakeroot
|
||||
echo "find ${BUILD_DIR}/buildroot-fs/tar/target/run/ -mindepth 1 -prune -print0 | xargs -0r rm -rf --" >> ${BUILD_DIR}/buildroot-fs/tar/fakeroot
|
||||
echo "find ${BUILD_DIR}/buildroot-fs/tar/target/tmp/ -mindepth 1 -prune -print0 | xargs -0r rm -rf --" >> ${BUILD_DIR}/buildroot-fs/tar/fakeroot
|
||||
printf ' \n' >> ${BUILD_DIR}/buildroot-fs/tar/fakeroot
|
||||
printf ' \n' >> ${BUILD_DIR}/buildroot-fs/tar/fakeroot
|
||||
printf " (cd ${BUILD_DIR}/buildroot-fs/tar/target; find -print0 | LC_ALL=C sort -z | tar --pax-option=exthdr.name=%%d/PaxHeaders/%%f,atime:=0,ctime:=0 -cf ${IMAGES_DIR}/rootfs.tar --null --xattrs-include='*' --no-recursion -T - --numeric-owner)\n" >> ${BUILD_DIR}/buildroot-fs/tar/fakeroot
|
||||
chmod a+x ${BUILD_DIR}/buildroot-fs/tar/fakeroot
|
||||
PATH="${HOST_DIR}/bin:${HOST_DIR}/sbin:${PATH}" FAKEROOTDONTTRYCHOWN=1 ${HOST_DIR}/bin/fakeroot -- ${BUILD_DIR}/buildroot-fs/tar/fakeroot
|
||||
rm -rf ${BUILD_DIR}/buildroot-fs/tar/target
|
||||
|
||||
echo ">>> Generating Init RAM Disk initrd.img"
|
||||
pushd ${TARGET_DIR}
|
||||
find . | cpio --create --format='newc' > ${IMAGES_DIR}/initrd.img
|
||||
popd
|
||||
|
||||
|
||||
echo ">>> Executing post-image";
|
||||
# Ubuntu 22.04 上默认安装的 qemu 是 6.2.0
|
||||
# Ubuntu 24.04 上默认安装的 qemu 是 8.2.2
|
||||
QEMU_CMD="qemu-system-riscv64 -M virt -m 256M -nographic -bios fw_jump.bin -kernel Image -drive file=rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -append \"nokaslr root=/dev/vda rw console=ttyS0\" -netdev user,id=net0 -device virtio-net-device,netdev=net0"
|
||||
echo ${QEMU_CMD} > ${IMAGES_DIR}/start-qemu.sh
|
||||
chmod +x ${IMAGES_DIR}/start-qemu.sh
|
||||
|
||||
# 如果是 initramfs 启动,在构建出 initrd.img 后可以采用如下
|
||||
QEMU_CMD_INITRAMFS="qemu-system-riscv64 -M virt -m 256M -nographic -bios fw_jump.bin -kernel Image -initrd initrd.img -append \"nokaslr rdinit=/sbin/init console=ttyS0\" -netdev user,id=net0 -device virtio-net-device,netdev=net0"
|
||||
echo ${QEMU_CMD_INITRAMFS} > ${IMAGES_DIR}/start-qemu-initramfs.sh
|
||||
chmod +x ${IMAGES_DIR}/start-qemu-initramfs.sh
|
||||
55
package/skeleton/make.sh
Executable file
55
package/skeleton/make.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/bash
|
||||
source $(dirname "$0")/../common.sh
|
||||
|
||||
PKGNAME=skeleton
|
||||
PKGVERSION=
|
||||
PKGSOURCE_DIR=
|
||||
PKGSOURCE=
|
||||
|
||||
PKGBUILDNAME=host-${PKGNAME}
|
||||
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}
|
||||
|
||||
echo "----> Building ${PKGBUILDNAME} ..."
|
||||
|
||||
stamp_downloaded
|
||||
|
||||
stamp_extracted
|
||||
|
||||
stamp_patched
|
||||
|
||||
stamp_configured
|
||||
|
||||
stamp_built
|
||||
|
||||
step_start install-host
|
||||
ln -snf . ${HOST_DIR}/usr
|
||||
mkdir -p ${HOST_DIR}/lib
|
||||
mkdir -p ${HOST_DIR}/include
|
||||
ln -snf lib ${HOST_DIR}/lib64
|
||||
step_end install-host
|
||||
|
||||
step_start install-staging
|
||||
rsync -a --ignore-times --exclude .svn --exclude .git --exclude .hg --exclude .bzr --exclude CVS --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' ${PROJECT_DIR}/package/${PKGNAME}/system/skeleton/ ${STAGING_DIR}
|
||||
/usr/bin/install -d -m 0755 ${STAGING_DIR}/bin
|
||||
/usr/bin/install -d -m 0755 ${STAGING_DIR}/sbin
|
||||
/usr/bin/install -d -m 0755 ${STAGING_DIR}/lib
|
||||
ln -snf lib ${STAGING_DIR}/lib64
|
||||
ln -snf lib ${STAGING_DIR}/usr/lib64
|
||||
/usr/bin/install -d -m 0755 ${STAGING_DIR}/usr/include
|
||||
step_end install-staging
|
||||
|
||||
step_start install-target
|
||||
rsync -a --ignore-times --exclude .svn --exclude .git --exclude .hg --exclude .bzr --exclude CVS --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' ${PROJECT_DIR}/package/${PKGNAME}/system/skeleton/ ${TARGET_DIR}
|
||||
/usr/bin/install -d -m 0755 ${TARGET_DIR}/bin
|
||||
/usr/bin/install -d -m 0755 ${TARGET_DIR}/sbin
|
||||
/usr/bin/install -d -m 0755 ${TARGET_DIR}/lib
|
||||
ln -snf lib ${TARGET_DIR}/lib64
|
||||
ln -snf lib ${TARGET_DIR}/usr/lib64
|
||||
/usr/bin/sed -i -e 's,@PATH@,"/bin:/sbin:/usr/bin:/usr/sbin",' ${TARGET_DIR}/etc/profile
|
||||
# setup sysv
|
||||
rsync -a --ignore-times --exclude .svn --exclude .git --exclude .hg --exclude .bzr --exclude CVS --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' ${PROJECT_DIR}/package/${PKGNAME}/skeleton/ ${TARGET_DIR}
|
||||
step_end install-target
|
||||
|
||||
stamp_installed
|
||||
|
||||
echo "<---- ${PKGBUILDNAME} build complete."
|
||||
1
package/skeleton/skeleton/dev/log
Symbolic link
1
package/skeleton/skeleton/dev/log
Symbolic link
@@ -0,0 +1 @@
|
||||
../tmp/log
|
||||
0
package/skeleton/skeleton/dev/pts/.empty
Normal file
0
package/skeleton/skeleton/dev/pts/.empty
Normal file
0
package/skeleton/skeleton/dev/shm/.empty
Normal file
0
package/skeleton/skeleton/dev/shm/.empty
Normal file
8
package/skeleton/skeleton/etc/fstab
Normal file
8
package/skeleton/skeleton/etc/fstab
Normal file
@@ -0,0 +1,8 @@
|
||||
# <file system> <mount pt> <type> <options> <dump> <pass>
|
||||
/dev/root / ext2 rw,noauto 0 1
|
||||
proc /proc proc defaults 0 0
|
||||
devpts /dev/pts devpts defaults,gid=5,mode=620,ptmxmode=0666 0 0
|
||||
tmpfs /dev/shm tmpfs mode=1777 0 0
|
||||
tmpfs /tmp tmpfs mode=1777 0 0
|
||||
tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0
|
||||
sysfs /sys sysfs defaults 0 0
|
||||
1
package/skeleton/skeleton/var/cache
Symbolic link
1
package/skeleton/skeleton/var/cache
Symbolic link
@@ -0,0 +1 @@
|
||||
../tmp
|
||||
1
package/skeleton/skeleton/var/lib/misc
Symbolic link
1
package/skeleton/skeleton/var/lib/misc
Symbolic link
@@ -0,0 +1 @@
|
||||
../../tmp
|
||||
1
package/skeleton/skeleton/var/lock
Symbolic link
1
package/skeleton/skeleton/var/lock
Symbolic link
@@ -0,0 +1 @@
|
||||
../run/lock
|
||||
1
package/skeleton/skeleton/var/log
Symbolic link
1
package/skeleton/skeleton/var/log
Symbolic link
@@ -0,0 +1 @@
|
||||
../tmp
|
||||
1
package/skeleton/skeleton/var/run
Symbolic link
1
package/skeleton/skeleton/var/run
Symbolic link
@@ -0,0 +1 @@
|
||||
../run
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user