Fix non-Linux builds

Various tools are Linuxish and should thus only attempted to build on
Linux only. Some features are also Linux-only.

Also, libresolv is used on all GNU platforms, notably GNU/Hurd and
GNU/kfreeBSD.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/Makefile.flags b/Makefile.flags
index 84cb00a..50137a7 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -184,7 +184,7 @@
 endif
 
 ifeq ($(CONFIG_FEATURE_NSLOOKUP_BIG),y)
-ifneq (,$(findstring linux,$(shell $(CC) $(CFLAGS) -dumpmachine)))
+ifneq (,$(findstring gnu,$(shell $(CC) $(CFLAGS) -dumpmachine)))
 LDLIBS += resolv
 endif
 endif
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c
index 81a0e6a..3f36cab 100644
--- a/console-tools/loadfont.c
+++ b/console-tools/loadfont.c
@@ -12,6 +12,7 @@
 //config:config LOADFONT
 //config:	bool "loadfont (5.2 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	This program loads a console font from standard input.
 //config:
diff --git a/console-tools/openvt.c b/console-tools/openvt.c
index db2f073..9e6cffe 100644
--- a/console-tools/openvt.c
+++ b/console-tools/openvt.c
@@ -10,6 +10,7 @@
 //config:config OPENVT
 //config:	bool "openvt (7.2 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	This program is used to start a command on an unused
 //config:	virtual terminal.
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 06c1b7b..3e034eb 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -200,6 +200,7 @@
 }
 
 #if ENABLE_FEATURE_DD_IBS_OBS
+# ifdef O_DIRECT
 static int clear_O_DIRECT(int fd)
 {
 	if (errno == EINVAL) {
@@ -211,6 +212,7 @@
 	}
 	return 0;
 }
+# endif
 #endif
 
 static ssize_t dd_read(void *ibuf, size_t ibs)
@@ -225,8 +227,10 @@
 #endif
 		n = safe_read(ifd, ibuf, ibs);
 #if ENABLE_FEATURE_DD_IBS_OBS
+# ifdef O_DIRECT
 	if (n < 0 && (G.flags & FLAG_IDIRECT) && clear_O_DIRECT(ifd))
 		goto read_again;
+# endif
 #endif
 	return n;
 }
@@ -239,8 +243,10 @@
  IF_FEATURE_DD_IBS_OBS(write_again:)
 	n = full_write(ofd, buf, len);
 #if ENABLE_FEATURE_DD_IBS_OBS
+# ifdef O_DIRECT
 	if (n < 0 && (G.flags & FLAG_ODIRECT) && clear_O_DIRECT(ofd))
 		goto write_again;
+# endif
 #endif
 
 #if ENABLE_FEATURE_DD_THIRD_STATUS_LINE
