[問題] bootloader 不需要 OS 也能用 C header?
看板C_and_CPP作者SweepingMonk ((((((((((()))))))))))時間14年前 (2011/10/21 10:31)推噓0(0推 0噓 11→)留言11則, 4人參與討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Linux
問題(Question):
最近在 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 的環境下面執行?
請幫小的解惑 <(_._)>
謝謝~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.130.78.82
→
10/21 10:47, , 1F
10/21 10:47, 1F
→
10/21 10:48, , 2F
10/21 10:48, 2F
→
10/21 10:59, , 3F
10/21 10:59, 3F
→
10/21 11:01, , 4F
10/21 11:01, 4F
→
10/21 11:02, , 5F
10/21 11:02, 5F
→
10/21 11:03, , 6F
10/21 11:03, 6F
→
10/21 11:03, , 7F
10/21 11:03, 7F
→
10/21 11:03, , 8F
10/21 11:03, 8F
→
10/21 11:04, , 9F
10/21 11:04, 9F
→
10/21 11:04, , 10F
10/21 11:04, 10F
→
10/22 01:38, , 11F
10/22 01:38, 11F