Archive for April, 2014

Compiling u-boot for AMCC Ocotea PPC440GX board

I downloaded the powerpc cross-compiler from:

http://newos.org/toolchains/powerpc-elf-4.8.1-Linux-x86_64.tar.xz

as redirected from here:

http://wiki.osdev.org/GCC_Cross-Compiler

and uboot is from:

ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2

Compile for ocotea_config (make ocotea config) after setting ARCH and CROSS_COMPILE environment variable, got a lot of errors:

arch/powerpc/cpu/ppc4xx/built-in.o: In function `spd_read':^M
/home/tthtlc/Downloads/ocotea/u-boot-2014.04/arch/powerpc/cpu/ppc4xx/44x_spd_ddr.c:268: undefined reference to `_restgpr_31_x'^M
arch/powerpc/cpu/ppc4xx/built-in.o: In function `program_tr1':^M
/home/tthtlc/Downloads/ocotea/u-boot-2014.04/arch/powerpc/cpu/ppc4xx/44x_spd_ddr.c:1033: undefined reference to `_restgpr_14_x'^M
arch/powerpc/cpu/ppc4xx/built-in.o: In function `spd_sdram':^M
/home/tthtlc/Downloads/ocotea/u-boot-2014.04/arch/powerpc/cpu/ppc4xx/44x_spd_ddr.c:246: undefined reference to `_restgpr_17_x'^M
arch/powerpc/cpu/ppc4xx/built-in.o: In function `__pci_pre_init':^M
/home/tthtlc/Downloads/ocotea/u-boot-2014.04/arch/powerpc/cpu/ppc4xx/4xx_pci.c:658: undefined reference to `_restgpr_30_x'^M
arch/powerpc/cpu/ppc4xx/built-in.o: In function `pci_init_board':^M
/home/tthtlc/Downloads/ocotea/u-boot-2014.04/arch/powerpc/cpu/ppc4xx/4xx_pci.c:850: undefined reference to `_restgpr_30_x'^M
arch/powerpc/cpu/ppc4xx/built-in.o: In function `checkcpu':^M
/home/tthtlc/Downloads/ocotea/u-boot-2014.04/arch/powerpc/cpu/ppc4xx/cpu.c:647: undefined reference to `_restgpr_28_x'^M

Nonetheless, downloading another cross-compiler from http://ftp.denx.de/pub/eldk/5.3/targets/powerpc/:

http://ftp.denx.de/pub/eldk/5.3/targets/powerpc/eldk-eglibc-i686-powerpc-toolchain-gmae-5.3.sh

and after executing it, the cross compiler is installed in /opt/eldk-5.3/powerpc/ directory.

export ARCH=powerpc
export CROSS_COMPILE=/opt/eldk-5.3/powerpc/sysroots/i686-eldk-linux/usr/bin/powerpc-linux/powerpc-linux-
make ocotea_config
make

The u-boot binaries is successfully produced.

Making the tools – "make tools":

CHK include/config/uboot.release
CHK include/generated/version_autogenerated.h
CHK include/generated/timestamp_autogenerated.h
UPD include/generated/timestamp_autogenerated.h
HOSTCC tools/dumpimage.o
HOSTCC tools/image-host.o
HOSTCC tools/mkenvimage.o
HOSTCC tools/mkimage.o
HOSTLD tools/envcrc
HOSTLD tools/mkenvimage
HOSTLD tools/dumpimage
HOSTLD tools/mkimage

And then compiling for the examples "make examples":

CHK include/config/uboot.release
CHK include/generated/version_autogenerated.h
CHK include/generated/timestamp_autogenerated.h
UPD include/generated/timestamp_autogenerated.h
HOSTCC tools/dumpimage.o
HOSTCC tools/image-host.o
HOSTCC tools/mkenvimage.o
HOSTCC tools/mkimage.o
HOSTLD tools/envcrc
HOSTLD tools/mkenvimage
HOSTLD tools/dumpimage
HOSTLD tools/mkimage
AS arch/powerpc/cpu/ppc4xx/kgdb.o
LD arch/powerpc/cpu/ppc4xx/built-in.o
AS arch/powerpc/cpu/ppc4xx/start.o
CC arch/powerpc/lib/board.o
LD arch/powerpc/lib/built-in.o
CC common/main.o
CC common/cmd_version.o
LD common/built-in.o
CC lib/display_options.o
LD lib/built-in.o
AS examples/standalone/ppc_longjmp.o
AS examples/standalone/ppc_setjmp.o
CC examples/standalone/stubs.o
LD examples/standalone/libstubs.o
CC examples/standalone/hello_world.o
LD examples/standalone/hello_world
CC examples/standalone/sched.o
LD examples/standalone/sched
OBJCOPY examples/standalone/hello_world.srec
OBJCOPY examples/standalone/sched.srec
OBJCOPY examples/standalone/hello_world.bin
OBJCOPY examples/standalone/sched.bin

