首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> 網頁程式設計 >> PHP 程式設計 >> PHP 相關知識

CentOS 6.5 編譯 LILO 22.8 實戰:缺少 16 位工具鏈 (as86/ld86/bcc) 解決方案

     編輯:PHP 相關知識

CentOS 6.5 編譯 LILO 22.8 實戰:缺少 16 位工具鏈 (as86/ld86/bcc) 解決方案

因調查某 Bootloader 相關 Bug,需在 CentOS 6.5 上編譯 LILO (Linux Loader) 22.8。源碼來自 官方頁面。make 直接報錯缺少 16 位匯編/鏈接工具,本文記錄定位與解決全過程。

編譯報錯信息

[root@localhost lilo-22.8]# make all
./checkit
GCC version 2.91 or later is required
gcc version 4.4.7
OKAY

AS86 version 0.16.10 or later is required
as86 is not present

LD86 version 0.16.10 or later is required
ld86 is not present

BCC version 0.16.10 or later is recommended
bcc is not present
You will not be able to make floppy2, diag2.img, or lilo.com
make: *** [test.img] Error 1

原因分析

  • LILO 編譯過程需要生成 16 位實模式代碼(MBR、Boot Sector)
  • 這要求 16 位工具鏈:as86 (匯編器)、ld86 (鏈接器)、bcc (Bruce's C Compiler,16 位 C 編譯器)
  • 現代 Linux 發行版默認不再預裝 16 位開發工具

解決方案:安裝 dev86 包

通過 rpmfind.net 查詢確認:as86、ld86、bcc 均包含在 dev86 包中。

# CentOS/RHEL/Fedora
sudo yum install dev86

# Debian/Ubuntu
sudo apt-get install dev86

# openSUSE
sudo zypper install dev86

驗證安裝

[root@localhost lilo-22.8]# which as86 ld86 bcc
/usr/bin/as86
/usr/bin/ld86
/usr/bin/bcc

[root@localhost lilo-22.8]# as86 --version
as86 0.16.21
[root@localhost lilo-22.8]# ld86 --version
ld86 0.16.21
[root@localhost lilo-22.8]# bcc --version
bcc 0.16.21

重新編譯

[root@localhost lilo-22.8]# make clean
[root@localhost lilo-22.8]# make all
./checkit
GCC version 2.91 or later is required
gcc version 4.4.7
OKAY

AS86 version 0.16.10 or later is required
as86 0.16.21
OKAY

LD86 version 0.16.10 or later is required
ld86 0.16.21
OKAY

BCC version 0.16.10 or later is recommended
bcc 0.16.21
OKAY
... 後續編譯正常進行 ...

補充知識:為什麼 Bootloader 需要 16 位工具鏈?

  1. BIOS 啟動流程:CPU 上電後運行在 16 位實模式(0xFFFF0),BIOS 將 MBR (512 字節) 加載到 0x7C00
  2. MBR 代碼:必須是 16 位機器碼,負責加載 Boot Sector 或直接加載內核
  3. LILO 架構:
    • lilo.com:16 位 DOS/實模式安裝程序
    • boot.b:16 位 Boot Sector 代碼
    • map:內核位置映射表
  4. 現代替代者:GRUB2 使用 grub-mkimage 生成多架構核心映像,不再依賴 16 位工具鏈;UEFI 系統直接運行 64 位 EFI 應用

相關包查詢技巧

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved