面大(lamian)的m8 android kernel

面大(lamian)的m8 android kernel共享给大家了,目前的m8 A13内核已经趋于稳定(不过待机电流仍然偏大,否则的话真的可以甩掉魅族的WinCE了)。

大家有兴趣的可以下载回来自己研究下代码:

地址:https://github.com/lamian/m8_android_kernel

代码的目录结构

./initramfs        RAM根(root)文件系统,将在系统引导过程中被加载

./kernel            2.6.29 内核

初始化脚本分析:

简单看了下init初始化脚本(./initramfs/init),基本上还都能看懂。

基本上就是挂载设备和镜像,通过md5来校验版本是否匹配。

#!/bin/sh

# This is the first script called by init process

validmd5=”c4681275d035fc778bb55b98425a0ef5″
/bin/mount -a

/bin/mount -t tmpfs mdev /dev

/bin/echo /sbin/mdev > /proc/sys/kernel/hotplug
/sbin/mdev -s

ifconfig usb0 192.168.1.100 255.255.255.0 up

#Display Logo
/fbv –delay 10 /images/logo.png

test -d /dev/pts || mkdir /dev/pts
/bin/mount -t devpts devpts /dev/pts

/debugmsg.sh

devmem 0x7e00f810 32 0xBFFF6D00
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

mkdir -p /mnt/disk
mkdir -p /mnt/looproot
mkdir -p /mnt/patchroot

if [ -e /dev/mmcblk0p5 ]; then
mmcblk=/dev/mmcblk0p5
else
mmcblk=/dev/mmcblk0
fi

mount -t vfat -o fmask=0000,dmask=0000,utf8,errors=continue,sync,dirsync $mmcblk /mnt/disk

if [ -e /mnt/disk/lbe_android/msys.img ]; then
curmd5=`md5sum /mnt/disk/lbe_android/msys.img | cut -d ‘ ‘ -f1`
validmd5=`cat /mnt/disk/lbe_android/version.txt | grep -i “CHECKSUM” | cut -d’=’ -f2`
fi

if [ -e /mnt/disk/lbe_android/mroot.img ] && [ -e /mnt/disk/lbe_android/msys.img ] && [ -e /mnt/disk/lbe_android/mdata.img ] && [ "$validmd5" = "$curmd5" ]; then
foundmdroid=1
mount -o sync,dirsync /mnt/disk/lbe_android/mroot.img /mnt/looproot
if [ $? -ne 0 ]; then
umount /mnt/looproot
foundmdroid=0
fi
mount -r -o loop -t squashfs /mnt/disk/lbe_android/msys.img /mnt/looproot/system
if [ $? -ne 0 ]; then
umount /mnt/looproot/system
umount /mnt/looproot
foundmdroid=0
fi
mount -o sync,dirsync /mnt/disk/lbe_android/mdata.img /mnt/looproot/data
if [ $? -ne 0 ] || [ ! -f /mnt/looproot/data/A11 ]; then
umount /mnt/looproot/data
umount /mnt/looproot/system
umount /mnt/looproot
foundmdroid=0
fi
else
foundmdroid=0
fi

if [ $foundmdroid -ne 1 ]; then
/fbv –delay 50 /images/corrupt.png
umount /mnt/disk
sync
fi

if [ -e /mnt/disk/lbe_android/mpatch_a13.img ]; then
foundmpatch=1
mount /mnt/disk/lbe_android/mpatch_a13.img /mnt/patchroot
else
foundmpatch=0
fi

if [ $foundmpatch -eq 1 ]; then
if  [ -e /mnt/patchroot/patch_apply.sh ]; then
/mnt/patchroot/patch_apply.sh /mnt/patchroot /mnt/looproot
fi
umount /mnt/patchroot
fi

if [ $foundmdroid -eq 1 ]; then

ver=`grep ro.lbe.version /mnt/looproot/init.rc | tr -s ‘ ‘ | cut -d’ ‘ -f4`
if [ "$ver" != "A13" ]; then
/fbv –delay 50 /images/wrongver.png
umount /mnt/looproot/data
umount /mnt/

How to set WPF window position according to DPI settings

Vista中当DPI设置改变的时候,屏幕的尺寸会改变,如果WPF窗口的位置是具体像素值偏移的,就需要根据当前的DPI配置进行相应的调整。

可以得到的系统参数(System Parameters we can get from WPF):

System.Windows.Forms.SystemInformation.WorkingArea (Width, Height)

Use WorkingArea to determine the bounds of the screen that can be used by applications. The working area is the portion of the screen not hidden by the operating system tray and other top-level windows that are docked to the Windows desktop.

工作区域的宽度、高度(高度不包括任务栏)

System.Windows.SystemParameters (PrimaryScreenWidth, PrimaryScreenHeight)

Gets a value that indicates the screen width/height, in pixels, of the primary display monitor.

屏幕区域的宽度、高度

网上搜罗来的解决办法:

Solution 1:

Get the current DPI value in WPF, and scale the width/height in pixels.

在WPF程序中取得当前DPI的设置,计算出像素宽度/高度的缩放数值

PresentationSource source = PresentationSource.FromVisual(this);

