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.

2 Likes

sorry for bringing back an old topic but I'm guessing the same thing for the profile ?

choice
	prompt "Target Profile"
	default TARGET_MULTI_PROFILE if BUILDBOT

EOF
	foreach my $target (@target) {
		$target->{profiles} = "wallys_dr40x9" if $target->{conf} eq "ipq40xx_generic";
		my $profile = $target->{profiles}->[0];
		$profile or next;
		print <<EOF;
	default TARGET_$target->{conf}_$profile->{id} if TARGET_$target->{conf} && !BUILDBOT
EOF
	}

The $target->{profiles} value must be an array.

$target->{profiles} = [ "wallys_dr40x9" ] if ...
1 Like

I did notice the config file is is listed like below was not too sure how to proceede it selects my target and the general tags but not the profile:

CONFIG_TARGET_ipq40xx_generic_DEVICE_wallys_dr40x9=y

I'm not too sure where the profile name is collected soorry im just a beginner, in the dts the device is names wallys,dr4029 for my custom target

EOF
	foreach my $target (@target) {
		$target->{profiles} = ["wallys,dr40x9"] if $target->{conf} eq "generic";
		my $profile = $target->{profiles}->[0];
		$profile or next;
		print <<EOF;
	default TARGET_$target->{conf}_$profile->{id} if TARGET_$target->{conf} && !BUILDBOT
EOF