Monday, August 29, 2011

http://www.linuxpicnic.org/twiki/bin/view/Picnix20/

Picn*x 20 - The Linux 20th Anniversary Picnic 简单回顾

硅谷地区一年一度的 Linux 周年纪念日野餐活动照例在 Sunnyvale Baylands Park.举办,上周六8月27日上午11点到下午4点;这个活动自2001年的Linux十周年纪念开始到现在已经是第十个年头了;地点所在公园其实是沿着 SF Bay 从 Palo Alto, Mountain View, Sunnyvale, Santa Clara, 到 Milpitas 很长的海湾公园的其中一段,刚好这一段在 Sunnyvale 而已;公园的网站上有写明禁止宠物入内,主要是保护海湾公园的珍稀动植物,号召 Commute 拼车或乘公交前往,我就乘坐VTA轨道线到Crossman车站并下车步行了二十分钟到达;


这里是VTA轨道线Crossman车站、硅谷一带到处都是知名公司、这里背后是NetApp

路过NetApp的超小型四座送货车

到达了会场,远观真是声势浩大,有上百人吧
登记后每人贴上贴纸姓名便于聊天时互相可以知道姓名;近观看到很多都是Family一同前来的,甚至还带着刚出生的Baby就放在桌子上玩

Fedora组的OLPC、上面是Fedora15的Sugar界面;和手摇发电机、背后还有一块是太阳能电池板,能在野外有日光的情况下给电脑充电

Ubuntu组的情况在哪里都是人最多的、不过这次我都没有时间去近观

左边是家长带着他的小孩前来学习OLPC;
背后的白帽大叔是SFLUG的活跃成员,他们城区的活动比较多;
我在里面问到什么时候会用上 Wayland Default; 以及 Multi Pointer 特性有没有;
好像人们普遍误区把 Multi Pointer 理解成 Multi Mouse 支持了,我仔细解释了一下现有的 Linux 桌面上插多个 Mouse 还是只能控制同一个 Cursor; 而真正的 Multi Pointer 是指屏幕上会出现多个 Cursor, 每个 Mouse 分别控制一个;虽然这个概念很早就有了,在Xorg上也有人在实做,但我不知道进行到什么进度了
会场有人也是第一次听到这个吓了一跳,这能干什么呀?为什么需要多个 Cursor ?
我举例说多人在用多个鼠标在同一个电脑上玩游戏,应该是 More fun

和白帽大叔聊了比较多、他说到十天后他会再次起程前往 非洲 Tanzania 内罗毕 进行下一期三个月的Volunteering
我说 Vim Author 有一段提到 Uganda 的情况,确实需要很多的志愿者

(在vim里面可以 :help iccf)

还有最近看过的2007年电影 Hotel Rwanda, 描述1994年的 Rwanda Genocide
大叔说他一直在 freenode #vim channel 里面,回答了人们关于Uganda的很多问题
佩服!

对了,硅谷的人一般都叫城区就是SF,才算City, 只有City里面才有点像样的高楼; 而硅谷这边MV, Sunnyvale,  ... 什么的都是一排排小平房、最多就两三层,公司楼说好听也叫做写字楼,但其实都叫厂房

这个其实说的是 Twiki 的 web app,  与LEGO好像没有看到

SVWUX 组部署完成的室外 Wifi  Repeater;  作为Wifi热点提供给大家Wifi上网
这里的Wifi流量是通过这个 Repeater 转发到周围山上的多个Wifi接收机再到 Internet 的
我在现场用Android试过了此Wifi发送图片Twitter速度不错!
现场还有另外的人使用自己的3G数据卡将自己的Linux笔记本设置成Router,再通过无线路由器给大家提供冗余的Wifi 热点,很不错
现场得益于公园良好的环境、设施,电源、水源、烧烤场都是免费使用,有洗手间,作为固定设施的很多桌子底下都是电源插座

-

生态环境真不错,还长出了大蘑菇、想起了老家的群山哪

- -
玩 Amateur Radio 业余无线电的一组人、或者又叫做 HAM 火腿族

