102014
 

bladeRF 维基上介绍了在 Linux 系统上搭建 bladeRF 环境的步骤,不过原文是英文的,另外其中一些具体选择不尽合理。本文以 Fedora 系统为示例,提供一个中文版的 bladeRF 环境搭建指南,并着重介绍和维基上的不同点。比较可能有一定的时效性,但一些原则应该足够通用。本文的比较基准是当前的维基版本

安装依赖

维基上建议安装 “Development Tools” “Development Libraries” 两个软件包组,但我们只需要其中的一部分软件包,其中有些可能已经安装过了,而像 cvs 等并不必须。如果你像我一样有“洁癖”,不希望安装不需要的软件包,那么可以用如下的命令安装必须的依赖(未严格验证,在我这里绝大多数包都在之前安装过了):

sudo yum install git doxygen gettext glibc-devel ncurses-devel readline-devel zlib-devel boost-devel
sudo yum install libusbx libusbx-devel cmake wget gcc-c++

注意其中是 libusbx 而非 libusb,后者是 0.x 系列的版本,而非 1.x 系列。Debian/Ubuntu 系的用户会注意到软件包命名上的差异 (devel 而非 dev)。

维基上推荐安装 libtecla,以增强 bladeRF-cli 交互模式的编辑功能。不过 Fedora 软件源里目前还没有这个包,所以需要手动下载,解压缩,使用经典的 ./configure; make; sudo make install 三部曲安装。

构建 bladeRF

在终端下进入打算用来放置 bladeRF 源码的目录,用 git 将 bladeRF 的源码库克隆下来:

cd /path/to/bladeRF/directory
git clone https://github.com/Nuand/bladeRF.git

切换到源码目录中的 host 目录,创建一个 build 目录用来存放构建过程的中间文件。这种使用单独的构建目录的方式称为树外构建 (out of tree build),相对于直接在源码目录构建,好处在于生成的中间文件不会分散在源码目录里,方便清理,另外可以用多个构建目录构建出互不干扰的不同参数下的版本。之后切换到构建目录,然后就是标准的 cmake ..; make; sudo make install 三部曲了。注意这里 cmake 时启用了 INSTALL_UDEV_RULES 宏,使得安装时把 udev 规则文件也安装到系统中。

cd bladeRF/host/
mkdir build
cd build
cmake -DINSTALL_UDEV_RULES=ON ../
make
sudo make install

很遗憾的是这里安装的 udev 规则文件使用了 plugdev 群组,不是 Fedora 下的标准做法。可以参考之前的博文修改 udev 规则文件。

为了让新安装的 bladeRF 库文件可以被二进制文件使用,我们需要用 ldconfig 刷新系统动态库的缓存。上面的构建过程会将 bladeRF 安装到 /usr/local 下,而其中的库文件目录 /usr/local/lib{,64} 不在 ldconfig 的默认搜索路径里。所以我们可以将它们添加到 /etc/ld.so.conf 里。添加之后文件内容如下:

