Skip to content

Commit a40e07d

Browse files
bird3: add protocol-specific build variants and Config.in
Bird's binary size is dominated by compiled-in routing protocols. This adds size-optimized package variants built with --with-protocols so users on flash-constrained devices can install only what they need without recompiling. New packages: - bird3-bgp: BGP, RPKI, BFD + infrastructure (mrt, pipe, static) - bird3-ospf: OSPF, BFD + infrastructure - bird3-babel: Babel + infrastructure - bird3-mesh: Babel, BGP + infrastructure, for mesh networks using BGP-based overlay services (e.g. hostname distribution via bgpdisco) All variants PROVIDE:=bird3 so existing DEPENDS:=+bird3 continue to work. They conflict with each other since all install /usr/sbin/bird. For users building from source, Config.in adds per-protocol checkboxes under the bird3 menu in menuconfig. Protocols default to enabled to preserve existing behaviour, builders on tight flash budgets can uncheck what they do not need. PKG_CONFIG_DEPENDS ensures bird3 is rebuilt when the selection changes. Signed-off-by: Nick Hainke <vincent@systemli.org>
1 parent 776e716 commit a40e07d

2 files changed

Lines changed: 237 additions & 29 deletions

File tree

bird3/Config.in

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
if PACKAGE_bird3
2+
3+
comment "Routing protocols"
4+
comment "Protocols mrt, pipe, and static are always included"
5+
6+
config BIRD3_PROTO_BGP
7+
bool "BGP"
8+
default y
9+
help
10+
Border Gateway Protocol. Required for internet routing,
11+
route servers, and route reflectors.
12+
13+
config BIRD3_PROTO_RPKI
14+
bool "RPKI"
15+
default y
16+
help
17+
Route Origin Validation via the Resource Public Key
18+
Infrastructure. Used alongside BGP to validate route origins.
19+
20+
config BIRD3_PROTO_BFD
21+
bool "BFD"
22+
default y
23+
help
24+
Bidirectional Forwarding Detection. Provides fast link failure
25+
detection for BGP and OSPF sessions.
26+
27+
config BIRD3_PROTO_OSPF
28+
bool "OSPF"
29+
default y
30+
help
31+
Open Shortest Path First (OSPFv2 for IPv4, OSPFv3 for IPv6).
32+
Common interior gateway protocol for enterprise and ISP networks.
33+
34+
config BIRD3_PROTO_BABEL
35+
bool "Babel"
36+
default y
37+
help
38+
Babel routing protocol. Distance-vector protocol suitable for
39+
mesh and wireless networks.
40+
41+
config BIRD3_PROTO_RIP
42+
bool "RIP"
43+
default y
44+
help
45+
Routing Information Protocol (RIPv2 for IPv4, RIPng for IPv6).
46+
47+
config BIRD3_PROTO_RADV
48+
bool "RAdv"
49+
default y
50+
help
51+
IPv6 Router Advertisements. Announces IPv6 prefixes and router
52+
information to hosts on the link.
53+
54+
config BIRD3_PROTO_AGGREGATOR
55+
bool "Aggregator"
56+
default y
57+
help
58+
Route aggregation protocol. Merges multiple routes into
59+
aggregate prefixes, typically used with BGP.
60+
61+
config BIRD3_PROTO_BMP
62+
bool "BMP"
63+
default n
64+
help
65+
BGP Monitoring Protocol. Streams BGP session state to a
66+
monitoring station. Rarely needed on embedded routers.
67+
68+
config BIRD3_PROTO_L3VPN
69+
bool "L3VPN"
70+
default n
71+
help
72+
MPLS/L3VPN support. Required for BGP-based MPLS VPNs.
73+
74+
config BIRD3_PROTO_PERF
75+
bool "PERF"
76+
default n
77+
help
78+
Performance testing protocol. Not intended for production use.
79+
80+
endif

bird3/Makefile

Lines changed: 157 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,85 @@ PKG_MAINTAINER:=Toke Høiland-Jørgensen <toke@toke.dk>, Nick Hainke <vincent@sy
1414
PKG_LICENSE:=GPL-2.0-or-later
1515