@@ -501,8 +507,13 @@
 	if (infile) {
 		int iflag = O_RDONLY;
 #if ENABLE_FEATURE_DD_IBS_OBS
-		if (G.flags & FLAG_IDIRECT)
+		if (G.flags & FLAG_IDIRECT) {
+# ifdef O_DIRECT
 			iflag |= O_DIRECT;
+# else
+			bb_error_msg_and_die("O_DIRECT not supported on this platform");
+# endif
+		}
 #endif
 		xmove_fd(xopen(infile, iflag), ifd);
 	} else {
@@ -516,8 +527,13 @@
 		if (G.flags & FLAG_APPEND)
 			oflag |= O_APPEND;
 #if ENABLE_FEATURE_DD_IBS_OBS
-		if (G.flags & FLAG_ODIRECT)
+		if (G.flags & FLAG_ODIRECT) {
+# ifdef O_DIRECT
 			oflag |= O_DIRECT;
+# else
+			bb_error_msg_and_die("O_DIRECT not supported on this platform");
+# endif
+		}
 #endif
 		xmove_fd(xopen(outfile, oflag), ofd);
 
diff --git a/klibc-utils/run-init.c b/klibc-utils/run-init.c
index 73c677b..77fc0e6 100644
--- a/klibc-utils/run-init.c
+++ b/klibc-utils/run-init.c
@@ -8,6 +8,7 @@
 //config:config RUN_INIT
 //config:	bool "run-init (7.7 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	The run-init utility is used from initramfs to select a new
 //config:	root device. Under initramfs, you have to use this instead of
diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c
index 209d1d5..c289245 100644
--- a/miscutils/adjtimex.c
+++ b/miscutils/adjtimex.c
@@ -13,6 +13,7 @@
 //config:config ADJTIMEX
 //config:	bool "adjtimex (4.7 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Adjtimex reads and optionally sets adjustment parameters for
 //config:	the Linux clock adjustment algorithm.
diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c
index da26f5e..46749fb 100644
--- a/miscutils/i2c_tools.c
+++ b/miscutils/i2c_tools.c
@@ -11,30 +11,35 @@
 //config:config I2CGET
 //config:	bool "i2cget (5.5 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Read from I2C/SMBus chip registers.
 //config:
 //config:config I2CSET
 //config:	bool "i2cset (6.7 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Set I2C registers.
 //config:
 //config:config I2CDUMP
 //config:	bool "i2cdump (7.1 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Examine I2C registers.
 //config:
 //config:config I2CDETECT
 //config:	bool "i2cdetect (7.1 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Detect I2C chips.
 //config:
 //config:config I2CTRANSFER
 //config:	bool "i2ctransfer (4.0 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Send user-defined I2C messages in one transfer.
 //config:
diff --git a/miscutils/partprobe.c b/miscutils/partprobe.c
index 0fb1927..0abed6f 100644
--- a/miscutils/partprobe.c
+++ b/miscutils/partprobe.c
@@ -7,6 +7,7 @@
 //config:config PARTPROBE
 //config:	bool "partprobe (3.5 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Ask kernel to rescan partition table.
 
diff --git a/miscutils/ubirename.c b/miscutils/ubirename.c
index 06a0ada..e7c5664 100644
--- a/miscutils/ubirename.c
+++ b/miscutils/ubirename.c
@@ -9,6 +9,7 @@
 //config:config UBIRENAME
 //config:	bool "ubirename (2.4 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Utility to rename UBI volumes
 
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index 9f5a4b8..91a2023 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -11,6 +11,7 @@
 //config:config WATCHDOG
 //config:	bool "watchdog (5.3 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	The watchdog utility is used with hardware or software watchdog
 //config:	device drivers. It opens the specified watchdog device special file
diff --git a/modutils/Config.src b/modutils/Config.src
index 1882968..b8ba3b7 100644
--- a/modutils/Config.src
+++ b/modutils/Config.src
@@ -8,6 +8,7 @@
 config MODPROBE_SMALL
 	bool "Simplified modutils"
 	default y
+	select PLATFORM_LINUX
 	help
 	Build smaller (~1.5 kbytes), simplified module tools.
 
diff --git a/modutils/depmod.c b/modutils/depmod.c
index bb42bbe..9e39481 100644
--- a/modutils/depmod.c
+++ b/modutils/depmod.c
@@ -10,6 +10,7 @@
 //config:config DEPMOD
 //config:	bool "depmod (27 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	depmod generates modules.dep (and potentially modules.alias
 //config:	and modules.symbols) that contain dependency information
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 8f7163e..85b46cd 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -9,6 +9,7 @@
 //config:config INSMOD
 //config:	bool "insmod (22 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	insmod is used to load specified modules in the running kernel.
 
diff --git a/modutils/lsmod.c b/modutils/lsmod.c
index 2beb123..39dc8e6 100644
--- a/modutils/lsmod.c
+++ b/modutils/lsmod.c
@@ -10,6 +10,7 @@
 //config:config LSMOD
 //config:	bool "lsmod (1.9 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	lsmod is used to display a list of loaded modules.
 //config:
diff --git a/modutils/modinfo.c b/modutils/modinfo.c
index 0a86c32..5d01179 100644
--- a/modutils/modinfo.c
+++ b/modutils/modinfo.c
@@ -8,6 +8,7 @@
 //config:config MODINFO
 //config:	bool "modinfo (24 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Show information about a Linux Kernel module
 
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index 235706f..77c4bb7 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -10,6 +10,7 @@
 //config:config MODPROBE
 //config:	bool "modprobe (28 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Handle the loading of modules, and their dependencies on a high
 //config:	level.
diff --git a/modutils/rmmod.c b/modutils/rmmod.c
index 2b3c391..8d4639f 100644
--- a/modutils/rmmod.c
+++ b/modutils/rmmod.c
@@ -10,6 +10,7 @@
 //config:config RMMOD
 //config:	bool "rmmod (3.3 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	rmmod is used to unload specified modules from the kernel.
 
diff --git a/networking/arp.c b/networking/arp.c
index 16783ab..6519f81 100644
--- a/networking/arp.c
+++ b/networking/arp.c
@@ -15,6 +15,7 @@
 //config:config ARP
 //config:	bool "arp (10 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Manipulate the system ARP cache.
 
diff --git a/networking/arping.c b/networking/arping.c
index 86f0221..fd0e1b2 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -8,6 +8,7 @@
 //config:config ARPING
 //config:	bool "arping (9 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Ping hosts by ARP packets.
 
diff --git a/networking/brctl.c b/networking/brctl.c
index 956bd91..b353210 100644
--- a/networking/brctl.c
+++ b/networking/brctl.c
@@ -12,6 +12,7 @@
 //config:config BRCTL
 //config:	bool "brctl (4.7 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Manage ethernet bridges.
 //config:	Supports addbr/delbr and addif/delif.
diff --git a/networking/ifconfig.c b/networking/ifconfig.c
index 9ee232a..4090959 100644
--- a/networking/ifconfig.c
+++ b/networking/ifconfig.c
@@ -27,6 +27,7 @@
 //config:config IFCONFIG
 //config:	bool "ifconfig (12 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Ifconfig is used to configure the kernel-resident network interfaces.
 //config:
diff --git a/networking/ifplugd.c b/networking/ifplugd.c
index 0b55bf4..bc4303e 100644
--- a/networking/ifplugd.c
+++ b/networking/ifplugd.c
@@ -9,6 +9,7 @@
 //config:config IFPLUGD
 //config:	bool "ifplugd (10 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Network interface plug detection daemon.
 
diff --git a/networking/ip.c b/networking/ip.c
index 7c32086..23ee7d2 100644
--- a/networking/ip.c
+++ b/networking/ip.c
@@ -11,6 +11,7 @@
 //config:config IP
 //config:	bool "ip (35 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	The "ip" applet is a TCP/IP interface configuration and routing
 //config:	utility.
@@ -21,6 +22,7 @@
 //config:config IPADDR
 //config:	bool "ipaddr (14 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	select FEATURE_IP_ADDRESS
 //config:	help
 //config:	Short form of "ip addr"
@@ -28,6 +30,7 @@
 //config:config IPLINK
 //config:	bool "iplink (17 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	select FEATURE_IP_LINK
 //config:	help
 //config:	Short form of "ip link"
@@ -35,6 +38,7 @@
 //config:config IPROUTE
 //config:	bool "iproute (15 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	select FEATURE_IP_ROUTE
 //config:	help
 //config:	Short form of "ip route"
@@ -49,6 +53,7 @@
 //config:config IPRULE
 //config:	bool "iprule (10 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	select FEATURE_IP_RULE
 //config:	help
 //config:	Short form of "ip rule"
@@ -56,6 +61,7 @@
 //config:config IPNEIGH
 //config:	bool "ipneigh (8.3 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	select FEATURE_IP_NEIGH
 //config:	help
 //config:	Short form of "ip neigh"
diff --git a/networking/nameif.c b/networking/nameif.c
index 66e0426..3ccd935 100644
--- a/networking/nameif.c
+++ b/networking/nameif.c
@@ -12,6 +12,7 @@
 //config:config NAMEIF
 //config:	bool "nameif (6.6 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	select FEATURE_SYSLOG
 //config:	help
 //config:	nameif is used to rename network interface by its MAC address.
diff --git a/networking/route.c b/networking/route.c
index 26146f8..6165728 100644
--- a/networking/route.c
+++ b/networking/route.c
@@ -27,6 +27,7 @@
 //config:config ROUTE
 //config:	bool "route (8.7 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Route displays or manipulates the kernel's IP routing tables.
 
diff --git a/networking/tc.c b/networking/tc.c
index 43187f7..1f4bcce 100644
--- a/networking/tc.c
+++ b/networking/tc.c
@@ -9,6 +9,7 @@
 //config:config TC
 //config:	bool "tc (8.3 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Show / manipulate traffic control settings
 //config:
diff --git a/networking/traceroute.c b/networking/traceroute.c
index 4bbe1ab..2ba990f 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -963,8 +963,10 @@
 	if (af == AF_INET) {
 		xmove_fd(xsocket(AF_INET, SOCK_RAW, IPPROTO_ICMP), rcvsock);
 #if ENABLE_FEATURE_TRACEROUTE_VERBOSE
+# ifdef IP_PKTINFO
 		/* want recvmsg to report target local address (for -v) */
 		setsockopt_1(rcvsock, IPPROTO_IP, IP_PKTINFO);
+# endif
 #endif
 	}
 #if ENABLE_TRACEROUTE6
diff --git a/networking/tunctl.c b/networking/tunctl.c
index 97e6917..59cae33 100644
--- a/networking/tunctl.c
+++ b/networking/tunctl.c
@@ -12,6 +12,7 @@
 //config:config TUNCTL
 //config:	bool "tunctl (6.2 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	tunctl creates or deletes tun devices.
 //config:
diff --git a/networking/udhcp/Config.src b/networking/udhcp/Config.src
index 8c8c11c..23e2b40 100644
--- a/networking/udhcp/Config.src
+++ b/networking/udhcp/Config.src
@@ -6,6 +6,7 @@
 config UDHCPD
 	bool "udhcpd (21 kb)"
 	default y
+	select PLATFORM_LINUX
 	help
 	udhcpd is a DHCP server geared primarily toward embedded systems,
 	while striving to be fully functional and RFC compliant.
@@ -53,6 +54,7 @@
 config DHCPRELAY
 	bool "dhcprelay (5.2 kb)"
 	default y
+	select PLATFORM_LINUX
 	help
 	dhcprelay listens for DHCP requests on one or more interfaces
 	and forwards these requests to a different interface or DHCP
@@ -61,6 +63,7 @@
 config UDHCPC
 	bool "udhcpc (24 kb)"
 	default y
+	select PLATFORM_LINUX
 	help
 	udhcpc is a DHCP client geared primarily toward embedded systems,
 	while striving to be fully functional and RFC compliant.
diff --git a/procps/free.c b/procps/free.c
index 0b68e1b..c734f75 100644
--- a/procps/free.c
+++ b/procps/free.c
@@ -9,6 +9,7 @@
 //config:config FREE
 //config:	bool "free (3.1 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	free displays the total amount of free and used physical and swap
 //config:	memory in the system, as well as the buffers used by the kernel.
diff --git a/procps/uptime.c b/procps/uptime.c
index 4fd0c9d..4992c26 100644
--- a/procps/uptime.c
+++ b/procps/uptime.c
@@ -14,6 +14,7 @@
 //config:config UPTIME
 //config:	bool "uptime (3.7 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	uptime gives a one line display of the current time, how long
 //config:	the system has been running, how many users are currently logged
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c
index df0edee..ddf5007 100644
--- a/sysklogd/klogd.c
+++ b/sysklogd/klogd.c
@@ -19,6 +19,7 @@
 //config:config KLOGD
 //config:	bool "klogd (5.7 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	klogd is a utility which intercepts and logs all
 //config:	messages from the Linux kernel and sends the messages
diff --git a/util-linux/acpid.c b/util-linux/acpid.c
index 00613f8..7bce8ab 100644
--- a/util-linux/acpid.c
+++ b/util-linux/acpid.c
@@ -9,6 +9,7 @@
 //config:config ACPID
 //config:	bool "acpid (9 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	acpid listens to ACPI events coming either in textual form from
 //config:	/proc/acpi/event (though it is marked deprecated it is still widely
diff --git a/util-linux/blkdiscard.c b/util-linux/blkdiscard.c
index 7ac8045..2291eec 100644
--- a/util-linux/blkdiscard.c
+++ b/util-linux/blkdiscard.c
@@ -8,6 +8,7 @@
 //config:config BLKDISCARD
 //config:	bool "blkdiscard (4.3 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	blkdiscard discards sectors on a given device.
 
diff --git a/util-linux/blkid.c b/util-linux/blkid.c
index 4a82077..008ae5d 100644
--- a/util-linux/blkid.c
+++ b/util-linux/blkid.c
@@ -9,6 +9,7 @@
 //config:config BLKID
 //config:	bool "blkid (12 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	select VOLUMEID
 //config:	help
 //config:	Lists labels and UUIDs of all filesystems.
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c
index 6670b84..5da887f 100644
--- a/util-linux/dmesg.c
+++ b/util-linux/dmesg.c
@@ -11,6 +11,7 @@
 //config:config DMESG
 //config:	bool "dmesg (3.7 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	dmesg is used to examine or control the kernel ring buffer. When the
 //config:	Linux kernel prints messages to the system log, they are stored in
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 20e7d56..e9ebbd5 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -10,6 +10,7 @@
 //config:config FDISK
 //config:	bool "fdisk (37 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	The fdisk utility is used to divide hard disks into one or more
 //config:	logical disks, which are generally called partitions. This utility
diff --git a/util-linux/findfs.c b/util-linux/findfs.c
index f5621a1..7ca9dc9 100644
--- a/util-linux/findfs.c
+++ b/util-linux/findfs.c
@@ -10,6 +10,7 @@
 //config:config FINDFS
 //config:	bool "findfs (12 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	select VOLUMEID
 //config:	help
 //config:	Prints the name of a filesystem with given label or UUID.
diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c
index 309169d..d27113d 100644
--- a/util-linux/freeramdisk.c
+++ b/util-linux/freeramdisk.c
@@ -11,6 +11,7 @@
 //config:config FDFLUSH
 //config:	bool "fdflush (1.3 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	fdflush is only needed when changing media on slightly-broken
 //config:	removable media drives. It is used to make Linux believe that a
@@ -23,6 +24,7 @@
 //config:config FREERAMDISK
 //config:	bool "freeramdisk (1.3 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Linux allows you to create ramdisks. This utility allows you to
 //config:	delete them and completely free all memory that was used for the
diff --git a/util-linux/fsfreeze.c b/util-linux/fsfreeze.c
index 6e2ff0a..fb0b3c4 100644
--- a/util-linux/fsfreeze.c
+++ b/util-linux/fsfreeze.c
@@ -7,6 +7,7 @@
 //config:config FSFREEZE
 //config:	bool "fsfreeze (3.5 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	select LONG_OPTS
 //config:	help
 //config:	Halt new accesses and flush writes on a mounted filesystem.
diff --git a/util-linux/fstrim.c b/util-linux/fstrim.c
index 6d67300..12bab40 100644
--- a/util-linux/fstrim.c
+++ b/util-linux/fstrim.c
@@ -10,6 +10,7 @@
 //config:config FSTRIM
 //config:	bool "fstrim (4.4 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Discard unused blocks on a mounted filesystem.
 
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index 723b095..2edadfa 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -9,6 +9,7 @@
 //config:config HWCLOCK
 //config:	bool "hwclock (5.8 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	The hwclock utility is used to read and set the hardware clock
 //config:	on a system. This is primarily used to set the current time on
diff --git a/util-linux/ionice.c b/util-linux/ionice.c
index 82bd309..b30d5f7 100644
--- a/util-linux/ionice.c
+++ b/util-linux/ionice.c
@@ -9,6 +9,7 @@
 //config:config IONICE
 //config:	bool "ionice (3.8 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Set/set program io scheduling class and priority
 //config:	Requires kernel >= 2.6.13
diff --git a/util-linux/losetup.c b/util-linux/losetup.c
index 24f7a23..ec0cf04 100644
--- a/util-linux/losetup.c
+++ b/util-linux/losetup.c
@@ -9,6 +9,7 @@
 //config:config LOSETUP
 //config:	bool "losetup (5.5 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	losetup is used to associate or detach a loop device with a regular
 //config:	file or block device, and to query the status of a loop device. This
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index ebdc0c2..f6de7ad 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -10,6 +10,7 @@
 //config:config MDEV
 //config:	bool "mdev (17 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	mdev is a mini-udev implementation for dynamically creating device
 //config:	nodes in the /dev directory.
diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c
index fcf374b..892b086 100644
--- a/util-linux/mkfs_ext2.c
+++ b/util-linux/mkfs_ext2.c
@@ -10,6 +10,7 @@
 //config:config MKE2FS
 //config:	bool "mke2fs (10 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Utility to create EXT2 filesystems.
 //config:
diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c
index 8213719..5136446 100644
--- a/util-linux/mkfs_vfat.c
+++ b/util-linux/mkfs_vfat.c
@@ -10,6 +10,7 @@
 //config:config MKDOSFS
 //config:	bool "mkdosfs (7.2 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Utility to create FAT32 filesystems.
 //config:
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 4e65b6b..e3aeda6 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -20,6 +20,7 @@
 //config:config MOUNT
 //config:	bool "mount (23 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	All files and filesystems in Unix are arranged into one big directory
 //config:	tree. The 'mount' utility is used to graft a filesystem onto a
diff --git a/util-linux/nsenter.c b/util-linux/nsenter.c
index 1aa045b..8652e80 100644
--- a/util-linux/nsenter.c
+++ b/util-linux/nsenter.c
@@ -9,6 +9,7 @@
 //config:config NSENTER
 //config:	bool "nsenter (6.5 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Run program with namespaces of other processes.
 
diff --git a/util-linux/pivot_root.c b/util-linux/pivot_root.c
index ecc8911..41f29da 100644
--- a/util-linux/pivot_root.c
+++ b/util-linux/pivot_root.c
@@ -11,6 +11,7 @@
 //config:config PIVOT_ROOT
 //config:	bool "pivot_root (1.1 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	The pivot_root utility swaps the mount points for the root filesystem
 //config:	with some other mounted filesystem. This allows you to do all sorts
diff --git a/util-linux/setarch.c b/util-linux/setarch.c
index cf8ef00..57051a6 100644
--- a/util-linux/setarch.c
+++ b/util-linux/setarch.c
@@ -9,6 +9,7 @@
 //config:config SETARCH
 //config:	bool "setarch (3.6 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	The linux32 utility is used to create a 32bit environment for the
 //config:	specified program (usually a shell). It only makes sense to have
@@ -18,12 +19,14 @@
 //config:config LINUX32
 //config:	bool "linux32 (3.3 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Alias to "setarch linux32".
 //config:
 //config:config LINUX64
 //config:	bool "linux64 (3.3 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Alias to "setarch linux64".
 
diff --git a/util-linux/setpriv.c b/util-linux/setpriv.c
index 6904cf0..bfe2c7a 100644
--- a/util-linux/setpriv.c
+++ b/util-linux/setpriv.c
@@ -9,6 +9,7 @@
 //config:config SETPRIV
 //config:	bool "setpriv (6.6 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	select LONG_OPTS
 //config:	help
 //config:	Run a program with different Linux privilege settings.
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index e2ff4b5..567869c 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -9,6 +9,7 @@
 //config:config SWAPON
 //config:	bool "swapon (15 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	Once you have created some swap space using 'mkswap', you also need
 //config:	to enable your swap space with the 'swapon' utility. The 'swapoff'
@@ -35,6 +36,7 @@
 //config:config SWAPOFF
 //config:	bool "swapoff (14 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:
 //config:config FEATURE_SWAPONOFF_LABEL
 //config:	bool "Support specifying devices by label or UUID"
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c
index 901c0b8..f610022 100644
--- a/util-linux/switch_root.c
+++ b/util-linux/switch_root.c
@@ -9,6 +9,7 @@
 //config:config SWITCH_ROOT
 //config:	bool "switch_root (5.5 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	The switch_root utility is used from initramfs to select a new
 //config:	root device. Under initramfs, you have to use this instead of
diff --git a/util-linux/uevent.c b/util-linux/uevent.c
index db11746..bd39c3a 100644
--- a/util-linux/uevent.c
+++ b/util-linux/uevent.c
@@ -6,6 +6,7 @@
 //config:config UEVENT
 //config:	bool "uevent (3.1 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	help
 //config:	uevent is a netlink listener for kernel uevent notifications
 //config:	sent via netlink. It is usually used for dynamic device creation.
diff --git a/util-linux/unshare.c b/util-linux/unshare.c
index 06b9380..156a96d 100644
--- a/util-linux/unshare.c
+++ b/util-linux/unshare.c
@@ -9,6 +9,7 @@
 //config:config UNSHARE
 //config:	bool "unshare (7.2 kb)"
 //config:	default y
+//config:	select PLATFORM_LINUX
 //config:	depends on !NOMMU
 //config:	select LONG_OPTS
 //config:	help