2011年5月26日 星期四

Gnu Parted

parted /dev/sdb

print
rm XXX
mklabel gpt
mkpart primary 1MB 3TB
print
mkfs.ext4 /dev/sdb1
# Reduce Reserved Space from 5% to 1%
tune2fs -m 1 /dev/sdb1


Ubuntu, formatting a 3TB drive
http://amaras-tech.co.uk/article/158/Ubuntu,_formatting_a_3TB_drive

[wiki] GNU Parted
http://en.wikipedia.org/wiki/GNU_Parted

http://ftp.gnu.org/gnu/parted/
parted-2.4.tar.xz
http://ftp.gnu.org/gnu/parted/parted-2.4.tar.xz


Build error with my uclibc toolchain, while no issue with glibc toolchain.
  CC       canonicalize-lgpl.lo
canonicalize-lgpl.c:71:1: error: "__set_errno" redefined
In file included from canonicalize-lgpl.c:40:
/arm-linux-le-uclibc-gcc-4.3.3-2010.05/usr/include/errno.h:63:1: error: this is the location of the previous definition
make[8]: *** [canonicalize-lgpl.lo] Error 1

FIX:
diff --git a/apps-pool/parted-2.4/lib/canonicalize-lgpl.c b/apps-pool/parted-2.4/lib/canonicalize-lgpl.c
index 1574ec1..e058d8f 100644
--- a/apps-pool/parted-2.4/lib/canonicalize-lgpl.c
+++ b/apps-pool/parted-2.4/lib/canonicalize-lgpl.c
@@ -68,7 +68,9 @@
# define __getcwd(buf, max) getwd (buf)
# endif
# define __readlink readlink
+#ifndef __set_errno
# define __set_errno(e) errno = (e)
+#endif
# ifndef MAXSYMLINKS
# ifdef SYMLOOP_MAX
# define MAXSYMLINKS SYMLOOP_MAX

2011年5月23日 星期一

正義:一場思辨之旅(JUSTICE: What’s the Right Thing to Do)

正義:一場思辨之旅
JUSTICE: What’s the Right Thing to Do
http://www.books.com.tw/exep/prod/booksfile.php?item=0010497671

第1講-正義:一場思辨之旅-Michael Sandel
http://www.youtube.com/watch?v=sHHa4ETr2jE

第2講-正義:一場思辨之旅-Michael Sandel
http://www.youtube.com/watch?v=DCx3O3gygok&feature=related

第3講-正義:一場思辨之旅-Michael Sandel
http://www.youtube.com/watch?v=0EwJRUzVYxk&feature=related

第4講-正義:一場思辨之旅-Michael Sandel
http://www.youtube.com/watch?v=J9btigv8l4s&feature=related

第6講-正義:一場思辨之旅-Michael Sandel
http://www.youtube.com/watch?v=33nzbYo-NWg&feature=related

2011年5月19日 星期四

[報稅]登入畫面出現一堆亂碼或問號(????)(只看到年度及部分英文字)?

http://tax.nat.gov.tw/info_ans.html?id=1&isTop=y#ans_0_4_16

登入畫面出現一堆亂碼或問號(????)(只看到年度及部分英文字)?
請您依步驟進行檢查:點選 開始-->設定-->控制台-->地區及語言選項 : 要選擇中文(台灣) 才對喔。

2011年5月9日 星期一

error: asm/bitsperlong.h: No such file

linux/include/asm-generic/int-ll64.h:11:29: error: asm/bitsperlong.h: No such file
make[8]: *** [wlanconfig] Error 1



diff --git a/kernels/linux-2.6.35.12-cavm1/include/asm-generic/int-ll64.h b/kernels/linux-2.6.35.12-cavm1/include/asm-generic/int-ll64.h
index f394147..f0a6e55 100644
--- a/kernels/linux-2.6.35.12-cavm1/include/asm-generic/int-ll64.h
+++ b/kernels/linux-2.6.35.12-cavm1/include/asm-generic/int-ll64.h
@@ -8,7 +8,8 @@
#ifndef _ASM_GENERIC_INT_LL64_H
#define _ASM_GENERIC_INT_LL64_H