美少女、和父亲一块儿来都是 RedHat Volunteer (T-shirt) ;  健谈,谈到其父亲德国裔、母亲来自南美Columbia;  乐于分享自己的暑期项目住在 Costa Rica / Panama 火山 Hotel 的情形,期盼着 Christmas 假期可以去(另一个南美国度) 第一次见到 Grandmother、团聚;父亲向大家介绍她13岁、人多的时候还会 Camera Shy
其父亲会多国语言,甚至包括 Chinese Mandarin, 和我直接中文对话了一会儿


Friday, August 19, 2011

Step 2: boot livedvd-amd64-multilib-11.2.iso from hard disk (with grub2)

After a few days experience of the gentoo livedvd run from usb, I think the usb drive should be saved for some other important data; I decided to copy the iso and run it from hard disk; usually a hard disk has large enough space, people could just copy all files inside /image.squashfs to a local partition, like the way on gentoo-wiki, but this computer assigned to me has a SSD drive default, has only 120G, furthermore, it's already partitioned long time ago, I don't have more space to back up all data on it and don't want to risk re-partition it; so I'd still like the way of loop mount iso on the fly, for saving disk space;
http://www.gentoo-wiki.info/HOWTO_Lightning_fast_install_from_LiveCD

/dev/sda3       240277504   250068991     4895744   83  Linux
/dev/sda5       129341440   132855807     1757184   82  Linux swap / Solaris
/dev/sda6       132857856   152387583     9764864   83  Linux LABEL=UBUNTU
/dev/sda7       152389632   210980863    29295616   83  Linux LABEL=HOME
/dev/sda8       210982912   211372031      194560   83  Linux LABEL=DEBIAN

The ubuntu partition already has grub2 default installed and home partition has a lot of remaining space, so I mkdir /gentoo under /home, put livedvd-amd64-multilib-11.2.iso there, rename or hardlink a short name gentoo.iso there; extract kernel/initramfs from the iso and put into /boot of the ubuntu partition, create a new entry there and no need to install another grub;

Notice that grub2 (version 1.9*) has slightly different syntax with grub1 (version 0.9*):
  1. disk partition order, counter from 1, same as Linux partitions;
  2. better not to change (append entries) in grub.cfg directly, use /boot/grub/custom.cfg instead; because every time later ubuntu upgrade or install new kernels would call update-grub2 that would overwrite grub.cfg; you could change /etc/grub/40_custom (that support script smart calculation) or /boot/grub/custom.cfg on that ubuntu partition; here I use custom.cfg;
Gentoo-11 ~ # cat /mnt/sda6/boot/grub/custom.cfg
menuentry "Gentoo11-Live Linux-3.0.0 (on /dev/sda7 {gentoo/gentoo.iso})" {
	  linux (hd0,6)/boot/gentoo/gentoo aufs_mem=2G cdroot=/dev/sda7 cdroot_type=ext4 isoboot=gentoo/gentoo.iso vga=791 splash=silent,theme:livecd-10 console=tty1 quiet nodetect doload=ahci dox
	  initrd (hd0,7)/gentoo/gentoo-initramfs.gz
}

