Pro praci na jednom embedded projektu jsem potreboval mit Linux na PowerPC, na nejake embedded platforme co nejvice podobne MPC55x. Prvni po ruce byl Cisco router, napr. rady 800/1700/SB100 bezi prave na MPC860 - ten obsahuje MMU a teoreticky na nem muze bezet Linux.
Tedy muze bezet i prakticky: udelal jsem jednoduchy hack, ktery se sestaval z "doprogramovani" platformy mpc860 nedodelaneho projektu CILO, upravy kernelu 2.6 pro danou platformu a kompilace buildrootu. Linux minimalne na Ciscu SB101 nabootuje (ochutnavka viz nize), byt v nem napr. jeste nefunguje ethernet phy.
Vzhledem k tomu, ze hardware routeru je velmi ruzny, nema smysl publikovat tento hack, ovsem pokud by se na mem stole sesla hromadka ruznych Cisco routeru, mohu z tohoto udelat publikovatelny projekt sestavajici se z prislusnych loaderu a zkompilovanych kernelu + rootfs. Pokud by tedy nekdo z ctenaru Rootu byl ochoten prispet tim, ze venuje nejake jiz nepouzivane cisco a soucasne se mi tech zarizeni sejde rozumny pocet (napric spektrem routeru), sestavim prislusne komponenty a dam je ke stazeni. Napsat mi muzete na martin (at) hinner (dot) info
Mimochodem, i v Catalystech je PowerPC, i kdyz "dospelejsi". Tady by asi taky slo neco delat, ovsem je otazka jak snadne to bude.
Nyni ukazka jak to bootuje na konzoli (cisco romon -> cilo -> kernel arch/powerpc/boot -> vmlinux -> buildroot(busybox) ). Linux je kupodivu velmi rychly (jestli jsem neco nezvoral, tak to Cisco je taktovane 50MHz, ale odezva je urcite lepsi nez by clovek cekal a treba s obdobne taktovanym x86 nebo m68k se to neda srovnat).
System Bootstrap, Version 12.2(11r)YV5, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 2006 by cisco Systems, Inc.
SB series (Board ID: 28-157) platform with 65536 Kbytes of main memory
rommon 1 > tftpdnld -r
IP_ADDRESS: 192.168.1.240
IP_SUBNET_MASK: 255.255.255.0
DEFAULT_GATEWAY: 192.168.1.254
TFTP_SERVER: 192.168.1.250
TFTP_FILE: ciscoload.bin
Receiving ciscoload.bin from 192.168.1.250 !!!!!!!!!!!
File reception completed.
program load complete, entry point: 0x8300d084, size: 0x5ace
CILO
Available RAM: 32768 kB
MSR=0x00001002.
Available files:
sb101-k9oy6-mz.124-10a.bin
cilo-sb101.bin
uImage
Enter filename to boot:
> uImageBooting uImage.
Loading [ load 0x00800000/3736540 bss 0x00b903dc/51780 ] - total 3788320 bytes.
ELF loading complete, entry point = 0x008001ac, size: 3788320
Kicking into Linux.
tbdf/addr = 0xff003bf8
Memory <- <0x0 0x4000000> (64MB)
ENET0: local-mac-address <- de:ad:fa:ce:01:00
ENET1: local-mac-address <- de:ad:fa:ce:02:00
CPU clock-frequency <- 0x2faf080 (50MHz)
CPU timebase-frequency <- 0x2faf08 (3MHz)
CPU bus-frequency <- 0x2faf080 (50MHz)
zImage starting: loaded at 0x00800000 (sp: 0x81fffd90)
Allocating 0x480229 bytes for kernel ...
gunzipping (0x00000000 <- 0x0080d000:0x00b903dc)...done 0x372e60 bytes
Linux/PowerPC load: console=ttyCPM0 verbose
Finalizing device tree... flat tree at 0xb9d300
cisdbg test .. before kernel launch
vmlinux.addr = 0x0
iid mach(): done
MMU:enter
MMU:hw init
MMU:mapin
MMU:setio
MMU:exitnin start_kernel
Using Freescale MPC8xx machine description
Linux version 2.6.39 (mhi@mhi-eee) (gcc version 4.4.1 (GCC) ) #44 Sun Aug 25 14:48:17 CEST 2013
bootconsole [udbg0] enabled
setup_arch: bootmem
test1
mpc885ads_setup_arch 1
mpc885ads_setup_arch 2
mpc885ads_setup_arch 3
mpc885ads_setup_arch 4
mpc885ads_setup_arch 5
arch: exit
Top of RAM: 0x4000000, Total RAM: 0x4000000
Memory hole size: 0MB
Zone PFN ranges:
DMA 0x00000000 -> 0x00004000
Normal empty
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
0: 0x00000000 -> 0x00004000
On node 0 totalpages: 16384
free_area_init_node: node 0, pgdat c036d4b0, node_mem_map c0483000
DMA zone: 128 pages used for memmap
DMA zone: 0 pages reserved
DMA zone: 16256 pages, LIFO batch:3
MMU: Allocated 72 bytes of context maps for 16 contexts
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: console=ttyCPM0 verbose
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 60220k/65536k available (3412k kernel code, 5316k reserved, 120k data, 1076k bss, 1368k init)
Kernel virtual memory layout:
* 0xfffdf000..0xfffff000 : fixmap
* 0xfde00000..0xfe000000 : consistent mem
* 0xfddf8000..0xfde00000 : early ioremap
* 0xc5000000..0xfddf8000 : vmalloc & ioremap
SLUB: Genslabs=14, HWalign=16, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:512
irq: irq 5 on host /soc@ff000000/interrupt-controller@0 mapped to virtual irq 16
irq: irq 0 on host /soc@ff000000/cpm@9c0/interrupt-controller@930 mapped to virtual irq 17
Decrementer Frequency = 0x2faf08
irq: irq 15 on host /soc@ff000000/interrupt-controller@0 mapped to virtual irq 18
time_init: decrementer frequency = 3.125000 MHz
time_init: processor frequency = 50.000000 MHz
clocksource: timebase mult[50000000] shift[22] registered
clockevent: decrementer mult[cccccc] shift[32] cpu[0]
irq: irq 4 on host /soc@ff000000/cpm@9c0/interrupt-controller@930 mapped to virtual irq 19
console [ttyCPM0] enabled, bootconsole disabled
pid_max: default: 4096 minimum: 301
Mount-cache hash table entries: 512
NET: Registered protocol family 16
Registering qe_ic with sysfs...
bio: create slab <bio-0> at 0
Switching to clocksource timebase
Switched to NOHz mode on CPU #0
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
irq: irq 3 on host /soc@ff000000/interrupt-controller@0 mapped to virtual irq 20
irq: irq 0 on host /soc@ff000000/interrupt-controller@0 mapped to virtual irq 21
irq: irq 30 on host /soc@ff000000/cpm@9c0/interrupt-controller@930 mapped to virtual irq 30
msgmni has been set to 119
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
ff000a80.serial: ttyCPM0 at MMIO 0xc5010a80 (irq = 19) is a CPM UART
loop: module loaded
fs_enet ff000e00.ethernet: eth0: Features changed: 0x00004800 -> 0x00004000
eth0: fs_enet: de:ad:fa:ce:02:00
fs_enet ff000a00.ethernet: eth1: Features changed: 0x00004800 -> 0x00004000
eth1: fs_enet: de:ad:fa:ce:01:00
FEC MII Bus: probed
mdio_bus ff000e00: error probing PHY at address 1
mdio_bus ff000e00: error probing PHY at address 2
mousedev: PS/2 mouse device common for all mice
TCP cubic registered
NET: Registered protocol family 17
Freeing unused kernel memory: 1368k init
[ .... smazan syslog ]
Welcome to cisco
buildroot login: root
Jan 1 05:06:46 buildroot auth.info login[40]: root login on 'ttyCPM0'
-sh: id: not found
sh: bad number
-sh: id: not found
$ uname -a
Linux buildroot 2.6.39 #44 Sun Aug 25 14:48:17 CEST 2013 ppc GNU/Linux
$ busybox free
total used free shared buffers
Mem: 62608 3228 59380 0 0
-/+ buffers: 3228 59380
Swap: 0 0 0