[精讚] [會員登入]
167

XSBASE270 由 WinCE 改為 Linux 記錄

XSBASE270 改為 Linux 記錄,此篇只是留個記錄,

分享此文連結 //n.sfs.tw/14767

分享連結 XSBASE270 由 WinCE 改為 Linux 記錄@新精讚
(文章歡迎轉載,務必尊重版權註明連結來源)
2022-03-15 10:14:04 最後編修
2020-10-12 11:41:51 By 張○○
 

自動目錄

XSBASE270 由 WinCE 改為 Linux 記錄

XSBASE270是2008年時讀書時用的嵌入式系統 ,此系統是否有在用不得而知,今在電腦中發現此文,貼出來留個記錄。

一、準備工作

1.一台Linux 機器,手冊上建議是 FC4 或是 RedHat 9,問題是我去哪裡找這種已經不見的作業系統。
事實上我找到了,結果變成硬體的問題,他要有印表器埠和ComPort,因此我決定姑且一試我目前用
的Linux:
Linux pc.er 2.6.23.15-80.fc7 #1 SMP Sun Feb 10 17:29:10 EST 2008 i686 i686 i386 GNU/Linux
以後這台Linux在此文章中就全稱之為伺服器。
下次要再有只用限定的低版次OS的嵌入系統的話請直接丟了吧。

2. XSBASE270 由兩個部分組成,一個是底版一大片的,以下文章全稱之為「平台」;另一個是平台上面的一個
小小方塊的模組,以下文章全稱之為「模組」。兩者以下合稱為「X系統」。

二、接線

先將 JTAG(彩色的那個扁扁的線) 一邊插到模組上,另一邊接到伺服器的「平行埠」
將序列埠的線一邊接到伺服器上的ComPort,另一邊接到模組上唯一能插進去的ComPort孔。
網路線他有附一條爛爛的,說是交換線,手冊說要由模組接到底板。而我這盒沒此線,因此
自備兩條正常的網路線(Straight Through RJ45)分別由模組、底板接到Switch。
<<以上接線看似容易我研究了很久>>

三、拷背

把光碟片整個Linux/ 目錄下的檔案約700MB拷入伺服器,怎麼拷的手冊是說要mount光碟機,因為我
光碟機沒接線麻煩,所以就拿WindowsXP的NB(下文全稱為筆電)再用FTP傳進去伺服器。過程略!

四、進到目錄 Jflash-XSBase270/

將 boot的影像檔用他提供的 程式jflashm 利用那條 JTAG線傳進去,其中程式jflashm記得改為可執行。

# ./jflashm boot

出現錯誤:
[root@pc Jflash-XSBase270]# ./jflashmm
./jflashmm: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or direc

[root@pc Jflash-XSBase270]# ln -s /usr/lib/libstdc++.so.5 /usr/lib/libstdc++.so.6
ln: creating symbolic link ‘/usr/lib/libstdc++.so.6’: 檔案已存在
使用老奸步看行不行。
[root@pc Jflash-XSBase270]# ln -s /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so.5
再執行,出現另一個錯誤,老奸步不行
[root@pc Jflash-XSBase270]# ./jflashmm: /usr/lib/libstdc++.so.5: version `CXXABI_1.2' not found (required by ./jflashmm)
這因為我的linux是新版的,所以尋找舊版的lib:
下尋找libstdc++.so.5
http://rpmfind.net/linux/rpm2html/search.php?query=libstdc%2B%2B.so.5
安裝
[root@pc Jflash-XSBase270]# rpm -ivh compat-libstdc++-33-3.2.3-62.i386.rpm
正在準備…             ########################################### [100%]
   1:compat-libstdc++-33    ########################################### [100%]
再執行就ok了
[root@pc Jflash-XSBase270]# ./jflashm boot

五、執行 minicom -s

在伺服器上執行 minicom -s 因為使用Com1,故先行設定device 為/dev/ttyS0,
com的通訊方式為115200 8 N 1 流量控制無後存檔離開再執行一次:
# minicom

開始監聽Com Port1,可按 Ctrl-A 後放開再按Z看使用說明,可按 Ctrl-A 再按X離開。

將X系統重開機,此時在伺服器的畫面上應該會出現選單: 記得在倒數 AUTO BOOT的時候按任意鍵才會出現以下選單,否則找不到 Kernel 會出現 Kernel Panic

