|
外部命令怎么弄?
我是这样的:
把你的 grub4dos.h 和 grubprog.h 改名 grub4efi.h 和 g4eprog.h。
写个最简单的外部命令:
- #include "grub4efi.h"
- /* this is needed, see the comment in grubprog.h */
- #include "g4eprog.h"
- /* Do not insert any other asm lines here. */
- int main(char *arg,int flags)
- {
- return printf ("%s\n",arg);
- }
复制代码
编译:
- gcc -nostdlib -DASM_BUILD_DATE="".long 20201216"" -fno-reorder-functions -fno-strict-aliasing -fno-exceptions -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-zero-initialized-in-bss -fno-function-cse -fno-jump-tables --entry main -Wl,-N -Wl,--build-id=none -m64 -mno-sse -Wl,-Ttext -Wl,0 -fPIE -I../include/ echo.c -o echo.o
- objcopy -O binary echo.o echo.tmp
- sed -e '$s/\x00*$//' echo.tmp > echo.mod
- mv echo.mod bin/$(basename -s .mod echo.mod)
复制代码
执行之后虚拟机报错。
|
|