Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
@@ -4697,7 +4697,7 @@ sub process {
|
||||
## $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) {
|
||||
##
|
||||
## # Remove any bracketed sections to ensure we do not
|
||||
## # falsly report the parameters of functions.
|
||||
## # falsely report the parameters of functions.
|
||||
## my $ln = $line;
|
||||
## while ($ln =~ s/\([^\(\)]*\)//g) {
|
||||
## }
|
||||
|
||||
@@ -207,7 +207,7 @@ class GitHubCommitTsCache(object):
|
||||
|
||||
|
||||
class DownloadGitHubTarball(object):
|
||||
"""Download and repack archive tarabll from GitHub.
|
||||
"""Download and repack archive tarball from GitHub.
|
||||
|
||||
Compared with the method of packing after cloning the whole repo, this
|
||||
method is more friendly to users with fragile internet connection.
|
||||
@@ -220,7 +220,7 @@ class DownloadGitHubTarball(object):
|
||||
|
||||
- GitHub archives do not contain source codes for submodules.
|
||||
|
||||
- GitHub archives seem to respect .gitattributes and ignore pathes with
|
||||
- GitHub archives seem to respect .gitattributes and ignore paths with
|
||||
export-ignore attributes.
|
||||
|
||||
For the first two issues, the method will fail loudly to allow fallback to
|
||||
|
||||
@@ -50,6 +50,7 @@ BIN_SPECS="
|
||||
gdbserver: gdbserver
|
||||
"
|
||||
|
||||
OVERWRITE_CONFIG=""
|
||||
|
||||
test_c() {
|
||||
cat <<-EOT | "${CC:-false}" $CFLAGS -o /dev/null -x c - 2>/dev/null
|
||||
@@ -281,8 +282,11 @@ print_config() {
|
||||
local mksubtarget
|
||||
|
||||
local target="$("$CC" $CFLAGS -dumpmachine)"
|
||||
local version="$("$CC" $CFLAGS -dumpversion)"
|
||||
local cpuarch="${target%%-*}"
|
||||
local prefix="${CC##*/}"; prefix="${prefix%-*}-"
|
||||
|
||||
# get CC; strip version; strip gcc and add - suffix
|
||||
local prefix="${CC##*/}"; prefix="${prefix%-$version}"; prefix="${prefix%-*}-"
|
||||
local config="${0%/scripts/*}/.config"
|
||||
|
||||
# if no target specified, print choice list and exit
|
||||
@@ -317,9 +321,13 @@ print_config() {
|
||||
fi
|
||||
|
||||
# bail out if there is a .config already
|
||||
if [ -f "${0%/scripts/*}/.config" ]; then
|
||||
echo "There already is a .config file, refusing to overwrite!" >&2
|
||||
return 1
|
||||
if [ -f "$config" ]; then
|
||||
if [ "$OVERWRITE_CONFIG" == "" ]; then
|
||||
echo "There already is a .config file, refusing to overwrite!" >&2
|
||||
return 1
|
||||
else
|
||||
echo "There already is a .config file, trying to overwrite!"
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$mktarget" in */*)
|
||||
@@ -327,8 +335,11 @@ print_config() {
|
||||
mktarget="${mktarget%/*}"
|
||||
;; esac
|
||||
|
||||
if [ ! -f "$config" ]; then
|
||||
touch "$config"
|
||||
fi
|
||||
|
||||
echo "CONFIG_TARGET_${mktarget}=y" > "$config"
|
||||
echo "CONFIG_TARGET_${mktarget}=y" >> "$config"
|
||||
|
||||
if [ -n "$mksubtarget" ]; then
|
||||
echo "CONFIG_TARGET_${mktarget}_${mksubtarget}=y" >> "$config"
|
||||
@@ -358,8 +369,18 @@ print_config() {
|
||||
echo "CONFIG_TOOLCHAIN_PREFIX=\"$prefix\"" >> "$config"
|
||||
echo "CONFIG_TARGET_NAME=\"$target\"" >> "$config"
|
||||
|
||||
if [ "$LIBC_TYPE" != glibc ]; then
|
||||
echo "CONFIG_TOOLCHAIN_LIBC=\"$LIBC_TYPE\"" >> "$config"
|
||||
if [ -f "$config" ]; then
|
||||
sed -i '/CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL/d' "$config"
|
||||
sed -i '/CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC/d' "$config"
|
||||
fi
|
||||
|
||||
if [ "$LIBC_TYPE" == glibc ]; then
|
||||
echo "CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC=y" >> "$config"
|
||||
elif [ "$LIBC_TYPE" == musl ]; then
|
||||
echo "CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL=y" >> "$config"
|
||||
else
|
||||
echo "Can't detect LIBC type. Aborting!" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local lib
|
||||
@@ -452,6 +473,13 @@ probe_cpp() {
|
||||
}
|
||||
|
||||
probe_libc() {
|
||||
if [ -f $TOOLCHAIN/info.mk ]; then
|
||||
LIBC_TYPE=$(grep LIBC_TYPE $TOOLCHAIN/info.mk | sed 's/LIBC_TYPE=//')
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Warning! Can't find info.mk, trying to detect with alternative way."
|
||||
|
||||
if [ -z "$LIBC_TYPE" ]; then
|
||||
if test_uclibc; then
|
||||
LIBC_TYPE="uclibc"
|
||||
@@ -529,8 +557,13 @@ while [ -n "$1" ]; do
|
||||
exit $?
|
||||
;;
|
||||
|
||||
--overwrite-config)
|
||||
OVERWRITE_CONFIG=y
|
||||
;;
|
||||
|
||||
--config)
|
||||
if probe_cc; then
|
||||
probe_libc
|
||||
print_config "$1"
|
||||
exit $?
|
||||
fi
|
||||
@@ -569,7 +602,9 @@ while [ -n "$1" ]; do
|
||||
echo -e " Most commands also take a --cflags parameter which " >&2
|
||||
echo -e " is used to specify C flags to be passed to the " >&2
|
||||
echo -e " cross compiler when performing tests." >&2
|
||||
echo -e " This paremter may be repeated multiple times." >&2
|
||||
echo -e " This parameter may be repeated multiple times." >&2
|
||||
echo -e " Use --overwrite-config before --config to overwrite" >&2
|
||||
echo -e " an already present config with the required changes.">&2
|
||||
exit 1
|
||||
;;
|
||||
|
||||
|
||||
98
scripts/ext-tools.sh
Executable file
98
scripts/ext-tools.sh
Executable file
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
TOOLS_TAR=""
|
||||
HOST_BUILD_DIR=$(pwd)/"build_dir/host"
|
||||
HOST_STAGING_DIR_STAMP=$(pwd)/"staging_dir/host/stamp"
|
||||
|
||||
refresh_timestamps() {
|
||||
find "$1" -not -type l -print0 | xargs -0 touch
|
||||
}
|
||||
|
||||
extract_prebuilt_tar() {
|
||||
tar -xf "$1"
|
||||
}
|
||||
|
||||
install_prebuilt_tools() {
|
||||
extract_prebuilt_tar "$TOOLS_TAR"
|
||||
|
||||
if [ ! -d "$HOST_BUILD_DIR" ]; then
|
||||
echo "Can't find Host Build Dir "$HOST_BUILD_DIR"" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
refresh_timestamps "$HOST_BUILD_DIR"
|
||||
sleep 1
|
||||
|
||||
if [ ! -d "$HOST_STAGING_DIR_STAMP" ]; then
|
||||
echo "Can't find Host Staging Dir Stamp "$HOST_STAGING_DIR_STAMP"" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
refresh_timestamps "$HOST_STAGING_DIR_STAMP"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
arg="$1"; shift
|
||||
case "$arg" in
|
||||
--host-build-dir)
|
||||
[ -d "$1" ] || {
|
||||
echo "Directory '$1' does not exist." >&2
|
||||
exit 1
|
||||
}
|
||||
HOST_BUILD_DIR="$(cd "$1"; pwd)"; shift
|
||||
;;
|
||||
|
||||
--host-staging-dir-stamp)
|
||||
[ -d "$1" ] || {
|
||||
echo "Directory '$1' does not exist." >&2
|
||||
exit 1
|
||||
}
|
||||
HOST_STAGING_DIR_STAMP="$(cd "$1"; pwd)"; shift
|
||||
;;
|
||||
|
||||
--tools)
|
||||
[ -f "$1" ] || {
|
||||
echo "Tools tar file '$1' does not exist." >&2
|
||||
exit 1
|
||||
}
|
||||
TOOLS_TAR="$1"; shift
|
||||
install_prebuilt_tools
|
||||
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-h|--help)
|
||||
me="$(basename "$0")"
|
||||
echo -e "\nUsage:\n" >&2
|
||||
echo -e " $me --host-build-dir {directory}" >&2
|
||||
echo -e " Set to refresh timestamp of this build directory" >&2
|
||||
echo -e " with --tools." >&2
|
||||
echo -e " THIS OPTION MUST BE SET BEFORE --tools." >&2
|
||||
echo -e " If not provided the default directory is:" >&2
|
||||
echo -e " $(pwd)/build_dir/host\n" >&2
|
||||
echo -e " $me --host-staging-dir-stamp {directory}" >&2
|
||||
echo -e " Set to refresh staging timestamp present in this" >&2
|
||||
echo -e " directory with --tools." >&2
|
||||
echo -e " THIS OPTION MUST BE SET BEFORE --tools." >&2
|
||||
echo -e " If not provided the default directory is:" >&2
|
||||
echo -e " $(pwd)/staging_dir/host/stamp\n" >&2
|
||||
echo -e " $me --tools {tar}" >&2
|
||||
echo -e " Install the prebuilt tools present in the passed" >&2
|
||||
echo -e " tar and prepare them." >&2
|
||||
echo -e " To correctly use them it's needed to update the." >&2
|
||||
echo -e " timestamp of each tools to skip recompilation.\n" >&2
|
||||
echo -e " $me --help" >&2
|
||||
echo -e " Display this help text and exit.\n\n" >&2
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown argument '$arg'" >&2
|
||||
exec $0 --help
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
exec $0 --help
|
||||
@@ -7,7 +7,7 @@ from sys import argv
|
||||
import json
|
||||
|
||||
if len(argv) != 2:
|
||||
print("JSON info files script requires ouput file as argument")
|
||||
print("JSON info files script requires output file as argument")
|
||||
exit(1)
|
||||
|
||||
output_path = Path(argv[1])
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
# This is appended to the factory image and is tested by the Linksys Upgrader - as observed in civic.
|
||||
# The footer is 256 bytes. The format is:
|
||||
# .LINKSYS. This is detected by the Linksys upgrader before continuing with upgrade. (9 bytes)
|
||||
# <VERSION> The version number of upgrade. Not checked so use arbitary value (8 bytes)
|
||||
# <VERSION> The version number of upgrade. Not checked so use arbitrary value (8 bytes)
|
||||
# <TYPE> Model of target device, padded (0x20) to (15 bytes)
|
||||
# <CRC> CRC checksum of the image to flash (8 byte)
|
||||
# <padding> Padding (0x20) (7 bytes)
|
||||
# <signature> Signature of signer. Not checked so use Arbitary value (16 bytes)
|
||||
# <signature> Signature of signer. Not checked so use arbitrary value (16 bytes)
|
||||
# <padding> Padding (0x00) (192 bytes)
|
||||
# 0x0A (1 byte)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
function usage {
|
||||
echo "Usage: prepare_image image_type kernel_image rootfs_image header_size"
|
||||
echo "Padd root and kernel image to the correct size and append the jffs2 start marker as needed"
|
||||
echo "Pad root and kernel image to the correct size and append the jffs2 start marker as needed"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
# directory where search for images
|
||||
TOP_DIR="${TOP_DIR:-./bin/targets}"
|
||||
# key to sign images
|
||||
BUILD_KEY="${BUILD_KEY:-key-build}" # TODO unifiy naming?
|
||||
BUILD_KEY="${BUILD_KEY:-key-build}" # TODO unify naming?
|
||||
# remove other signatures (added e.g. by buildbot)
|
||||
REMOVE_OTER_SIGNATURES="${REMOVE_OTER_SIGNATURES:-1}"
|
||||
|
||||
# find all sysupgrade images in TOP_DIR
|
||||
# factory images don't need signatures as non OpenWrt system doen't check them anyway
|
||||
# factory images don't need signatures as non OpenWrt system doesn't check them anyway
|
||||
for image in $(find $TOP_DIR -type f -name "*-sysupgrade.bin"); do
|
||||
# check if image actually support metadata
|
||||
if fwtool -i /dev/null "$image"; then
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
###
|
||||
### The script compares locally compiled package with the package indexes
|
||||
### available upstream. This way the storage impact of optimizations or
|
||||
### feature modifiactions is easy to see.
|
||||
### feature modifications is easy to see.
|
||||
###
|
||||
### If no environmental variables are set the scritp reads the current
|
||||
### If no environmental variables are set the script reads the current
|
||||
### .config file. The evaluated env variables are the following:
|
||||
###
|
||||
### TARGET SUBTARGET ARCH PACKAGES BIN_DIR BASE_URL CHECK_INSTALLED
|
||||
|
||||
@@ -772,7 +772,7 @@ sub writeOutFirmware {
|
||||
$_->{'name'}, $filename);
|
||||
}
|
||||
|
||||
# If the next parition is before the end of the current image, then rewind.
|
||||
# If the next partition is before the end of the current image, then rewind.
|
||||
elsif ($_->{'offset'} < $end_point) {
|
||||
$debug and printf("Rewound %s before <%s> in \"%s\"\n",
|
||||
(($end_point - $_->{'offset'}) >= $block_size ?
|
||||
@@ -971,7 +971,7 @@ if (!GetOptions("d|debug" => \$debug,
|
||||
print " [-b|--redboot] <file> Input/Output RedBoot filename\n";
|
||||
print " [-s|--sysconf] <file> Input/Output SysConf filename\n";
|
||||
print " [-L|--loader] <file> Second stage boot loader filename\n";
|
||||
print " [-k|--kernel] <file> Input/Ouptut Kernel filename\n";
|
||||
print " [-k|--kernel] <file> Input/Output Kernel filename\n";
|
||||
print " [-r|--ramdisk] <file> Input/Output Ramdisk filename(s)\n";
|
||||
print " [-f|--fisdir] <file> Input/Output FIS directory filename\n";
|
||||
print " [-m|--microcode] <file> Input/Output Microcode filename\n";
|
||||
|
||||
Reference in New Issue
Block a user