1616
PKG_BUILD_DEPENDS:=ncurses readline
17-
PKG_BUILD_DIR:=$(BUILD_DIR)/bird-$(PKG_VERSION)
17+
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/bird-$(PKG_VERSION)
18+
19+
PKG_CONFIG_DEPENDS := \
20+
CONFIG_BIRD3_PROTO_AGGREGATOR \
21+
CONFIG_BIRD3_PROTO_BABEL \
22+
CONFIG_BIRD3_PROTO_BFD \
23+
CONFIG_BIRD3_PROTO_BGP \
24+
CONFIG_BIRD3_PROTO_BMP \
25+
CONFIG_BIRD3_PROTO_L3VPN \
26+
CONFIG_BIRD3_PROTO_OSPF \
27+
CONFIG_BIRD3_PROTO_PERF \
28+
CONFIG_BIRD3_PROTO_RADV \
29+
CONFIG_BIRD3_PROTO_RIP \
30+
CONFIG_BIRD3_PROTO_RPKI
1831

1932
include $(INCLUDE_DIR)/package.mk
2033

21-
define Package/bird3
22-
TITLE:=The BIRD Internet Routing Daemon (v3)
23-
URL:=https://bird.nic.cz/
24-
SECTION:=net
25-
CATEGORY:=Network
26-
SUBMENU:=Routing and Redirection
27-
DEPENDS:=+libpthread +libatomic
28-
CONFLICTS:=bird2
29-
endef
30-
31-
define Package/bird3c
32-
TITLE:=The BIRD command-line client (v3)
33-
URL:=https://bird.nic.cz/
34-
SECTION:=net
35-
CATEGORY:=Network
36-
SUBMENU:=Routing and Redirection
37-
DEPENDS:=+bird3 +libreadline +libncurses
38-
CONFLICTS:=bird2
39-
endef
34+
BUILD_VARIANT?=full
35+
36+
# Infrastructure protocols included in every variant unconditionally.
37+
BIRD3_INFRA := mrt,pipe,static
38+
39+
# Predefined protocol sets for prebuilt package variants
40+
BIRD3_PROTOCOLS_bgp := bgp,rpki,bfd,$(BIRD3_INFRA)
41+
BIRD3_PROTOCOLS_ospf := ospf,bfd,$(BIRD3_INFRA)
42+
BIRD3_PROTOCOLS_babel := babel,$(BIRD3_INFRA)
43+
BIRD3_PROTOCOLS_mesh := babel,bgp,$(BIRD3_INFRA)
44+
45+
# For the full variant, assemble the protocol list from Config.in selections.
46+
ifeq ($(BUILD_VARIANT),full)
47+
BIRD3_PROTOCOLS := $(BIRD3_INFRA)
48+
ifdef CONFIG_BIRD3_PROTO_AGGREGATOR
49+
BIRD3_PROTOCOLS := $(BIRD3_PROTOCOLS),aggregator
50+
endif
51+
ifdef CONFIG_BIRD3_PROTO_BABEL
52+
BIRD3_PROTOCOLS := $(BIRD3_PROTOCOLS),babel
53+
endif
54+
ifdef CONFIG_BIRD3_PROTO_BFD
55+
BIRD3_PROTOCOLS := $(BIRD3_PROTOCOLS),bfd
56+
endif
57+
ifdef CONFIG_BIRD3_PROTO_BGP
58+
BIRD3_PROTOCOLS := $(BIRD3_PROTOCOLS),bgp
59+
endif
60+
ifdef CONFIG_BIRD3_PROTO_BMP
61+
BIRD3_PROTOCOLS := $(BIRD3_PROTOCOLS),bmp
62+
endif
63+
ifdef CONFIG_BIRD3_PROTO_L3VPN
64+
BIRD3_PROTOCOLS := $(BIRD3_PROTOCOLS),l3vpn
65+
endif
66+
ifdef CONFIG_BIRD3_PROTO_OSPF
67+
BIRD3_PROTOCOLS := $(BIRD3_PROTOCOLS),ospf
68+
endif
69+
ifdef CONFIG_BIRD3_PROTO_PERF
70+
BIRD3_PROTOCOLS := $(BIRD3_PROTOCOLS),perf
71+
endif
72+
ifdef CONFIG_BIRD3_PROTO_RADV
73+
BIRD3_PROTOCOLS := $(BIRD3_PROTOCOLS),radv
74+
endif
75+
ifdef CONFIG_BIRD3_PROTO_RIP
76+
BIRD3_PROTOCOLS := $(BIRD3_PROTOCOLS),rip
77+
endif
78+
ifdef CONFIG_BIRD3_PROTO_RPKI
79+
BIRD3_PROTOCOLS := $(BIRD3_PROTOCOLS),rpki
80+
endif
81+
else
82+
BIRD3_PROTOCOLS := $(BIRD3_PROTOCOLS_$(BUILD_VARIANT))
83+
endif
84+
85+
CONFIGURE_ARGS += --disable-libssh --with-protocols=$(BIRD3_PROTOCOLS)
86+
TARGET_LDFLAGS += -latomic
4087

