适用于 32 位 LSB MIPS MIPS32 架构的编译器

适用于 32 位 LSB MIPS MIPS32 架构的编译器

我有一个电视机顶盒,目前正在试验:

在此输入图像描述

我通过板上的串行端口与它建立了串行控制台连接。我正在尝试编译一个简单的 C 可执行文件以在此设备上运行,但我似乎不知道如何执行此操作。

我尝试了 CodeSourcery、cross-compiler-mipsel 和 uClibc,但它们不起作用,而且后来使用其配置选项进行构建非常混乱。

以下是我能够收集的有关该系统的数据:

示例文件架构:

apps-startup: ELF 32-bit LSB  executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.12, stripped

系统信息:

tangox[/]# uname -a
Linux tangox 2.6.22.19-40-sigma #3230 PREEMPT Thu Oct 3 15:54:23 IST 2013 mips GNU/Linux

CPU信息:

tangox[/]# cat /proc/cpuinfo 
system type             : Sigma Designs TangoX
processor               : 0
cpu model               : MIPS 24K V7.12  FPU V0.0
Initial BogoMIPS                : 332.59
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 32
extra interrupt vector  : yes
hardware watchpoint     : yes
ASEs implemented        : mips16
shadow register sets    : 1
VCED exceptions         : not available
VCEI exceptions         : not available

SMP8XXX Chip ID         : 8653
SMP8XXX Rev ID          : 2
System bus frequency    : 333000000 Hz
CPU frequency           : 499500000 Hz
DSP frequency           : 333000000 Hz

消息:

tangox[/]# dmesg
Linux version 2.6.22.19-40-sigma (buildmgr@hulk) (gcc version 4.3.2 (Sourcery G++ Lite 4.3-51) ) #3230 PREEMPT Thu Oct 3 15:54:23 IST 2013
Mixed DRAM usage enabled.
Configured for SMP865x, detected SMP8653 (revision ES2).
Detected CPU/System/DSP Frequencies: 499.50/333.00/333.00MHz
SMP86xx Enabled Devices under Linux/XENV 0x9f3fbff4 = 0x003303f8
....

文件和目录:

tangox[/]# ls
apps@             images/           mrua_SMP8654F/    sysfs/
apps-peer/        init*             mruafw/           system@
bin/              initial_settings/ opt/              tmp/
cpgui/            lib/              probe/            upgrade/
data/             linuxrc@          proc/             usr/
dcchd_SMP8652/    logd/             rfs/              var/
dev/              lost+found/       root/             vnms/
etc/              media@            sbin/             webkit/
home/             mnt/              sys/

