Re: [問題] bootloader 不需要 OS 也能用 C header?

看板LinuxDev作者 (牛頓運動定律)時間14年前 (2011/10/21 13:13), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串2/2 (看更多)
※ 引述《SweepingMonk ((((((((((()))))))))))》之銘言: : 最近在 trace 一個 bootloader (x-loader)的 source code : 原以為在沒有 OS 的環境下就不能呼叫 standard C library : 但是 source code 裡面還是有不少檔案有 include standard C library 像是 : #include <stdio.h> : #include <errno.h> : #include <stdlib.h> : #include <string.h> : 另外還有 include 到 linux 的 header files : #include <malloc.h> : #include <linux/types.h> : #include <sys/stat.h> : #include <fcntl.h> : 這跟我想像的差很多...是我的觀念有問題嗎? : 還是只要 static link 成一個不依賴外部 library 的程式,一樣可以在沒有 OS 的環境 : 下面執行? : 請幫小的解惑 <(_._)> : 謝謝~ 我剛去看了下x-loader的code 你說有include這些glibc的是一個叫signGP.c吧 它不算是x-loader binary的一部分,只是一個工具用來轉成x-load.bin.ift的 所以沒問題阿 還有include那些linux header你去看他的inculde它都有 define所以include也沒問題的 你把它包成static沒有OS中的loader你也沒辦法執行的 所以不是你講的那樣 -- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 60.250.164.201

10/22 03:34, , 1F
可以參考一下 ap or kernel bin & bl 的memory map...
10/22 03:34, 1F

10/24 10:24, , 2F
謝謝!
10/24 10:24, 2F
文章代碼(AID): #1EeFzmdq (LinuxDev)
文章代碼(AID): #1EeFzmdq (LinuxDev)