41-
define Package/bird3cl
42-
TITLE:=The BIRD lightweight command-line client (v2)
88+
define Package/bird3/Default
4389
URL:=https://bird.nic.cz/
4490
SECTION:=net
4591
CATEGORY:=Network
4692
SUBMENU:=Routing and Redirection
47-
DEPENDS:=+bird3
93+
DEPENDS:=+libpthread +libatomic
4894
CONFLICTS:=bird2
95+
PROVIDES:=bird3
4996
endef
5097

5198
define Package/bird3/Default/description
@@ -55,6 +102,17 @@ interface and powerful route filtering language. It is lightweight and
55102
efficient and therefore appropriate for small embedded routers.
56103
endef
57104

105+
define Package/bird3
106+
$(call Package/bird3/Default)
107+
TITLE:=The BIRD Internet Routing Daemon (v3)
108+
VARIANT:=full
109+
CONFLICTS:=bird2 bird3-bgp bird3-ospf bird3-babel bird3-mesh
110+
endef
111+
112+
define Package/bird3/config
113+
source "$(SOURCE)/Config.in"
114+
endef
115+
58116
define Package/bird3/description
59117
$(call Package/bird3/Default/description)
60118

@@ -70,9 +128,59 @@ configuration syntax.
70128
This is the 3.0 branch of Bird which is a multithreaded rewrite.
71129
endef
72130

73-
define Package/bird3c/description
131+
define Package/bird3-bgp
132+
$(call Package/bird3/Default)
133+
TITLE:=The BIRD Internet Routing Daemon (v3) - BGP/RPKI/BFD
134+
VARIANT:=bgp
135+
CONFLICTS:=bird2 bird3 bird3-ospf bird3-babel bird3-mesh
136+
endef
137+
138+
Package/bird3-bgp/description = $(Package/bird3/Default/description)
139+
140+
define Package/bird3-ospf
141+
$(call Package/bird3/Default)
142+
TITLE:=The BIRD Internet Routing Daemon (v3) - OSPF/BFD
143+
VARIANT:=ospf
144+
CONFLICTS:=bird2 bird3 bird3-bgp bird3-babel bird3-mesh
145+
endef
146+
147+
Package/bird3-ospf/description = $(Package/bird3/Default/description)
148+
149+
define Package/bird3-babel
150+
$(call Package/bird3/Default)
151+
TITLE:=The BIRD Internet Routing Daemon (v3) - Babel
152+
VARIANT:=babel
153+
CONFLICTS:=bird2 bird3 bird3-bgp bird3-ospf bird3-mesh
154+
endef
155+
156+
Package/bird3-babel/description = $(Package/bird3/Default/description)
157+
158+
define Package/bird3-mesh
159+
$(call Package/bird3/Default)
160+
TITLE:=The BIRD Internet Routing Daemon (v3) - Babel+BGP mesh
161+
VARIANT:=mesh
162+
CONFLICTS:=bird2 bird3 bird3-bgp bird3-ospf bird3-babel
163+
endef
164+
165+
define Package/bird3-mesh/description
74166
$(call Package/bird3/Default/description)
75167

