无忧启动论坛

标题: grub4dos for uefi 编译环境搭建出错 [打印本页]

作者: fmwqsn    时间: 2021-3-26 23:38
标题: grub4dos for uefi 编译环境搭建出错
如题,尝试编译 grub4dos for uefi 时报如下错误


  1. checking for .code16 addr64 assembler support... no
  2. configure: error: GRUB requires GAS .code16 addr32 support; upgrade your binutils
复制代码

在32位的uabntu16.04和64位的uabntu18.04上均进行了尝试,出现相同问题。
16.04中gcc版本gcc version 5.4.0 20160609
18.04中gcc版本gcc version 7.5.0
gcc-multilib也都装了。
非uefi版的grub4dos编译倒是没有问题。实在是费解。特此求教。感谢。
作者: 2011yaya2007777    时间: 2021-3-27 08:02
目前是使用gcc 4.8版本编译的。
作者: caocaofff    时间: 2021-3-27 09:08
本帖最后由 caocaofff 于 2021-3-27 10:13 编辑

我专门写了篇如何搭建G4D的编译环境的文章:
https://pecmd.net/thread-133.htm
作者: 2011yaya2007777    时间: 2021-3-27 10:01
本帖最后由 2011yaya2007777 于 2021-3-27 10:19 编辑

@ caocaofff
很好,有利于搭建编译环境。建议使用 gcc 4.8 版本,否则 grub4dos for UEFI 有可能编译通不过。(没有亲自验证,只是有人反馈,不知你那里是否可以编译,并正常使用?)

另外请教个问题,ubuntu-14.04.6-server-amd64.iso 只能安装在单独的 ext2/3/4 分区吗?有没有可以安装在 Windows 任意分区的?
每次编译都需要执行 ./configure 吗?

作者: fmwqsn    时间: 2021-3-29 16:09
本帖最后由 fmwqsn 于 2021-3-29 16:10 编辑
caocaofff 发表于 2021-3-27 09:08
我专门写了篇如何搭建G4D的编译环境的文章:
https://pecmd.net/thread-133.htm

我尝试着用这个说明文档做了个编译环境,在这个环境上编译g4d for UEFI 的时候问题依旧。
我试着装了所有我能想到的支持包,但是就是阴魂不散的。
有点崩溃。只能厚着脸皮再来求助。


这个和机器的处理器支持有关系么?

作者: caocaofff    时间: 2021-3-29 17:29
fmwqsn 发表于 2021-3-29 16:09
我尝试着用这个说明文档做了个编译环境,在这个环境上编译g4d for UEFI 的时候问题依旧。
我试着装了所 ...

按4楼所说,你可以将版本号由4.6改为4.8再测试。我写的教程适用于Grub4Dos Legacy编译
作者: caocaofff    时间: 2021-3-29 17:31
2011yaya2007777 发表于 2021-3-27 10:01
@ caocaofff
很好,有利于搭建编译环境。建议使用 gcc 4.8 版本,否则 grub4dos for UEFI 有可能编译通不 ...

传统的工作方式是:安装虚拟机、安装双系统。
但是,目前微软的Windows 10支持了WSL,所以我们可以利用这个特性,直接在Windows里安装Linux子系统,不用来回切换环境,工作效率非常高。
作者: caocaofff    时间: 2021-3-29 17:35
2011yaya2007777 发表于 2021-3-27 10:01
@ caocaofff
很好,有利于搭建编译环境。建议使用 gcc 4.8 版本,否则 grub4dos for UEFI 有可能编译通不 ...

./configure只需执行一次,make可以添加-j4这种参数使用多线程,后面的数字是CPU支持的线程数
作者: caocaofff    时间: 2021-3-29 20:57
经测试,在WSL2环境下Ubuntu1804可以顺利make,只需要将我的教程里的命令把版本号换成4.8即可,apt源不需要更换
作者: fmwqsn    时间: 2021-3-31 14:30
caocaofff 发表于 2021-3-29 20:57
经测试,在WSL2环境下Ubuntu1804可以顺利make,只需要将我的教程里的命令把版本号换成4.8即可,apt源不需要 ...

心态略崩。
  1. checking if C symbols get an underscore after compilation... no
  2. checking whether objcopy works for absolute addresses... yes
  3. checking whether addr32 must be in the same line as the instruction... yes
  4. checking for .code16 addr64 assembler support... no
  5. configure: error: GRUB requires GAS .code16 addr32 support; upgrade your binutils
  6. root@ubuntu:/home/user/grub4dos-for_UEFI# gcc -v
  7. Using built-in specs.
  8. COLLECT_GCC=gcc
  9. COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
  10. Target: x86_64-linux-gnu
  11. Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.5-4ubuntu8' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
  12. Thread model: posix
  13. gcc version 4.8.5 (Ubuntu 4.8.5-4ubuntu8)
复制代码

g4d for UEFI 跟我有仇。。
作者: caocaofff    时间: 2021-3-31 19:46
fmwqsn 发表于 2021-3-31 14:30
心态略崩。

g4d for UEFI 跟我有仇。。

你可以按我给的bash脚本走一遍,每行单独复制出来执行
作者: fmwqsn    时间: 2021-4-2 16:15
caocaofff 发表于 2021-3-31 19:46
你可以按我给的bash脚本走一遍,每行单独复制出来执行