Finally to flash the uboot to the Ocotea board, which comes default with PIBS bootloader, flash uboot using PIBS bootloader as instructed in:

https://casper.berkeley.edu/svn/trunk/roach/sw/uboot/doc/README.ocotea-PIBS-to-U-Boot

After turning the board off and switching SW1 (U46) to on (= closed) (as instructed in above article), and turning on the power of the board again you should see the following message:


U-Boot 1.1.3 (Apr 5 2005 - 22:59:57)

AMCC PowerPC 440 GX Rev. C
Board: AMCC 440GX Evaluation Board
VCO: 1066 MHz
CPU: 533 MHz
PLB: 152 MHz
OPB: 76 MHz
EPB: 76 MHz
I2C: ready
DRAM: 256 MB
FLASH: 5 MB
PCI: Bus Dev VenId DevId Class Int
In: serial
Out: serial
Err: serial
KGDB: kgdb ready
ready
Net: ppc_440x_eth0, ppc_440x_eth1, ppc_440x_eth2, ppc_440x_eth3
BEDBUG:ready
=>

Next is to get linux kernel porting done.

Checking out the linux kernel 2.6.25 (which does have ocotea.c implemented inside the source code, having been deprecated in the current 3.14 version):

export ARCH=ppc
export CROSS_COMPILE=/opt/eldk-5.3/powerpc/sysroots/i686-eldk-linux/usr/bin/powerpc-linux/powerpc-linux-
make ocotea_defconfig
make V=1
make V=1 uImage

And the following is the partial compiled output:

/bin/bash /home/tthtlc/Downloads/ocotea/kernel2625/scripts/mksysmap .tmp_System.map
cmp -s System.map .tmp_System.map || (echo Inconsistent kallsyms data; echo Try setting CONFIG_KALLSYMS_EXTRA_PASS; rm .tmp_kallsyms* ; /bin/false )
rm -f .old_version
make -f scripts/Makefile.build obj=arch/ppc/boot/images arch/ppc/boot/images/uImage
/opt/eldk-5.3/powerpc/sysroots/i686-eldk-linux/usr/bin/powerpc-linux/powerpc-linux-objcopy -O binary vmlinux arch/ppc/boot/images/vmlinux.bin
gzip -f -9 arch/ppc/boot/images/vmlinux.gz.$$ && mv arch/ppc/boot/images/vmlinux.gz.$$ arch/ppc/boot/images/vmlinux.gz
rm -f arch/ppc/boot/images/uImage
/bin/bash /home/tthtlc/Downloads/ocotea/kernel2625/scripts/mkuboot.sh -A ppc -O linux -T kernel -C gzip -a 00000000 -e 00000000 -n 'Linux-2.6.25' -d arch/ppc/boot/images/vmlinux.gz arch/ppc/boot/images/uImage
Image Name: Linux-2.6.25
Created: Fri Apr 18 23:25:48 2014
Image Type: PowerPC Linux Kernel Image (gzip compressed)
Data Size: 1118419 Bytes = 1092.21 kB = 1.07 MB
Load Address: 00000000
Entry Point: 00000000
Image: arch/ppc/boot/images/uImage is ready

Learning kprobes internals

First some theory:

http://phrack.org/issues/67/6.html

http://www-users.cs.umn.edu/~boutcher/kprobes/kprobes.txt.html

https://doc.opensuse.org/documentation/html/openSUSE_121/opensuse-tuning/cha.tuning.kprobes.html

http://www.ibm.com/developerworks/library/l-kprobes/index.html

Kprobes tutorial at OLS2006 (with examples):

http://www-users.cs.umn.edu/~boutcher/kprobes/

Lots of pictorial rendering of kprobes:

http://home.eng.iastate.edu/~kothari/LinuxResults/results-2.6.31/globals/kprobe_mutex/index.html

And finally some examples:

http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/samples/kprobes/kprobe_example.c

And here is reverse engineering via kprobes in Android:

http://recon.cx/2013/slides/Recon2013-Joshua%20J.%20Drake-Reversing%20and%20Auditing%20Android’s%20Proprietary%20Bits-public.pdf

Vickblöm

Research scattered with thoughts, ideas, and dreams

Penetration Testing Lab

Offensive Techniques & Methodologies

Astr0baby's not so random thoughts _____ rand() % 100;

@astr0baby on Twitter for fresh randomness

The Data Explorer

playing around with open data to learn some cool stuff about data analysis and the world

Conorsblog

Data | ML | NLP | Python | R

quyv

Just a thought

IFT6266 - H2017 Deep Learning

A Graduate Course Offered at Université de Montréal

Deep Learning IFT6266-H2017 UdeM

Philippe Paradis - My solutions to the image inpainting problem

IFT6266 – H2017 DEEP LEARNING

Pulkit's thoughts on the course project

Thomas Dinsmore's Blog

No man but a blockhead ever wrote except for money -- Samuel Johnson

the morning paper

a random walk through Computer Science research, by Adrian Colyer

The Spectator

Shakir's Machine Learning Blog