Embedded/mini2440
- mini2440 supervivi를 이용한 nand fusing 2010.09.26
- vmware 리눅스 환경에서 tftp, nfs 구동하기 2010.08.23
- HOWTO: Compiling and Flashing U-Boot onto Mini2440 2010.08.16
- mini2440 2010.08.16
- Host PC 와 mini2440 nfs 연결 하기 2010.08.16
- 가상 단말기 및 교차개발환경 2010.08.15
mini2440 supervivi를 이용한 nand fusing
vmware 리눅스 환경에서 tftp, nfs 구동하기
정말 간단한거라 감히 여기다 써도 될지 모르겠지만, 전 인터넷에서 이런 정보를 못얻었었기 때문에 올려봅니다ㅋ
일단 전 노트북을 사용하고 있구요, 허브나 스위치는 쓰지 않습니다. 그리구 리눅스는 vmware내에서 구동하고 있구요
노트북은 무선랜을 이용해 인터넷을 하구요, 유선랜은 타겟보드와 연결을 합니다.
근데 유선랜을 연결하면 vmware들어가서 custom방식으로 유선랜을 선택해줘야 tftp나 nfs를 할수있더군요. 이렇게하면 근데 리눅스머신의 인터넷이 안됩니다.
그래서 생각한방법
1. vmware리눅스 머신의 전원을 끕니다.
2. edit로 들어가서 네트워크 어댑터를 하나더 추가합니다.
3. 하나는 NAT방식(vmnet8을 이용하여 호스트에 공유하여 쓰는), 또하나는 custom방식(vmware 네트웍 세팅에서 vmnet0을 만들고 여기다가는 유선랜카드를 설정해줍니다)으로 해줍니다.
4. 리눅스를 켜면, NAT방식의 랜카드가 DHCP로 알아서 ip를 잡는데요, custom방식으로 한거는 ifconfig eth<n> <ip주소> 명령으로 서버 ip를 만듭니다.
5. 타겟보드는 호스트ip로 설정합니다.
6. 이렇게 하면 리눅스 머신은 putty를 이용할수도 있고 인터넷도 할수있으며, 타겟보드와 바로 통신할수 있습니다. ping을 쳐보면 잘갑니다
7. nfs설정하고 마운트 해줍니다. 이건 검색해보면 많이나오네요
아, 참고로 노트북의 윈도우의 유선랜의 ip는 맨 마지막 자리를 다르게 해서 주면 타겟보드, vmware리눅스머신, 노트북의 윈도우 세개가 서로서로 핑을 주고받는걸 볼수있습니다. (물론 서버ip와 호스트ip설정할때도 같은대역대 사용하기~)
이 방법을 쓰면 컴퓨터 한대, 타겟보드 하나로 공유기나 허브같은거 필요없이 어디서나 마음껏인터넷을하며 서로간에 통신도 가능하네요.
정말 보잘것없는 팁이지만, 인터넷에서는 못찾았었어요ㅎㅎ
[출처] VMware 리눅스 환경에서 TFTP,NFS 구동하기|작성자 조화
HOWTO: Compiling and Flashing U-Boot onto Mini2440
The bootloader that comes factory installed on the Micro2440 and the Mini2440 board is called Supervivi. I don't personally like it. It has very limited support and requires a YAFFS filesystem for the root filesystem. So when I bought my board I began to immediately search out an alternative. The bootloader by choice, it seems, is a modified version of U-Boot with modifications for the Mini2440 board's hardware
The code is maintained by a guy named buserror. I'll provide his information at the end of this howto.
At the time of writing this, I had some issues with getting Buserror's U-Boot working correctly.
The code that is in his git repository, doesn't run from RAM without a modification to the source. So here are the instructions that I gathered for altering and compiling it, and getting it going on the Mini2440 and Micro2440 board.
For this to work, I'm going to assume that you have a crosscompiler set up. Later on, I will probably write an entry here about setting that up, but not now. I'm also assuming you have git installed.
Step 1: Get the source
mkdir uboot ; cd uboot
git clone git://repo.or.cz/u-boot-openmoko/mini2440.git
Step 2: Set your cross compiler prefix so you don't end up compiling this for x86.
export CROSS_COMPILE=arm-none-linux-gnueabi-
Step 3: Modify the source to disable CONFIG_USE_IRQ. Open include/configs/mini2440.h.
#define USE_920T_MMU
//#define CONFIG_USE_IRQ 1 /* Needed for USB device! */
Disabling this obviously disables the use of USB During boot. You can fix this by reflashing a normal copy of u-boot from within u-boot once this is up and running. In the above example, I commented it out but you can probably just change the 1 to a 0.
Step 4: Make and compile.
cd ../../
make mini2440_config
make
Assuming this all compiles correctly, you will have a u-boot.bin file in your directory now as well as a 2k and 16k block size bin file. Those two are for flashing inside of U-Boot. The normal .bin is for flashing from ram from within supervivi.
Step 5: Flashing u-boot to the mini2440. In this example, we'll be using DMW for Windows to transfer the binary over to the board with the supplied USB cable.
5a. Set boot switch to NOR.
5b. When supervivi pops up, hit q for supervivi shell.
5c. Load the image in to ram at 0x32000000 (6 zeros) memory location.
shell> load ram 0x32000000 <uboot bin size in bytes> u-boot
5d. Use DNW to transfer the u-boot.bin from your computer to the board.
5e. Execute the loaded bin file you loaded in to RAM.
shell> go 0x32000000
5f. You should now be inside u-boot at a MINI24440# prompt. Now we prepare the NAND.
MINI2440# nand scrub
5g. Create the bad block table.
MINI2440# nand createbbt
5h. Write the u-boot that we're running at 0x32000000, to the NAND.
MINI2440# nand write.e 0x32000000 0x0 <u-boot bin size in hex>
5i. Partition the NAND.
MINI2440# dynpart
5j Create the dynamic environment space for u-boot.
MINI2440# dynenv set u-boot_env
5k. Save the environment to NAND.
MINI2440# saveenv
You can now set the boot switch back to NAND and reboot the system. It should pop up with U-Boot and give you a MINI2440# uboot prompt. From this point on you can do all your work inside U-boot for loading images for the kernel and for the filesystem. I would like to note though, that in the above examples, you need to know your u-boot bin file size in both bytes and in hex. You can use google to convert the file size in bytes to hex. (i.e. "233907 to hex" in the google search box). I recommend trying to run u-boot without the source modification first before disabling IRQ because I'm guessing at some point, buserror or someone else will figure out why it won't run from RAM with that enabled. If it fails, and you can always modify the source and recompile.
I'd like to note that I collected these instructions from various sites and I've re-worded and explained them some to help. I hope that this helps you.
Here are some useful links for u-boot and other things:
http://bliterness.blogspot.com/ - Busseror's blog
http://code.google.com/p/mini2440/ ... - Buserror's Google code page.
http://repo.or.cz/w/openembedded/mi... - Git repository for the modified Openembedded
http://repo.or.cz/w/u-boot-openmoko... - Git repository for u-boot
UPDATE: MAY 8th, 2010: As of writing this update, the code in the git repository already has the above modification to the code. If you for any reason require USB support on your bootloader, you will need to uncomment the line that is commented out above and recompile.
UPDATE MAY 31st, 2010: There have been some problems with the current repository code and it won't run from RAM for some devices. So here's a quick workaround.
- 1. Switch the system to NOR and boot with supervivi.
- 2. hit v in supervivi
- 3. i uploaded the u-boot.bin file
- 4. switch the system to NAND and boot up with u-boot. You'll get some errors.
- 5. Run nand scrubs and createbbt
- 6. switch back to NOR
- 7. hit v again and upload U-boot since you just erased it.
- 8. switch back to nand and it should boot up with minimal errors using u-boot.
- 9. run the dynpart and dynenv and saveenv as mentioned above.
You should have a working u-boot... I'm currently getting an error about it not seeing my nand but it seems to be able to access it. Maybe you guys can let me know if you see anything wrong. I am suspecting there is a problem with the new u-boot code. Maybe buserror can shed some light on this.
mini2440
Contents
[hide]- 1 About
- 2 Preparations
- 3 Setting up the bootloader
- 4 Kernel
- 5 Setting up embedian
- 6 Bit Baking Angstrom, and QT Embedded 4
- 7 Troubleshooting
- 8 Links
About
This is a howto install uboot and a new kernel on the mini2440. Big thanks to BusError for the instructions and guidance. DISCLAIMER: This worked for me, if it eats your cat or burns your kitchen sink, don't blame me.
Preparations
Toolchain
I used this one: http://www.codesourcery.com/sgpp/lite/arm/portal/package3696/public/arm-none-linux-gnueabi/arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
Add the bin dir to the $PATH. If you have a toolchain with another prefix (like arm-linux-) adapt the CROSS_COMPILE environment variable in the next steps.
Setting up the bootloader
Compiling uboot
Clone the git tree:
mkdir uboot ; cd uboot
git clone git://repo.or.cz/u-boot-openmoko/mini2440.git
Setup cross compiling:
export CROSS_COMPILE=arm-none-linux-gnueabi-
or edit your .bashrc eg.
export CROSS_COMPILE=arm-none-linux-gnueabi-
export PS1="\[\033[1;34m\]\u \[\033[0m\]\w:\$: \[\033[0m\]"
#export PS1="\u:\w\$>"
LS_OPTIONS="--color=auto"
alias ls="ls $LS_OPTIONS"
Prepare the mini2440 target:
cd mini2440
make mini2440_config
Compile:
make all
This will give you a "u-boot.bin". If you get an error about a missing whatever-gcc, verifiy if there is a hardcoded CROSS_COMPILE setting in the Makefile
Flashing uboot
We use the installed vivi bootloader to load uboot via usb. Power the board off, set the NOR switch to on, power the board on. You'll get the vivi output on the serial console. Press 'q' to go to the shell and do the "load flash" on address 0 with the size of "u-boot.bin" (238232 bytes in this example):
[q] Goto shell of vivi
Enter your selection: q
Supervivi> load flash 0 238232 u
USB host is connected. Waiting a download.
Use the "s3c2410_boot_usb" utility (http://mini2440.googlecode.com/files/s3c2410_boot_usb-20060807.tar.bz2) to upload the "u-boot.bin" via usb:
./s3c2410_boot_usb u-boot.bin
You'll see something like this as output, ignore the error message:
csum = 0x9a6e
send_file: addr = 0x33f80000, len = 0x0003a298
Error downloading program
and this on the serial console:
Now, Downloading [ADDRESS:30000000h,TOTAL:238242]
RECEIVED FILE SIZE: 238242 (232KB/S, 1S)
Downloaded file at 0x30000000, size = 238232 bytes
Found block size = 0x0003c000
Erasing... ... done
Writing... ... done
Written 238232 bytes
Supervivi>
Then you see
MINI2440 # saveenv
Saving Environment to NAND...
Erasing Nand...nand_erase: attempt to erase a bad block at page 0x00000260
Try
MINI2440 # nand scrub
...
Really scrub this NAND flash? <y/N>
press y and enter. After erasing make
MINI2440 # nand createbbt
press y and enter. Now you can save the environment
MINI2440 # saveenv
Now power off the board, set the NOR switch back to off, and power on the board. We verify the version and then prepare config storage in flash:
MINI2440 # version
U-Boot 1.3.2-dirty-moko12 (Mar 8 2009 - 13:50:19)
MINI2440 # dynenv set 40000
device 0 offset 0x40000, size 0x3fc0000
45 4e 56 30 - 00 00 04 00
MINI2440 # saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
MINI2440 # reset
Configure uboot
do a "printenv" to show active settings. Adjust the IP for uboot and the tftp server. We need proper IP connectivity to load the kernel with tftp. "setenv" is your friend. "saveenv" stores the setting to flash.
Kernel
Compilation
Fetch from git:
mkdir kernel ; cd kernel
git clone git://repo.or.cz/linux-2.6/mini2440.git
cd mini2440
mkdir -p ../kernel-bin
Generate .config from mini2440 template:
CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/ mini2440_defconfig
(optional) if you want to modify kernel modules use this command afterwards:
(optional if you don't have libncurses5-dev) apt-get install libncurses5-dev
cd ../kernel-bin
make ARCH=arm menuconfig
cd ../mini2440
Compile kernel and modules:
CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/
Generate "uImage" with the "mkimage" tool:
../uboot/mini2440/tools/mkimage -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008000 -d ../kernel-bin/arch/arm/boot/zImage /tftpboot/uImage
Kernel Modules
To create the dynamically loaded kernel modules, which would go into the root file system later on do this:
CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/ modules
CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/ INSTALL_MOD_PATH=.. modules_install
After this step, there should be a directory ../lib which would contain the dynamically loaded modules(drivers). This folder would go to the root file system of your board, for example I have my filesystem on a sd card. I would stick the SD card in the PC, and mount it and then copy the modules as:
cp ../lib/modules/2.6.32-rc8/ /media/rootfs/lib/modules/ -r
don't forget to
sync
umount /media/*
Flash kernel
Verify partitions, we need the offset for the kernel partition (probably 0x60000):
mtdparts
Erase the kernel partition:
nand erase 60000 <padded size>
Load the kernel with uboot into ram:
tftp 0x32000000 uImage
Note the size, pad it to 512 byte and use the nand write command to flash it:
nand write 32000000 60000 <padded size>.
Configure uboot
We use a nfs chroot for now:
setenv bootargs console=ttySAC0,115200 noinitrd init=/sbin/init mini2440=1tb ip=192.168.80.12 root=/dev/nfs rw nfsroot=192.168.80.1:/home/public/arm
This is helpful for automatic booting:
setenv bootcmd 'nboot.e kernel ; bootm'
Setting up embedian
Follow this nice howto from BusError http://code.google.com/p/mini2440/wiki/Emdebian
Bit Baking Angstrom, and QT Embedded 4
If you are using Fedora follow this link : http://www.electronics.diycinema.co.uk/embedded/mini2440/bitbaking-the-kernel-angstrom-and-qt4-embedded-all-at-once/comment-page-2/#comment-498 , otherwise follow here:
Getting the required software
cd ~
mkdir OE
cd OE
git clone git://repo.or.cz/openembedded/mini2440.git openembedded
Getting other required Softwares
sudo apt-get install gawk diffstat help2man texi2html texinfo build-essential subversion cvs unzip texinfo git-core
sudo dpkg-reconfigure dash
and choose "<No>" from the menu.
Then we create a helper for ourselves:
gedit ~/OE/source-me.txt
and past the following, and change the /home/ashkax to your own home directory address.
export OETREE="/home/ashkax/OE"
BBPATH=${OETREE}/:${OETREE}/openembedded/
echo Setting up dev env for Ångström
if [ -z ${ORG_PATH} ] ; then
ORG_PATH=${PATH}
export ORG_PATH
fi
if [ -z ${ORG_LD_LIBRARY_PATH} ] ; then
ORG_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
export ORG_LD_LIBRARY_PATH
fi
PATH=${OETREE}/openembedded/bitbake/bin:${ORG_PATH}
LD_LIBRARY_PATH=
export PATH LD_LIBRARY_PATH BBPATH
export LANG=C
export BB_ENV_EXTRAWHITE="MACHINE DISTRO OETREE ANGSTROM_MODE ANGSTROMLIBC LIBC"
sudo sysctl vm.mmap_min_addr=0
echo "Altered environment for OE Development"
This file that we just created will be used later on, to setup the compiler... Now lets edit the bitbake configuration file to tell bit bake we like it to compile the QT embedded for us too:
cd ~/OE/openembedded
wget http://www.electronics.diycinema.co.uk/wp-content/uploads/2009/11/local.conf.txt
gedit local.conf.txt
now change all the doug to your own user name, save the file and quit gedit. Then
cp local.conf.txt conf/local.conf
Alternatively you can use the original sample file and edit it to your liking:
cd openembedded
gedit mini2440_local_conf_example.conf
cp mini2440_local_conf_example.conf conf/local.conf
Adding QT to baking recipes
gedit ~/OE/openembedded/recipes/images/mini2440-image.bb
it would be something like:
#Angstrom bootstrap image
IMAGE_PREPROCESS_COMMAND = "create_etc_timestamp"
ANGSTROM_EXTRA_INSTALL ?= ""
DEPENDS = "task-base-extended \
psplash-zap \
esekeyd u-boot-utils tslib \
i2c-tools i2c screen rsync nfs-utils \
directfb gdbserver directfb mtd-utils \
"
IMAGE_INSTALL = "task-base-extended \
${ANGSTROM_EXTRA_INSTALL} \
psplash-zap qt4-embedded\
esekeyd u-boot-utils tslib-calibrate tslib-tests \
i2c-tools i2c screen rsync nfs-utils-client \
directfb gdbserver directfb mtd-utils \
rsvg pango \
"
export IMAGE_BASENAME = "mini2440-image"
IMAGE_LINGUAS = ""
inherit image
running the bitbake
Now all you have to do is source the script from wherever you put it:
source ~/OE/source-me.txt
cd ~/OE/openembedded/
bitbake mini2440-image
If you get an error trying to build a package try cleaning it: bitbake -c clean INSERTPACKAGENAME
Then try and build the image again. Maybe you won’t have this problem. I guess it’s either because the checksum parser failed to build or my hdd is dodgy. It only happened once on binutils but worked fine after cleaning it.
A few hours later if all goes well you should have images in: ~/OE/oetmp/deploy/glibc/images/mini2440/
Obviously that directory depends on what you setup in the local.conf.
but, for a fun start boot up your mini2440 with the new image that you've just created and issue the following command:
ts_calibrate
ts_test
qtdemo -qws
Troubleshooting
Write errors
When you have bad blocks in NAND, you'll get write errors. This gives more information: http://wiki.openmoko.org/wiki/NAND_bad_blocks
Clear the flash (do not reset the board till uboot is reinstalled, or you need to use NOR/vivi to reinstall uboot via usb):
nand scrub
Create new bad blocks table:
nand createbbt
Reflash uboot (use the size in the output from the tftp command and pad it to hit 512 byte boundaries for the nand write command)
tftp 0x32000000 u-boot.bin
nand write 32000000 0 <size of u-boot.bin>
reset
Create dynamic partitions:
dynpart
dynenv set u-boot_env
saveenv
reset
And then use write.e to write to the mtdparts, e.g.:
tftp 0x32000000 uImage
nand write.e 32000000 kernel
nboot.e kernel
Python Alignment trap, Segmentation fault
This error and some other errors related to illegal instructions happened because all packages are compiled with -mthumb though the kernel and modules use -mno-thumb. The mix of instruction sets seem to cause problems. A hotfix is to edit your conf/distro/include/angstrom.inc and change the line: ANGSTROM_ARM_INSTRUCTION_SET_armv4t = "thumb" to ANGSTROM_ARM_INSTRUCTION_SET_armv4t = "arm"
The default for the mini2440 is -mno-thumb but for some reason (save memory space, maybe?) the angstrom distro overrides this for all armv4t family processors.
Messed Up Screen Positions( or TS calibration) IN QT
If the resolution is messed up or you can run the ts_calibrate but the hitting points are out of range, it may be because of the boot arguments.. Reboot your system, press a key in startup to go to uboot environment and make sure mini2440=0tb for 3.5" screen, and mini2440=1tb for 7" screen. Try using the commands printenv, and setenv to do so.
Try ts_calibrated after booting.
Links
http://bliterness.blogspot.com/
http://code.google.com/p/mini2440/
http://blog.cor-net.org/ (Qt 4.5 on mini2440)
http://wiki.openembedded.net/index.php/Getting_Started
http://www.sereno-online.com/site/2010/05/01/qt-4-6-2-installation-procedure-for-friendlyarm-mini-2440-board/ (Qt 4.6.2 on mini 2440)
출 처 : http://wiki.linuxmce.org/index.php/Mini2440#Setting_up_embedian
Host PC 와 mini2440 nfs 연결 하기
- Debian Linux / hp nc4010
1. NFS 사용을 위해서는 먼저 host pc에 NFS 서버 프로그램이 설치되어 있어야 한다.
2. 설치 완료 후 디렉토리를 하나 생성한다.
# chmod 777 /nfs
# chown nobody /nfs
# chgrp nogroup /nfs
3. /etc/exports 파일을 편집한다. 다음의 내용을 추가한다.
4. nfs 데몬을 재시작 한다.
5. 일단 ping을 이용하여 host pc와 mini2440 보드간 연결이 제대로 되어 있는지 확인한다.
6. mini2440 보드에 minicom으로 연결한 후 리눅스 로그인 상태에서 다음과 같은 명령을 내린다.
# mount -t nfs -o nolock 192.168.1.1:/nfs /root/nfs
가상 단말기 및 교차개발환경
COM1포트, 115200bps, 데이터 8비트, 패리티 없음, 정지비트 1, 흐름제어 없음
2. 파일 전송 : Zmodem을 이용하여 파일을 전송
- 미니컴에서 임베디드 컴퓨터에 로그인 한 후 파일 전송 프로그램인 rz 명령을 사용한다.
- rz명령을 내린 후 ctrl + A와 Z키를 입력하여 미니컴 명령 모드로 빠져 나온다.
- s 명령을 내린 후 프로토콜로 Zmodem을 선택하고 보낼 파일을 선택한다.
3. 교차컴파일러 설치
호스트 컴퓨터에 타겟 컴퓨터에 맞는 컴파일러를 설치한다.
(arm-linux-gcc)