使用 Android NDK 來build SDL2_image 時, 出現如下錯誤訊息
SDL2_image/IMG_webp.o: in function IMG_InitWEBP:jni/SDL_image/IMG_webp.c:123: error: undefined reference to 'WebPDecodeRGBAInto'
這時在 SDL_image 的 Android.mk 最後面加上這幾行
#
# 假設環境變數 NDK_ROOT 指到 NDK
#
# 設定 NDK_MODULE_PATH
#
$(call import-add-path,$(NDK_ROOT)/sources)
$(call import-add-path,./$(LOCAL_PATH))
# 叫 ndk-build 編譯 libwebp
$(call import-module,$(WEBP_LIBRARY_PATH))
2014年5月29日 星期四
2014年4月15日 星期二
多線程 tar 壓縮與解壓縮
TAR 是單線程的,
就算是多核 CPU,
只有單核 CPU
使用率
100%, 其他的在睡覺.
有人寫了多線程壓縮器來充分使用多核心優勢
http://www.zlib.net/pigz/
http://lbzip2.org/
http://www.nongnu.org/lzip/plzip.html
http://jnovy.fedorapeople.org/pxz/
http://sourceforge.net/projects/pixz/files/
https://wiki.archlinux.org/index.php/Lrzip
http://lbzip2.org/
http://www.nongnu.org/lzip/plzip.html
http://jnovy.fedorapeople.org/pxz/
http://sourceforge.net/projects/pixz/files/
https://wiki.archlinux.org/index.php/Lrzip
在 ubuntu
直接安裝
sudo apt-get install
pigz
sudo apt-get install lbzip2
sudo apt-get install plzip
sudo apt-get install lrzip
pxz & pixz 目前不在 ubuntu 套件內, 需要自己拉 source code rebuild
sudo apt-get install plzip
sudo apt-get install lrzip
pxz & pixz 目前不在 ubuntu 套件內, 需要自己拉 source code rebuild
Compress
tar -I pigz -cf test.tar.gz *
tar -I pigz -cf test.tar.gz *
Decompress
tar -I pigz -xf test.tar.gz
tar -I pigz -xf test.tar.gz
剩下的問題就看 Harddisk & memory 速度有多快
也可以把 pigz rename 成 gzip, 來省去 "-I pigz"
另外有人拿 tar 的 source code 重新編譯, 在 configure 加參數
"--with-gzip=pigz" "--with-bzip2=lbzip2" "--with-lzip=plzip"
這樣就不需要使用 "-I xxx" 參數
tar --help | grep "lbzip2\|7x\|plzip\|pigz"
-j, --bzip2 filter the archive through lbzip2
-J, --xz filter the archive through 7x
--lzip filter the archive through plzip
-z, --gzip, --gunzip, --ungzip filter the archive through pigz
也可以把 pigz rename 成 gzip, 來省去 "-I pigz"
另外有人拿 tar 的 source code 重新編譯, 在 configure 加參數
"--with-gzip=pigz" "--with-bzip2=lbzip2" "--with-lzip=plzip"
這樣就不需要使用 "-I xxx" 參數
tar --help | grep "lbzip2\|7x\|plzip\|pigz"
-j, --bzip2 filter the archive through lbzip2
-J, --xz filter the archive through 7x
--lzip filter the archive through plzip
-z, --gzip, --gunzip, --ungzip filter the archive through pigz
2014年2月18日 星期二
Lenovo 筆電 G780 換硬碟之後, 重新安裝Win8 一鍵還原, install onekey recovery for new Win8 OS in Lenovo G780
買新筆電, 不小心把一鍵還原搞死掉, 只好拿個新硬碟來研究如何救回一鍵還原.
請注意, 這過程只限於個人學習記錄, 在你的筆電實施, 不見得會正確,
有問題最好是送聯想客服處理.
1. 首先你要有一版 Win8 OS DVD, PRO 或是 STD或是MSDN 都無所謂. 只要能安裝就可以.
2. 我的筆電預裝OS是 Win8 x64 標準版. 所以要去找Win8 的一鍵還原 AP.
在這個地方找到 okrwin8.exe
http://support.lenovo.com/en_US/downloads/detail.page?DocID=DS035708
3. 然後要找在硬碟製作一鍵還原的環境, 這個需要一個聯想維修站用的 AP
google " WIN8_OKR8.0(Without_OS)_130106_evozi.com.iso"
我在這裏找到 https://mega.co.nz/temporary/mega/2cEFDYCR
將這個 ISO 還原到 USB flash drive. 我看的教學如下是用 ultraISO 還原.
http://plus.evozi.com/143/lenovo-one-key-recovery-okr-8-0-iso-and-download-and-setup-guide/
4. 要從原硬碟取出需要的最初還原檔, 需要一個修改 GPT partition 工具.
我用的是 EaseUS Partition Manager free version
http://www.easeus.com/partition-manager/
5. 準備一個 USB flash driver 或是 USB 硬碟, 容量要大於 10GB, 這是要備份最初還原檔.
6. Win8 PE USB flash drive. 這個可有可無, 有是比較方便除錯.
下面就是我 try 出來的步驟
1. 取得最初還原檔.
1.a 在原硬碟安裝 EaseUS partition manager. 用 partition manager 將 "PBR_DRV" 設定為 unhide,
以我的例子, partition manager 會加一個 F: 碟
注意 EaseUS partition manager 會亂改 GPT partition Type. 這樣一鍵還原 AP 就會失效
1.b 在 F: 可以找到兩個目錄 "OKRBackup" & "onekey"
1.c 用系統管理員權限, 在 F:\OKRBackup\Factory 之下有個隱藏檔 install.wim, 將其 unhide.
1.d copy F:\OKRBackup 的內容到 USB flash drive.
1.e 恢復 EaseUS partition manager 搞爛的 GPT parition type.
參考這篇以及一鍵還原 WinPE 內的 create.cmd & create.ini
http://amigotechnotes.wordpress.com/2013/12/07/recover-lenovo-one-key-rescue-after-resizing-partitions/
製作 fixid.cmd & fixid.ini 如下, 這樣可以把 GPT type 改回來.
fixid.ini
2. 乾淨的硬碟裝到 G780, 用 Win8_OKR8 USB driver 開機, 同意安裝一鍵還原
3. 安裝 Win8 OS, 選擇要安裝到 "Windows8_OS" 這個 partition
4. Win8 安裝後, 安裝 okrwin8.exe
5. 執行 Onekey Recovery, 你會發現可以做"系統備份" 但是系統還原的"最初還原" 是不能用的.
因為我們還沒有最初還原檔.
6. 安裝 EaseUS partition manager. 用 partition manager 將"PBR_DRV" 設定為 unhide,
注意 EaseUS partition manager 會亂改 GPT partition Type. 這樣一鍵還原 AP 就會失效
7. 將之前存的 . OKRBackup 的備份, copy 到新硬碟的 F:\OKRBackup, 若是有相同檔名就跳過不要覆蓋, 我的 case 是 Info.ini, Boot.okr, MBR.okr 這3個 file.
8. 用 1.e 恢復 EaseUS partition manager 搞爛的 GPT parition type.
9. 再用一鍵還原, 做最初還原, 這樣就會得到最初的 OEM 版 Win8, 相當於剛安裝完OS, 輸入個人帳號的階段.
請注意, 這過程只限於個人學習記錄, 在你的筆電實施, 不見得會正確,
有問題最好是送聯想客服處理.
1. 首先你要有一版 Win8 OS DVD, PRO 或是 STD或是MSDN 都無所謂. 只要能安裝就可以.
2. 我的筆電預裝OS是 Win8 x64 標準版. 所以要去找Win8 的一鍵還原 AP.
在這個地方找到 okrwin8.exe
http://support.lenovo.com/en_US/downloads/detail.page?DocID=DS035708
3. 然後要找在硬碟製作一鍵還原的環境, 這個需要一個聯想維修站用的 AP
google " WIN8_OKR8.0(Without_OS)_130106_evozi.com.iso"
我在這裏找到 https://mega.co.nz/temporary/mega/2cEFDYCR
將這個 ISO 還原到 USB flash drive. 我看的教學如下是用 ultraISO 還原.
http://plus.evozi.com/143/lenovo-one-key-recovery-okr-8-0-iso-and-download-and-setup-guide/
4. 要從原硬碟取出需要的最初還原檔, 需要一個修改 GPT partition 工具.
我用的是 EaseUS Partition Manager free version
http://www.easeus.com/partition-manager/
5. 準備一個 USB flash driver 或是 USB 硬碟, 容量要大於 10GB, 這是要備份最初還原檔.
6. Win8 PE USB flash drive. 這個可有可無, 有是比較方便除錯.
下面就是我 try 出來的步驟
1. 取得最初還原檔.
1.a 在原硬碟安裝 EaseUS partition manager. 用 partition manager 將 "PBR_DRV" 設定為 unhide,
以我的例子, partition manager 會加一個 F: 碟
注意 EaseUS partition manager 會亂改 GPT partition Type. 這樣一鍵還原 AP 就會失效
1.b 在 F: 可以找到兩個目錄 "OKRBackup" & "onekey"
1.c 用系統管理員權限, 在 F:\OKRBackup\Factory 之下有個隱藏檔 install.wim, 將其 unhide.
1.d copy F:\OKRBackup 的內容到 USB flash drive.
1.e 恢復 EaseUS partition manager 搞爛的 GPT parition type.
參考這篇以及一鍵還原 WinPE 內的 create.cmd & create.ini
http://amigotechnotes.wordpress.com/2013/12/07/recover-lenovo-one-key-rescue-after-resizing-partitions/
製作 fixid.cmd & fixid.ini 如下, 這樣可以把 GPT type 改回來.
fixid.ini
select disk 0 sele part 1 set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac" sele part 2 sele part 3 sele part 4 sele part 5 sele part 6 sele part 7 set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac" list volume select disk 0 list partition sel par 3 set id="BFBFAFE7-A34F-448A-9A5B-6213EB736C22" list volume exit
fixid.cmd
diskpart /s fixid.ini
2. 乾淨的硬碟裝到 G780, 用 Win8_OKR8 USB driver 開機, 同意安裝一鍵還原
3. 安裝 Win8 OS, 選擇要安裝到 "Windows8_OS" 這個 partition
4. Win8 安裝後, 安裝 okrwin8.exe
5. 執行 Onekey Recovery, 你會發現可以做"系統備份" 但是系統還原的"最初還原" 是不能用的.
因為我們還沒有最初還原檔.
6. 安裝 EaseUS partition manager. 用 partition manager 將"PBR_DRV" 設定為 unhide,
注意 EaseUS partition manager 會亂改 GPT partition Type. 這樣一鍵還原 AP 就會失效
7. 將之前存的 . OKRBackup 的備份, copy 到新硬碟的 F:\OKRBackup, 若是有相同檔名就跳過不要覆蓋, 我的 case 是 Info.ini, Boot.okr, MBR.okr 這3個 file.
8. 用 1.e 恢復 EaseUS partition manager 搞爛的 GPT parition type.
9. 再用一鍵還原, 做最初還原, 這樣就會得到最初的 OEM 版 Win8, 相當於剛安裝完OS, 輸入個人帳號的階段.
2014年2月13日 星期四
使用 Grub4DOS 啟動 ubuntu 12.04.2 Live CD 出現 “The system is running in low-graphics mode” 然後就卡住
用 USB flash drive 用 grub4dos 裝 ubuntu 12.04.2 Live CD, menu.lst 加入設定如下
title ubuntu 12.04.2 x86 Live CD
find --set-root /ISO/ubuntu-12.04.2-x86.iso
map /ISO/ubuntu-12.04.2-x86.iso (0xff) || map --mem /ISO/ubuntu-12.04.2-x86.iso (0xff)
map --hook
root (0xff)
kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper persistent iso-scan/filename=/ISO/ubuntu-12.04.2-x86.iso quiet splash --
initrd /casper/initrd.lz
但是在某些機台會出現 low-graphics mode error , 然後就無法進入 x-windows