168+
Size-optimized variant for mesh networks running Babel for routing and
169+
BGP for overlay services such as hostname distribution.
170+
endef
171+
172+
define Package/bird3c
173+
TITLE:=The BIRD command-line client (v3)
174+
URL:=https://bird.nic.cz/
175+
SECTION:=net
176+
CATEGORY:=Network
177+
SUBMENU:=Routing and Redirection
178+
DEPENDS:=+bird3 +libreadline +libncurses
179+
CONFLICTS:=bird2
180+
VARIANT:=full
181+
endef
182+
183+
define Package/bird3c/description
76184
This is a BIRD command-line client. It is used to send commands to BIRD,
77185
commands can perform simple actions such as enabling/disabling of
78186
protocols, telling BIRD to show various information, telling it to show
@@ -82,24 +190,35 @@ Unless you can't afford dependency on ncurses and readline, you
82190
should install BIRD command-line client together with BIRD.
83191
endef
84192

85-
define Package/bird3cl/description
86-
$(call Package/bird3/Default/description)
193+
define Package/bird3cl
194+
TITLE:=The BIRD lightweight command-line client (v3)
195+
URL:=https://bird.nic.cz/
196+
SECTION:=net
197+
CATEGORY:=Network
198+
SUBMENU:=Routing and Redirection
199+
DEPENDS:=+bird3
200+
CONFLICTS:=bird2
201+
VARIANT:=full
202+
endef
87203

204+
define Package/bird3cl/description
88205
This is a BIRD lightweight command-line client. It is used to send commands
89206
to BIRD, commands can perform simple actions such as enabling/disabling of
90207
protocols, telling BIRD to show various information, telling it to show
91208
a routing table filtered by a filter, or asking BIRD to reconfigure.
92209
endef
93210

94-
CONFIGURE_ARGS += --disable-libssh
95-
TARGET_LDFLAGS += -latomic
96-
97211
define Package/bird3/conffiles
98212
/etc/bird.conf
99213
/etc/bird4.conf
100214
/etc/bird6.conf
101215
endef
102216

217+
Package/bird3-bgp/conffiles = $(Package/bird3/conffiles)
218+
Package/bird3-ospf/conffiles = $(Package/bird3/conffiles)
219+
Package/bird3-babel/conffiles = $(Package/bird3/conffiles)
220+
Package/bird3-mesh/conffiles = $(Package/bird3/conffiles)
221+
103222
define Package/bird3/install
104223
$(INSTALL_DIR) $(1)/usr/sbin
105224
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bird $(1)/usr/sbin/
@@ -109,6 +228,11 @@ define Package/bird3/install
109228
$(INSTALL_BIN) ./files/bird.init $(1)/etc/init.d/bird
110229
endef
111230

231+
Package/bird3-bgp/install = $(Package/bird3/install)
232+
Package/bird3-ospf/install = $(Package/bird3/install)
233+
Package/bird3-babel/install = $(Package/bird3/install)
234+
Package/bird3-mesh/install = $(Package/bird3/install)
235+
112236
define Package/bird3c/install
113237
$(INSTALL_DIR) $(1)/usr/sbin
114238
$(INSTALL_BIN) $(PKG_BUILD_DIR)/birdc $(1)/usr/sbin/
@@ -120,5 +244,9 @@ define Package/bird3cl/install
120244
endef
121245

122246
$(eval $(call BuildPackage,bird3))
247+
$(eval $(call BuildPackage,bird3-bgp))
248+
$(eval $(call BuildPackage,bird3-ospf))
249+
$(eval $(call BuildPackage,bird3-babel))
250+
$(eval $(call BuildPackage,bird3-mesh))
123251
$(eval $(call BuildPackage,bird3c))
124252
$(eval $(call BuildPackage,bird3cl))

0 commit comments

Comments
 (0)