commit 56c010a0ffc745bf37b5ae0df28169a6cdb25aa0
parent 4c3dd02f29a7d01a7395a509b0cbce7a096383ae
Author: hovercats <hovercatswithlasereyes@protonmail.com>
Date: Fri, 27 Oct 2023 02:06:06 +0200
wiki/kernel: add more text in patches section | add byacc patch
Diffstat:
2 files changed, 90 insertions(+), 0 deletions(-)
diff --git a/wiki/kernel/patches/index.md b/wiki/kernel/patches/index.md
@@ -1,3 +1,10 @@
# Kernel patches
+There are numerous kernel patches floating around the web for all kinds of usecases.
+Heres some that you might find usefull:
+
+Remove `perl` as a buildtime dependency for kernel:
[kernel-no-perl.patch](kernel-no-perl.patch)
+
+Use `byacc` instead of `bison`:
+[use byacc patch](make-yacc-usage-POSIX-compliant.diff)
diff --git a/wiki/kernel/patches/make-yacc-usage-POSIX-compliant.diff b/wiki/kernel/patches/make-yacc-usage-POSIX-compliant.diff
@@ -0,0 +1,83 @@
+diff --git a/scripts/Makefile.host b/scripts/Makefile.host
+index 278b4d6ac..4f3fa7756 100644
+--- a/scripts/Makefile.host
++++ b/scripts/Makefile.host
+@@ -11,7 +11,7 @@ $(obj)/%.lex.c: $(src)/%.l FORCE
+ # YACC
+ # ---------------------------------------------------------------------------
+ quiet_cmd_bison = YACC $(basename $@).[ch]
+- cmd_bison = $(YACC) -o $(basename $@).c --defines=$(basename $@).h -t -l $<
++ cmd_bison = $(YACC) -b $(basename $(basename $@)) -d -t -l $<
+
+ $(obj)/%.tab.c $(obj)/%.tab.h: $(src)/%.y FORCE
+ $(call if_changed,bison)
+diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile
+index d6a422a63..0d974ede4 100644
+--- a/scripts/genksyms/Makefile
++++ b/scripts/genksyms/Makefile
+@@ -13,9 +13,11 @@ genksyms-objs := genksyms.o parse.tab.o lex.lex.o
+ # so that 'bison: not found' will be displayed if it is missing.
+ ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
+
++ifeq ($(shell command -v $(YACC) || [ -x $(YACC) ] && echo y),)
++ $(error command not found: $(YACC))
++endif
+ quiet_cmd_bison_no_warn = $(quiet_cmd_bison)
+- cmd_bison_no_warn = $(YACC) --version >/dev/null; \
+- $(cmd_bison) 2>/dev/null
++ cmd_bison_no_warn = $(cmd_bison) 2>/dev/null
+
+ $(obj)/pars%.tab.c $(obj)/pars%.tab.h: $(src)/pars%.y FORCE
+ $(call if_changed,bison_no_warn)
+diff --git a/scripts/genksyms/lex.l b/scripts/genksyms/lex.l
+index a4d7495ea..9a59ebba6 100644
+--- a/scripts/genksyms/lex.l
++++ b/scripts/genksyms/lex.l
+@@ -19,6 +19,8 @@
+ #include "genksyms.h"
+ #include "parse.tab.h"
+
++extern YYSTYPE yylval;
++
+ /* We've got a two-level lexer here. We let flex do basic tokenization
+ and then we categorize those basic tokens in the second stage. */
+ #define YY_DECL static int yylex1(void)
+diff --git a/scripts/kconfig/parser.y b/scripts/kconfig/parser.y
+index 2af7ce4e1..b7862b9f0 100644
+--- a/scripts/kconfig/parser.y
++++ b/scripts/kconfig/parser.y
+@@ -21,6 +21,8 @@
+
+ int cdebug = PRINTD;
+
++int yynerrs = 0;
++
+ static void yyerror(const char *err);
+ static void zconfprint(const char *err, ...);
+ static void zconf_error(const char *err, ...);
+@@ -98,13 +100,6 @@ struct menu *current_menu, *current_entry;
+ %type <string> word_opt assign_val
+ %type <flavor> assign_op
+
+-%destructor {
+- fprintf(stderr, "%s:%d: missing end statement for this entry\n",
+- $$->file->name, $$->lineno);
+- if (current_menu == $$)
+- menu_end_menu();
+-} if_entry menu_entry choice_entry
+-
+ %%
+ input: mainmenu_stmt stmt_list | stmt_list;
+
+@@ -517,6 +512,11 @@ static bool zconf_endtoken(const char *tokenname,
+ if (strcmp(tokenname, expected_tokenname)) {
+ zconf_error("unexpected '%s' within %s block",
+ tokenname, expected_tokenname);
++ if (!strcmp(tokenname, "if") || !strcmp(tokenname, "menu") ||
++ !strcmp(tokenname, "choice"))
++ fprintf(stderr, "%s:%d: missing end statement for this entry\n",
++ current_menu->file->name, current_menu->lineno);
++ menu_end_menu();
+ yynerrs++;
+ return false;
+ }