Intel Edison買いました
Intel Edison買いました。
最新のファームにアップデート。
ブートローダはu-boot。起動時に素早くキー入力を行うとu-bootプロンプトが表示され、コマンド入力を受け付ける。
u-bootがどのようにvmlinuzを実行しているのか、u-bootからprintを実行して重要そうなところを記録しておく。
zbootはbzImage形式のファイルを処理するもののようだ。bzImage形式は、http://wiki.bit-hive.com/linuxkernelmemo/pg/bzImageに書いてある情報を参考にすると、カーネルのbinaryイメージの前にbootsect.o, setup.oというのがくっついている形式らしい。
startup_32が0x100000にあるのかと思ったが、/proc/kallsymsを見ると0xc1200000にあるようだ。
最新のファームにアップデート。
root@edison:~# uname -a Linux edison 3.10.17-poky-edison+ #1 SMP PREEMPT Mon Sep 8 14:09:55 CEST 2014 i686 GNU/Linux内蔵MMCはこんな感じでマウントされてる。
root@edison:~# mount|grep mmcblk /dev/mmcblk0p8 on / type ext4 (rw,nodev,noatime,discard,noauto_da_alloc,data=ordered) /dev/mmcblk0p5 on /factory type ext4 (ro,nosuid,nodev,noatime,discard,noauto_da_alloc) /dev/mmcblk0p10 on /home type ext4 (rw,nosuid,nodev,noatime,discard,noauto_da_alloc,data=ordered)mmcblk0p7はマウントされていないが、ここからブートしているようだ。
root@edison:~# mount -t msdos /dev/mmcblk0p7 /mnt root@edison:~# mount | grep msdos /dev/mmcblk0p7 on /mnt type msdos (rw,relatime,fmask=0022,dmask=0022,codepage=437,errors=remount-ro) root@edison:~# ls /mnt ldlinux.c32 ldlinux.sys syslinux.cfg vmlinuz root@edison:~# df /mnt Filesystem 1K-blocks Used Available Use% Mounted on /dev/mmcblk0p7 5638 5182 456 92% /mntrootパーティションは10MB程度の空きがあるようだ。kernelを置くぐらいならできそうだ。
root@edison:/mnt# df -m / Filesystem 1M-blocks Used Available Use% Mounted on /dev/root 464 454 0 100% /Windowsからドライブとして見える領域がLinuxから簡単に参照できるのだろうか。
ブートローダはu-boot。起動時に素早くキー入力を行うとu-bootプロンプトが表示され、コマンド入力を受け付ける。
-Boot 2014.04 (Sep 08 2014 - 14:09:10)
Watchdog enabled
DRAM: 980.6 MiB
MMC: tangier_sdhci: 0
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
boot > help
? - alias for 'help'
askenv - get environment variables from stdin
base - print or set address offset
bdinfo - print Board Info structure
boot - boot default, i.e., run 'bootcmd'
bootd - boot default, i.e., run 'bootcmd'
bootelf - Boot from an ELF image in memory
bootm - boot application image from memory
bootvx - Boot vxWorks from an ELF image
cmp - memory compare
coninfo - print console devices and information
cp - memory copy
crc32 - checksum calculation
dcache - enable or disable data cache
dfu - Device Firmware Upgrade
echo - echo args to console
editenv - edit environment variable
env - environment handling commands
exit - exit script
ext4load- load binary file from a Ext4 filesystem
ext4ls - list files in a directory (default /)
ext4write- create a file in the root directory
false - do nothing, unsuccessfully
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls - list files in a directory (default /)
fatwrite- write file into a dos filesystem
gettime - get timer val elapsed,
go - start application at address 'addr'
gpt - GUID Partition Table
grepenv - search environment variables
hash - compute message digest
help - print command description/usage
icache - enable or disable instruction cache
in - read data from an IO port
ini - parse an ini file in memory and merge the specified section into the env
interrupts- enable or disable interrupts
irqinfo - print information about IRQs
itest - return true/false on integer compare
load - load binary file from a filesystem
loadb - load binary file over serial line (kermit mode)
loads - load S-Record file over serial line
loadx - load binary file over serial line (xmodem mode)
loady - load binary file over serial line (ymodem mode)
loop - infinite loop on address range
ls - list files in a directory (default /)
md - memory display
meminfo - display memory information
mm - memory modify (auto-incrementing address)
mmc - MMC sub system
mmcinfo - display MMC info
mw - memory write (fill)
nm - memory modify (constant address)
out - write datum to IO port
part - disk partition related commands
pci - list and access PCI Configuration Space
printenv- print environment variables
read - Load binary data from a partition
reginfo - print register information
reset - Perform RESET of the CPU
run - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv - set environment variables
setexpr - set environment variable as the result of eval expression
sha1sum - compute SHA1 message digest
showvar - print local hushshell variables
sleep - delay execution for some time
source - run script from memory
test - minimal test like /bin/sh
timer - access the system timer
true - do nothing, successfully
version - print monitor, compiler and linker version
zboot - Boot bzImage
シリアルコンソールはLinuxのdmesgからttyMFD2でアドレスは0xff010180、IRQは54の模様。root@edison:~# dmesg | grep ttyMFD2 [ 0.000000] Kernel command line: root=PARTUUID=012b3303-34ac-284d-99b4-34e03a2335f4 rootfstype=ext4 console=ttyMFD2 earlyprintk=ttyMFD2,keep loglevel=4 systemd.unit=multi-user.target hardware_id=00 g_multi.iSerialNumber=c6305d42cdcc9203bf0c6a2901a70a5a [ 0.727379] 0000:00:04.3: ttyMFD2 at MMIO 0xff010180 (irq = 54) is a hsu_debug_port_p [ 0.734998] console [ttyMFD2] enabled [ 2.368030] systemd[1]: Expecting device dev-ttyMFD2.device...u-bootからシリアルコンソールとおぼしきアドレスに直接書き込んでみる。40を書き込んでいるが、これはアットマークのASCIIコード。
boot > mm.b 0xff010180 ff010180: 00 ? 40 @ff010181: 02 ? .ちゃんとアットマークが表示された。
u-bootがどのようにvmlinuzを実行しているのか、u-bootからprintを実行して重要そうなところを記録しておく。
boot_target_cmd=run do_flash_os;run do_probe_dfu;run do_compute_target;run mmc-bootargs;run load_kernel;zboot ${loadaddr}
load_kernel=fatload mmc 0:7 ${loadaddr} vmlinuz
loadaddr=0x100000
MMCのパーティション7から0x100000にvmlinuzをロードし、zboot 0x100000しているようだ。zbootはbzImage形式のファイルを処理するもののようだ。bzImage形式は、http://wiki.bit-hive.com/linuxkernelmemo/pg/bzImageに書いてある情報を参考にすると、カーネルのbinaryイメージの前にbootsect.o, setup.oというのがくっついている形式らしい。
startup_32が0x100000にあるのかと思ったが、/proc/kallsymsを見ると0xc1200000にあるようだ。
root@edison:/proc# head kallsyms c1200000 T startup_32 c1200000 T _text c12000b8 T start_cpu0 c12000c8 T _stext c12000d0 T do_one_initcall c1200230 t match_dev_by_uuid c1200260 T name_to_dev_t c12005d0 t init_linuxrc c1200670 t set_ti_thread_flag c1200680 T start_thread
コメント(0件)
- TB-URL http://www.tokuda.net/diary/adiary.cgi/0849/tb/