我这两天试了我能弄到的所有ubantu版本……也尝试了各种编译姿势。。
也确确实实是用您提供的脚本一步一步的安装,然鹅,全都是一样的问题。
现在唯一可能的区别也许就是我都是在虚拟机上弄得?
非UEFI版的编译都能正常通过。但是UEFI版的就不行。
想破脑袋也没想明白到底是为啥。

作者: 2011yaya2007777    时间: 2021-4-2 16:57
编译通不过,总有一些提示吧,可以根据这些提示搜一搜。
作者: fmwqsn    时间: 2021-4-6 09:41
本帖最后由 fmwqsn 于 2021-4-7 09:43 编辑
2011yaya2007777 发表于 2021-4-2 16:57
编译通不过,总有一些提示吧,可以根据这些提示搜一搜。

感谢两位大大花时间帮我,
现在是常规版的g4d编译完全没问题,各种姿势通过。
但是uefi版的configure的时候就报
configure: error: GRUB requires GAS .code16 addr32 support; upgrade your binutils
网上我有搜,但是没找到什么有用的东西。
也试过各种版本的系统和gcc(尤其是4.8),问题依旧。
binutils啥的相关的东西全都更的最新了。
主要是这个错我还从来没遇见过,完全不知道是啥原因。
只好舔着脸来这发帖。OTZ
作者: liuzhaoyzz    时间: 2021-6-5 09:26
本帖最后由 liuzhaoyzz 于 2021-6-6 12:26 编辑
2011yaya2007777 发表于 2021-4-2 16:57
编译通不过,总有一些提示吧,可以根据这些提示搜一搜。

@2011yaya2007777,@wintoflash大神不能发布个grub4dos uefi编译环境搭建教程吗?比如你们用的哪个发行版,是ubuntu吗?还是chenall说的那个koding在线编译?ubuntu版本是什么,从哪里下载的,gcc4.8需要的依赖文件等等。论坛里面似乎没有一个帖子系统地说下grub4dos编译环境搭建(chenall的colinux似乎在64位windows环境下不能用)。

我虽然是业余人士,只是很好奇g4e/grub2编译环境是怎么搭建的。请满足下我的好奇心。


搜了下论坛里面有几例编译环境搭建失败的例子,chenall的colinux似乎在64位windows环境下不能用。而且grub4dos bios更加倾向于gcc4.8以下的版本编译(历史遗留原因,开发的早,用的gcc3.4低版本),现在ubuntu的发行版,gcc的版本都是高版本了。





作者: 2011yaya2007777    时间: 2021-6-5 10:09
我使用 chenall 搭建的环境。
http://chenall.net/post/grub4dos_dev/
作者: liuzhaoyzz    时间: 2021-6-5 10:47
2011yaya2007777 发表于 2021-6-5 10:09
我使用 chenall 搭建的环境。
http://chenall.net/post/grub4dos_dev/

chenall的colinux,在64位win10里面似乎无法加载linux.sys啊?        
作者: chenall    时间: 2021-6-5 12:19
sudo apt install -y gcc-4.8 gcc-4.8-multilib nasm upx upx-ucl p7zip-full autoconf automake make patch binutils-dev liblzma-dev
作者: liuzhaoyzz    时间: 2021-6-5 13:07
本帖最后由 liuzhaoyzz 于 2021-6-5 13:12 编辑
chenall 发表于 2021-6-5 12:19
sudo apt install -y gcc-4.8 gcc-4.8-multilib nasm upx upx-ucl p7zip-full autoconf automake make patc ...


我试了下,用colinux的话,64位win10里面无法加载linux.sys啊?看了txt说明逐步做的。不懂怎么弄。

你上面的依赖,是在ubuntu里面的吗?ubuntu哪个版本的?      

作者: chenall    时间: 2021-6-5 13:13
ubuntu 16.04, colinux 不支持64位
作者: chenall    时间: 2021-6-5 13:13
ubuntu 16.04, colinux 不支持64位
作者: wintoflash    时间: 2021-6-5 13:50
本帖最后由 wintoflash 于 2021-6-5 21:49 编辑
liuzhaoyzz 发表于 2021-6-5 09:26
@2011yaya2007777,@wintoflash大神不能发布个grub4dos uefi编译环境搭建教程吗?比如你们用的哪个发行版 ...

wsl装个ubuntu18.04就行了。
作者: liuzhaoyzz    时间: 2021-6-6 07:57
本帖最后由 liuzhaoyzz 于 2021-6-6 08:22 编辑

看了wintoflash和caocaofff的介绍,似乎WSL效果挺高,但我的WIN10里面的WSL被我干掉了。


chenall说的ubuntu版本16.04好像有点问题,我试了下,ubuntu14.04版本apt在线get的gcc版本才是4.8.4。
另外,grub4dos编译似乎还需要texinfo软件包?gawk最好也加上吧,不清楚mawk能否正常代替之。
https://blog.csdn.net/weixin_30572265/article/details/116678855
(3) 编译源码安装
a.) 编译条件
要编译GRUB的源代码,系统必须具备以下条件:
q GCC2.95或者以上版本
q 安装了GNU Make
q binutils2.9.1.0.23或者个更高版本
q Texinfo 4.0或者更高版本
q Autoconf 2.5x
q Automake 1.7 或者更高版本