tangox[/]# find . -type f -name *.c
tangox[/]# find . -type f -name *.h
tangox[/]# find . -type f -name *.cpp
tangox[/]# find . -type f -name *.hpp
tangox[/]# find . -type f -name *.so
./webkit/lib/libcplibutils.so
./webkit/lib/libbrowserutils.so
./webkit/lib/plugins/npswitch.so
./webkit/lib/plugins/npplayer.so
./dcchd_SMP8652/directfb/lib/libdirectfb-smp86xx.so
./dcchd_SMP8652/dcchd/lib/libdcchd_dtv.so
./dcchd_SMP8652/dcchd/lib/librmcdda.so
./dcchd_SMP8652/dcchd/lib/libdcchd_acap.so
./dcchd_SMP8652/dcchd/lib/librmdvdfs.so
./dcchd_SMP8652/dcchd/lib/librmdvdfsapi.so
./dcchd_SMP8652/dcchd/lib/libdcchd_core.so
./dcchd_SMP8652/dcchd/lib/librmdvdvideoapi.so
./dcchd_SMP8652/dcchd/lib/libdcchd_tuner.so
./dcchd_SMP8652/dcchd/lib/librmvcdnavapi.so
./dcchd_SMP8652/dcchd/lib/librmpacketcommand.so
./dcchd_SMP8652/dcchd/lib/librmdisc.so
./dcchd_SMP8652/dcchd/lib/libdcchd_cap.so
./dcchd_SMP8652/dcchd/lib/libdcchd_mcast.so
./dcchd_SMP8652/dcchd/lib/libdcchd_dvd.so
./dcchd_SMP8652/dcchd/lib/librmdvdvideonav.so
./dcchd_SMP8652/dcchd/lib/librmcddanavapi.so
./dcchd_SMP8652/dcchd/lib/libdcchd_dvdvr.so
./dcchd_SMP8652/dcchd/lib/librmvcdnav.so
./dcchd_SMP8652/dcchd/lib/libdcchd_lpb.so
./dcchd_SMP8652/dcchd/lib/libdcchd.so
./mrua_SMP8654F/lib/libndsp.so
./mrua_SMP8654F/lib/libruai2c.so
./mrua_SMP8654F/lib/librmmkvdemux.so
./mrua_SMP8654F/lib/libindex.so
./mrua_SMP8654F/lib/librmdtcpapi.so
./mrua_SMP8654F/lib/librmmp4core.so
./mrua_SMP8654F/lib/librmdrm.so
./mrua_SMP8654F/lib/libruahdmi.so
./mrua_SMP8654F/lib/librmtextsubs.so
./mrua_SMP8654F/lib/libaudiooutports.so
./mrua_SMP8654F/lib/librmcore.so
./mrua_SMP8654F/lib/librmasfdemuxcore.so
./mrua_SMP8654F/lib/librmi2c.so
./mrua_SMP8654F/lib/librmmonitoring.so
./mrua_SMP8654F/lib/librmmpeg4framework.so
./mrua_SMP8654F/lib/librmmm_g.so
./mrua_SMP8654F/lib/libvp6decoder.so
./mrua_SMP8654F/lib/librmhsi.so
./mrua_SMP8654F/lib/librmcpputils.so
./mrua_SMP8654F/lib/librua.so
./mrua_SMP8654F/lib/librmmpegsystemindex.so
./mrua_SMP8654F/lib/libdcc.so
./mrua_SMP8654F/lib/librmwmaprodecodercore.so
./mrua_SMP8654F/lib/librmflv.so
./mrua_SMP8654F/lib/librmzlib.so
./mrua_SMP8654F/lib/librmmm_t.so
./mrua_SMP8654F/lib/librmcapture.so
./mrua_SMP8654F/lib/libgbus.so
./mrua_SMP8654F/lib/librmriff.so
./mrua_SMP8654F/lib/libllad.so
./mrua_SMP8654F/lib/librmdetector3api.so
./mrua_SMP8654F/lib/libdisplayoutports.so
./mrua_SMP8654F/lib/librmcdfs_t.so
./mrua_SMP8654F/lib/librmlibplay_t.so
./mrua_SMP8654F/lib/librmstreamingprotocols.so
./mrua_SMP8654F/lib/librmdetectorapi.so
./mrua_SMP8654F/lib/librmmpegdemux.so
./mrua_SMP8654F/lib/librmcprminterface.so
./mrua_SMP8654F/lib/librmdetector3.so
./mrua_SMP8654F/lib/librmhdmi.so
./mrua_SMP8654F/lib/libsh263decoder.so
./mrua_SMP8654F/lib/librmwmdrmstub.so
./mrua_SMP8654F/lib/librmmp4api.so
./mrua_SMP8654F/lib/librmwmaprodecoder.so
./mrua_SMP8654F/lib/librmcurl.so
./mrua_SMP8654F/lib/librmedid.so
./mrua_SMP8654F/lib/librmdescriptordecoder.so
./mrua_SMP8654F/lib/librmpthreadw.so
./mrua_SMP8654F/lib/librmasfdemux.so
./mrua_SMP8654F/lib/librmavicore.so
./mrua_SMP8654F/lib/librmvdemux.so
./mrua_SMP8654F/lib/librmsubidx.so
./mrua_SMP8654F/lib/librmvideoout.so
./mrua_SMP8654F/lib/librmrtk86.so
./mrua_SMP8654F/lib/librmcec.so
./mrua_SMP8654F/lib/librmmm.so
./mrua_SMP8654F/lib/librmsoftmixer.so
./mrua_SMP8654F/lib/librmdvbsubs.so
./mrua_SMP8654F/lib/librmcpputils_t.so
./mrua_SMP8654F/lib/librmsha1.so
./mrua_SMP8654F/lib/librmppf.so
./mrua_SMP8654F/lib/librmfp_t.so
./mrua_SMP8654F/lib/librmchannel.so
./mrua_SMP8654F/lib/libruahsi.so
./mrua_SMP8654F/lib/librmhttp.so
./mrua_SMP8654F/lib/librmcdfs.so
./mrua_SMP8654F/lib/librmmp4.so
./mrua_SMP8654F/lib/libsamples_t.so
./mrua_SMP8654F/lib/librmfontrender.so
./mrua_SMP8654F/lib/librmdisplay.so
./mrua_SMP8654F/lib/librmscc.so
./mrua_SMP8654F/lib/librmcw.so
./mrua_SMP8654F/lib/librmmpegsystemindexcreator.so
./mrua_SMP8654F/lib/librmcssinterface.so
./mrua_SMP8654F/lib/librmwmdrmndstub.so
./mrua_SMP8654F/lib/librmsofttxt.so
./data/myapps/tvstreamer/lib/libmpr.so
./data/myapps/tvstreamer/lib/libpcre.so
./data/myapps/tvstreamer/lib/libvuxmlgen.so
./data/myapps/tvstreamer/lib/libappweb.so
./data/myapps/tvstreamer/lib/modules/mod_vuxml.so
./lib/libnss_compat-2.8.so
./lib/libthread_db-1.0.so
./lib/libtinyxml.so
./lib/libIStagecraft.so
./lib/libnss_nis-2.8.so
./lib/ld-2.8.so
./lib/libIURLOps.so
./lib/libnss_files-2.8.so
./lib/libpcprofile.so
./lib/libIStreamPlayer.so
./lib/libIFL31NativeSoundOutput.so
./lib/libIXMLReaderLib.so
./lib/libSegFault.so
./lib/libresolv-2.8.so
./lib/libIEDKExtensions.so
./lib/libm-2.8.so
./lib/libarchop_74k.so
./lib/libIAEKernel.so
./lib/libsqlite.so
./lib/libutil-2.8.so
./lib/libtomcrypt.so
./lib/libIShell.so
./lib/libIVideoDecoder.so
./lib/libnss_nisplus-2.8.so
./lib/libIFileSystem.so
./lib/libIAudioDecoder.so
./lib/libcrypt-2.8.so
./lib/libIImageDecoder.so
./lib/libnss_hesiod-2.8.so
./lib/libISocket.so
./lib/libIStream.so
./lib/libBrokenLocale-2.8.so
./lib/libIFlashLib.so
./lib/libIIO.so
./lib/librt-2.8.so
./lib/libViewRightWebClient.so
./lib/libanl-2.8.so
./lib/libnss_dns-2.8.so
./lib/libIGraphicsDriver.so
./lib/libIJSONParserLib.so
./lib/libarchop_24k.so
./lib/libIProcess.so
./lib/libnsl-2.8.so
./lib/libc-2.8.so
./lib/libcidn-2.8.so
./lib/libpthread-2.8.so
./lib/libmemusage.so
./lib/libdl-2.8.so

没有内核或库头,只有静态库。如何创建与该板兼容的二进制文件?

答案1

当然,没有人会在嵌入式系统上留下任何源代码,因为这是不必要的。像您这样的嵌入式系统通常甚至没有足够的空间来存储其固件。

你会看到它包含 glibc。通过/libversion-named中共享对象的存在可以看出这一点-2.8.so。您需要 glibc 兼容工具链,其中包含 glibc 2.8 或早些时候为此系统编译二进制文件。

或者您可以放弃使用 glibc 构建的想法,而只是将可执行文件与 uClibc 工具链静态链接。使用-static命令行参数。

使用 musl libc 构建更加容易,并且已经有相应的工具链。您只需将一个动态链接器符号链接libc.so放入它和您的二进制文件中的某处即可。/lib

我希望apps-startup来自您的董事会,并且您已经知道它运行的字节顺序。

而且您没有提到对简单 C 可执行文件的要求。也许它需要您可能需要构建的额外库。

相关内容