---
# System prepended metadata

title: 86 Duino Debug Log
tags: [Blog]

---

# 86 Duino Debug Log

## Envrioment(`unmae-a`) 
Linux 6.8.0-48-generic #48~22.04.1-Ubuntu

## Building IASL 20130626 ... failed

build-coreboot/coreboot/util/crossgcc/acpica-unix-20130626/source/compiler

```bash=
/usr/bin/ld: obj/aslcompilerparse.o:(.bss+0x8): multiple definition of `AslCompilerlval'; obj/aslcompilerlex.o:(.bss+0x8): first defined here
/usr/bin/ld: obj/prparserlex.o:(.bss+0x0): multiple definition of `LexBuffer'; obj/dtparserlex.o:(.bss+0x0): first defined here
/usr/bin/ld: obj/dbfileio.o:(.bss+0x0): multiple definition of `AcpiGbl_DebugFile'; obj/aslmain.o:(.bss+0x3350): first defined here
```

(.bss+0x8): first defined here

判斷應該是撞到（因為First defined 是其他.c)

代表缺少extern

* aslcompilerparse.o vs aslcompilerlex.o : AslCompilerlval
    * aslcompiler.y.h 有寫extern YYSTYPE AslCompilerlval , 但是只有aslcompilerlex.c 有include , aslcompilerparse 缺少include
    * 根據log  bison -v -d -y -pAslCompiler -oobj/aslcompilerparse.c ../../../source/compiler/aslcompiler.y
    * 輸出 aslcompilerparse.c 輸入 aslcompiler.y
    * 先找找看aslcompiler.y 有沒有新版的Source Code
    * IASL_VERSION=20130626 now version
    * https://github.com/acpica/acpica/releases/tag/R06_26_13 (https://downloadmirror.intel.com/774561/acpica-unix-20130626.tar.gz)
    * https://github.com/acpica/acpica/releases/tag/R07_25_13 no update 
    * https://github.com/acpica/acpica/commits/master/source/compiler/aslcompiler.l
        * https://github.com/acpica/acpica/commit/01ab8c6dd686139d0ccc4651cc90387081b59e09
* prparserlex.o vs dtparserlex.o : LexBuffer
    * https://github.com/acpica/acpica/commit/fa605f87907370b40e91e1eb90a284fd6177df59
* dbfileio.o vs aslmain.o : AcpiGbl_DebugFile
    * https://github.com/acpica/acpica/commit/4d8796b767f40b3c5ba4005fb1a93d1beb732975
    * modify acglobal.h to `extern ACPI_FILE   ACPI_INIT_GLOBAL (AcpiGbl_DebugFile, NULL);`

Patch File

```
From eaaf907de6a7ada5be8f51e98c7c8dd6652dd1f6 Mon Sep 17 00:00:00 2001
From: Yu-Ti Kuo <bobgash2@gmail.com>
Date: Mon, 18 Nov 2024 21:54:28 +0800
Subject: [PATCH] Fix Linker Error in new compiler

---
 source/compiler/aslcompiler.l                | 1 -
 source/compiler/aslglobal.h                  | 2 --
 source/compiler/dtparser.l                   | 2 +-
 source/compiler/prparser.l                   | 2 +-
 source/components/debugger/dbfileio.c        | 8 --------
 source/include/platform/acenv.h              | 9 +++++++++
 source/os_specific/service_layers/osunixxf.c | 1 -
 source/os_specific/service_layers/oswinxf.c  | 1 -
 source/tools/acpibin/acpibin.h               | 1 -
 source/tools/acpiexec/aecommon.h             | 1 -
 source/tools/acpinames/anmain.c              | 1 -
 source/tools/examples/examples.c             | 1 -
 12 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l
index f981796..c0077e4 100644
--- a/source/compiler/aslcompiler.l
+++ b/source/compiler/aslcompiler.l
@@ -119,7 +119,6 @@
 
 #include <stdlib.h>
 #include <string.h>
-YYSTYPE AslCompilerlval;
 
 /*
  * Generation:  Use the following command line:
diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h
index 5468711..e361737 100644
--- a/source/compiler/aslglobal.h
+++ b/source/compiler/aslglobal.h
@@ -303,8 +303,6 @@ ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_NumNamespaceObjects, 0)
 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_ReservedMethods, 0);
 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_TableSignature, "NO_SIG");
 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_TableId, "NO_ID");
-ASL_EXTERN FILE                     *AcpiGbl_DebugFile; /* Placeholder for oswinxf only */
-
 
 /* Static structures */
 