sudo apt install -y gcc-4.8 gcc-4.8-multilib nasm upx upx-ucl p7zip-full texinfo autoconf automake make patch binutils-dev liblzma-dev gawk


看下ubuntu版本号:sudo lsb_release -a
root@ubuntu:/media/root/SSD1/grub4dos-20210602source# sudo lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 14.04.6 LTS
Release:    14.04
Codename:    trusty

看下gcc版本:gcc -v,4.8.4的。
root@ubuntu:/media/root/SSD1/grub4dos-20210602source# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.4' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.4)


开始编译了:
root@ubuntu:/media/root/SSD1/grub4dos-20210602source# ./configure
bash: ./configure: 权限不够
权限不够,试了chmod +x ./configure无效,chmod -R 777 ./无效,我原来把源代码放在NTFS分区的,尝试放在FAT32分区也没用,话说ubuntu不是有ntfs-3g加持了吗?NTFS分区读写都没有问题呀!FAT32驱动应该有吧?FAT32分区应该没有什么ACL权限吧?
直接用bash ./configure吧:

root@ubuntu:/media/root/SSD1/grub4dos-20210602source# bash ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/media/root/SSD1/grub4dos-20210602source':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
出错了。

执行uname -m看了下名字是:x86_64
root@ubuntu:/media/root/SSD1/grub4dos-20210602source# uname -m
x86_64


加上--host=x86-64编译试试看:
root@ubuntu:/media/root/SSD1/grub4dos-20210602source# bash ./configure --host=x86-64
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for x86-64-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for x86-64-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking dependency style of gcc... gcc3
checking build system type... x86_64-unknown-linux-gnu
checking host system type... Invalid configuration `x86-64': system `64' not recognized
configure: error: /bin/sh ./config.sub x86-64 failed
这个错误信息该怎么解决?


看了下config.log,有几个错误:
configure:3212: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3223: $? = 4
configure:3212: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
上面的错误好像不影响什么。


configure:4016: checking build system type
configure:4030: result: x86_64-unknown-linux-gnu
configure:4050: checking host system type
configure:4059: error: /bin/sh ./config.sub x86-64 failed
上面的错误可能有点问题。./config.sub有读写权限问题?

我的ubuntu14.04是desktop64位版本的,能否正常编译grub4dos BIOS版本?看了caocaofff的介绍,他用的是server64位版本的,应该可以编译啊?奇怪。
我看了caocaofff的脚本,似乎改了国内的源,我试过改了国内的源的话,似乎软件包依赖没有ubuntu官网的丰富。
另外caocaofff似乎用了双重gcc4.6+gcc4.8共存的方案,这种方案感觉不如只用gcc4.8一种方案稳定,grub4dos官方都说了是在gcc4.8下面编译的。

g4d g4e编译都通不过。


作者: wintoflash    时间: 2021-6-6 08:49
本帖最后由 wintoflash 于 2021-6-6 08:53 编辑
liuzhaoyzz 发表于 2021-6-6 07:57
看了wintoflash和caocaofff的介绍,似乎WSL效果挺高,但我的WIN10里面的WSL被我干掉了。

1)源码不能放在ntfs/fat等不支持POSIX权限的分区上。
2)建议用git获取源码。
3)执行./build开始编译。

至于要不要换软件源,那倒不重要。不过并不存在所谓的"官方软件源软件更多"的现象。各镜像都是从官方同步来的,如果不一样,那也不能叫"镜像"了。
作者: liuzhaoyzz    时间: 2021-6-6 09:34
本帖最后由 liuzhaoyzz 于 2021-6-7 06:38 编辑
wintoflash 发表于 2021-6-6 08:49
1)源码不能放在ntfs/fat等不支持POSIX权限的分区上。
2)建议用git获取源码。
3)执行./build开始编译。
...

大神就是大神!
1)源码不能放在ntfs/fat等不支持POSIX权限的分区上。

(1)我格式化了一个分区格式为ext4,把源代码放在里面开始编译grub4dos_BIOS:
root@ubuntu:/media/root/yule/grub4dos-for_UEFI-2021-06-02source# cd /media/root/yule/grub4dos-20210602source
root@ubuntu:/media/root/yule/grub4dos-20210602source#

