@@ -57,9 +57,11 @@ def add_i2c(self):
5757
5858 # Ethernet configuration -------------------------------------------------------------------
5959
60- def configure_ethernet (self , remote_ip , local_ip ):
60+ def configure_ethernet (self , remote_ip , local_ip , use_gateway , gateway_ip , subnet_mask ):
6161 remote_ip = remote_ip .split ("." )
6262 local_ip = local_ip .split ("." )
63+ gateway_ip = gateway_ip .split ("." )
64+ subnet_mask = subnet_mask .split ("." )
6365
6466 try : # FIXME: Improve.
6567 self .constants .pop ("REMOTEIP1" )
@@ -85,6 +87,33 @@ def configure_ethernet(self, remote_ip, local_ip):
8587 self .add_constant ("LOCALIP3" , int (local_ip [2 ]))
8688 self .add_constant ("LOCALIP4" , int (local_ip [3 ]))
8789
90+ try : # FIXME: Improve.
91+ self .constants .pop ("GATEWAYIP1" )
92+ self .constants .pop ("GATEWAYIP2" )
93+ self .constants .pop ("GATEWAYIP3" )
94+ self .constants .pop ("GATEWAYIP4" )
95+ except :
96+ pass
97+ self .add_constant ("GATEWAYIP1" , int (gateway_ip [0 ]))
98+ self .add_constant ("GATEWAYIP2" , int (gateway_ip [1 ]))
99+ self .add_constant ("GATEWAYIP3" , int (gateway_ip [2 ]))
100+ self .add_constant ("GATEWAYIP4" , int (gateway_ip [3 ]))
101+
102+ try : # FIXME: Improve.
103+ self .constants .pop ("SUBNETMASK1" )
104+ self .constants .pop ("SUBNETMASK2" )
105+ self .constants .pop ("SUBNETMASK3" )
106+ self .constants .pop ("SUBNETMASK4" )
107+ except :
108+ pass
109+ self .add_constant ("SUBNETMASK1" , int (subnet_mask [0 ]))
110+ self .add_constant ("SUBNETMASK2" , int (subnet_mask [1 ]))
111+ self .add_constant ("SUBNETMASK3" , int (subnet_mask [2 ]))
112+ self .add_constant ("SUBNETMASK4" , int (subnet_mask [3 ]))
113+
114+ if use_gateway :
115+ self .add_constant ("ETH_NETBOOT_USE_GATEWAY" )
116+
88117 # DTS generation ---------------------------------------------------------------------------
89118
90119 def generate_dts (self , board_name , rootfs = "ram0" ):
0 commit comments