忍者ブログ
趣味+メモ用のブログです。 GNU/Linux関連、OSS関連情報、調査事項になるでしょうが、何を書くか分かりません。
[99] [98] [97] [96] [95] [94] [93] [92] [91] [90] [89]
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

クロス環境のセットアップが終わったので、Linux/busyboxを動作させてみた。

参考サイト:https://gist.github.com/poutyface/1223553
QEMU: 仮想ボード ARM Cortex-A9 マルチコアで Linux を動かす)


■qemuのインストール

apt-getで環境をインストール。
$ sudo apt-get install qemu qemu-system

armでサポートしているボードを確認。
$  qemu-system-arm -M \?
Supported machines are:
collie               Collie PDA (SA-1110)
nuri                 Samsung NURI board (Exynos4210)
smdkc210             Samsung SMDKC210 board (Exynos4210)
connex               Gumstix Connex (PXA255)
verdex               Gumstix Verdex (PXA270)
highbank             Calxeda Highbank (ECX-1000)
integratorcp         ARM Integrator/CP (ARM926EJ-S) (default)
mainstone            Mainstone II (PXA27x)
musicpal             Marvell 88w8618 / MusicPal (ARM926EJ-S)
n800                 Nokia N800 tablet aka. RX-34 (OMAP2420)
n810                 Nokia N810 tablet aka. RX-44 (OMAP2420)
sx1                  Siemens SX1 (OMAP310) V2
sx1-v1               Siemens SX1 (OMAP310) V1
cheetah              Palm Tungsten|E aka. Cheetah PDA (OMAP310)
realview-eb          ARM RealView Emulation Baseboard (ARM926EJ-S)
realview-eb-mpcore   ARM RealView Emulation Baseboard (ARM11MPCore)
realview-pb-a8       ARM RealView Platform Baseboard for Cortex-A8
realview-pbx-a9      ARM RealView Platform Baseboard Explore for Cortex-A9
akita                Akita PDA (PXA270)
spitz                Spitz PDA (PXA270)
borzoi               Borzoi PDA (PXA270)
terrier              Terrier PDA (PXA270)
lm3s811evb           Stellaris LM3S811EVB
lm3s6965evb          Stellaris LM3S6965EVB
tosa                 Tosa PDA (PXA255)
versatilepb          ARM Versatile/PB (ARM926EJ-S)
versatileab          ARM Versatile/AB (ARM926EJ-S)
vexpress-a9          ARM Versatile Express for Cortex-A9
vexpress-a15         ARM Versatile Express for Cortex-A15
xilinx-zynq-a9       Xilinx Zynq Platform Baseboard for Cortex-A9
z2                   Zipit Z2 (PXA27x)

■ ダウンロードしたLinux、Busybox

Linux カーネル linux-3.19
Busybox busybox-1.23.1

■ Linuxカーネルのコンパイル

Linuxカーネルを展開してデフォルト設定。
$ tar -xvf linux-3.19.tar.xz
$ cd linux-3.19
$ export ARCH=arm
$ export CROSS_COMPILE=arm-linux-gnueabi-
$ make realview_smp-defconfig
realview-pbx-a9 用のデフォルト設定にするため、「realview_smp-defconfig」を指定。
デフォルト設定は「arch/arm/configs/」にある。

make menuconfigして、カーネルの設定を行う。
$ export ARCH=arm
$ export CROSS_COMPILE=arm-linux-gnueabi-
$ make menuconfig
以下の設定を行った。
・Physical address of main memory -> 0x00000000
 CONFIG_PHYS_OFFSET:
 Symbol: PHYS_OFFSET [=0x00000000] 
 Type  : hex
 Prompt: Physical address of main memory

・Enable loadable module support -> n
 CONFIG_MODULES:
 Symbol: MODULES [=n]
 Type  : boolean
 Prompt: Enable loadable module support 

・Support ARM V6 processor -> n
 Symbol: CPU_V6 [=n]
 Type  : boolean
 Prompt: Support ARM V6 processor
 Location:
  -> System Type

・ARM system type -> ARM Ltd. RealView family
 Prompt: ARM system type
 Location:
  -> System Type         

・Support RealView(R) Emulation Baseboar -> y
 CONFIG_MACH_REALVIEW_EB:
 Symbol: MACH_REALVIEW_EB [=y]
 Type  : boolean
 Prompt: Support RealView(R) Emulation Baseboard
 Location:
  -> System Type
   -> RealView platform type 

・Support Multicore Cortex-A9 Tile -> y
 CONFIG_REALVIEW_EB_A9MP:
 Symbol: REALVIEW_EB_A9MP [=y] 
 Type  : boolean
 Prompt: Support Multicore Cortex-A9 Tile
 Location:
 -> System Type
  -> RealView platform type
   -> Support RealView(R) Emulation Baseboard (MACH_REALVIEW_EB [=y]) 