-#include <asm/bitsperlong.h>
+//#include <asm/bitsperlong.h>
+#include <asm-generic/bitsperlong.h>

#ifndef __ASSEMBLY__
/*


This seems not the best solution.
1. user space application shouldn't include kernel header file from kernel, but from the installed kernel header
2. if installed kernel header is too old, one should install a new kernel header and REBUILD C LIBRARY...



KernelHeaders
http://kernelnewbies.org/KernelHeaders
User space programs

In general, user space programs are built against the header files provided by the distribution, typically from a package named glibc-devel, glibc-kernheaders or linux-libc-dev. These header files are often from an older kernel version, and they cannot safely be replaced without rebuilding glibc as well. In particular, installing /usr/include/linux as a symbolic link to /usr/src/linux/include or /lib/modules/*/build/include/linux is highly discouraged as it frequently breaks rebuilding applications. For instance, older kernels had the architecture specific header files in include/asm-${arch} instead of arch/${arch}/include/asm and had on a symlink to the architecture specific directory.

The correct way to package the header files for a distribution is to run 'make headers_install' from the kernel source directory to install the headers into /usr/include and then rebuild the C library package, with a dependency on the specific version of the just installed kernel headers.


Re: 2.6.31.1 BUG #include <asm/bitsperlong.h>
http://linux.derkeiler.com/Mailing-Lists/Kernel/2009-09/msg10738.html

asm-generic: introduce asm/bitsperlong.h
http://www.kerneltrap.com/mailarchive/git-commits-head/2009/6/13/5958143

error: dereferencing pointer to incomplete type

I got following error:

debug.c: In function '_get_pid':
debug.c:6: error: dereferencing pointer to incomplete type

while compiling module on 2.6.35 contain following code:
static inline pid_t *_get_pid(void)
{
return current->pid;
}


The same module has no issue on 2.6.31.

Strange error(dereferencing pointer to incomplete type)
http://stackoverflow.com/questions/2693393/strange-errordereferencing-pointer-to-incomplete-type
The solution is to include both of these headers:
#include <linux/sched.h>
#include <linux/fs_struct.h>

2011年5月3日 星期二

Fixing SVN connection timeout

netstat -l

tcp 0 0 *:svn *:* LISTEN


socklist
tcp 3690 273396 81 28455 3 svnserve



nmap -p3689-3691 172.20.1.150
Starting Nmap 5.00 ( http://nmap.org ) at 2011-05-04 13:22 CST
Interesting ports on kuso (172.20.1.150):
PORT STATE SERVICE
3689/tcp closed rendezvous
3690/tcp filtered svn
3691/tcp closed unknown
MAC Address: 00:13:D4:3B:70:64 (Asustek Computer)


Changing to new kernel but the situation remain.
Add a rule in iptables (default is in filter) to match dport 3690 result in no packet matched.


Gentoo will save iptables rules at /var/lib/iptables/rules-save on reboot

/etc/init.d/svnserve
/etc/conf.d/svnserve

iptables -nvL -t mangle
Chain PREROUTING (policy ACCEPT 12G packets, 7166G bytes)
pkts bytes target prot opt in out source destination
724 40840 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:3690


After flushing it with "iptables -F -t mangle"

nmap -p3689-3691 172.20.1.150
Starting Nmap 5.00 ( http://nmap.org ) at 2011-05-05 11:12 CST
Interesting ports on kuso (172.20.1.150):
PORT STATE SERVICE
3689/tcp closed rendezvous
3690/tcp open svn
3691/tcp closed unknown
MAC Address: 00:13:D4:3B:70:64 (Asustek Computer)


Do remember check all the iptables tables (nat, filter, mangle, and raw).