root@ubuntu:/media/root/yule/grub4dos-20210602source# bash ./build
./build: 行 77: ./configure: 权限不够
root@ubuntu:/media/root/yule/grub4dos-20210602source# chmod -R 777 ./
root@ubuntu:/media/root/yule/grub4dos-20210602source# bash ./build
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking dependency style of gcc... gcc3
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... (cached) gcc
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking dependency style of gcc... (cached) gcc3
checking for ranlib... ranlib
checking whether optimization for size works... yes
checking whether gcc has -fno-stack-protector... yes
checking whether gcc has -fno-reorder-functions... yes
checking whether -Wundef works... yes
checking whether -falign-loops works... yes
checking whether linker accepts `--build-id=none'... yes
checking for objcopy... objcopy
checking if C symbols get an underscore after compilation... no
checking whether objcopy works for absolute addresses... yes
checking whether addr32 must be in the same line as the instruction... yes
checking for .code16 addr32 assembler support... yes
checking whether an absolute indirect call/jump must not be prefixed with an asterisk... no
checking if start is defined by the compiler... no
checking if _start is defined by the compiler... yes
checking if __bss_start is defined by the compiler... yes
checking if _edata is defined by the compiler... yes
checking if edata is defined by the compiler... yes
checking if end is defined by the compiler... yes
checking if _end is defined by the compiler... yes
checking for opendisk in -lutil... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating stage2/Makefile
config.status: creating config.h
config.status: executing depfiles commands
Making clean in stage2
make[1]: 正在进入目录 `/tmp/grub4dos-temp/stage2'
test -z "grub.exe badgrub.exe grldr grldr.mbr bootlace.com hmload.com eltorito.sys pre_stage2 dosstart badgrubstart grldrstart mbrstart bootlacestart hmloadstart pre_stage2_fullsize pre_stage2_head pre_stage2_tail " || rm -f grub.exe badgrub.exe grldr grldr.mbr bootlace.com hmload.com eltorito.sys pre_stage2 dosstart badgrubstart grldrstart mbrstart bootlacestart hmloadstart pre_stage2_fullsize pre_stage2_head pre_stage2_tail
test -z "pre_stage2.exec dosstart.exec badgrubstart.exec grldrstart.exec mbrstart.exec bootlacestart.exec hmloadstart.exec" || rm -f pre_stage2.exec dosstart.exec badgrubstart.exec grldrstart.exec mbrstart.exec bootlacestart.exec hmloadstart.exec
rm -f *.o
test -z "pre_stage2.exec dosstart.exec badgrubstart.exec grldrstart.exec mbrstart.exec bootlacestart.exec hmloadstart.exec" || rm -f pre_stage2.exec dosstart.exec badgrubstart.exec grldrstart.exec mbrstart.exec bootlacestart.exec hmloadstart.exec
test -z "" || rm -f
test -z "" || rm -f
test -z "test-suite.log" || rm -f test-suite.log
make[1]:正在离开目录 `/tmp/grub4dos-temp/stage2'
make[1]: 正在进入目录 `/tmp/grub4dos-temp'
make[1]: 没有什么可以做的为 `clean-am'。
make[1]:正在离开目录 `/tmp/grub4dos-temp'
make  all-recursive
make[1]: 正在进入目录 `/tmp/grub4dos-temp'
Making all in stage2
make[2]: 正在进入目录 `/tmp/grub4dos-temp/stage2'
  CPPAS    pre_stage2_exec-asm.o
  CC       pre_stage2_exec-bios.o
  CC       pre_stage2_exec-boot.o
  CC       pre_stage2_exec-builtins.o
  CC       pre_stage2_exec-char_io.o
  CC       pre_stage2_exec-cmdline.o
  CC       pre_stage2_exec-common.o
  CC       pre_stage2_exec-console.o
  CC       pre_stage2_exec-dec_lz4.o
  CC       pre_stage2_exec-dec_lzma.o
  CC       pre_stage2_exec-dec_vhd.o
  CC       pre_stage2_exec-disk_io.o
  CC       pre_stage2_exec-fsys_ext2fs.o
  CC       pre_stage2_exec-fsys_fat.o
  CC       pre_stage2_exec-fsys_ntfs.o
  CC       pre_stage2_exec-fsys_ffs.o
  CC       pre_stage2_exec-fsys_iso9660.o
  CC       pre_stage2_exec-fsys_jfs.o
  CC       pre_stage2_exec-fsys_minix.o
  CC       pre_stage2_exec-fsys_reiserfs.o
  CC       pre_stage2_exec-fsys_ufs2.o
  CC       pre_stage2_exec-fsys_vstafs.o
  CC       pre_stage2_exec-fsys_xfs.o
  CC       pre_stage2_exec-fsys_pxe.o
  CC       pre_stage2_exec-fsys_initrd.o
  CC       pre_stage2_exec-fsys_ipxe.o
  CC       pre_stage2_exec-fsys_fb.o
  CC       pre_stage2_exec-gunzip.o
  CC       pre_stage2_exec-hercules.o
  CC       pre_stage2_exec-md5.o
  CC       pre_stage2_exec-serial.o
  CC       pre_stage2_exec-stage2.o
  CC       pre_stage2_exec-terminfo.o
  CC       pre_stage2_exec-tparm.o
  CC       pre_stage2_exec-graphics.o
  CCLD     pre_stage2.exec
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-bios.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-boot.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-builtins.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-char_io.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-cmdline.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-common.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-console.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-dec_lz4.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-dec_lzma.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-dec_vhd.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-disk_io.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-fsys_ext2fs.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-fsys_fat.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-fsys_ntfs.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-fsys_ffs.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-fsys_iso9660.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-fsys_jfs.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-fsys_minix.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-fsys_reiserfs.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-fsys_ufs2.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-fsys_vstafs.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-fsys_xfs.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-fsys_pxe.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-fsys_initrd.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-fsys_ipxe.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-fsys_fb.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-gunzip.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-hercules.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-md5.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-serial.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-stage2.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-terminfo.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-tparm.o
/usr/bin/ld: Warning: alignment 2 of symbol `grub_putchar' in pre_stage2_exec-asm.o is smaller than 4 in pre_stage2_exec-graphics.o
  OBJ    pre_stage2
  CPPAS    dosstart_exec-dosstart.o
  CCLD     dosstart.exec
  CPPAS    badgrubstart_exec-badgrubstart.o
  CCLD     badgrubstart.exec
  CPPAS    grldrstart_exec-grldrstart.o
  CCLD     grldrstart.exec
  CPPAS    mbrstart_exec-mbrstart.o
  CCLD     mbrstart.exec
  CPPAS    bootlacestart_exec-bootlacestart.o
  CCLD     bootlacestart.exec
  CPPAS    hmloadstart_exec-hmloadstart.o
  CCLD     hmloadstart.exec
  OBJ    dosstart
  GEN      grub.exe
  OBJ    badgrubstart
  GEN      badgrub.exe
  OBJ    grldrstart
  GEN      grldr
  OBJ    mbrstart
  GEN      grldr.mbr
  OBJ    bootlacestart
  GEN      bootlace.com
记录了10+0 的读入
记录了10+0 的写出
5120字节(5.1 kB)已复制,0.000104693 秒,48.9 MB/秒
记录了1+0 的读入
记录了1+0 的写出
512字节(512 B)已复制,7.2937e-05 秒,7.0 MB/秒
记录了1+0 的读入
记录了1+0 的写出
512字节(512 B)已复制,7.509e-05 秒,6.8 MB/秒
  OBJ    hmloadstart
  GEN      hmload.com
                       Ultimate Packer for eXecutables
                          Copyright (C) 1996 - 2013
UPX 3.91        Markus Oberhumer, Laszlo Molnar & John Reiser   Sep 30th 2013

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
      6140 ->      1724   28.08%     dos/sys     eltorito.sys                  

Packed 1 file.
make[2]:正在离开目录 `/tmp/grub4dos-temp/stage2'
make[2]: 正在进入目录 `/tmp/grub4dos-temp'
make[2]:正在离开目录 `/tmp/grub4dos-temp'
make[1]:正在离开目录 `/tmp/grub4dos-temp'
记录了64+0 的读入
记录了64+0 的写出
64字节(64 B)已复制,0.000137164 秒,467 kB/秒
记录了43456+0 的读入
记录了43456+0 的写出
43456字节(43 kB)已复制,0.0319802 秒,1.4 MB/秒

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=zh_CN.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)
Scanning

Creating archive grub4dos-0.4.6a-2021-06-06.7z

Compressing  grub4dos-0.4.6a/COPYING      
Compressing  grub4dos-0.4.6a/sample/default      
Compressing  grub4dos-0.4.6a/grldr      
Compressing  grub4dos-0.4.6a/grldr_cd.bin      
Compressing  grub4dos-0.4.6a/docs/ChangeLog_chenall.txt      
Compressing  grub4dos-0.4.6a/docs/ChangeLog_GRUB4DOS.txt      
Compressing  grub4dos-0.4.6a/docs/README_GRUB4DOS.txt      
Compressing  grub4dos-0.4.6a/docs/README_GRUB4DOS_CN.txt      
Compressing  grub4dos-0.4.6a/badgrub.exe      
Compressing  grub4dos-0.4.6a/grub.exe      
Compressing  grub4dos-0.4.6a/sample/config.sys      
Compressing  grub4dos-0.4.6a/eltorito.sys      
Compressing  grub4dos-0.4.6a/bootlace.com      
Compressing  grub4dos-0.4.6a/bootlace64.com      
Compressing  grub4dos-0.4.6a/hmload.com      
Compressing  grub4dos-0.4.6a/sample/menu.lst      
Compressing  grub4dos-0.4.6a/grldr.mbr      
Compressing  grub4dos-0.4.6a/grldr.pbr      
Compressing  grub4dos-0.4.6a/grub.pif      

Everything is Ok
root@ubuntu:/media/root/yule/grub4dos-20210602source#
grub4dos-BIOS成功编译!



(2)选择那个ex4分区,把源代码放在里面开始编译grub4dos_UEFI:

root@ubuntu:/media/root/yule/grub4dos-20210602source# cd /media/root/yule/grub4dos-for_UEFI-2021-06-02source

root@ubuntu:/media/root/yule/grub4dos-for_UEFI-2021-06-02source# chmod -R 777 ./
root@ubuntu:/media/root/yule/grub4dos-for_UEFI-2021-06-02source# bash ./build

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/tmp/grub4dos-temp/missing: Unknown `--is-lightweight' option
Try `/tmp/grub4dos-temp/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking dependency style of gcc... gcc3
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... (cached) gcc
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking dependency style of gcc... (cached) gcc3
checking for ranlib... ranlib
checking whether optimization for size works... yes
checking whether gcc has -fno-stack-protector... yes
checking whether gcc has -fno-reorder-functions... yes
checking whether -Wundef works... yes
checking whether -falign-loops works... yes
checking whether linker accepts `--build-id=none'... yes
checking for objcopy... objcopy
checking if C symbols get an underscore after compilation... no
checking whether objcopy works for absolute addresses... yes
checking whether addr32 must be in the same line as the instruction... yes
checking for .code16 addr32 assembler support... yes
checking whether an absolute indirect call/jump must not be prefixed with an asterisk... no
checking if start is defined by the compiler... no
checking if _start is defined by the compiler... yes
checking if __bss_start is defined by the compiler... yes
checking if _edata is defined by the compiler... yes
checking if edata is defined by the compiler... yes
checking if end is defined by the compiler... yes
checking if _end is defined by the compiler... yes
checking for opendisk in -lutil... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating stage2/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
Making clean in stage2
make[1]: 正在进入目录 `/tmp/grub4dos-temp/stage2'
test -z " pre_stage2 " || rm -f  pre_stage2
test -z "pre_stage2.exec" || rm -f pre_stage2.exec
rm -f *.o
test -z "pre_stage2.exec" || rm -f pre_stage2.exec
test -z "" || rm -f
test -z "" || rm -f
test -z "test-suite.log" || rm -f test-suite.log
make[1]:正在离开目录 `/tmp/grub4dos-temp/stage2'
make[1]: 正在进入目录 `/tmp/grub4dos-temp'
make[1]: 没有什么可以做的为 `clean-am'。
make[1]:正在离开目录 `/tmp/grub4dos-temp'
make  all-recursive
make[1]: 正在进入目录 `/tmp/grub4dos-temp'
Making all in stage2
make[2]: 正在进入目录 `/tmp/grub4dos-temp/stage2'
  CPPAS    pre_stage2_exec-asm.o
  CC       pre_stage2_exec-boot.o
  CC       pre_stage2_exec-builtins.o
  CC       pre_stage2_exec-char_io.o
  CC       pre_stage2_exec-cmdline.o
  CC       pre_stage2_exec-common.o
  CC       pre_stage2_exec-console.o
  CC       pre_stage2_exec-dec_lz4.o
  CC       pre_stage2_exec-dec_lzma.o
  CC       pre_stage2_exec-dec_vhd.o
  CC       pre_stage2_exec-disk_io.o
  CC       pre_stage2_exec-fsys_ext2fs.o
  CC       pre_stage2_exec-fsys_fat.o
  CC       pre_stage2_exec-fsys_ntfs.o
  CC       pre_stage2_exec-fsys_iso9660.o
  CC       pre_stage2_exec-fsys_pxe.o
  CC       pre_stage2_exec-fsys_ipxe.o
  CC       pre_stage2_exec-fsys_fb.o
  CC       pre_stage2_exec-fsys_initrd.o
  CC       pre_stage2_exec-gunzip.o
  CC       pre_stage2_exec-md5.o
  CC       pre_stage2_exec-stage2.o
  CC       pre_stage2_exec-graphics.o
  CCLD     pre_stage2.exec
  OBJ    pre_stage2
make[2]:正在离开目录 `/tmp/grub4dos-temp/stage2'
make[2]: 正在进入目录 `/tmp/grub4dos-temp'
make[2]:正在离开目录 `/tmp/grub4dos-temp'
make[1]:正在离开目录 `/tmp/grub4dos-temp'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/tmp/grub4dos-temp/missing: Unknown `--is-lightweight' option
Try `/tmp/grub4dos-temp/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking dependency style of gcc... gcc3
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... (cached) gcc
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking dependency style of gcc... (cached) gcc3
checking for ranlib... ranlib
checking whether optimization for size works... yes
checking whether gcc has -fno-stack-protector... yes
checking whether gcc has -fno-reorder-functions... yes
checking whether -Wundef works... yes
checking whether -falign-loops works... yes
checking whether linker accepts `--build-id=none'... yes
checking for objcopy... objcopy
checking if C symbols get an underscore after compilation... no
checking whether objcopy works for absolute addresses... yes
checking whether addr32 must be in the same line as the instruction... yes
checking for .code16 addr32 assembler support... yes
checking whether an absolute indirect call/jump must not be prefixed with an asterisk... no
checking if start is defined by the compiler... no
checking if _start is defined by the compiler... yes
checking if __bss_start is defined by the compiler... yes
checking if _edata is defined by the compiler... yes
checking if edata is defined by the compiler... yes
checking if end is defined by the compiler... yes
checking if _end is defined by the compiler... yes
checking for opendisk in -lutil... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating stage2/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
Making clean in stage2
make[1]: 正在进入目录 `/tmp/grub4dos-temp/stage2'
test -z " pre_stage2 " || rm -f  pre_stage2
test -z "pre_stage2.exec" || rm -f pre_stage2.exec
rm -f *.o
test -z "pre_stage2.exec" || rm -f pre_stage2.exec
test -z "" || rm -f
test -z "" || rm -f
test -z "test-suite.log" || rm -f test-suite.log
make[1]:正在离开目录 `/tmp/grub4dos-temp/stage2'
make[1]: 正在进入目录 `/tmp/grub4dos-temp'
make[1]: 没有什么可以做的为 `clean-am'。
make[1]:正在离开目录 `/tmp/grub4dos-temp'
make  all-recursive
make[1]: 正在进入目录 `/tmp/grub4dos-temp'
Making all in stage2
make[2]: 正在进入目录 `/tmp/grub4dos-temp/stage2'
  CPPAS    pre_stage2_exec-asm.o
  CC       pre_stage2_exec-boot.o
  CC       pre_stage2_exec-builtins.o
  CC       pre_stage2_exec-char_io.o
  CC       pre_stage2_exec-cmdline.o
  CC       pre_stage2_exec-common.o
  CC       pre_stage2_exec-console.o
  CC       pre_stage2_exec-dec_lz4.o
  CC       pre_stage2_exec-dec_lzma.o
  CC       pre_stage2_exec-dec_vhd.o
  CC       pre_stage2_exec-disk_io.o
  CC       pre_stage2_exec-fsys_ext2fs.o
  CC       pre_stage2_exec-fsys_fat.o
  CC       pre_stage2_exec-fsys_ntfs.o
  CC       pre_stage2_exec-fsys_iso9660.o
  CC       pre_stage2_exec-fsys_pxe.o
  CC       pre_stage2_exec-fsys_ipxe.o
  CC       pre_stage2_exec-fsys_fb.o
  CC       pre_stage2_exec-fsys_initrd.o
  CC       pre_stage2_exec-gunzip.o
  CC       pre_stage2_exec-md5.o
  CC       pre_stage2_exec-stage2.o
  CC       pre_stage2_exec-graphics.o
  CCLD     pre_stage2.exec
  OBJ    pre_stage2
make[2]:正在离开目录 `/tmp/grub4dos-temp/stage2'
make[2]: 正在进入目录 `/tmp/grub4dos-temp'
make[2]:正在离开目录 `/tmp/grub4dos-temp'
make[1]:正在离开目录 `/tmp/grub4dos-temp'

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=zh_CN.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)
Scanning


/tmp/grub4dos-temp/Get_Source_of_This_Build.txt:  WARNING: No more files               
/tmp/grub4dos-temp/grub4dos_.diff:  WARNING: No more files               


Creating archive grub4dos-for_UEFI-2021-06-06.7z

Compressing  x86_64-efi/kernel.img      
Compressing  i386-efi/kernel.img      
Compressing  ChangeLog_UEFI.txt      
Compressing  BOOTIA32.EFI      
Compressing  BOOTX64.EFI      
Compressing  menu.lst      
Compressing  mkimage.exe      


WARNINGS for files:

/tmp/grub4dos-temp/Get_Source_of_This_Build.txt : No more files               
/tmp/grub4dos-temp/grub4dos_.diff : No more files               
----------------
WARNING: Cannot find 2 files
7z failed. Continue with zip or tar...
grub4dos_UEFI成功编译!

nice!!!


作者: liuzhaoyzz    时间: 2021-6-6 10:47
wintoflash 发表于 2021-6-6 08:49
1)源码不能放在ntfs/fat等不支持POSIX权限的分区上。
2)建议用git获取源码。
3)执行./build开始编译。
...

另外想请问下,grub2编译对于gcc版本有没有什么要求?需要哪些依赖?      
作者: liuzhaoyzz    时间: 2021-6-7 06:31
wintoflash 发表于 2021-6-6 08:49
1)源码不能放在ntfs/fat等不支持POSIX权限的分区上。
2)建议用git获取源码。
3)执行./build开始编译。
...

  软件源的问题,我尝试过国内的软件源,似乎p7zip-full还是什么软件包没有(记不清是哪个了),切换回ubuntu好像就可以了,我感觉国内的软件源同步了官方的发行版iso镜像什么的,这个的确是跟官网一样,但感觉其他的依赖包不如官方源齐全。      
作者: liuzhaoyzz    时间: 2021-6-7 06:51
另外想请问下,25楼编译grub4dos_BIOS版本的时候,有很多/usr/bin/ld: Warning,是否影响编译结果?
编译grub4dos_UEFI版本似乎没有/usr/bin/ld: Warning。        

作者: wintoflash    时间: 2021-6-7 10:24
liuzhaoyzz 发表于 2021-6-7 06:31
软件源的问题,我尝试过国内的软件源,似乎p7zip-full还是什么软件包没有(记不清是哪个了),切换回ub ...

我现在用的软件源是ustc的,有p7zip-full。
有些企业的软件源确实有点问题(比如网易),我建议用高校的。
北方建议清华 https://mirrors.tuna.tsinghua.edu.cn/
南方建议科大 http://mirrors.ustc.edu.cn/
作者: wintoflash    时间: 2021-6-7 10:32
本帖最后由 wintoflash 于 2021-6-7 10:37 编辑
liuzhaoyzz 发表于 2021-6-6 10:47
另外想请问下,grub2编译对于gcc版本有没有什么要求?需要哪些依赖?

grub2的readme文档里面有下面这句话:
See the file INSTALL for instructions on how to build and install the GRUB 2 data and program files.
所以具体怎么编译,看install文件就行了。
  1. * GCC 5.1.0 or later
  2.   Experimental support for clang 3.8.0 or later (results in much bigger binaries)
  3.   for i386, x86_64, arm (including thumb), arm64, mips(el), powerpc, sparc64
复制代码


当然,也可以看github持续集成服务的配置:
https://github.com/a1ive/grub/bl ... workflows/build.yml

我用的是gcc11。
另外,不要先在windows/ntfs/fat下先解压再复制到ext等分区,也不要用7-zip/p7zip等解压。要用tar等命令直接解压。
p7zip/7-zip等软件在解压的时候不能正确处理权限和符号链接。
  1. tar -xf xxx.tar.gz
复制代码

我建议用git直接同步代码。
  1. git clone --depth=1 https://github.com/a1ive/grub
复制代码

作者: liuzhaoyzz    时间: 2021-6-7 11:09
本帖最后由 liuzhaoyzz 于 2021-6-7 11:50 编辑
wintoflash 发表于 2021-6-7 10:24
我现在用的软件源是ustc的,有p7zip-full。
有些企业的软件源确实有点问题(比如网易),我建议用高校的 ...

呵呵,用的ustc的源?有点儿意思,我就在合肥呢。前年的时候还去了中科大看了樱花,跟武大的樱花差不多,去年疫情影响没去。        
作者: liuzhaoyzz    时间: 2021-6-7 11:23
本帖最后由 liuzhaoyzz 于 2021-6-7 11:48 编辑
wintoflash 发表于 2021-6-7 10:32
grub2的readme文档里面有下面这句话:
See the file INSTALL for instructions on how to build and ins ...

好像是从gcc5.0开始,grub4dos编译的话可能会有ABI问题,grub4dos编译环境从gcc3.4到gcc4.8,似乎稳定在gcc4.8版本。


grub2则要求gcc版本≥gcc5.1,官方grub2.04支持gcc8和gcc9(news文件)。现在主流的linux发行版适配的gcc版本应该都满足条件,感觉上来说,grub2编译环境搭建可能要比grub4dos搭建略微简单点,因为主流的发行版都满足gcc5.1以上的条件,不挑发行版。

不要先在windows/ntfs/fat下先解压再复制到ext等分区,也不要用7-zip/p7zip等解压。要用tar等命令直接解压。
p7zip/7-zip等软件在解压的时候不能正确处理权限和符号链接。

建议用git直接同步代码。

学到了,我玩linux也只是出于体验、好奇罢了,所以总是喜欢尝试用windows的思想去解决linux的问题,我觉得浏览器有那种“所见即所得”的既视感,更加真实,我并不知道还有你说的那些权限和符号链接的问题,所以有了“权限不够,chmod来凑
”的笨办法。git感觉很专业啊。
        



作者: wintoflash    时间: 2021-6-7 11:39
liuzhaoyzz 发表于 2021-6-7 11:23
好像是从gcc5.0开始,grub4dos编译的话可能会有ABI问题,grub4dos编译环境从gcc3.4到gcc4.8,似乎稳定在g ...

grub2要求gcc>5只是最近才弄的,因为低版本gcc没法解决一个安全漏洞。
git非常好用。它不仅仅可以用来管理代码。也可以用来管理文档。用过的都说好。不信的话你可以问问江南一根葱。
作者: liuzhaoyzz    时间: 2021-6-14 16:25
wintoflash 发表于 2021-6-6 08:49
1)源码不能放在ntfs/fat等不支持POSIX权限的分区上。
2)建议用git获取源码。
3)执行./build开始编译。
...

想请问下,
grub4dos-BIOS版本:git clone --depth=1 https://github.com/chenall/grub4dos.git
grub4dos-UEFI版本:?????地址是什么?

我该从哪里获取这个下载地址?在github上面看好像BIOS/UEFI版本是一个?有没有相对固定的网址?

作者: liuzhaoyzz    时间: 2021-6-14 19:33
匿名者 发表于 2021-6-14 17:57
左上角可以切换分支查看。默认分支是 0.4.6a,efi 就是 efi 分支,master 是 0.4.5c。



明白了
作者: 312439374    时间: 2023-10-19 16:21
liuzhaoyzz 发表于 2021-6-6 09:34
大神就是大神!

(1)我格式化了一个分区格式为ext4,把源代码放在里面开始编译grub4dos_BIOS:

我编译完成了, 但是通过IPXE调用启动GRUB4DOS时,一直报这个错误,麻烦帮我看看
====================================================
http:  // 192.168.1.186/grub/B00TX64.EFI... ok
Couldn't get file size GRUB4DOS for_UEFI 2023-10-19, Mem: 0K/0M/0M, Free-mem-start: 0x0
[ Minimal BASH-like line editing is supported. For the first'word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename .
grub>
作者: liuzhaoyzz    时间: 2023-10-19 21:36
312439374 发表于 2023-10-19 16:21
我编译完成了, 但是通过IPXE调用启动GRUB4DOS时,一直报这个错误,麻烦帮我看看
======================== ...

好像g4e不支持ipxe吧,你改了代码了吗?这块我不懂啊。

Grub2也是间接支持ipxe协议。

首先需要g4e支持http协议,感觉上来说UEFI下采用ipxe.efi作为第一引导,进而引导g4ebootx64.efi,有可能可以。
作者: wintoflash    时间: 2023-10-19 21:39
312439374 发表于 2023-10-19 16:21
我编译完成了, 但是通过IPXE调用启动GRUB4DOS时,一直报这个错误,麻烦帮我看看
======================== ...

g4e目前不支持http吧。

作者: 312439374    时间: 2023-10-19 22:43
wintoflash 发表于 2023-10-19 21:39
g4e目前不支持http吧。

好的,看来只能放弃了.研究了几天了
作者: 312439374    时间: 2023-10-19 22:45
liuzhaoyzz 发表于 2023-10-19 21:36
好像g4e不支持ipxe吧,你改了代码了吗?这块我不懂啊。

Grub2也是间接支持ipxe协议。

是的, 我现在就是用ipxe的chain ${boot-server}/grub/BOOTX64.EFI引导的,直接进入命令行了.bios下的grldr是可以进入menu.lst菜单的

算了, 不研究了,试试GRUB2吧只能




欢迎光临 无忧启动论坛 (http://bbs.wuyou.net/) Powered by Discuz! X3.3