buildsys: Add helper to list suid applets
Add a helper script that lists all applets that
- do or may require SUID provileges (busybox.cfg.suid)
- do not require SUID provileges (busybox.cfg.nosuid)
Some setups prefer to build two busybox binaries, one that is suid which
contains all applets that do or may require suid privileges, and a
second one for all the rest (which drops suid). To ease splitting these
two binaries, generate a list of CONFIG_ items for the suid binary.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index bd2d70e..303df0b 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -474,7 +474,11 @@
fprintf(out_h, "#define CONFIG_%s 1\n", sym->name);
/* bbox */
fprintf(out_h, "#define ENABLE_%s 1\n", sym->name);
- fprintf(out_h, "#define IF_%s(...) __VA_ARGS__\n", sym->name);
+ fprintf(out_h, "#ifdef MAKE_SUID\n");
+ fprintf(out_h, "# define IF_%s(...) __VA_ARGS__ \"CONFIG_%s\"\n", sym->name, sym->name);
+ fprintf(out_h, "#else\n");
+ fprintf(out_h, "# define IF_%s(...) __VA_ARGS__\n", sym->name);
+ fprintf(out_h, "#endif\n");
fprintf(out_h, "#define IF_NOT_%s(...)\n", sym->name);
}
break;
@@ -506,7 +510,11 @@
fputs("\"\n", out_h);
/* bbox */
fprintf(out_h, "#define ENABLE_%s 1\n", sym->name);
- fprintf(out_h, "#define IF_%s(...) __VA_ARGS__\n", sym->name);
+ fprintf(out_h, "#ifdef MAKE_SUID\n");
+ fprintf(out_h, "# define IF_%s(...) __VA_ARGS__ \"CONFIG_%s\"\n", sym->name, sym->name);
+ fprintf(out_h, "#else\n");
+ fprintf(out_h, "# define IF_%s(...) __VA_ARGS__\n", sym->name);
+ fprintf(out_h, "#endif\n");
fprintf(out_h, "#define IF_NOT_%s(...)\n", sym->name);
}
break;
@@ -518,7 +526,11 @@
fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str);
/* bbox */
fprintf(out_h, "#define ENABLE_%s 1\n", sym->name);
- fprintf(out_h, "#define IF_%s(...) __VA_ARGS__\n", sym->name);
+ fprintf(out_h, "#ifdef MAKE_SUID\n");
+ fprintf(out_h, "# define IF_%s(...) __VA_ARGS__ \"CONFIG_%s\"\n", sym->name, sym->name);
+ fprintf(out_h, "#else\n");
+ fprintf(out_h, "# define IF_%s(...) __VA_ARGS__\n", sym->name);
+ fprintf(out_h, "#endif\n");
fprintf(out_h, "#define IF_NOT_%s(...)\n", sym->name);
}
break;
@@ -532,7 +544,11 @@
fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str);
/* bbox */
fprintf(out_h, "#define ENABLE_%s 1\n", sym->name);
- fprintf(out_h, "#define IF_%s(...) __VA_ARGS__\n", sym->name);
+ fprintf(out_h, "#ifdef MAKE_SUID\n");
+ fprintf(out_h, "# define IF_%s(...) __VA_ARGS__ \"CONFIG_%s\"\n", sym->name, sym->name);
+ fprintf(out_h, "#else\n");
+ fprintf(out_h, "# define IF_%s(...) __VA_ARGS__\n", sym->name);
+ fprintf(out_h, "#endif\n");
fprintf(out_h, "#define IF_NOT_%s(...)\n", sym->name);
}
break;