diff --git a/source/compiler/dtparser.l b/source/compiler/dtparser.l
index bc8b22b..e2633dc 100644
--- a/source/compiler/dtparser.l
+++ b/source/compiler/dtparser.l
@@ -172,7 +172,7 @@ NewLine         [\n]
 /*
  * Local support functions
  */
-YY_BUFFER_STATE         LexBuffer;
+static YY_BUFFER_STATE         LexBuffer;
 
 /******************************************************************************
  *
diff --git a/source/compiler/prparser.l b/source/compiler/prparser.l
index cae12cb..65f5e67 100644
--- a/source/compiler/prparser.l
+++ b/source/compiler/prparser.l
@@ -178,7 +178,7 @@ Identifier      [a-zA-Z][0-9a-zA-Z]*
 /*
  * Local support functions
  */
-YY_BUFFER_STATE         LexBuffer;
+static YY_BUFFER_STATE         LexBuffer;
 
 
 /******************************************************************************
diff --git a/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c
index 768668a..ca40272 100644
--- a/source/components/debugger/dbfileio.c
+++ b/source/components/debugger/dbfileio.c
@@ -132,14 +132,6 @@
 #define _COMPONENT          ACPI_CA_DEBUGGER
         ACPI_MODULE_NAME    ("dbfileio")
 
-/*
- * NOTE: this is here for lack of a better place. It is used in all
- * flavors of the debugger, need LCD file
- */
-#ifdef ACPI_APPLICATION
-#include <stdio.h>
-FILE                        *AcpiGbl_DebugFile = NULL;
-#endif
 
 
 #ifdef ACPI_DEBUGGER
diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h
index 3838e79..807dce3 100644
--- a/source/include/platform/acenv.h
+++ b/source/include/platform/acenv.h
@@ -468,4 +468,13 @@ typedef char *va_list;
 
 #endif /* ACPI_USE_SYSTEM_CLIBRARY */
 
+#ifndef ACPI_FILE
+#ifdef ACPI_APPLICATION
+#include <stdio.h>
+#define ACPI_FILE              FILE *
+#else
+#define ACPI_FILE              void *
+#endif /* ACPI_APPLICATION */
+#endif /* ACPI_FILE */
+
 #endif /* __ACENV_H__ */
diff --git a/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c
index 4be7b9b..8544a3b 100644
--- a/source/os_specific/service_layers/osunixxf.c
+++ b/source/os_specific/service_layers/osunixxf.c
@@ -137,7 +137,6 @@
         ACPI_MODULE_NAME    ("osunixxf")
 
 
-extern FILE                    *AcpiGbl_DebugFile;
 FILE                           *AcpiGbl_OutputFile;
 
 
diff --git a/source/os_specific/service_layers/oswinxf.c b/source/os_specific/service_layers/oswinxf.c
index b33920b..3e5a67d 100644
--- a/source/os_specific/service_layers/oswinxf.c
+++ b/source/os_specific/service_layers/oswinxf.c
@@ -136,7 +136,6 @@
         ACPI_MODULE_NAME    ("oswinxf")
 
 
-extern FILE                 *AcpiGbl_DebugFile;
 extern BOOLEAN              AcpiGbl_DebugTimeout;
 
 FILE                        *AcpiGbl_OutputFile;
diff --git a/source/tools/acpibin/acpibin.h b/source/tools/acpibin/acpibin.h
index ce476eb..6c53f1c 100644
--- a/source/tools/acpibin/acpibin.h
+++ b/source/tools/acpibin/acpibin.h
@@ -138,7 +138,6 @@
 /* Globals */
 
 EXTERN BOOLEAN              INIT_GLOBAL (Gbl_TerseMode, FALSE);
-EXTERN FILE                 INIT_GLOBAL (*AcpiGbl_DebugFile, NULL);
 
 
 /* Prototypes */
diff --git a/source/tools/acpiexec/aecommon.h b/source/tools/acpiexec/aecommon.h
index 4083b69..8375bea 100644
--- a/source/tools/acpiexec/aecommon.h
+++ b/source/tools/acpiexec/aecommon.h
@@ -135,7 +135,6 @@
 #include <string.h>
 #include <signal.h>
 
-extern FILE                 *AcpiGbl_DebugFile;
 extern BOOLEAN              AcpiGbl_IgnoreErrors;
 extern UINT8                AcpiGbl_RegionFillValue;
 extern UINT8                AcpiGbl_UseHwReducedFadt;