Welcome to use 51Board Bootloader for XSBase270 board
 Copyright (C) 2002-2006 Hua Heng Co,. Ltd.
 Support : http://www.chhnet.com.tw
 Version : 01.00.03
 flash : base=0x00000000, size=0x02000000
 Eth port can access, the base address is 0x0c000300
 Eth chip is LAN91C111
 autoboot in progress, press any key to stop.
 Boot delay 2 seconds ..
 autoboot started.
 loading kernel image from flash...
 loading ramdisk image from flash...
 error: kernel is not exists.
 autoboot aborted.
============================ Operation Menu ==========================
        [0] ComanndLine mode
        [1] View current configuration
        [2] Bootp
        [3] Download default Kernel (zImage_qt)
        [4] Flash Kernel
        [5] Download default Filesystem (rootfs270qt.img)
        [6] Flash Filesystem
        [7] Boot system
        [8] Reboot system
        [9] Reset to factory default configuration
        [a] Set default Kernel filename and Filesystem filename
        [b] Set boot delay time
        [c] Help(to get a list of commands)
======================================================================
 Please enter your selection:

 這表示成功的將boot植入

六、設定網路參數

因為他的作業系統都要由TFTP傳入,因此要先設定IP,但是因為他無法直接設定IP上去,
所以他採用 bootp的協定取得ip,光碟有附 bootp的rpm,不過試了很久都失敗。他還要
我們裝xinetd,設定boottab等步驟全照作可是完全抓不到 bootp的封包,用WireShark才
找發現根本沒有bootp的 response。這裡一度想放棄,不過最後心一橫,
直接安裝 DHCPD 來解決這個問題,而 X系統也直接能抓到ip了。

由五的選單選0
設定網卡MAC,隨便設定
 51Board> set myhaddr 12:34:56:78:9a:00
送出 bootp的request封包
 51Board> bootp
 my mac address is 12:34:56:78:9A:00
 try to send bootp packet.....
 failed : bootp packet is not received.
失敗,因為伺服器沒有回應給他bootp的封包

在伺服器上安裝 DHCPD
[root@pc etc]# yum install dhcp
.....
Downloading Packages:
(1/2): openldap-servers-2 100% |=========================| 2.3 MB    00:00
(2/2): dhcp-3.0.5-42.fc7. 100% |=========================| 863 kB    00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: openldap-servers             ######################### [1/2]
  Installing: dhcp                         ######################### [2/2]
Installed: dhcp.i386 12:3.0.5-42.fc7
Dependency Installed: openldap-servers.i386 0:2.3.34-7.fc7
Complete!

將組態檔拷至 /etc
[root@pc etc]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample ./dhcpd.conf
修改組態檔
[root@pc etc]# vi /etc/dhcpd.conf

ddns-update-style interim;
ignore client-updates;
subnet 10.200.0.0 netmask 255.255.0.0 {
# --- default gateway
        option routers                  10.200.8.254;
        option subnet-mask              255.255.0.0;
        option domain-name-servers      10.200.8.254;
        option time-offset              -18000; # Eastern Standard Time
#       option ntp-servers              192.168.1.1;
#       option netbios-name-servers     192.168.1.1;
        range dynamic-bootp 10.200.8.100 10.200.8.102;
        default-lease-time 21600;
        max-lease-time 43200;
# 以下這段指定即可
# 這裡表示 這個mac一定會拿到下面那個ip

        host xsbase270 {
                hardware ethernet 12:34:56:78:9A:00;
                fixed-address 10.200.8.34;
        }
}

存檔後啟動
[root@pc etc]# service dhcpd start
正在啟動 dhcpd:                                            [  確定  ]

重新在方才串列埠上送出 bootp的request封包。順利取得了IP
 51Board> bootp
 my mac address is 12:34:56:78:9A:00
 try to send bootp packet.
 reply packet is received from  (10.200.8.254)
 my ip address is 10.200.8.34
回到選單
 51Board> quit

七、安裝tftp server

x系統光碟提供有tftp的程式,不過那個要配合 xinetd使用,不但麻煩,而且設定費時。

因我之前有用另一個tftp server 所以決定用我用習慣的程式,在哪下載的不記得了
因解壓:

