Here is the command that do flash erase and copy rootfs to mtdblock4.
# flash_eraseall -j /dev/mtd4
# dd if=rootfs.jffs2 of=/dev/mtd4 bs=4096
# mount -t jffs2 /dev/mtdblock4 /mnt/jffs2
# flash_eraseall -j /dev/mtd4
# dd if=rootfs.jffs2 of=/dev/mtd4 bs=4096
# mount -t jffs2 /dev/mtdblock4 /mnt/jffs2
mount -t jffs2 /dev/mtdblock4 /mnt/nand
mount /dev/mmcblk0p2 /mnt/mmc2
tar cf - -C /mnt/nand . | tar xvf - -C /mnt/mmc2/target
export CROSS_CC=/opt/CodeSourcery/arm-2007q3-51
export PATH=$CROSS_CC/bin:$PATH
export TGT="your target file system"
./configure --enable-cross-compile -cc=arm-none-linux-gnueabi-gcc \
--host-cc=gcc --target=arm-linux --prefix=$TGT \
--disable-network --disable-x11 --disable-gui \
--with-extralibdir=$TGT/lib \
--with-extraincdir=$TGT/include
#include < stdio.h >
#define PACKED __attribute__((packed))
typedef struct struct_Foo
{
char c;
int r;
long f;
} PACKED FOO;
typedef struct struct_Foo2
{
char c;
int r;
long f;
} FOO2;
int main(int argc, char* argv[])
{
printf ("Test arm...\n");
printf (" char : %2d\n", sizeof(char));
printf (" int : %2d\n", sizeof(int));
printf (" long : %2d\n", sizeof(long));
printf (" foo : %2d\n", sizeof(FOO));
printf (" foo2 : %2d\n", sizeof(FOO2));
}
# where is my tool chains for arm
BLD_NAME=greenphone
BLD_TOOL_VER = gcc-4.1.1-glibc-2.3.6
BLD_TARGET=arm-linux
BLD_PREFIX= /opt/toolchains/greenphone/$(BLD_TOOL_VER)
CROSS_COMPILE=$(BLD_PREFIX)/$(BLD_TARGET)/bin/$(BLD_TARGET)-
# tools... I am using
LD = $(CROSS_COMPILE)ld
CC = $(CROSS_COMPILE)gcc
CPP = $(CC) -E
CFLAGS = -x c
all:
$(CC) $(CFLAGS) -o test test.c
int : 4
long : 4
foo : 9
foo2 : 12
gdbserver localhost:3230 ./helloworld
arm-linux-gdb ./helloworld
target remote 10.10.10.20:3230
b main
c