diff --git a/source/tools/acpinames/anmain.c b/source/tools/acpinames/anmain.c
index bd29840..1bc1741 100644
--- a/source/tools/acpinames/anmain.c
+++ b/source/tools/acpinames/anmain.c
@@ -121,7 +121,6 @@
 
 extern ACPI_TABLE_DESC  Tables[];
 
-FILE                    *AcpiGbl_DebugFile;
 static AE_TABLE_DESC    *AeTableListHead = NULL;
 
 
diff --git a/source/tools/examples/examples.c b/source/tools/examples/examples.c
index a49353d..fa2bd02 100644
--- a/source/tools/examples/examples.c
+++ b/source/tools/examples/examples.c
@@ -495,7 +495,6 @@ ExecuteOSI (void)
  *
  *****************************************************************************/
 
-FILE    *AcpiGbl_DebugFile;
 
 ACPI_PHYSICAL_ADDRESS
 AeLocalGetRootPointer (
-- 
2.34.1

```

## write-crossbar.py need patch for python3

```

From 40eaf7c199908606e5b7cf10521c84ac4e65dea1 Mon Sep 17 00:00:00 2001
From: Yu-Ti Kuo <bobgash2@gmail.com>
Date: Mon, 18 Nov 2024 22:34:16 +0800
Subject: [PATCH] Change to py3

---
 write-crossbar.py | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/write-crossbar.py b/write-crossbar.py
index b2cc393..058014b 100755
--- a/write-crossbar.py
+++ b/write-crossbar.py
@@ -1,23 +1,33 @@
-#! /usr/bin/env python
+#!/usr/bin/env python3
 # Write 240 byte crossbar data into ROM file address 3FD00.
 import sys
 import os
+
 def main():
-    print "write-crossbar.py : Write CrossBar data into ROM file"
+    print("write-crossbar.py : Write CrossBar data into ROM file")
     rom_fn, cb_fn = sys.argv[1], sys.argv[2]
-    print "ROM file : %s, CrossBar file = %s" % (rom_fn, cb_fn)
-    cb_data = open(cb_fn, "rb").read()
+    print("ROM file : {}, CrossBar file = {}".format(rom_fn, cb_fn))
+
+    # Open the CrossBar data file in binary mode ('rb')
+    with open(cb_fn, "rb") as cb_file:
+        cb_data = cb_file.read()
+
     if len(cb_data) != 240:
-        print "CrossBar data file length error"
+        print("CrossBar data file length error")
         sys.exit(1)
+
+    # Check ROM file size
     fs = os.stat(rom_fn).st_size
     if fs not in [512 * 1024, 256 * 1024, 4096 * 1024]:
-        print "ROM file file length error"
+        print("ROM file length error")
         sys.exit(1)
-    rom_f = open(rom_fn, "r+b")
-    rom_f.seek(-0x300, 2)  # seek from the end of file
-    rom_f.write(cb_data)
-    print "Write CrossBar ok"
+
+    # Open the ROM file in read/write binary mode ('r+b')
+    with open(rom_fn, "r+b") as rom_f:
+        rom_f.seek(-0x300, 2)  # seek from the end of file
+        rom_f.write(cb_data)
+
+    print("Write CrossBar ok")
 
 if __name__ == "__main__":
     main()
-- 
2.34.1

```

## build seaBios : fatal: No names found, cannot describe anything.
```
From b56ee91eed2e345035a3255e5afa557128eebf4e Mon Sep 17 00:00:00 2001
From: Yu-Ti Kuo <bobgash2@gmail.com>
Date: Mon, 18 Nov 2024 22:47:41 +0800
Subject: [PATCH] Change to Python3

---
 Makefile                | 2 +-
 scripts/buildrom.py     | 2 +-
 scripts/buildversion.sh | 2 +-
 scripts/checkrom.py     | 2 +-
 scripts/checkstack.py   | 2 +-
 scripts/checksum.py     | 2 +-
 scripts/encodeint.py    | 2 +-
 scripts/layoutrom.py    | 2 +-
 scripts/readserial.py   | 2 +-
 scripts/transdump.py    | 2 +-
 scripts/vgafixup.py     | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index d788ffe..03e50ad 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ LD=$(CROSS_PREFIX)ld
 OBJCOPY=$(CROSS_PREFIX)objcopy
 OBJDUMP=$(CROSS_PREFIX)objdump
 STRIP=$(CROSS_PREFIX)strip
-PYTHON=python
+PYTHON=python3
 CPP=cpp
 IASL:=iasl
 LD32BIT_FLAG:=-melf_i386
diff --git a/scripts/buildrom.py b/scripts/buildrom.py
index 0499049..821f421 100755
--- a/scripts/buildrom.py
+++ b/scripts/buildrom.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # Fill in checksum/size of an option rom, and pad it to proper length.
 #
 # Copyright (C) 2009  Kevin O'Connor <kevin@koconnor.net>
diff --git a/scripts/buildversion.sh b/scripts/buildversion.sh
index e5ce96c..6b7895d 100755
--- a/scripts/buildversion.sh
+++ b/scripts/buildversion.sh
@@ -5,7 +5,7 @@ VAR16MODE="$2"
 
 # Extract version info
 if [ -d .git -o -f .git ]; then
-    VERSION="`git describe --tags --long --dirty`"
+    VERSION="`git describe --all --long --dirty`"
 elif [ -f .version ]; then
     VERSION="`cat .version`"
 else
diff --git a/scripts/checkrom.py b/scripts/checkrom.py
index 377277d..56a43c2 100755
--- a/scripts/checkrom.py
+++ b/scripts/checkrom.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # Script to check a bios image and report info on it.
 #
 # Copyright (C) 2008  Kevin O'Connor <kevin@koconnor.net>
diff --git a/scripts/checkstack.py b/scripts/checkstack.py
index 62fef36..e1dd929 100755
--- a/scripts/checkstack.py
+++ b/scripts/checkstack.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # Script that tries to find how much stack space each function in an
 # object is using.
 #
diff --git a/scripts/checksum.py b/scripts/checksum.py
index 773fa7a..87cce60 100755
--- a/scripts/checksum.py
+++ b/scripts/checksum.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # Script to report the checksum of a file.
 #
 # Copyright (C) 2009  Kevin O'Connor <kevin@koconnor.net>
diff --git a/scripts/encodeint.py b/scripts/encodeint.py
index 0d34aee..e861d81 100755
--- a/scripts/encodeint.py
+++ b/scripts/encodeint.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # Encode an integer in little endian format in a file.
 #
 # Copyright (C) 2011  Kevin O'Connor <kevin@koconnor.net>
diff --git a/scripts/layoutrom.py b/scripts/layoutrom.py
index b325406..d10f7e0 100755
--- a/scripts/layoutrom.py
+++ b/scripts/layoutrom.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # Script to analyze code and arrange ld sections.
 #
 # Copyright (C) 2008-2010  Kevin O'Connor <kevin@koconnor.net>
diff --git a/scripts/readserial.py b/scripts/readserial.py
index 4f29648..ed122b8 100755
--- a/scripts/readserial.py
+++ b/scripts/readserial.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # Script that can read from a serial device and show timestamps.
 #
 # Copyright (C) 2009  Kevin O'Connor <kevin@koconnor.net>
diff --git a/scripts/transdump.py b/scripts/transdump.py
index 665f04a..9877b33 100755
--- a/scripts/transdump.py
+++ b/scripts/transdump.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # This script is useful for taking the output of memdump() and
 # converting it back into binary output.  This can be useful, for
diff --git a/scripts/vgafixup.py b/scripts/vgafixup.py
index a981bbf..bc25b12 100644
--- a/scripts/vgafixup.py
+++ b/scripts/vgafixup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # Work around x86emu bugs by replacing problematic instructions.
 #
 # Copyright (C) 2012  Kevin O'Connor <kevin@koconnor.net>
-- 
2.34.1

```

## Makefile.inc:69: *** empty variable name.  Stop.

https://review.coreboot.org/c/coreboot/+/38958

edit Makefile.inc
```
# Helper functions for ramstage postprocess
spc :=
spc := $(spc) $(spc)
````

## Segmentation fault (core dumped) in coreboot make

use `make -nd`

Reading makefile 'src/cpu/x86/smm/Makefile.inc' (search path) (don't care) (no ~ expansion)...
Segmentation fault (core dumped)

src/cpu/x86/smm/Makefile.inc 裡面是可以讀取的

透過 `$(error $$DATA = $(DATA))` 找到 Makefile 執行這一行的時候會  觸發 Segmentation fault (core dumped)
註解以下的功能
```
# Call post-processors if they're defined
$(foreach class,$(classes),\
	$(if $(value $(class)-postprocess),$(eval $(call $(class)-postprocess,$($(class)-objs)))))
```


## build/util/sconfig/main.o:/home/jenskuo/Documents/86Duino/build-coreboot/coreboot/util/sconfig/sconfig.h:84: multiple definition of `head'; build/util/sconfig/sconfig.tab.o:/home/jenskuo/Documents/86Duino/build-coreboot/coreboot/util/sconfig/sconfig.h:84: first defined here

sconfig\sconfig.h

Change to 
```
extern struct device *head;
```