・Support RealView(R) Platform Baseboard Explore -> y
 CONFIG_MACH_REALVIEW_PBX:
 Symbol: MACH_REALVIEW_PBX [=y]
 Type  : boolean
 Prompt: Support RealView(R) Platform Baseboard Explore
 Location:
  -> System Type
   -> RealView platform type 

・High physical base address for the RealView platform -> n
 CONFIG_REALVIEW_HIGH_PHYS_OFFSET:
 Symbol: REALVIEW_HIGH_PHYS_OFFSET [=n]
 Type  : boolean
 Prompt: High physical base address for the RealView platform
 Location:
  -> System Type
   -> RealView platform type 

・Initial RAM filesystem and RAM disk (initramfs/initrd) support -> y
 Symbol: BLK_DEV_INITRD [=y]
 Type  : boolean
 Prompt: Initial RAM filesystem and RAM disk (initramfs/initrd) support 
 Location:
  -> General setup

・Use the ARM EABI to compile the kernel -> y
 Symbol: AEABI [=y]
 Type  : boolean
 Prompt: Use the ARM EABI to compile the kernel
 Location:
  -> Kernel Features   
※ PHYS_OFFSETは0x00000000に設定しないとkernelが起動しません・・・
※ BLK_DEV_INITRD は明示的に =yを設定する必要がありました。

続けて、カーネルコンパイル。
$ export ARCH=arm
$ export CROSS_COMPILE=arm-linux-gnueabi-
$ make realview_smp-defconfig

■ busyboxのコンパイル

$ tar -xvf busybox-1.23.1.tar.bz2
$ cd busybox-1.23.1
$ export ARCH=arm
$ export CROSS_COMPILE=arm-linux-gnueabi-
$ make defconfig
$ make menuconfig
デフォルトのままだと、staticコンパイルしてくれない・・
・Build BusyBox as a static binary (no shared libs) -> y
 CONFIG_STATIC:
 Symbol: STATIC [=y]
 Prompt: Build BusyBox as a static binary (no shared libs)
 Location:
  -> Busybox Settings
   -> Build Options
こんぱいるする。
$ make install
コンパイル結果は、_installに格納される。

■ initrdイメージの作成

以下のコマンドで作成。
$ cd _install
$ find . | cpio -o --format=newc > ../rootfs.img
$ cd ../../

■ qemuの実行

Linuxカーネルを起動する。 $ cd ../ $ linux-3.19 $ qemu-system-arm \ -M realview-pbx-a9 \ -m 128M \ -kernel ./arch/arm/boot/zImage \ -nographic \ -initrd ../busybox-1.23.1/rootfs.img \ -smp 2 \ -append "root=/dev/null rdinit=/bin/sh console=ttyAMA0 mem=128M"

実行結果

Uncompressing Linux... done, booting the kernel.
l2x0_priv_write: Bad offset 900
l2x0_priv_write: Bad offset 904
l2x0_priv_write: Bad offset 908
l2x0_priv_write: Bad offset 90c
l2x0_priv_write: Bad offset 910
l2x0_priv_write: Bad offset 914
l2x0_priv_write: Bad offset 918
l2x0_priv_write: Bad offset 91c
l2x0_priv_write: Bad offset 920
l2x0_priv_write: Bad offset 924
l2x0_priv_write: Bad offset 928
l2x0_priv_write: Bad offset 92c
l2x0_priv_write: Bad offset 930
l2x0_priv_write: Bad offset 934
l2x0_priv_write: Bad offset 938
l2x0_priv_write: Bad offset 93c
Booting Linux on physical CPU 0x0
Linux version 3.19.0 (sakaihdt@debian-r6) (gcc version 4.7.2 (Debian 4.7.2-5) ) #3 SMP Sun Feb 15 10:35:15 JST 2015
CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: ARM-RealView PBX
Ignoring unrecognised tag 0x00000000
Memory policy: Data cache writeback
CPU: All CPU(s) started in SVC mode.
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956969942ns
PERCPU: Embedded 7 pages/cpu @c7ddc000 s5952 r0 d22720 u32768
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
Kernel command line: root=/dev/null rdinit=/bin/sh console=ttyAMA0 mem=128M
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 123460K/131072K available (3212K kernel code, 188K rwdata, 604K rodata, 172K init, 125K bss, 7612K reserved, 0K cma-reserved)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)
    lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
      .text : 0xc0008000 - 0xc03c2570   (3818 kB)
      .init : 0xc03c3000 - 0xc03ee000   ( 172 kB)
      .data : 0xc03ee000 - 0xc041d0c0   ( 189 kB)
       .bss : 0xc041d0c0 - 0xc043c724   ( 126 kB)
