Changing default target

I am building a firmware for an hardware and would like to have my target ramips- mt7621- selected by default in my source code. I tried to find the place to make this change but it's not obvious to me which file needs to be changed. Can someone tell me the file one needs to change to set default target?

Modify scripts/target-metadata.pl:

diff --git a/scripts/target-metadata.pl b/scripts/target-metadata.pl
index ee0ab5a718..591decda1f 100755
--- a/scripts/target-metadata.pl
+++ b/scripts/target-metadata.pl
@@ -174,7 +174,7 @@ EOF
        print <<EOF;
 choice
        prompt "Target System"
-       default TARGET_ath79
+       default TARGET_ramips
        reset if !DEVEL
        
 EOF
@@ -191,6 +191,7 @@ choice
        prompt "Subtarget" if HAS_SUBTARGETS
 EOF
        foreach my $target (@target) {
+               $target->{def_subtarget} = "mt7621" if $target->{conf} eq "ramips";
                next unless $target->{def_subtarget};
                print <<EOF;
        default TARGET_$target->{conf}_$target->{def_subtarget} if TARGET_$target->{conf}

You need to clear the temporary data (rm -r tmp/) for the change to take effect. After moving away any existing .config and invoking make menuconfig, ramips/mt7621 should be selected by default.

1 Like