if (source != null)
{
dpiX = 96.0 * source.CompositionTarget.TransformToDevice.M11;

dpiY = 96.0 * source.CompositionTarget.TransformToDevice.M22;
}

Solution 2:

Using System.Windows.SystemParameters (PrimaryScreenWidth, PrimaryScreenHeight)

注意PrimaryScreenWidth, PrimaryScreenHeight这两个参数得到的像素数值本来就是经过DPI换算过的,但是请注意PrimaryScreenHeight的高度包括TaskBar。

ubuntu10.10实现双机互联共享上网

现有两台机器,一台ubuntu配置有无线网卡(无线连接ADSL路由器)和内置网卡各一块,另一台普通PC,只配有一块普通网卡,现在需要用ubuntu作主机通过双机互连线来共享上网。

注:双机互连线不是普通网线,接线两头的连线不同,具体请搜索网上相关链接。

如下配置在ubuntu10.10下测试可用,对其他ubuntu版本应该也可以适用。

首先确保你的无线网卡可以正常连接到外网。

然后用双机互连线来连接好两台机器,ubuntu主机配置如下:

通过界面来设置:

菜单选择 系统 -网络连接

打开网络连接对话框,选择有线选项卡,选择eth0,并点击编辑,选择IPv4选项卡,连接方法选择:与其他计算机共享

Ubuntu Internet Connection Share Setting

ubuntu实现双机互联共享上网配置

然后重启机器或者重启一下网络连接(sudo /etc/init.d/networking restart)就可以了。

参考文档:https://help.ubuntu.com/community/Internet/ConnectionSharing

忽悠

我在建设银行工作,昨天中午银行储蓄大厅里没有顾客,我正坐在存取柜台的窗口内发呆,这时一个女顾客走进大厅,来到我的窗口,递给我一张纸条说是要取钱。我接过纸条一看,上面写着:兹派 xx 同志前往贵银行提取人民币十万元。落款是中共中央办公厅。

看着这极不规范的手写纸条,我立马肯定这是个骗局,只是觉得这个骗局也太“小儿科”了。我正在犹豫是否要报警,突然发现这位女子的脸上神情恍惚,穿着也很凌乱。我意识到她可能是一个精神病患者,所以,我打消了报警的念头,把她交给了大堂的保安。

大堂保安听我介绍完情况,就对那位女子说:你这张条子要提款,得先去街对面的派出所,找所长给你盖个章。那女子听了保安的话,想都没想就奔街对面的派出所去了。看到这一幕,我是打心眼里佩服这位保安,心里想:就冲他这聪明劲,没准哪天我就会嫁给他呢。

过了午饭时间,大厅里开始忙起来,这时那女子又兴冲冲地走了进来,我和那个保安看了直感到诧异,要知道如今这派出所可是好进不好出啊。我们俩人赶紧问这位女子是怎么回事,那女子高兴地说,值班的警察告诉她,如今为了方便群众,办公手续简化了,你这条子不用派出所盖章就可以取钱。听了这女子的话,我不得不佩服这位警察大哥,谁说现在的警察素质差?你看这位警察大哥手法多纯熟,一个官腔就把这麻烦又给我们忽悠回来了,唉,不服不行。

这 下我和那位大堂保安都没辄了,只好把这位女子交给了大堂的主管,大堂主管弄清楚了事情的来龙去脉后就问这女子:你取钱干啥?那女子说:买好吃的,好穿的。 听了她的话大堂主管说:我们这是建设银行,在这取的钱只能用来盖房子,吃的东西是粮食做的,所以,买好吃的钱得去隔壁的农行去取,买衣服的钱要到对面的工商银行去取。听了大堂主管的话,这位女子又兴冲冲地走了。看着她离去的背影,我把我们大堂主管佩服得是五体投地。

又过了好一会,我 们都快把这事给忘了,那女子又回来了。看着她,我和大堂保安还有主管全傻眼了,这真神了!我们问这女子怎么回事,她说农行的人告诉她,只有农民才能在农行 取钱,她是城市户口,不能取。后来她又去了工商银行,在那人家告诉她,这里是公行,你是母的不能取。最后人家还说,就你这“贱”人,只能去建行取钱。所 以,她又回来了。

额的神啊!如今这社会,可真是一个全民忽悠的社会,人人都是忽悠高手,这要想把一个麻烦忽悠出去可真难。
所以说,还是真心待人的好!
就在我们傻眼时行长来了,行长接过纸条看了看对我们说了声“瞎胡闹”。然后转过身对那女的和蔼地说,“同志,不是我们不接待,你是中央派来的,我们级别不够,要取还得到央行去!

冷笑话

某剧组在村庄外拍戏。

间歇期间,一群扮演国民党军官和士兵的演员未卸装进村找厕所,在村口碰到一老农,向其打听厕所。

老农激动地握着演员的手说:你们什么时候打回来的?以前恨你们,可现在盼你们了…(哽咽)先别上厕所了,我带你们去抓村干部吧,晚了这帮孙子就跑了……

笑话一则

一个IT经理走进一家拉面馆,问:请问你们需要客户端吗?
老板一愣:面一般是伙计端,忙的时候才需要客户端。

Canonical URL by SEO No Duplicate WordPress Plugin