Hierarchical RCU implementation.
        RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=1.
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
NR_IRQS:160
smp_twd: clock not found -2
Console: colour dummy device 80x30
Calibrating local timer... 99.86MHz.
Calibrating delay loop... 66.76 BogoMIPS (lpj=333824)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x30cb18 - 0x30cb88
Brought up 1 CPUs
SMP: Total of 1 processors activated (66.76 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 0
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
L2C: DT/platform modifies aux control register: 0x02020000 -> 0x02520000
L2C: DT/platform tries to modify or specify cache size
L2C-310 enabling early BRESP for Cortex-A9
L2C-310 full line of zeros enabled for Cortex-A9
L2C-310 dynamic clock gating disabled, standby mode disabled
L2C-310 cache controller enabled, 8 ways, 128 kB
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x46520001
Serial: AMBA PL011 UART driver
dev:uart0: ttyAMA0 at MMIO 0x10009000 (irq = 44, base_baud = 0) is a PL011 rev1
console [ttyAMA0] enabled
dev:uart1: ttyAMA1 at MMIO 0x1000a000 (irq = 45, base_baud = 0) is a PL011 rev1
dev:uart2: ttyAMA2 at MMIO 0x1000b000 (irq = 46, base_baud = 0) is a PL011 rev1
fpga:uart3: ttyAMA3 at MMIO 0x1000c000 (irq = 47, base_baud = 0) is a PL011 rev1
Advanced Linux Sound Architecture Driver Initialized.
Switched to clocksource timer3
NET: Registered protocol family 2
TCP established hash table entries: 1024 (order: 0, 4096 bytes)
TCP bind hash table entries: 1024 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP: reno registered
UDP hash table entries: 256 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Unpacking initramfs...
Freeing initrd memory: 2032K (c0d00000 - c0efc000)
futex hash table entries: 256 (order: 2, 16384 bytes)
io scheduler noop registered
io scheduler deadline registered (default)
pl061_gpio dev:gpio0: invalid IRQ base in pdata
pl061_gpio dev:gpio1: invalid IRQ base in pdata
pl061_gpio dev:gpio2: invalid IRQ base in pdata
clcd-pl11x issp:clcd: PL111 rev2 at 0x10020000
clcd-pl11x issp:clcd: RealView hardware, XVGA display
Console: switching to colour frame buffer device 128x48
physmap platform flash device: 04000000 at 40000000
physmap-flash physmap-flash.0: map_probe failed
mousedev: PS/2 mouse device common for all mice
rtc-ds1307 0-0068: rtc core: registered ds1338 as rtc0
rtc-ds1307 0-0068: 56 bytes nvram
rtc-pl031 dev:rtc: rtc core: registered pl031 as rtc1
Driver 'mmcblk' needs updating - please use bus_type methods
mmci-pl18x fpga:mmc0: No vmmc regulator found
mmci-pl18x fpga:mmc0: No vqmmc regulator found
amba fpga:mmc0: Driver mmci-pl18x requests probe deferral
ledtrig-cpu: registered to indicate activity on CPUs
input: AT Raw Set 2 keyboard as /devices/fpga:kmi0/serio0/input/input0
aaci-pl041 fpga:aaci: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 51
aaci-pl041 fpga:aaci: FIFO 512 entries
TCP: cubic registered
NET: Registered protocol family 17
Registering SWP/SWPB emulation handler
mmci-pl18x fpga:mmc0: No vmmc regulator found
mmci-pl18x fpga:mmc0: No vqmmc regulator found
amba fpga:mmc0: Driver mmci-pl18x requests probe deferral
rtc-ds1307 0-0068: setting system clock to 2015-02-15 05:31:26 UTC (1423978286)
ALSA device list:
  #0: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 51
Freeing unused kernel memory: 172K (c03c3000 - c03ee000)
/bin/sh: can't access tty; job control turned off
/ # input: ImExPS/2 Generic Explorer Mouse as /devices/fpga:kmi1/serio1/input/input2
mmci-pl18x fpga:mmc0: No vmmc regulator found
mmci-pl18x fpga:mmc0: No vqmmc regulator found
amba fpga:mmc0: Driver mmci-pl18x requests probe deferral
/ #
/ # ls
bin      dev      linuxrc  root     sbin     usr

以上。
PR


忍者ブログ [PR]
カレンダー
04 2024/05 06
S M T W T F S
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
フリーエリア
最新コメント
最新トラックバック
プロフィール
HN:
一乗寺 又兵衛
性別:
男性
職業:
コンパイル
趣味:
コンパイル
バーコード
ブログ内検索