2011-07-01 5 views
1

ROMサイズを取得するために使用できるC/C++ライブラリまたはLinuxシステムコマンドはありますか? 起動時に、カーネルは適切なサイズをMbで表示します。私はちょうど私が組み込みシステム上jff2 ROMファイルシステムを使用してところでCでLinuxのFlash ROMのサイズを取得するには?

、イムを-Naze

感謝からそれを引き出すことができる場所を見つけることができないようです。 ARM7 CPU。

+0

私はあなたが何を求めているのか分かりませんが、これらのコマンドを試してみてください: 'dmesg'、' df' –

答えて

2

それはMTDデバイスとして表示された場合、あなたは以下の

cat /proc/mtd 
dev: size erasesize name 
mtd0: 00030000 00010000 "BootLoaders" 
mtd1: 00200000 00010000 "Kernel" 
mtd2: 00280000 00010000 "RootFS" 
mtd3: 00350000 00010000 "User" 

サイズを行うことができますが、個々のMTDの詳細については進

であり、あなたは/sys/class/mtd<n>ディレクトリにそれらを見つけるでしょう

+0

ええ、私はこれを使いました!ループされた[sscanf(行、 "mtd0:%x"、&ram0)]を押して値を取得します。ありがとう! –

1

dmidecodehere)は、BIOSのROMサイズなどの情報をダンプするシェルで実行できるプログラムです。私のマシン上では、この行います:私は、必要に応じて復号し、バイナリデータの束がある期待:

sophiel:/home/owner# dmidecode | more 
# dmidecode 2.9 
SMBIOS 2.3 present. 
59 structures occupying 1891 bytes. 
Table at 0x000F0450. 

Handle 0xDA00, DMI type 218, 35 bytes 
OEM-specific Type 
     Header and Data: 
       DA 23 00 DA B2 00 17 0B 0E 18 00 58 00 58 00 01 
       00 59 00 59 00 01 00 05 80 05 80 01 00 FF FF 00 
       00 00 00 

Handle 0xDA01, DMI type 218, 17 bytes 
OEM-specific Type 
     Header and Data: 
       DA 11 01 DA B2 00 17 0B 0E 18 00 FF FF 00 00 00 
       00 

Handle 0x0000, DMI type 0, 20 bytes 
BIOS Information 
     Vendor: Dell Computer Corporation 
     Version: A03 
     Release Date: 01/05/2006 
     Address: 0xF0000 
     Runtime Size: 64 kB 
     ROM Size: 512 kB 
     Characteristics: 
       PCI is supported 
       PNP is supported 
       APM is supported 
       BIOS is upgradeable 
       BIOS shadowing is allowed 
       ESCD support is available 
       Boot from CD is supported 
       Selectable boot is supported 
       EDD is supported 
       Japanese floppy for Toshiba 1.2 MB is supported (int 13h) 
       Print screen service is supported (int 5h) 
       8042 keyboard services are supported (int 9h) 
       Serial services are supported (int 14h) 
       Printer services are supported (int 17h) 
       ACPI is supported 
       USB legacy is supported 
       LS-120 boot is supported 
       BIOS boot specification is supported 
       Function key-initiated network boot is supported 

私はあなたがそれを掘ると、それがどのように動作するかを把握することができます賭けているように、オープンソースです。

+0

Linux PCでこれを試しましたが、動作しますが、組み込みシステムでは動作しません。しかし、アイデアをありがとう。 –

関連する問題