mirror of
https://github.com/FUjr/gl-infra-builder.git
synced 2025-12-16 17:15:08 +00:00
support build qsdk
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
This commit is contained in:
parent
3979004817
commit
007ab01285
12
config-qsdk11.5.yml
Normal file
12
config-qsdk11.5.yml
Normal file
@ -0,0 +1,12 @@
|
||||
repo: https://gitlab.com/gl.sdk4.0/gl.router/gl-axt1800.git
|
||||
branch: master
|
||||
git_clone_dir: gl-axt1800
|
||||
qsdk_repo: /home/glinet/work/qsdk-11.5-repo.tar.xz
|
||||
openwrt_root_dir: gl-axt1800/qsdk
|
||||
qca_spf_repo: https://gitlab.com/gl.sdk4.0/gl.router/qca-networking-spf.git
|
||||
qca_spf_branch: r11.5_00002.1
|
||||
gen_script: gen-qsdk11.5.sh
|
||||
qsdk: true
|
||||
|
||||
patch_folders:
|
||||
- patches-qsdk11/
|
||||
205
patches-qsdk11/0001-scripts-update-feed-script.patch
Normal file
205
patches-qsdk11/0001-scripts-update-feed-script.patch
Normal file
@ -0,0 +1,205 @@
|
||||
From f8a99dff081b6afada0b1c0d253631307cfe4edc Mon Sep 17 00:00:00 2001
|
||||
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
|
||||
Date: Sat, 15 Jan 2022 11:46:30 +0800
|
||||
Subject: [PATCH] scripts: update feed script
|
||||
|
||||
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
|
||||
Change-Id: If21b985e70e54ba70d30761b8e1780a57a76d677
|
||||
---
|
||||
scripts/feeds | 136 +++++++++++++++++++++++++++++++++++++++++++-------
|
||||
1 file changed, 118 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/scripts/feeds b/scripts/feeds
|
||||
index 908e56c60e..e0673a0ec5 100755
|
||||
--- a/scripts/feeds
|
||||
+++ b/scripts/feeds
|
||||
@@ -38,33 +38,56 @@ my $feed_package = {};
|
||||
my $feed_src = {};
|
||||
my $feed_target = {};
|
||||
|
||||
-sub parse_config() {
|
||||
+sub parse_file($$);
|
||||
+
|
||||
+sub parse_file($$) {
|
||||
+ my ($fname, $existing) = @_;
|
||||
my $line = 0;
|
||||
- my %name;
|
||||
+ my $fh;
|
||||
|
||||
- open FEEDS, "feeds.conf" or
|
||||
- open FEEDS, "feeds.conf.default" or
|
||||
- die "Unable to open feeds configuration";
|
||||
- while (<FEEDS>) {
|
||||
+ open $fh, $fname or return undef;
|
||||
+ while (<$fh>) {
|
||||
chomp;
|
||||
s/#.+$//;
|
||||
- next unless /\S/;
|
||||
- my @line = split /\s+/, $_, 3;
|
||||
- my @src;
|
||||
$line++;
|
||||
+ next unless /\S/;
|
||||
+
|
||||
+ my ($type, $flags, $name, $urls) = m!^src-([\w\-]+)((?:\s+--\w+(?:=\S+)?)*)\s+(\w+)(?:\s+(\S.*))?$!;
|
||||
+ unless ($type && $name) {
|
||||
+ die "Syntax error in $fname, line $line\n";
|
||||
+ }
|
||||
|
||||
- my $valid = 1;
|
||||
- $line[0] =~ /^src-[\w-]+$/ or $valid = 0;
|
||||
- $line[1] =~ /^\w+$/ or $valid = 0;
|
||||
- @src = split /\s+/, $line[2];
|
||||
- $valid or die "Syntax error in feeds.conf, line: $line\n";
|
||||
+ if ($existing->{$name}++) {
|
||||
+ die "Duplicate feed name '$name' in '$fname' line: $line\n";
|
||||
+ }
|
||||
+
|
||||
+ my @src = defined($urls) ? split /\s+/, $urls : ();
|
||||
+ push @src, '' if @src == 0;
|
||||
|
||||
- $name{$line[1]} and die "Duplicate feed name '$line[1]', line: $line\n";
|
||||
- $name{$line[1]} = 1;
|
||||
+ my %flags;
|
||||
+ if (defined $flags) {
|
||||
+ while ($flags =~ m!\s+--(\w+)(?:=(\S+))?!g) {
|
||||
+ $flags{$1} = defined($2) ? $2 : 1;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- push @feeds, [$line[0], $line[1], \@src];
|
||||
+ if ($type eq "include") {
|
||||
+ parse_file($urls, $existing) or
|
||||
+ die "Unable to open included file '$urls'";
|
||||
+ next;
|
||||
+ }
|
||||
+
|
||||
+ push @feeds, ["src-$type", $name, \@src, \%flags];
|
||||
}
|
||||
- close FEEDS;
|
||||
+ close $fh;
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+sub parse_config() {
|
||||
+ my %name;
|
||||
+ parse_file("feeds.conf", \%name) or
|
||||
+ parse_file("feeds.conf.default", \%name) or
|
||||
+ die "Unable to open feeds configuration";
|
||||
}
|
||||
|
||||
sub update_location($$)
|
||||
@@ -537,6 +560,35 @@ sub refresh_config {
|
||||
}
|
||||
}
|
||||
|
||||
+sub install_profiles {
|
||||
+ my $feed = shift;
|
||||
+ my $dir = sprintf('feeds/%s/', $feed->[1]);
|
||||
+
|
||||
+ -d "./feeds/profiles" or mkdir "./feeds/profiles" or return 1;
|
||||
+
|
||||
+ opendir (DIR, $dir) or return 0;
|
||||
+ while (my $file = readdir(DIR)) {
|
||||
+ next unless (-f "$dir/$file");
|
||||
+ next unless ($file =~ m/\.profile$/);
|
||||
+ -e "./feeds/profiles/$file" or system("ln -s ../$feed->[1]/$file ./feeds/profiles/");
|
||||
+ }
|
||||
+ closedir(DIR);
|
||||
+}
|
||||
+
|
||||
+sub install_dl {
|
||||
+ my $feed = shift;
|
||||
+ my $dir = sprintf('feeds/%s/dl/', $feed->[1]);
|
||||
+
|
||||
+ -d "./dl" or mkdir "./dl" or return 1;
|
||||
+
|
||||
+ opendir (DIR, $dir) or return 0;
|
||||
+ while (my $file = readdir(DIR)) {
|
||||
+ next unless (-f "$dir/$file");
|
||||
+ -e "./dl/$file" or system("ln -s ../feeds/$feed->[1]/dl/$file ./dl/");
|
||||
+ }
|
||||
+ closedir(DIR);
|
||||
+}
|
||||
+
|
||||
sub install {
|
||||
my $name;
|
||||
my %opts;
|
||||
@@ -572,6 +624,8 @@ sub install {
|
||||
install_package($feed, $p->{name}, exists($opts{f})) == 0 or $ret = 1;
|
||||
get_feed($f->[1]);
|
||||
}
|
||||
+ install_profiles($f);
|
||||
+ install_dl($f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -734,6 +788,47 @@ sub update {
|
||||
return 0;
|
||||
}
|
||||
|
||||
+sub setup {
|
||||
+ my %opts;
|
||||
+
|
||||
+ getopts('bh', \%opts);
|
||||
+
|
||||
+ if ($opts{h}) {
|
||||
+ usage();
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (-e "feeds.conf") {
|
||||
+ warn "The file feeds.conf already exists.\n";
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ open(my $fd, ">>feeds.conf");
|
||||
+
|
||||
+ if ($opts{b}) {
|
||||
+ printf $fd "src-include defaults feeds.conf.default\n";
|
||||
+ }
|
||||
+
|
||||
+ while (my $entry = shift @ARGV) {
|
||||
+ my ($type, $name, $src) = split /,/, $entry;
|
||||
+
|
||||
+ $update_method{$type} or do {
|
||||
+ warn "Unknown type '$type' in parameter $entry\n";
|
||||
+ unlink "feeds.conf";
|
||||
+ return 1;
|
||||
+ };
|
||||
+
|
||||
+ if ($name =~ /[\s-]/) {
|
||||
+ warn "Feed names or sources may not contain whitespace or - characters in parameter $entry\n";
|
||||
+ unlink "feeds.conf";
|
||||
+ return 1;
|
||||
+ }
|
||||
+ printf $fd "%s %s %s\n", $type, $name, $src;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
sub feed_config() {
|
||||
foreach my $feed (@feeds) {
|
||||
my $installed = (-f "feeds/$feed->[1].index");
|
||||
@@ -782,6 +877,10 @@ Commands:
|
||||
-a : Update all feeds listed within feeds.conf. Otherwise the specified feeds will be updated.
|
||||
-i : Recreate the index only. No feed update from repository is performed.
|
||||
|
||||
+ setup [options] <type,name,link> <type,name,link> ...: generate feeds.conf
|
||||
+ Options:
|
||||
+ -b : Use feeds.conf.default as base for new feeds.conf.
|
||||
+
|
||||
clean: Remove downloaded/generated files.
|
||||
|
||||
EOF
|
||||
@@ -795,6 +894,7 @@ my %commands = (
|
||||
'search' => \&search,
|
||||
'uninstall' => \&uninstall,
|
||||
'feed_config' => \&feed_config,
|
||||
+ 'setup' => \&setup,
|
||||
'clean' => sub {
|
||||
system("rm -rf ./feeds ./package/feeds");
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
30
profiles/target_qsdk11.5_gl-ax1800.yml
Normal file
30
profiles/target_qsdk11.5_gl-ax1800.yml
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
profile: gl-ax1800
|
||||
target: ipq
|
||||
subtarget: ipq60xx_64
|
||||
description: Build image for the GL.iNET AX1800
|
||||
|
||||
diffconfig: |
|
||||
CONFIG_TARGET_ROOTFS_UBIFS=y
|
||||
CONFIG_COLLECT_KERNEL_DEBUG=y
|
||||
CONFIG_KERNEL_DYNAMIC_DEBUG=y
|
||||
CONFIG_PKG_CC_STACKPROTECTOR_REGULAR=y
|
||||
CONFIG_KERNEL_CC_STACKPROTECTOR_REGULAR=y
|
||||
CONFIG_PKG_FORTIFY_SOURCE_2=y
|
||||
CONFIG_PKG_RELRO_FULL=y
|
||||
CONFIG_DEVEL=y
|
||||
CONFIG_LOCALMIRROR="https://www.codeaurora.org/mirrored_source/quic/qsdk/"
|
||||
CONFIG_GIT_MIRROR="https://source.codeaurora.org/quic/qsdk/"
|
||||
CONFIG_TOOLCHAINOPTS=y
|
||||
CONFIG_GCC_USE_VERSION_5=y
|
||||
CONFIG_LIBC_USE_MUSL=y
|
||||
CONFIG_PACKAGE_kmod-crypto-qce=y
|
||||
CONFIG_PACKAGE_kmod-qca-ovsmgr=n
|
||||
CONFIG_PACKAGE_kmod-qca-psdk=m
|
||||
CONFIG_PACKAGE_kmod-bootconfig=n
|
||||
CONFIG_PACKAGE_kmod-usb-f-qdss=n
|
||||
CONFIG_PACKAGE_uclibcxx=y
|
||||
CONFIG_WIFI_TARGET_WIFI_2_0=n
|
||||
CONFIG_WIFI_LOG_UTILS=y
|
||||
CONFIG_PACKAGE_qca-lowi=n
|
||||
CONFIG_PACKAGE_qca-wifi-cyp-fw-hw1-11.0-asic=y
|
||||
@ -165,6 +165,7 @@ def generate_config(profile):
|
||||
config_output = f"""CONFIG_TARGET_{profile["target"]}=y
|
||||
CONFIG_TARGET_{profile["target"]}_{profile["subtarget"]}=y
|
||||
CONFIG_TARGET_{profile["target"]}_{profile["subtarget"]}_DEVICE_{profile["profile"]}=y
|
||||
CONFIG_TARGET_{profile["target"]}_{profile["subtarget"]}_{profile["profile"]}=y
|
||||
"""
|
||||
|
||||
config_output += f"{profile.get('diffconfig', '')}"
|
||||
@ -223,7 +224,8 @@ if __name__ == "__main__":
|
||||
die(f"Error running make defconfig")
|
||||
|
||||
if call("grep 'CONFIG_TARGET_PROFILE' .config|grep %s" % (profile['profile']), shell=True) != 0:
|
||||
die(f"Error: Cant not find the profile '%s'! Please check again!" % (profile['profile']))
|
||||
if call("grep 'CONFIG_TARGET_%s_%s_%s' .config" % (profile['target'], profile['subtarget'], profile['profile']), shell=True) != 0:
|
||||
die(f"Error: Cant not find the profile '%s'! Please check again!" % (profile['profile']))
|
||||
|
||||
for package in profile['packages']:
|
||||
if call("grep 'CONFIG_PACKAGE_%s=y' .config" % (package), shell=True) != 0:
|
||||
|
||||
45
setup.py
45
setup.py
@ -33,16 +33,33 @@ def clone_tree():
|
||||
def reset_tree():
|
||||
try:
|
||||
print("### Resetting tree")
|
||||
os.chdir(openwrt)
|
||||
run(
|
||||
["git", "checkout", config["branch"]],
|
||||
check=True,
|
||||
)
|
||||
run(
|
||||
["git", "reset", "--hard", config.get("revision", config["branch"])],
|
||||
check=True,
|
||||
)
|
||||
run(["rm", "-rf", "profiles"], )
|
||||
|
||||
if config["qsdk"]:
|
||||
os.chdir(git_clone_dir)
|
||||
|
||||
if not Path("qca-networking-spf").exists():
|
||||
run(["git", "clone", config["qca_spf_repo"], "-b", config["qca_spf_branch"]], check=True)
|
||||
os.chdir("qca-networking-spf")
|
||||
os.system("rm -rf BOOT.AK.1.0 BOOT.BF.3.* IPQ8064.ILQ* IPQ4019.ILQ* IPQ8074.ILQ* RPM.AK.1.0 TZ.AK.1.0 TZ.BF.2.7 TZ.BF.4.0.8 WIGIG.TLN* BOOT.BF.3.3.1.1 TZ.WNS.4.0 IPQ5018.ILQ.11.* BTFW.MAPLE.* WIGIG.TLN.7.5")
|
||||
os.system("cp -rf */* .")
|
||||
os.chdir(git_clone_dir)
|
||||
|
||||
if not Path(".repo").exists():
|
||||
print("Uncompress qsdk repo...")
|
||||
run(["tar", "Jxvf", config["qsdk_repo"]], check=True)
|
||||
|
||||
run(["rm", "-rf", path.join(base_dir, openwrt)], check=True)
|
||||
|
||||
print("sync qsdk repo...")
|
||||
run(["repo", "sync", "-j8", "--no-tags", "-c"], check=True)
|
||||
|
||||
print("Gen qsdk framework...")
|
||||
run([path.join(".", config["gen_script"])], check=True)
|
||||
else:
|
||||
os.chdir(openwrt)
|
||||
run(["git", "checkout", config["branch"]], check=True)
|
||||
run(["git", "reset", "--hard", config.get("revision", config["branch"])], check=True)
|
||||
run(["rm", "-rf", "profiles"], )
|
||||
print("### Reset done")
|
||||
except:
|
||||
print("### Resetting tree failed")
|
||||
@ -177,5 +194,13 @@ clone_tree()
|
||||
reset_tree()
|
||||
setup_tree()
|
||||
|
||||
if config["qsdk"]:
|
||||
os.chdir(openwrt)
|
||||
os.system("cp -r ../files-qsdk/* .")
|
||||
os.system("cp -r ../patches-qsdk patches")
|
||||
os.system("quilt import patches/*")
|
||||
os.system("quilt push -a")
|
||||
os.chdir(base_dir)
|
||||
|
||||
if git_clone_dir == "openwrt-18.06/siflower":
|
||||
remove_feeds()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user