逆向工程?!

於此引自 WiKi 『逆向工程Reverse engineering 的詞條所說︰

又稱『反向工程』 back engineering ,是一種技術過程,即對一專案標產品進行逆向分析及研究,從而演繹並得出該產品的處理流程、組織結構、功能效能規格等設計要素,以製作出功能相近,但又不完全一樣的產品。逆向工程源於商業及軍事領域中的硬體分析。其主要目的是,在不能輕易獲得必要的生產資訊下,直接從成品的分析,推匯出產品的設計原理。

逆向工程可能會被誤認為是對智慧財產權的嚴重侵害,但是在實際應用上,反而可能會保護智慧財產權所有者。例如在積體電路領域,如果懷疑某公司侵犯智慧財產權,可以用逆向工程技術來尋找證據。

在《【Sonic π】電路學之補充《三》》一文中,我們談到了從『專利權』到『著作權』的歷史因由︰

現今的世界又拓展到了『著作權』,這不可不說是一把『雙面刃』,好或不好但看社會之『世道人心』的啊!在那個沒有『專利保護』的『祖傳秘方』年代,也許有人會因為『知識無價』和『智慧共享』破解所謂的『巧妙』,這樣的人在今天就成了標準『傻鳥』,豈有不先『申請專利』後,再談公開的『道理』呢!果真如俗語所說的『成也蕭何,敗也蕭何』的啊!!

社會中人的『分工』和『合作』,是所有人的『福祉』與『共享』,一個『誰多誰寡』以及『勞心勞力』的『計價』和『分配』問題,不知還要再『繼續』爭議幾千年呢!!

作者以為這是必須省思的問題,試想人們認為『科學』屬於全人類應當彼此『分享』,難道說人類的『科學』就不是『大自然』的『逆向工程』??或許我們真的是需要『公平哲學』︰

‧《物理哲學·下中

‧《物理哲學·下中………

‧《物理哲學·下中…………

‧《物理哲學·下中+‧

 

眼下就讓我們探探『 vc4asm project 』── VC4ASM – macro assembler for Broadcom VideoCore IV aka Raspberry Pi GPU ── 的『 Broadcom VideoCore IV 』  GPU 『反向工程』專案已經取得之不容易的成果吧!!

# 保存原有 apt-sources
more /etc/apt/sources.list
deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rp
i
…

# 將 apt-sources 修改成
more /etc/apt/sources.list
deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rp
i
sudo apt-get update

# 安裝 4.9 版 gcc 與 g++
sudo apt-get install gcc-4.9 g++-4.9

# 還原原有 apt-sources
more /etc/apt/sources.list
deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rp
i
…

# 編譯
cd ~
wget http://maazl.de/project/vc4asm/vc4asm.tar.bz2
tar xf vc4asm.tar.bz2

# 修改 ~/vc4asm/src/Makefile
FLAGS    = -Wall -std=c++11 -g
CPPFLAGS = -c
LDFLAGS  =
LIBS     = -lm -lstdc++
CC  = g++-4.9
LD  = gcc-4.9
EXE =
OBJ = .o

make

# 編譯後程式位於 ~/vc4asm/bin
~/vc4asm/bin $ ./vc4asm
vc4asm V0.1.4
Usage: vc4asm [-o <bin-output>] [-{c|C} <c-output>] [-V] <qasm-file(s)>
 -o<file> Binary output file.
 -c<file> C output file with trailing ','.
 -C<file> C output file withOUT trailing ','.
 -V       Run instruction verifier and print warnings about suspicious code.

~/vc4asm/bin $ ./vc4dis
vc4dis V0.1
Usage: vc4dis [-x[32|64]] [-M] [-F] [-v] [-b <addr>] [-o <out_file>] [-V] <code_file(s)>
 -x    Hexadecimal input, comma separated (rather than binary).
 -x64  64 bit formatted hexadecimal input.
 -M    Do not print simple ALU instructions and load immediate as mov.
 -F    Print floating point constants as hexadecimal.
 -v    Binary code and offset as comment behind each line.
 -v2   Write internal instruction field as comment behind every line also.
 -b<addr> base address (only for output).
 -o<file> Write output to this file rather than stdout.
 -V    Run instruction verifier and print warnings about suspicious code.