/usr/local/lib
/usr/local/lib64
include ld.so.conf.d/*.conf

之后,用 sudo ldconfig 刷新缓存即可。可以用 ldd /usr/local/bin/bladeRF-cli 命令检查 bladeRF 库文件是否被找到。连上 bladeRF 设备,用 bladeRF-cli -p 命令看下是否能够发现设备。更多操作见于另一个维基页

构建 GNU Radio 与 gr-osmosdr

通过上述步骤,就可以操作 bladeRF 板卡了。但是,要想便捷地为 bladeRF 开发软件无线电应用,最好再构建一下 GNU Radio 和 gr-osmosdr。GNU Radio 是一个开源的软件无线电开发平台,提供众多的信号处理模块和简单易用的图形界面开发环境。gr-osmosdr 适配 GNU Radio,为众多硬件板卡(除了 bladeRF 之外还有 HackRF 等)提供一个统一的软件接口。

GNU Radio 依赖比较多,编译安装相对麻烦,一般推荐使用 build-gnuradio 脚本。但是因为其中涉及到从网络下载诸多软件以及编译安装,效率受网速和电脑硬件性能限制,耗时较长。另外,脚本的健壮性不高,所以很容易中途退出。这个脚本很长,但实际上是把整个构建过程划分为几个步骤,放在几个函数里先后执行的。我建议阅读这个 Shell 脚本,每次运行其中的一步或几步,必要时手动完成一些配置。对于新手,这会是一个很好的通过阅读代码学习 Shell 编程的机会。

具体的构建步骤可以在维基或这里找到,这里就不再赘述。只是提几点注意事项:

  • 如果你像我一样,除了 bladeRF 之外,还会使用 Ettus 公司的 USRP 系列设备,那么记得先构建 UHD,然后构建 GNU Radio。
  • build-gnuradio 脚本在 cmake 时,有时用了树外构建,但有时又没用。建议始终用树外构建。
  • 编译 GNU Radio 时,并行 make (make -j N 其中 N 大于 1)时有时会编译失败(竞态条件?),直接 make 就可以正常编译通过,虽然速度会慢很多。什么?make 也会出错?那考虑换一个 git 提交重新编译,并向上游报 BUG 吧。

构建成功 GNU Radio 后,构建 gr-osmosdr 就显得小菜一碟了,标准的 cmake 构建三部曲,项目不大,编译过程也能很快完成。

全部构建完成后,可以使用如下命令用 bladeRF 看一下频谱,检验是否大功告成。其中 FPGA 映像可以从 Nuand 网站下载。此外,最新固件也可以从官网下载。

osmocom_fft -a bladerf=0,fpga=<your FPGA image> -s 2000000 -f 446000000

致谢

本工作由星天科技赞助。

072014
 

最近,我发现 Fedora 系统上没有 plugdev 群组,而是使用动态 ACL 的方式允许普通用户访问可插拔设备等。

事情的缘由是我在折腾软件无线电 (SDR),更特别的说就是 bladeRF,它在编译安装时会自动安装相应的 udev 规则,以使得普通用户可以访问这块板卡。它提供的 udev 规则文件为 /etc/udev/rules.d/88-nuand.rules,内容如下:

# nuand bladeRF
ATTR{idVendor}=="1d50", ATTR{idProduct}=="6066", MODE="660", GROUP="plugdev"

# Reserved for future bladeRF-specific bootloader
ATTR{idVendor}=="1d50", ATTR{idProduct}=="6081", MODE="660", GROUP="plugdev"

# Cypress Bootloader
ATTR{idVendor}=="04b4", ATTR{idProduct}=="00f3", MODE="660", GROUP="plugdev"

其含义是将 bladeRF (以及相关设备)的权限设为仅属主和群组可读写,群组设为 plugdev。类似的使用 plugdev 群组的 udev 规则设置,在许多涉及可插拔外设的上游项目里都会看到。

然而事实上 Fedora 系统上是没有 plugdev 群组的。bladeRF 维基建议手动建立该群组,并将当前用户添加进去。 但这种做法其实是不被 Fedora 推荐的,原因是这种静态的设备管理群组

  • 不安全。考虑这样的一个场景:一个 SSH 远程登录的用户可以访问物理主机的摄像头、麦克风,只要他是该群组的成员。
  • 不灵活。需要手动地维护该群组的成员列表,新增用户还需要注销当前会话重启会话才能使用该设备。
  • 不具体。plugdev 群组的用户可以使用任何可插拔设备,不论这个设备是手机、摄像头还是麦克风。

Fedora 支持动态的权限控制 (ACL),可以根据用户会话状态、物理座位(seat)配置来决定是否授权设备。在这种机制下,udev 规则文件可以是简单的一行

SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \
  ATTRS{idVendor}=="1ed8", ATTRS{idProduct}=="000[456]" \
  ENV{ID_<some_name>}="1"

这里的 ID_<some_name> 是设备的一个“合适”的类别,例如 ID_CDROM, ID_MEDIA_PLAYER 等。它会出现在 Systemd 的 uaccess 规则文件 70-uaccess.rules 中,这个文件会授权此类设备给活跃用户。

遗憾的是,目前 uaccess 规则文件里并没有一个软件无线电有关的设备类别。所以暂时只能像如下的 udev 规则文件中那样,直接给设备加上 uaccess 的标签:

SUBSYSTEM!="usb", GOTO="nuand_rules_end"
ACTION!="add", GOTO="nuand_rules_end"

ATTR{idVendor}=="1d50", ATTR{idProduct}=="6066", TAG+="uaccess"

# Reserved for future bladeRF-specific bootloader
ATTR{idVendor}=="1d50", ATTR{idProduct}=="6081", TAG+="uaccess"

# Cypress Bootloader
ATTR{idVendor}=="04b4", ATTR{idProduct}=="00f3", TAG+="uaccess"

LABEL="nuand_rules_end"

注意 udev 规则文件命名时开头的数字编号需要小于 70,此时 uaccess 才会生效。如果设备已经连接到电脑上,要使新添加的或新修改的规则生效,还需要 udevadm trigger 一下。

事实上,邮件列表并不推荐上述做法,udev 与 Systemd 开发者 Kay Sievers 表示设备规则文件不应该直接设置 uaccess 这一标签。我已经在 systemd-devel 邮件列表上请求添加一个软件无线电相关的设备类别,得到了肯定的回应,并最终在这次提交中添加了 ID_SOFTWARE_RADIO。在不远的将来,带有这一改动的 Systemd 进入主流发行版后,我们将可以通过在 udev 规则文件中使用类似 ENV{ID_SOFTWARE_RADIO}="bladerf" 的语句,让普通用户以一种更安全灵活的方式使用软件无线电外设。

122014
 

This is my own (unofficial) report of FUDCon APAC 2014 Day 2 (Sunday).

Main Hall

The hosts in the main hall on Sunday were Tobi from GNOME and Tommy He from Fedora. The sessions began with the keynote speech on Systemd by Lennart Poettering. He talked about what is the modern Linux system and what role Systemd plays in it. Pity I didn’t finish listening to the talk, since I was asked out to help with hacking room. It turns out quite a few guys would like a separate hacking room. So we decided to open up Room 2 for hacking. Shortly after setting it up, the most important guest, Richard Stallman (RMS), came to the venue along with Zeuux guys and others. They were not happy with the booth setup (it was the last booth) until an exchange was made. They brought many swags, and some of them are to be sold rather than given away. Richard also went into the hack room since it was still some time from his keynote.

IMG_8876

After Lennart’s talk there were four lightning talks. It’s such a pity that I missed them all, in particular biergaizi’s lightning talk on “Tips about Linux Servers”. Then RMS’s keynote on “Computing, Freedom and Privacy” began. Many more people were coming and filling up the main hall. RMS’s talk itself is not quite new to me since I had listened to him in Tsinghua. The part about why GNOME was created at all was new, but the history was already familiar to Linux hobbyists. However, being able to listen to his talk on site was quite impressive and educating. I have the feeling that his opinion might be ahead of the time but is always right. In the middle of the talk, he held an auction for a toy gnu and “an adorable book” (Free Software, Free Society). After the talk was the Q&A, which lasted till about 12:45. We went to Heyi Building for lunch after that.

IMG_9006

At lunch I got the message from zsun that Ankur would like to have the GPG key signing party in a small room rather than main hall. That was doable and we had difficulties to find a substitute to fill in the empty slot in main hall. At last the signing party was held in Room 2 and there was no replacement in main hall.

Room 3

After lunch it was near 14:00, and the first talk in Room 3 was supposed to be mine. So I hurried there to prepare. The volunteers (Feng Tian, Justin Wong, Rosie Ye, Tang Zhixin, etc.) were ready. I began my talk on LaTeX Tips a little bit later than the schedule. I talked about common compilation errors and output errors and how to fix them. The time was limited so I skipped the part about math formulas and BibTeX errors. I got a question about the main advantages of LaTeX compared with GUI Office applications. I explained that the advantages lie in high quality output and automatic generation of table-of-contents and list-of-various-stuff. Users normally only focus on the main contents rather than formatting issues.

The second talk was “CD using Docker” by Gerard Braad. He explained the actual definition of CD, Consistent Development and Deployment, and use Docker to demonstrate the concept. He introduced PaaS, LXC, cgroups, Dokku and so on along the talk. The talk was presented in an interactive and interesting way: questions, answers, and gifts!

After that there were only 10 minutes for tea break. However it was a nice time to take photos in front of the large banner. The following talk was meant to be Carbo Kuo’s Batsh topic, but he could not come and had sent regrets on Saturday. So Cheer Xiao’s talk was moved upwards to fill in the slot. Cheer Xiao talked about his experiments with Elvish, a new Unix shell created by himself. There were many considerations and tradeoffs when designing a shell, and he introduced the philosophy behind his choices. He also compared it with existing shells such as fish and zsh.

There was no more talks in Room 3 afterwards, so we headed for Room 8 to join the discussion about Fedora Women.

Room 8

The last talk in Room 8 was “Fedora Women” by Nitesh. He would like to make it more an interactive discussion than an oral presentation, and asked zsun and me to help translate. The session turned out to be quite productive. There were many nice suggestions out of the discussion. The main points are summarized as follows (with relevant names in parentheses):

  • For online communications such as IRC in a diverse community like Fedora, people generally do not know whether one is a man or woman, so there is normally no discrimination against gender. The community is equal to men and women. Potential women contributors should not fear questions such as why do you code you are a girl. If there is any such question, it is more important what is one’s interest than what is others’ opinion. (Nitesh, Ankur, Feng Tian)

  • Fedora has many roles and tasks for contributors. Even if you do not like coding, you can try to join the design team or the translation (L10N) team or others to contribute. Fedora also has a lot of special interest groups (SIGs) which welcomes people with that special interest, such as electronics, cloud computing and so on. And there is the opportunity to start a new SIG. There is a SIG called Fedora Join SIG, which is an ideal place for people who are new to the project and do not know what exactly they should do. You can just do informal introduction in the Join SIG mailing list and people will help you find what you can do. (Jaroslav, Aditya, Nitesh, Ankur)

  • There are many tasks waiting for people to join and contribute. And there will be many new tasks since Fedora.next is coming. Some of them are easyfix ones, which is very suitable for new contributors to get started. (Ankur, Jaroslav)

  • The local communities should draw the attention of outside non-users, organize activities to help them especially women to install Fedora on their computer and to show them how things work in the communities. Among the activities some can be girls oriented. Besides, blogging about how to install the OS and how to do various things on Fedora! (Martin, Aditya, Nitesh)

  • Lovely dolls attract girls! We should design more stuff than stickers for offline events. (Feng Tian, zsun)

  • Fedora might have a narrower user base than other projects like GNOME. But people can actually contribute to Fedora even without using it everyday. The way can be bug reporting, translating, or volunteering in offline events, etc. (Justin Wong, zsun)

  • A question to current contributors: why do you fail to bring your girlfriend to the community? (Robin Lee)

  • We should continue the discussion after the conference, rather than raising the same question again on the next conference. We should setup activities talking about how to achieve something, especially in Beijing. We should have clear targets. (Martin)

Closing

We went back to the main hall for the closing part of the event, and found the last talk in the main hall had not been finished, and it also became a discussion. So it seems we should consider panel discussion as a session type in the future.

The closing speech was given by Kat (IIRC) and Jaroslav respectively, and then followed by the speech by the local team. Emily and I went on the stage. She spoke in English and I did the translation. We gave our thanks to everyone, especially hardworking volunteers. The two hand fans, full of writings in different languages, were given to Tong Hui and Zamir Sun respectively as gifts for best volunteer of each community. The top horizontal scroll for the couplet was decided to be “Happy Hacking” according to the result of two days’ voting. At last we had a group photo.

SAM_4563.JPG

SAM_4575.JPG

Evening

In the evening we had a very nice buffet dinner at Oasis Café, Vision Hotel, which is just behind the conference venue. We toasted to everyone and thanked them for coming. I sat with robyduck and zsun. We talked about a lot of things including robyduck’s travel plan. Robyduck also pointed out a possible issue with FZUG’s logo. Richard Stallman also went to the celebration party. Besides, zsun and I stood in front of the camera of Nitesh near the cafe since we promised to participate the short interview by him and Ankur. It was such a relax at the dinner after two days’ event and after several months’ preparation. And I was really happy that many people found the event good and successful.

022014
 

This is my own (unofficial) report of FUDCon APAC 2014 Day 1 (Saturday).

Registration

Tonghui and I went up early, had a simple breakfast at the hotel, and then went to the venue. I took the Live DVDs along, and the box was kind of heavy (about 400 DVDs!). Many volunteers were already there and ready when we arrived. Christopher was there too and needed to find a hotel for the night. Robin Lee offered him help. I took out about 50 DVDs and put them at the Fedora booth, and told the volunteers at registration desks to distribute the remaining ones. I took out some and put them close to the desks while left others in the box. It turned out to be not so good since the ones in the box were left unnoticed by the volunteers and were not distributed. But they can be used in future events anyway. It rained at night, so we expect fewer attendees than usual. Later in the night I got the message there was above 200 registrants on Saturday, which is a pretty good number.

As for the swags (gifts) for attendees, we prepared sufficient conference bags and badges, and each bag had a Fedora flyer, a Fedora DVD, a Deepin DVD, and some flyers from various sponsors. It was good except several issues. The paper of Fedora flyer is soft (157g paper) and the bag is soft (basketball bag or so), which makes the flyer easily rumpled. Another issue is that the Deepin DVD was not together with Deepin brochure.

Although we had enough bags, there were not sufficient T-shirts. We had decided to provide each volunteer two T-shirts, one from GNOME and one from Fedora. Also we need to reserve T-shirts for designers, speakers and donate tickets buyers. Therefore not many T-shirts were left for normal attendees, so they had to be distributed in a first-come, first-served manner.

Main Hall

The sessions at main hall began with loud sound of a Chinese gong. The hosts are Max from GNOME and Gerard (gbraad) from Fedora. Kat and Jaroslav gave the welcome speech from each side respectively. Then Emily represented the local team and introduced the event and also called for voting for the top horizontal scroll for the couplet — Evolution of the Desktop, Innovation for the Community — which is the conference theme. The former of the two parts was proposed by GNOME folks. It took some time for me and other Fedora guys to think of the latter half.

IMG_8948

Then it was the time for keynote speeches. First Tobi gave a nice overview of GNOME 3.12 features. Then Jiri and Jaroslav introduced Fedora.next to the audience, talking about the features and the community. Pity I didn’t finish listening to their talk, since I needed to head to Room 8 to prepare following Fedora sessions. One of the most important thing was to bring a Fedora Friend Finder (power strip) there!

Room 8

When I arrived at Room 8, the volunteers (Shi Jie, Ma jing, Fan Jiayue and others) were already there. Shi Jie was the host of Room 8 on Saturday. His introduction scripts were outdated and could not reflect real schedule that day, but he adjusted quickly with the help of kraks. Ma Jing was the coordinator in that room, and was in charge of distributing gifts (books and cups) to questioners. Fan Jiayue was responsible for posting news on SNS websites (weibo) and preparing the daily news report.

The first speech was “Fedora Videos” by Nitesh Narayan Lal. He talked about one main current work is to organize all the videos. It is worth pointing out Nitesh (together with Ankur) was also responsible for recoding short videos of interview with random attendees.

Then Robert Mayr from Italy gave us the talk “Fedora Websites – present and future”. The talk was quite interesting and the new design for Fedora.next was quite impressive. Currently there are no APAC contributors for Websites subproject. Hopefully we will have interested APAC folks join the team. Robert also showed the easyfix page and Tommy asked about the feasibility of localizing it.

The morning sessions ended after that, and then we went to lunch at Heyi Building in Beihang. I met Nitesh and Aditya there, and helped them to tell the cook they need vegan food. There was a short period when no one was taking care of the booth. Zamir helped and I asked dongfengweixiao to be there quickly.

At 14:00 the afternoon session started. First Aditya Patawari from India talked about “Orchestration with Ansible at Fedora Project.” He is from the infra team, and he talked about why they moved to Ansible, and how to use Ansible to executive ad hoc commands and create playbooks.

Then Zamir Sun brought a brief introduction to FirewallD. He introduced the advantage of FirewallD, the GUI and command line interface of FirewallD, and the rich language to define complex rules. He also called for help on localization of FirewallD wiki pages and software applications.

Then it was a tea break. Unfortunately there was no drinkable tea since (we thought) there was no hot spoiled water at the venue. But the registration desks were moved to the side and the large banner stood out, which became a very good background to take photos. The booth was also quite popular, partially due to the lovely chameleon dolls brought by SUSE. I also met Su Zhe, the author of venerable SCIM, by the introduction of Emily at the booth. Su Zhe shared some information about Google’s input method project, and told that they are planning to release the input method framework open source.

After the break I went to the main hall to listen to Peng Wu’s “Wayland intro with i18n hacks”. I came in a bit late and only caught the part of two patches for wayland and a demo to run wayland for debugging. Su Zhe raised questions difficult to answer about Wayland and Mir.

After that I went back to Room 8 for Ankur Sinha’s hackfest about “ROS on Fedora”. Ankur introduced ROS and Fedora packaging. The talk was finished early but there was not much time for hacking. Ankur planned hacking on the next day. So we had more discussions, including Fedora Join SIG.

Then all the sessions for Room 8 on Saturday ended. We volunteers, speakers, and some attendees took a group photo, and then went back to the main hall.

IMG_8834

Note: Ankur’s report contains more photos!

Main Hall Again

In the main hall we had three lightning talks, and they were Deepin Desktop Environment (DDE) from Xia Bin, Chandao FIXME from Wang chunsheng, and Open Build Service (OBS) from Lance Wang. Then we reached the closing part of first day. A wonderful video of short interviews was created by the volunteers and presented. We also had volunteers take a group photo.

DSC03705

Evening

I originally intended to join the sports game after the one day’s sessions, but at that time I was with tiansworld, tommy, and Wang Ye. I needed to help tiansworld to check in at the hotel, but we decided to have dinner first. We searched around the street outside East Gate of Beihang, and settled at Hannashan eating Korean toast. The food was good and not so expensive with groupon. But it would be not so good without conversation! We talked a lot, and after the dinner, Wang Ye left but liangsuilong joined the conversation at McDonald’s. We talked about all kinds of stuff, Fedora related or not. The conversation lasted to over 11:00 PM until I got a message from tonghui, asking whether I was back. We agreed it was a bit late, and it was time to say goodbye and go for rest.

When tiansworld and I were back at the hotel, I helped with the check-in at the front desk. Most of the staff there are not proficient with English, and zsun had reminded me that we needed to speak of 亚洲峰会 (Chinese for Asia Summit) to let them know which group we belonged to. After it was done, we went upstairs to each one’s room. Finally I had time to revise my slides for Sunday. Check the git log if you want to know the detailed changes. While I was preparing the slides, tonghui was checking the photos taken in the day. There are many good photos to tell the truth! It was quite late in the night after I finished my slides, so I went sleep quickly.

312014
 

This is my own (unofficial) report of FUDCon APAC 2014 Day 0 (Friday).

Preparation

There were no speech sessions for FUDCon on Friday, so it was all about event preparation in the day. At around 11:00 AM, I called Justin Wong, another guy from TUNA, also a volunteer of host, to help me move event gifts in my lab downstairs, where Emily waited for us with her car. We went to the venue, New Main Building in Beihang University, on the car full with sponsored gifts, including but not limited to cafe cups, hats, DVDs, books. Dongfengweixiao also just arrived when we got there. We had a brief lunch together at PengLaoShi, a Chinese fast food restaurant.

On the way back to the venue after lunch, we ordered the bottled drinking water for the three days. In the afternoon we are busy with setting up everything. Zamir (zsun) arrived to help. First we set up the booth with the desks rent from venue as well as desks from Beihang leagues (credit Wang Yang). The shop owner of bottle water helped with moving the desks from outside to venue. We had a booth for Fedora too, which dongfengweixiao took care of, so we left some Fedora flyers (and later on many stickers, F20 Live DVDs) there. We met one guy in orange T-shirt while setting up the booth. He asked about the place for upcoming GNOME training sessions. The next day I knew it was Tobi, the host in main hall from GNOME side!

Tong Hui (tonghui) arrived later and then event roll-up posters, X posters, and vertical banners arrived. I helped to hang up the two vertical banners in the main hall with tonghui and dongfengweixiao. It took three up-and-downs to finally make them look good (symmetric and smooth). Next I helped to buy some utilities such as power strips, mark pens, glue, and “postit” sticky notes. I also fetched the express of stickers. After I came back, many sponsors were there. There were some disagreements with booth position, but they were solved later. Li Bin (libin) and many other volunteers also arrived, and the registration desks (sign-in office) was set up. They put various small gifts into conference bags. T-shirts arrived and classified. Large banner which sat on the ground arrived a bit late, but was put up quickly. Time went by without being noticed, and it was almost 7 o’clock when we headed for the FUDPub, i.e. the welcome party.

FUDPub (Welcome Party)

The FUDPub was at Sculpture in Time Cafe, a cafe bar on campus and quite near to the venue. It was scheduled to begin from 6:00 PM, and we had volunteers waiting there to help from that time. As mentioned above some volunteers and I arrived a little late, and there were few empty seats then. Some early birds already begin to drink beer when we started to order pizzas and noodles! Around 60 people from the event were there, and the cafe bar seemed to be not able to handle so many people. The service was slow and a bit chaotic, but luckily we had sunny (and later on libin) who took care of the detailed list of ordered and served food. Except the long waiting time for food, it was good. I met and said hello to Ankur, Nitesh and other guys. Max called on emily, libin and me to toast to everyone. Ankur asked to continue discussion at the hotel after the party, but I stayed till 10:00 PM at the cafe bar since tonghui had so many interesting stories to tell! While we went to the hotel, I picked up the Fedora 20 Live DVDs with GNOME Desktop, whose creation was finished late due to some issues with DVD sleeves during production.

Hotel

The conference hotel is Beihang Training Center, which is inside Beihang and near to the conference venue. There was no WiFi at hotel, only one wired interface available. Luckily tonghui set up a WiFi AP using his laptop with GNOME 3.12. He also charged his camera for next days’ activities. I replied some emails, took a shower, and then went to bed. I had planned to revise my slides, but it had to be delayed to Saturday.

202014
 

Fedora Activity Day (FAD) China 2014 was successfully held at Park Plaza of Beijing Science Park, Beijing on Mar 30 (Sunday). It was organized by Fedora Zhongwen User Group with the help of CSDN. It was under the umbrella of Open Source Technology Conference (OSTC) 2014 initiated by CSDN, being one of three parallel sessions in the afternoon. There were around 600 attendees in total, and about 200 in the FAD session.

I arrived at the venue in the morning with more than 100 Live DVDs and 500 stickers. We distributed them during the Red Hat booth as well as the afternoon session. In the morning there were several keynote speeches and one panel discussion. More details can be found in the CSDN news report.

The afternoon session began at 1:30 pm. Thomas Yao and I served as the hosts of FAD. The first talk was “About Those Python Asynchronous Concurrency Frameworks” by Fantix King, CTO at FlowForge Games, Archlinux x32 committer, and Python programmer. He introduced the concept of concurrency, compared Tornado, Twisted, and Gevent, and then introduced asyncio, the newly available framework in Python 3.4.0.

Python Concurrency Frameworks by Fantix King

Python Concurrency Frameworks by Fantix King

The second talk was “Use Linux Command Line as a Hacker” by Xiaodong Xu (Toy), the webmaster of LinuxToy. He shared a lot of command line tips to fix typos, manipulate shell history, and speed up operations. In the QA session he talked about his opinion on text editor choice and Linux distro choice.

Toy

Toy

The next talk was “Reform the Toolbox: From Open Source Software to Open Source Service” by Daobing Li, the chief architect of Qiniu, who is also a Debian developer. He talked about the achievements of open source cloud service, and shared his vision of future cloud service – cloud in computer room. He also gave suggestions on how developers treat cloud services.

Daobing Li

Daobing Li

Following the talk was “Introduction to HackRF & GNURadio” by Scateu Wang, the creator of hackrf.net and the former leader of TUNA. He demonstrated the ease of using GNU Radio to develop software defined radio applications for DTMF decoding, FM modulation and demodulation, digital audio broadcasting, etc. He also introduced HackRF, the newly created inexpensive hardware peripheral used with GNU Radio.

Scateu Wang

Scateu Wang

The next talk was “Fedora Ambassadors & FUDCon” by myself. I introduced the four foundations of Fedora Project, gave an overview of Fedora Ambassadors project, showed what ambassadors do and how reimbursement works, and then shared the recent progress of organizing FUDCon APAC 2014 to be held in May and welcomed everyone to join.

Alick

Alick

Next Emily Chen, GNOME.Asia founder, senior software engineer in Oracle, gave the talk “Bringing More Women to Free and Open Source Software”. She introduced the Outreach Program for Women initiated by GNOME, talked about how it increases the women participation in open source projects. The annual program provides prize for women participants in similar way with GSoC, but it does not require the applicants to be students, and applicants does not need to write code in the program.

Emily Chen

Emily Chen

The following talk was “Operation and Management of SHLUG” by Thomas Yao, leader of Shanghai Linux User Group (SHLUG), founder of GitCafe.com. Thomas gave an impressive speech without any slides. He talked about the history of SHLUG and shared the experience. He pointed out the pioneering effort of building the first open source mirror site in China, Geekbone, and the importance of keeping the community focus on technique rather than commercial activities. He also shared the interesting stories of Hacking Thursday and Rails Girls.

Thomas Yao

Thomas Yao

After that is the panel discussion on “History and Future of Open Source OS in China”. It was moderated by Thomas Yao, and the panelists are Weijia He from Redflag College of Education, Jianzhong Huang from Redflag R&D, Jack Yu from UbuntuKylin, and Yong Wang from Linux Deepin. They shared their opinions and experiences about Linux Desktop, collaboration of distros, cultivation of open source talents, and open source in education.

Panel Discussion

Panel Discussion

At last, Martin, leader of Beijing Linux User Group (BLUG) gave a lightining speech of introducing BLUG and its activities. Everyone is welcomed and should not worry about their English since there are actually many Chinese there. And it is quite easy to join the event by registering on BLUG website or joining discussion in mailing list.

At night there is the Open Source Night, a social event for free face-to-face discussions. Unfortunately I didn’t attend it. I had dinner with FUDCon and GNOME.Asia organizers and discussed current progress and following tasks.

Overall it is a very good event in my mind. If I have to point out some issues, I’d say there might be too many talks and no time for tea or coffee in between! Besides, my own talk was prepared in a bit hurry, and not practised well beforehand.

The slides links is available on CSDN news. They also provide a Chinese report for FAD. There is a great minute for the meeting by Bojie Li from USTC LUG. The videos and various other materials can be found at this link.

032014
 

NOTE: For Chinese readers, there is a Chinese version of the report here.

Happy new year everyone!

The Fedora 20 Release Party in Beijing was successfully held at Turing Office last Wednesday (Dec 25). It was organized by Fedora Zhongwen User Group with the help of Beijing GNOME User Group. There were 22 registrants on site, which is comparatively fewer than previous due to the time arrangement.

The release party began at 6 pm. (I was late for about 10 minutes.) We conducted the registration on a computer: We opened a LibreOffice Calc spreadsheet filled with pre-registrants’ information so that they can just type 1 to register. As for others we required them to type their names and email addresses. As usual, every attendee can pick a Live DVD and a sticker. We prepared 50 Fedora 20 DVDs. Each of them has a label with Fedora 10th anniversary icon, and is 64bit with either GNOME or KDE. The stickers are from Fedora, GitCafe, and CSDN CODE.

The party entered pizza time at around 6:30 pm. We had ordered seven pizzas, 5 large and 2 small. Along with drinks and snacks sponsored by CSDN, they more or less met the requirement of everyone’s supper. While supper we managed to collect four topics for the talk.

The talk session started from 7:30 pm. In the opening address, I welcomed everyone, and introduced the features (changes) of Fedora 20 and the 10 year history of Fedora project briefly. Then it came to the first talk, which was "systemd Introduction" by Robin Lee, an active Fedora packager, FZUG member, and skilled programmer. He talked about the origin, main concepts, and core implementation of systemd as well as its impact on application development. There were in depth discussions about the implementation details and comparison with other competitors in and after the talk.

systemd Introduction by Robin Lee

systemd Introduction by Robin Lee

Then there were three short talks. The first one was "Open Source Strategies of CSDN" by Orson Zhai. He pointed out that CSDN has set open source as one focus, and CSDN CODE is striving to provide a better collaboration platform for open source projects in China. Then David Liang from SUSE talked about the state and progress of "Automatic Testing for GUI". Currently there is no mature tool for automatic GUI testing to increase the efficiency of desktop testing. Projects such as openQA aim at building such tools and are being developed. The last talk was an introduction to Fedora.next by Robin Lee. Fedora.next is a plan being carried to improve the current release practice of Fedora. Based on the reflections of the existing practice, Fedora.next tries to replace the single repository with four rings of packages. Each ring can has its packaging polices. Besides, multiple working groups with possibly different release strategies are formed to build multiple products. In summary Fedora.next aims at better integration of Fedora and the overall open source ecosystem, and more involvement and contribution from more people.

We prepared several GitCafe cups, and Turing generously provided some Linux books. They were distributed as gifts for questioners. CSDN brought gifts for speakers too. Then after all the talks, at around 9:30 pm, we took a group photo.

Group Photo

Group Photo

It is worth pointing out several issues for the event. The pizzas was sent earlier than the registration, without receipts. The number of attendees is small since it was arranged at weekday night. The discussions were more abroad than expected and led to overtime. So to avoid the issues:

  • When ordering takeout, specify both the earliest and latest time.
  • To attract more people, make the event happen on weekend day (afternoon) at easily findable venue.
  • Prepare for overtime, and put the start time as early as possible.

The slides links is available on the wiki page. The photos can be found on G+. Don’t forget to take the post-event survey before Jan 11! You feedback is appreciated!

022014
 

先给各位朋友道声新年快乐!

上周三(12 月 25 日)晚上在立水桥南附近的图灵办公室,由 Fedora 中文用户组主办,北京 GNOME 用户组协办,并由 CSDN 赞助的 Fedora 20 发行派对北京站活动顺利举行。由于时间是在工作日,恰逢圣诞,又是晚间活动,到场人数与以往相比偏少,最终注册了 22 人。

活动开始时间是下午六点,我迟到了十多分钟。这次注册为电子注册:在 Fedora 电脑上开一个 LibreOffice 电子表格,预报名过的人可以直接填 1 进行签到,现场报名的只需填上自己的名字和邮箱。照惯例,注册后每人可以领取一张 Live 光盘和一枚贴纸。我们准备了 50 张 Fedora 20 光盘,盘贴上有 Fedora 10 周年纪念字样,光盘有 GNOME 64 位以及 KDE 64 位两种以供选择。这次的贴纸不仅有 Fedora 的金属图标,还有 GitCafe 贴纸和 CSDN CODE 带来的 Git 主题贴纸。

大约六点半时,活动进入比萨时间。我们预订了五大两小共七个外卖比萨,加上 CSDN 赞助的零食饮品等,比较好地满足了大家的晚餐需求。在晚餐闲聊环节,我们征集到了一大三小共四个主题演讲。

演讲从七点半开始。在各个主题演讲之前,我对大家的到来表示欢迎,并简单介绍了 Fedora 20 新特性以及 Fedora 项目 10 周年的历史。之后便开始了第一个主题演讲。演讲是活跃的社区成员、Fedora 打包者李瑞彬带来的“systemd 简介”。他介绍了 systemd 的历史缘起、主要思想、实现核心,以及对程序开发的影响。大家在演讲中和演讲后对 systemd 的实现细节、与竞争者的对比等方面进行了深入的讨论。

李瑞彬介绍 systemd

李瑞彬介绍 systemd

之后是三个较短的演讲。首先是 CSDN CODE 的翟京介绍了 CSDN 的开源策略。开源已成为 CSDN 的一个重心,其推出的 CODE 平台将力图为国内开源项目提供更好的协作平台。然后是 SUSE 的 David Liang 介绍了图形界面自动化测试的现状和发展。图形界面程序的自动化测试可以极大提高图形界面测试工作的效率,但目前尚无成熟工具,OpenQA 等项目在力图打造优秀的图形界面自动化测试工具。最后一个演讲是李瑞彬对 Fedora.next 的简要介绍。Fedora.next 是 Fedora 现有发行模式的改进计划。它基于对现有模式的反思,将单一的软件仓库分为四个环 (Ring),不同环可以采取不同的打包策略,另外组建多个工作组 (Working Group),打造多个产品,不同组可以有不同的发布策略。总体上力图让 Fedora 和开源生态更好地融合,让更多人可以参与到 Fedora 项目当中。

我们事先准备了若干杯子,图灵提供了若干 Linux 图书,在问答互动环节作为奖励进行了分发。最后九点三十许,大家合影留念。

集体合影

集体合影

这次活动也呈现出一些问题与不足:比萨送餐人员比预定时间提前半个小时把比萨送到了,先于不少参加活动人员的到场时间,而且没有现场给发票。因为是工作日晚上,加上场地位置在五环外对于其他区的人来说相对偏远,最终现场参与的人数偏少。虽然人不多,但大家讨论交流的比较深入广泛,时间控制得不太好,最终活动结束比预定晚了半个小时。总结出来的经验教训是:

  • 外卖订餐不仅需要指定不晚于的时间,还要指定不早于的时间。记得要发票。
  • 要想让活动参与人多,最好在周末白天(下午),场地交通要方便且易找到。
  • 要有超时的准备,开始时间应尽量往前赶。

本次活动演讲的幻灯片链接可以在维基页面看到。活动照片可以在 G+ 上看到。最后,参加了活动的朋友请记得在 1 月 11 日之前填下反馈调查问卷!欢迎您对活动留下宝贵意见!

修订记录:

  1. [2014-01-02] 修正星期几错误……
十二 152013
 

最近我把个人资料迁移到了一个新笔记本电脑上,旧电脑不再使用了,需要清除上面的个人数据。旧电脑是 Windows XP 与 Linux (Fedora 19) 的双系统,个人资料在 Linux 下,所以任务是清空 Linux 系统,保留原有 XP 可用。

由于重要的数据都已导出,所以这给了我一次在实体机上尝试 rm -rf / 的绝佳机会。众所周知,这项操作需要 root 权限 (su/sudo),而且 GNU 的 rm 默认已不再允许在顶级根目录下这样做,所以真实的命令是:

sudo rm -rf --no-preserve-root /

我是在原 Linux 系统图形界面的虚拟终端里做此操作的。过了一会儿,突然虚拟终端不见了,桌面背景等都还在。在图形界面试图新建虚拟终端无效。于是我切到控制台终端,发现控制台一直是等待状态,没法登录。(猜想是相应的程序都没了。)切回图形界面后发现鼠标键盘失去响应,但桌面背景还在。此时已经做不了什么有意义的操作,于是按电源键关机了。

之后用 Live USB 开机登录,挂载硬盘分区,发现原 Linux 的文件并没有全删光,还残留若干空目录,也有非空目录下有残余文件,$HOME 下也有几个残余文件(视频目录里有东西!$HOME 下还留着一个 PDF 文档!),不过所剩无几。

不过我们知道,Linux 下的 rm 本质上是去掉文件系统中的链接 (unlink),硬盘上的数据并没有擦除。使用数据恢复工具还是有可能找回其内容的。要真正地清空硬盘分区,需要进行“低格”,即低层格式化。Linux 上的 dd 命令可以做到这一点。如下 /dev/sda7 是一个 Linux 分区,我们通过往上面写入全零 (/dev/zero) 来擦除数据(使用 /dev/urandom 写入随机数也是可以的)。

[liveuser@localhost~]$ sudo dd if=/dev/zero of=/dev/sda7 & pid=$!

注意其中用的是一个 & 号,意为放后台运行。后面将进程号赋值给 pid 变量,是为了后面可以方便地查询进度,毕竟受限于磁盘 IO,dd 对于几百 GB 的硬盘是很慢的。可以通过向 dd 命令发送 USR1 信号获取当前进度:

[liveuser@localhost ~]$ sudo kill -USR1 $pid
[liveuser@localhost ~]$ 512417+0 records in
512417+0 records out
262357504 bytes (262 MB) copied, 17.5086 s, 15.0 MB/s

由于耗时实在太长,我是晚上把电脑一直开着,第二天去看的结果。最终擦写完成后会显示类似下面的信息:

[liveuser@localhost~]$ dd: writing to ‘/dev/sda7’: No space left on device
210183058+0 records in
210183057+0 records out
107613725184 bytes (108 GB) copied, 8295.38 s, 13.0 MB/s

可见,这个 108 GB 的分区用了两个多小时才擦写完。类似地对每个 Linux 分区执行上述 dd 命令,即可把所有数据擦除干净。有人会建议多擦写几次(3次?)以更加确定数据不会被恢复。不管怎样,注意务必写对分区编号,不然把(未备份的)有用数据擦掉了就出大事了。(如果你要清空整个硬盘的话,注意把硬盘设备名弄对。)

清除数据的任务到此就宣告结束了。不过,对于双系统来说,正常的引导是通过 GRUB 来实现的,而 /boot 分区或文件在前面已经被擦除了,所以开机会进入 GRUB 的 rescue shell 中。我没有搞明白如何在这里引导进入 XP 系统,于是用 Windows 系统光盘恢复引导。由于手头没有 XP 安装盘,当时用的是一个 Server 2003 的安装盘。不过操作是一样的,这个文档里有详细说明。简单来讲,就是进入 Windows 安装盘修复模式后执行 fixmbr 命令。

十二 052013
 

JavaScript 社区的国际性技术大会 JingJS 2013 于 11 月 9 号和 10 号两天在学校东门外的紫光国际会议中心(紫光二楼)举行,我有幸作为活动志愿者一枚近距离围观了两天的活动。这里记录下其中的点滴收获。

活动有众多演讲,特别是有许多国外讲师,组织工作会很辛苦。不过得知活动的组织核心只是几个技术大牛在负责。佩服他们的热情和能力。也耳濡目染到一些组织经验,包括日程调整、活跃气氛等。

活动第一天上午,Jason Denizac 在题为 My Year With Node.js (我与 Node.js 的一年) 的分享中,说自己是个 writer (作家),也 write code (写代码)。听起来感觉碉堡了,这个认识水平比一般人高了不少。

IMG_0007

后面 cnblog 的创始人 Issac Mao 在不用幻灯片的分享中,谈他对社区、分享等的体会。他提到 sharism 这个词,将分享精神上升为一种主义。他还提到 meme 一词,他建议翻译为“媒母”(音)。谈到多种文化时常提到这个词,维基百科上给出的翻译是“迷因”“模因”等。不确定它们是否恰切地反应了词的含义。此外他还提到他们做的对社交媒体信息的归档。

IMG_0010

中午之前有个 workshop 教学环节。无奈家用路由器根本无法满足会场二百多人同时连接的需求,最后只能选取若干幸运者代表大家参与一下。

午饭和众多大神一起在科技园里某餐馆吃的,其中包括 Domonic Tarr,npm 模块数目排行第三的大神。等餐期间,他学习了中文中的模块、土等词汇,并用在了自己第二天的演讲稿中。

头天最吸引人的演讲恐怕是 James Halliday 带来的 the wizard of moduletopia (模块之魔法)。James 不经意间展示了飞速的键盘操作,亲手绘制的漫画风格幻灯片,以及用 Vim 放映展示代码功能的“幻灯片”。James 网名 substack,目前提交 npm 模块数量上排行第二,其中 browserify 模块已经颇为知名。

IMG_0018 IMG_0019 IMG_0021

第二天的演讲,Eric Redmond 在题为 HTTP Is Hard 的演讲中讲述了 HTTP 状态码背后的含义,以及常见的误区。人们或许会习惯于检查 HTTP 回应状态吗是否是 200 以确定是否是正常回复,然而事实上 2xx 都意味着正确结果。有个网站可以帮忙查询每个状态码的含义,用法如下:

curl -I http://codes.io/206

(此外 418 也是一个有趣的状态码。)除了状态码之外,HTTP 本身就支持授权认证 (Basic authentication)。值得一提的是,Eric 还是 7 Databases in 7 Weeks 一书的作者。

百度的 Yao Tong 介绍了他们的一个针对实时性应用的开源纯 JavaScript 框架 Clouda。现场测试的待办事项列表应用在使用手机 GPRS 网络时依然表现良好,令人印象深刻。

闪电演讲环节,一个小朋友流畅地用英文介绍了自己的小项目 gifme。它是一个 Web 应用,获取访问用户摄像头权限后,可以截取一段动作,并自动生成 GIF 图片,然后可以选择保存在本地或者分享到社交网络。

之后有演讲总结了自动化 CSS 测试,介绍了语法检查、lint、截图对比等方式,推荐了 hardy 模块。演讲者 Jakob Mattson 强烈建议设计先行的做法。

来自阿里的漂亮的 Zhouxuan Yang (fool2fish) 介绍了名为 totoro 的前端测试工具。没错,这个名字来自宫崎骏的龙猫。这一工具的设计特点是简单易用足够稳定。

最后一个演讲是沈嵘带来的 Grunt.js 介绍。Grunt 是一个自动化构建工具,实现了用 JavaScript 构建 JavaScript 的美好特性,这在别的语言是似乎还是没有过的,这一特性带来了极大的便捷。Grunt 的安装需要两步,先全局安装 grunt-cli,再给每个项目安装 grunt。详细内容见幻灯片材料

晚上的 After Party 在五道口的 Pyro Pizza,那里提供了丰盛的食物饮料,还有游戏环节,不过最主要的活动还是随机的小范围的聊天。自己也应该更积极地投入到这种氛围中去。