[root@pc axer]# tar zxvf tftpserverspV1.4.tar.gz
tftpserversp/
tftpserversp/getServers.cpp
tftpserversp/Licence.txt
tftpserversp/README
tftpserversp/tftpserver
tftpserversp/tftpserver.cpp
tftpserversp/tftpserver.h
tftpserversp/tftpserver.ini

可以直接放到背景去執行
[root@pc tftpserversp]# ./tftpserver

或是加 -v 的參數觀察執行情況
[root@pc tftpserversp]# ./tftpserver -v

starting TFTP...
alias / is mapped to /home/
listening On: 127.0.0.1:69
listening On: 10.200.8.254:69
listening On: 210.240.196.46:69
listening On: 192.168.122.1:69
permitted clients: all
max blksize: 65464
defult blksize: 512
default interval: 3
overwrite existing files: No

Accepting requests..

八、放至要拷給x系統的檔案---並下載Linux 核心

[root@pc TinyX]# cp xsbase270/Images/TinyX/zImage_EDR_tinyx  tftpserversp的目錄

拷背…失敗
 51Board> tftp zImage_EDR_tinyx kernel
 tftp start...
 my ip address     : 10.200.8.34
 server ip address : 10.200.8.254
 filename          : zImage_EDR_tinyx
 store at          : 0xA0008000
 loading start...
 error : 'File Not Found' (1)

拷背 tftpserver.ini 到 /etc
編輯
vi /etc/tftpserver.ini
將 '/home/ 前的 ' 拿掉再啟動。
將要上傳的檔放到 /home/
再執行以下指令下載Linux 核心:
 51Board> tftp zImage_EDR_tinyx kernel
 tftp start...
 my ip address     : 10.200.8.34
 server ip address : 10.200.8.254
 filename          : zImage_EDR_tinyx
 store at          : 0xA0008000
 loading start...
 1122540 (0x001120EC) bytes received. done.
下載成功

執行燒寫到 flash
 51Board> flash kernel
 erase at 0x00040000~0x0017ffff : done.
 write at 0x00040000~0x001520eb with 0xa0008000 : done.

編譯檔案系統
到xsbase270/Filesystem 下,解壓 rootfs270_tinyx.tar.gz
mkfs.jffs2, rootfs270.sh 修改權限為755
執行
# sh rootfs270.sh
預設會產生一個檔 rootfs270.img,將此檔改名zfs270並放到 tftp 的目錄下。

下載Linux 檔案系統
 51Board> tftp zfs270 root
 tftp start...
 my ip address     : 10.200.8.34
 server ip address : 10.200.8.254
 filename          : zfs270
 store at          : 0xA0000000
 loading start...
 2359296 (0x00240000) bytes received. error : timed out.
 <<逾時錯誤?檔案只有23mb>>只好重試一次,還是失敗,一直失敗,傳到一半就停止了。


九、編譯內核

到伺服器中,先將光碟附的內核解壓:

# cd xsbase270/Kernel

# tar zxvf linux-2.4.21-51Board_EDR.tar.gz

# cd linux-2.4.21-51Board_EDR

# make xsbase270_config

# make oldconfig

建立目錄選單
[root@pc linux-2.4.21-51Board_EDR]# make menuconfig
rm -f include/asm
( cd include ; ln -sf asm-arm asm)
make -C scripts/lxdialog all
make[1]: Entering directory `/home/axer/xsbase270/Kernel/linux-2.4.21-51Board_EDR/scripts/lxdialog'
/usr/bin/ld: cannot find -lncurses
collect2: ld 回傳 1

>> Unable to find the Ncurses libraries.
>>
>> You must have Ncurses installed in order
>> to use 'make menuconfig'

make[1]: *** [ncurses] Error 1
make[1]: Leaving directory `/home/axer/xsbase270/Kernel/linux-2.4.21-51Board_EDR/scripts/lxdialog'
make: *** [menuconfig] Error 2

出錯…?

十、下載 ncurses-devel

ftp://ftp.isu.edu.tw/pub/Linux/Fedora/linux/updates/7/x86_64/ncurses-devel-5.6-9.20070812.fc7.i386.rpm
並安裝此rpm 後再執行
[root@pc linux-2.4.21-51Board_EDR]# make menuconfig

切成 big5的編碼以免視窗破損
出現要編譯進內核的選單
我有修改的地方,其餘的用預設的。
System Type  --->
    Intel PXA270/250/210 Implementations  --->
    (XSBase270-EDR) XSBase270 Board Type