Compared to previous menuentry in syslinux.cfg, here I removed some unused parameters (like "root=/dev/ram0 init=/linuxrc" because that is the default, I think I should recommend the Gentoo-Ten team to remove that, but not sure if any other computer need it, at least my computer doesn't need it, it could boot, as granted; the only useful parameters here are:
  1. aufs_mem=2G, it means how large of tmpfs layered on top of squashfs by aufs; default it's 420M tmpfs, enough if you don't modify/install too many applications in live mode;
  2. cdroot=/dev/sda7, specify a parameter saves parsing during booting; specify cdroot_type the same way;
  3. isoboot=gentoo/gentoo.iso, you need to specify where do you save that iso inside that partition; it's required;
  4. nodetect doload=ahci dox; depends on if you know your hardware, if no idea, autodetect is best, but I know my hardware, specifying it could save booting time;
The default gentoo kernel/initramfs should work this way I thought originally, but it doesn't, I have to look at the init script and change it a little, here is the diff: http://paste.pocoo.org/show/460334/

the initramfs is just cpio (newc format) + gz; extract and reconstruct in this way;
$ mkdir -vp gentoo-initramfs
$ zcat gentoo.igz |(cd gentoo-initramfs; cpio -d -i)
$ emacs -nw gentoo-initramfs/...; modify /init and /etc/init.scripts
$ (cd gentoo-initramfs/; find |cpio -H newc -o) |gzip -v9 >gentoo-initramfs.gz
Or
$ (cd gentoo-initramfs/; find |cpio -H newc -o) |xz -v9 >gentoo-initramfs.xz
Gentoo-11 ~ # (cd /home/gentoo/; ls -lh gentoo-initramfs.*)
-rw-r--r-- 1 root root 9.8M Aug 16 02:25 gentoo-initramfs.gz
-rw-r--r-- 1 root root 7.5M Aug 15 17:50 gentoo-initramfs.xz
The latest xz (aka. lzma2) could save 20% over "gzip -v9";

Update: use "xz --check=crc32" instead, because some latest xz support "none,crc32,crc64,sha256" or more types of integrity check, default as crc64; the kernel xz dec is "xz embedded" that only support "none or crc32",  kernel may report XZ_OPTIONS_ERROR, you could use "xz -vl ..." to check it, read Documentation/xz.txt for more;
/usr/src/linux-3.0-gentoo-r1/lib/decompress_unxz.c:
-=--:%%--F1  decompress_unxz.c   92% L364   (C/l Abbrev)

        case XZ_OPTIONS_ERROR:
                error("Input was encoded with settings that are not "
                                "supported by this XZ decoder");
                break;

# (cd gentoo-initramfs/; find |cpio -H newc -o) |xz --check=crc32 -v9 >../gentoo-initramfs.xz

Thursday, August 18, 2011

Step 1: boot livedvd-amd64-multilib-11.2.iso from a usbstick (without wiping all data)
Gentoo Linux releases 11.2 LiveDVD: run the iso from hard disk (hack on initramfs)

Recently Gentoo LiveDVD 11.2 was released on Aug 7, I'd like to try it but don't want to waste a blank DVD; the first thing I think is to run it on a usb; the only usb stick I have important data, don't want to try the dd way ("dd if=image.iso of=/dev/sdb")  in faq which will wipe out all data, looking up some documentation on its default isolinux/syslinux, finally I got this way working:

1) mount loop that livedvd-amd64-multilib-11.2.iso; mkdir /gentoo on the usb stick, copy all files inside the iso into that /gentoo;
2) rename its isolinux/ to syslinux/, and isolinux.cfg to syslinux.cfg; yes! thanks to syslinux.zytor.com great work, they're sharing the same configuration file syntax, what you need to do is just rename;
3) since we copied all the files from rootdir of cdrom to /gentoo of another disk(usb), the syslinux.cfg need to be adjusted; find out the "label gentoo-x86_64", change it to this;


label gentoo-x86_64
  MENU LABEL Gentoo ^x86_64
  kernel ../boot/gentoo
  append root=/dev/ram0 init=/linuxrc dokeymap aufs looptype=squashfs loop=/gentoo/image.squashfs cdroot initrd=../boot/gentoo.igz vga=791 splash=silent,theme:livecd-10 console=tty1 quiet subdir=gentoo

the "kernel" "initrd=" parameters was parsed by syslinux so it support "../" style relative path, so you could move the whole "/gentoo" to any name, under any path; but the "loop=" and some otherwhere was read by code inside the initramfs (here it's ../boot/gentoo.igz), there some hard code doesn't support relative path, so you must write its full absolute path, prepend "/gentoo" to image.squashfs, and append "subdir=gentoo";

for other label entries if you want to use, you could change the same way;

4) install syslinux bootsector to that usb stick (/dev/sdb has only one vfat partition):
  syslinux -d /gentoo/syslinux /dev/sdb1

Then you could boot it with this usb: find out label gentoo-x86_64 and boot it into LiveDVD 11.2;
The 2.8G iso file has packaged with linux kernel 3.0.0 and most a dozen of major and minor WM Environment (gnome3/kde4/xfce/lxde/windowmaker/openbox/fluxbox/awesome/xmbc/...), and all applications on each WM; just try and found which is your favorite? all the latest software;


http://www.gentoo.org/news/20110807-livedvd.xml
http://syslinux.zytor.com/wiki/index.php/SYSLINUX
http://paste.pocoo.org/show/460334/
http://www.gentoo.org/proj/en/pr/releases/10.0/faq.xml
http://mirrors.kernel.org/gentoo/releases/amd64/11.2/

livedvd-amd64-multilib-11.2.iso                      06-Aug-2011 07:12  2.8G