FC3000

安裝Debian Wheezy系統


參考資訊:
1. Kernel Source
2. CrossDebootstrap

製作Debian系統:

$ cd
$ sudo apt-get install binfmt-support qemu qemu-user-static debootstrap
$ sudo debootstrap --arch armel --foreign wheezy wheezy http://archive.debian.org/debian/
$ sudo chroot wheezy /debootstrap/debootstrap --second-stage

$ sudo mount -o bind /dev wheezy/dev
$ sudo mount -o bind /sys wheezy/sys
$ sudo mount -o bind /proc wheezy/proc

$ sudo chroot wheezy
# passwd
# adduser user
# nano /etc/apt/sources.list
    deb http://archive.debian.org/debian wheezy main contrib non-free

# apt-get update
# apt-get install lxde obconf openbox lxdm lxde-common xbindkeys xdotool -y
# nano home/user/.xbindkeysrc
    "xdotool mousemove_relative 10 0"
        Right
    "xdotool mousemove_relative -- -10 0"
        Left
    "xdotool mousemove_relative 0 -10"
        Up
    "xdotool mousemove_relative 0 10"
        Down

    "xdotool click 1"
        m:0x0 + c:65

    "xdotool click 3"
        m:0x1 + c:50

# nano /etc/lightdm/lightdm.conf
    autologin-user=user

# nano /etc/inittab
    1:2345:respawn:/sbin/getty -L ttyS0 115200 vt100

# nano /etc/rc.local
    /usr/bin/xbindkeys -f /home/user/.xbindkeysrc

# nano /etc/fstab
    /swap.img none  swap  sw  0  0

# dd if=/dev/zero of=/swap.img bs=1M count=512
# mkswap /swap.img
# exit

$ sudo umount wheezy/dev
$ sudo umount wheezy/sys
$ sudo umount wheezy/proc

編譯Kernel

$ cd
$ wget https://github.com/steward-fu/miyoo/releases/download/v1.0/toolchain.7z
$ 7za x toolchain.7z
$ sudo mv miyoo /opt

$ git clone https://github.com/steward-fu/kernel
$ cd kernel
$ git checkout f1c100s_fc3000_linux-4.14.0_debian
$ ARCH=arm make suniv-debian_defconfig
$ ./tools/make_suniv.sh fc3000_ips2

準備一張MicroSD並分割成如下:


編譯Bootloader並且燒錄到MicroSD

$ cd
$ git clone https://github.com/steward-fu/bootloader
$ cd bootloader
$ git checkout f1c100s_fc3000_uboot-2018.01
$ ARCH=arm make suniv_defconfig
$ ./tools/make_suniv.sh /dev/sdX fc3000

P.S. 如果不想手動自己安裝,可以使用司徒打包好的燒錄檔案(fc3000_ips2_debian7.img.7z, root:root, user:user)

系統穩定時間大約需要三分鐘(F1C100S CPU:486MHz, RAM:32MB, SWAP:512MB)





記得連接FC3000 UART,這樣就可以有Terminal操作的功能


按鍵映射(滑鼠左、右鍵需要長按大約3秒再放開)

UPMouse Y--
DOWNMouse Y++
LEFTMouse X--
RIGHTMouse X++
YMouse Left Button
XMouse Right Button
ACtrl
BAlt
LTab
RBackspace
SELECTEsc
STARTEnter
MENUCtrl

司徒打包的燒錄檔案有包含許多編譯器套件,這樣就可以直接在FC3000上面做開發的工作,首先,試試Hello, world!

$ cd
$ gcc hello.c -o hello
$ ./hello
    hello, world!

接著試試SDL 1.2(sdl.c)

#include <stdio.h>
#include <stdlib.h>
#include <SDL.h>

int main(int argc, char** argv)
{
    SDL_Rect rt={0};
    SDL_Surface* screen;

    SDL_Init(SDL_INIT_VIDEO);
    screen = SDL_SetVideoMode(150, 150, 16, SDL_HWSURFACE);

    SDL_FillRect(screen, &screen->clip_rect, SDL_MapRGB(screen->format, 0xff, 0x00, 0x00));

    rt.x = 0;
    rt.y = 0;
    rt.w = 30;
    rt.h = 30;
    SDL_FillRect(screen, &rt, SDL_MapRGB(screen->format, 0x00, 0xff, 0x00));

    rt.x = 50;
    rt.y = 50;
    rt.w = 30;
    rt.h = 40;
    SDL_FillRect(screen, &rt, SDL_MapRGB(screen->format, 0x00, 0x00, 0xff));

    SDL_Flip(screen);
    SDL_Delay(3000);
    SDL_Quit();
    return 0;
}

編譯SDL 1.2並且執行

$ export DISPLAY=:0
$ gcc sdl.c -o sdl -lSDL -I/usr/include/SDL
$ ./sdl



接著試試GTK(gtk.c)

#include <gtk/gtk.h>

int main(int argc, char** argv)
{
    GtkWidget *win;
    GtkWidget *label;

    gtk_init(&argc, &argv);
    win = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    label = gtk_label_new("Hello, world!");
    gtk_container_add(GTK_CONTAINER(win), label);

    gtk_widget_show_all(win);
    g_signal_connect(win, "destroy", G_CALLBACK(gtk_main_quit), NULL);
    gtk_main();
    return 0;
}

編譯GTK並且執行

$ export DISPLAY=:0
$ gcc -o gtk gtk.c `pkg-config --libs --cflags gtk+-2.0`
$ ./gtk



接著試試QT(qt.cpp)

#include <QApplication>
#include <QWidget>
#include <QLabel>

int main(int argc, char** argv)
{
    QApplication app(argc, argv);
    QWidget *win;
    QLabel *label;

    win = new QWidget;
    label = new QLabel("Hello, world!", win);
    win->show();
    return app.exec();
}

qt.pro

TARGET = qt
SOURCES = qt.cpp

編譯QT並且執行

$ export DISPLAY=:0
$ qmake
$ make
$ ./qt


返回上一頁