File systems  --->
    Kernel automounter support
    /dev file system support (EXPERIMENTAL)
         Automatically mount at boot
         Debug devfs

Multimedia Capabilities Port drivers  --->
    ---> (Tinyx) GUI to be supported
     --->  (X) Tinyx

結束後儲存。
*** End of Linux kernel configuration.
*** Check the top-level Makefile for additional configuration.
*** Next, you may run 'make bzImage', 'make bzdisk', or 'make install'.


建立檔案的相關性:
[root@pc linux-2.4.21-51Board_EDR]# make dep

編譯內核:
[root@pc linux-2.4.21-51Board_EDR]# make bzImage
出錯:
make: /opt/xscalev1/bin/arm-linux-gcc: Command not found
make: *** [init/main.o] Error 127

十一、嘗試安裝  arm-linux-gcc

[root@pc linux-2.4.21-51Board_EDR]# yum install arm-*

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 arm-gp2x-linux-SDL      noarch     1.2.9-4.fc7      updates           817 k
 arm-gp2x-linux-gcc-c++  i386       4.1.2-6.fc7      updates           5.2 M
 arm-gp2x-linux-zlib     noarch     1.2.3-6.fc7      updates           209 k
Installing for dependencies:
 arm-gp2x-linux-binutils  i386       2.16.1-2.fc7     updates           3.1 M
 arm-gp2x-linux-gcc      i386       4.1.2-6.fc7      updates           2.3 M
 arm-gp2x-linux-glibc    noarch     2.3.6-4.fc7      updates            13 M
 arm-gp2x-linux-kernel-headers  noarch     2.6.12.0-1.fc7   updates           885 k

Transaction Summary
=============================================================================
Install      7 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 25 M

因為安裝完出現arm-gp2x-linux-gcc 而無 arm-linux-gcc,修改安裝檔 Makefile
#CROSS_COMPILE  = /opt/xscalev1/bin/arm-linux-
CROSS_COMPILE  = /usr/bin/arm-gp2x-linux-

再重編
[root@pc linux-2.4.21-51Board_EDR]# make bzImage
出錯:
/usr/bin/arm-gp2x-linux-gcc -D__KERNEL__ -I/home/axer/xsbase270/Kernel/linux-2.4.21-51Board_EDR/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -Uarm -fno-common -pipe -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mapcs-32 -D__LINUX_ARM_ARCH__=5 -mcpu=xscale -mtune=xscale -mshort-load-bytes -msoft-float -Uarm   -DKBUILD_BASENAME=main -c -o init/main.o init/main.c
cc1: error: unrecognized command line option "-mapcs-32"
cc1: error: unrecognized command line option "-mshort-load-bytes"
make: *** [init/main.o] Error 1

這裡的方法無法使用,詢問原廠工程師該信函答覆如下:
===========================================================
LucasChen 寄給 我  顯示詳細資料 2008/12/31 (9 天以前)

請見第25頁  安裝toolchain

將xscalev1.tar.gz copy 到PC的   /opt 然後解壓縮

修改 ~/.bash_profile 這個檔案

新增路徑

第27頁 以source指令重新存取該檔案

之後在任何路徑底下都能使用 arm-linux-gcc
============================================================
照做
# cd xsbase270/Toolchain/
# cp xscalev1.tar.gz /opt
# cd /opt/
# tar zxvf xscalev1.tar.gz
# vi ~/.bash_profile
加入一行:
PATH=$PATH:/opt/xscalev1/bin

使指令立刻生效
# source ~/.bash_profile

寫一個hello.c, 再編譯測試,可用這行檢查檔案屬性
# vi hello.arm.c
# /opt/xscalev1/bin/arm-linux-gcc hello.arm.c
[root@pc ~]# file a.out
a.out: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared libs), for GNU/Linux 2.0.0, not stripped

到 Kernel/linux-2.4.21-51Board_EDR 下編譯
# cd /home/axer/xsbase270/Kernel/linux-2.4.21-51Board_EDR
# make zImage
如此能正確編譯,完成後,會在 /home/axer/xsbase270/Kernel/linux-2.4.21-51Board_EDR/arch/arm/boot
下找到 zImage 這個檔案。

十二、重做步驟八