姑狗大神說要加 xforcevesa
在參數 splash 後面加了 xforcevesa, 果然就可以了.
title ubuntu 12.04.2 x86 Live CD
find --set-root /ISO/ubuntu-12.04.2-x86.iso
map /ISO/ubuntu-12.04.2-x86.iso (0xff) || map --mem /ISO/ubuntu-12.04.2-x86.iso (0xff)
map --hook
root (0xff)
kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper persistent iso-scan/filename=/ISO/ubuntu-12.04.2-x86.iso quiet splash --
initrd /casper/initrd.lz
但是在某些機台會出現 low-graphics mode error , 然後就無法進入 x-windows
姑狗大神說要加 xforcevesa
在參數 splash 後面加了 xforcevesa, 果然就可以了.
2013年10月10日 星期四
用 mingw rebuild linux network ap, 找不到 netdn.h, inet.h, socket.h
google 到是 在 win32 改用 winsock2.h, 但我還沒有用看看, 我乾脆用 cygwin
#ifdef WIN32
# include < winsock2.h >
#else
# include < netdn.h >
# include < inet.h >
# include < socket.h>
# include
# indlude
#endif
#ifdef WIN32
# include < winsock2.h >
#else
# include < netdn.h >
# include < inet.h >
# include < socket.h>
# include
# indlude
#endif
gcc 錯誤 「for」 loop initial declarations are only allowed in C99 mode
像這樣的 code, gcc 報錯
for(int i = low; i <= high; ++i)
需要在 cflags 加 -std=c99, 或是不要在 for loop 宣告變數
訂閱:
文章 (Atom)