ntzyz's space

∠( ᐛ 」∠)_

Category

  • Algorithm
  • Figures
  • Gameplay
  • Linux
  • Network
  • Other
  • Photos
  • Web

Tags

  • Linux
  • JavaScript
  • PS4
  • A6300
  • A7M3
  • HTML5
  • OpenWrt
  • FE55
  • 手办
  • Tunnel
  • Web
  • systemd
  • Arcaea
  • iptables
  • node
  • Network
  • 雪
  • 狗
  • VPN
  • 猫
  • PowerShell
  • AudioContext
  • MediaSource
  • IPv6
  • Gaming
  • NVMe
  • SQLite
  • CSharp
  • Routing
  • LeetCode
  • PPTP
  • MHW
  • HDOJ
  • USB
  • FromSoftware
  • CI
  • Highlight.js
  • HTML
  • FE24105G
  • Algorithm
  • VR
  • Arch Linux
  • SVP
  • WireGuard
  • Minecraft
  • Highcharts.js
  • SDL
  • CAPCOM
  • Sekiro
  • WebAssembly
  • GitHub
  • UEFI
  • iSCSI
  • UglifyJS
  • MPV
  • PHP
  • MySQL
  • NAT
  • Surface
  • Node

Recent replies

  • 张建新 发表于「在浏览器中使用 WebAssembly 解码 MP3 并播放」
  • 张建新 发表于「在浏览器中使用 WebAssembly 解码 MP3 并播放」
  • Dingles 发表于「个人网络配置方案」
  • 竹林里有冰 发表于「用 Elastic Stack 拯救 Telegram 的中文搜索」
  • spinmry 发表于「CoreMark WebAssembly」
  • spinmry 发表于「CoreMark WebAssembly」
  • ntzyz 发表于「CoreMark WebAssembly」
  • Hatsuroku 发表于「CoreMark WebAssembly」
  • Kyle 发表于「用 Elastic Stack 拯救 Telegram 的中文搜索」
  • ShellBin 发表于「Cinebench」

Links

About me
WordPress 存档
Cinebench 跑分记录
Coremark WebAssembly 跑分记录
Hpoi 手办维基 个人页
ZephRay
>Lithia's Core
业余无线电台 BD4SUR
Ferrets 家的 Wordpress
spinmry实验室
notonokodds
春上冰月的博客
kasora's blog
蒋炜成 | 个人博客
Test2g
447f.Misaka
Project RC
Shell Bin
标签:SDL

ARM v7 交叉编译笔记

2018 年 5 月 16 日分类:Linux#SDL#Linux

busybox,产生一个最小的可用 coreutils 等工具,并充当新系统的 init,毕竟这种嵌入式场景要是跑 systemd,开机速度什么的就走远了(

$ wget https://busybox.net/downloads/busybox-1.28.3.tar.bz2
$ tar xjvf busybox* && cd busybox*
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- defconfig
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j64
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- install CONFIG_PREFIX=/root/basefiles

SDL 1.2,把除了 fbcon 之外的 video 和 audio 都关了。SDL 支持的东西真多啊,居然还有 PS2 PS3的。

./configure --host=arm-linux-gnueabihf \
            --prefix=/root/basefiles/usr \
            --disable-audio \
            --disable-threads \
            --disable-x11 \
            --disable-dga \
            --disable-video-photon \
            --disable-video-cocoa \
            --disable-video-directfb \
            --disable-video-ps2gs \
            --disable-video-ps3 \
            --disable-video-svga \
            --disable-video-vgl \
            --disable-video-wscons \
            --disable-video-xbios \
            --disable-video-gem \
            --disable-video-opengl
make && make install

zlib,作为 libpng 和 freetype2 的依赖。

CC=arm-linux-gnueabihf-gcc LD=arm-linux-gnueabihf-ld AS=arm-linux-gnueabihf-as ./configure --prefix=/root/basefiles/usr
make && make install 

libpng 1.6,资源文件保存格式,SDL_image 依赖该库。

必须注意的是头文件目录一定要放在 CPPFLAGS 这个变量里,否则会报错。同时如果 已经报错了记得 make clean 了之后再编译,否则这个错误不会被修正。

./configure --host=arm-linux-gnueabihf \
            --prefix=/root/basefiles/usr \
            CPPFLAGS="-I/root/basefiles/usr/include" \
            LDFLAGS="-L/root/basefiles/usr/lib"
make && make install

SDL_image 1.2,去掉了所有其他用不到的格式,只保留 PNG 的支持。

./configure --host=arm-linux-gnueabihf \
            --prefix=/root/basefiles/usr/ \
            --with-sdl-prefix=/root/basefiles/usr/ \
            --disable-jpg \
            --disable-tif \
            --disable-webp \
            CFLAGS="-I/root/basefiles/usr/include" \
            LDFLAGS="-L/root/basefiles/usr/lib"
make && make install

Freetype2 会通过 pkg-config 命令来判断系统内是否安装了 libpng 和 zlib,所以我们需要手动指定这个 PKG_CONFIG_PATH ,或者干脆去掉对 libpng 的支持。

./configure --host=arm-linux-gnueabihf \
            --prefix=/root/basefiles/usr/ \
            --with-png=yes \
            CFLAGS="-I/root/basefiles/usr/include" \
            LDFLAGS="-L/root/basefiles/usr/lib" \
            PKG_CONFIG_PATH=/root/basefiles/usr/lib/pkgconfig/

SDL_ttf,需要把 include/SDL 内的 SDL_opengl.h 给删掉或者改名,因为 configure 内没有提供任何方法来关闭 OpenGL,只能破坏这个检测机制来避免让 autoconf 认为我需要使用 libGL 进行链接。

[ -e /root/basefiles/usr/include/SDL/SDL_opengl.h ] && mv /root/basefiles/usr/include/SDL/SDL_opengl.h /root/basefiles/usr/include/SDL/SDL_opengl.fucked.h
./configure --host=arm-linux-gnueabihf \
            --prefix=/root/basefiles/usr/ \
            --with-freetype-prefix=/root/basefiles/usr/ \
            CFLAGS="-I/root/basefiles/usr/include -I/root/basefiles/usr/include/freetype2" \
            LDFLAGS="-L/root/basefiles/usr/lib -lfreetype" \
            PKG_CONFIG_PATH=/root/basefiles/usr/lib/pkgconfig/

OpenCV3,测试算法使用,正式代码中使用的部分将被重构

cmake -DCMAKE_TOOLCHAIN_FILE=../arm-gnueabi.toolchain.cmake ../../.. -DCMAKE_INSTALL_PREFIX=/opt/rootfs/usr -DENABLE_NEON=ON
  • «
  • 1
  • »
Copyright © 2016-2019 ntzyz. All rights reserved.
Except where otherwise noted, content on this blog is licensed under CC-BY 2.0.