下載內核到模組
開機選單選[a] Set default Kernel filename and Filesystem filename
Kernel name設為 zImage (步驟十一完成的檔案)
FileSystem name 設為 zfs270
按[3] Download default Kernel 下載內核
按[4] Flash Kernel 燒錄內核
按[5] Download default Filesystem下載檔案系統
........

這裡花了六七個小時的虛工,下載一半就停止,找不到原因。最後直接把實驗的環境和學校隔離…
接線的照片。完工....七六個小時找不到錯,原來是學校網路太亂,廣播亂跑

........

按[6] Flash Filesystem 燒錄檔案系統
按[7] Boot system 重開機


開機畫面..........
..................
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 4096 bind 8192)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
NetWinder Floating Point Emulator V0.97 (double precision)
IrCOMM protocol (Dag Brattli)
RAMDISK: Couldn't find valid RAM disk image starting at 0.
Freeing initrd memory: 4224K
FAT: bogus logical sector size 381
VFS: Mounted root (jffs2 filesystem).
Mounted devfs on /dev
Freeing init memory: 388K
Kernel panic: No init found.  Try passing init= option to kernel.

沒地方下參數,不知要怎麼處理。

經詢問高雄原廠後,得知可能原因為 Kernel或FS 失敗,因此重新上載 default 的 kernel.

燒錄完後重載成功…

十三、開機

第一次登入使用者為 root,密碼不用
修改 設定檔
[root@51Board conf]# vi /conf/xsbase270_config

將網路介面修改為自己想要的ip
#------------------------------------------------------------
# System Setting
HOST_NAME="XSBase270_Axer"


#------------------------------------------------------------
# Ethernet Setting
eth0_IPADDR="10.200.0.3"
eth0_NETMASK="255.255.0.0"


#------------------------------------------------------------
# Route Setting
ROUTE_DEFAULT="10.200.0.254"


#------------------------------------------------------------
# DNS_Server Setting
DNS_SERVER="nameserver 168.95.1.1"
DNS_SERVER="nameserver 10.200.0.254"

修改字型編碼
# vi /etc/sysconfig/i18n
LANG="zh_TW.UTF-8"
SUPPORTED="zh_TW.UTF-8:en_US:en:zh_TW:zh"
SYSFONT="latarcyrheb-sun16"


修改Telnet 讓 root可以telnet
# mv securetty securetty.bak

重新啟動

十四、設備趨動

1.CF 卡 mount
# mount /dev/hda1 /mnt/cf

2.SD 卡 mount
# mount /dev/mmcda1 /mnt/mmc_sd
解mount方法:
# umount /mnt/mmc_sd

3.撥放mp3
# splay mu1.mp3 mu2.mp3 ....

4.錄音
# cat /dev/dsp > rec.wav

 


原文2008.12

END

你可能感興趣的文章

台灣2023(民國112年)節慶國定假日 ics下載 找不到2023年的假日ics檔?沒關係,我自己做一個。

我有六顆硬碟,該設定 RAID5, RAID50 還是 RAID6? 我有六顆硬碟,該設定 RAID5, RAID50 還是 RAID6?

超強姓名音譯網站 超級強,符合我所有需求

[GITLAB] 讓git可以用ssh push,解決 Permission denied (publickey).的問題 在使用git push資料的時候發生 Permission denied (publickey).的問題,有沒有解法?

系統碟硬碟複製(磁區複製) 複製我的硬碟,這篇也算是札記

2016 網頁設計的8項觀念 我觀察了這近網頁設計的趨勢,寫出8點設計上應該要注意的給大家參考

我有話要說

>>

限制:留言最高字數1000字。 限制:未登入訪客,每則留言間隔需超過10分鐘,每日最多5則留言。

訪客留言

[無留言]

隨機好文

安裝SPHINX支援中文 新版本的 sphinx 和舊版不同,網路上很多範例和教學是不能用的。此文是安裝和設定方法分享

為什麼要重造輪子? 什麼輪子?造什麼輪子?我為什麼要重造輪子?

[bc] linux 的計算機 bc 設定小數位數、計算π、次方根 linux 的計算機 bc 設定小數位數、計算π、次方根

最值得學的電腦技能 什麼是最值得學的電腦技能?程式設計?美工繪圖?系統網路?還是…? 都不是!個人覺得一個最值得學的電腦技能就

在Centos7 下安裝 Wildfly10 wildfly以前叫JBoss,2014.11.20改名叫Wildfly,起始版本是Wildfly8,現在已經出到Wil