android JB版本如何更新时区data文件
1. 到网站ftp://ftp.iana.org/tz/releases/下载时区的tzdata*.tar.gz文件,由于JB版本使用的data和现在KK的不同,要下载2013年的版本
例如tzdata2013a.tar.gz
2.解压修改tzdata2013a.tar.gz相关时区文件,再次打包为tzdata2013a.tar.gz,具体如何修改可以参考FAQ04310 如何修改时区data文件
3. 把修改后tzdata2013a.tar.gz拷贝到路径\bionic\libc\tools\zoneinfo下
4. 修改generate脚本文件,使用如下内容替换:
\bionic\libc\tools\zoneinfo\generate 文件内容:
#!/bin/bash
# Run with no arguments from any directory, with no special setup required.
# Abort if any command returns an error exit status, or if an undefined
# variable is used.
set -e
set -u
echo "Looking for bionic..."
bionic_dir=$(cd $(dirname $0)/../../.. && pwd)
bionic_zoneinfo_dir=$bionic_dir/libc/zoneinfo
bionic_zoneinfo_tools_dir=$bionic_dir/libc/tools/zoneinfo
if [[ ! -d "$bionic_zoneinfo_dir"
|| ! -d "$bionic_zoneinfo_tools_dir" ]];
then
echo "Can‘t find bionic‘s zoneinfo directories!"
exit 1
fi
echo "Switching to temporary directory..."
temp_dir=`mktemp -d`
cd $temp_dir
trap "rm -rf $temp_dir; exit" INT TERM EXIT
# URL from "Sources for Time Zone and Daylight Saving Time Data"
# http://www.twinsun.com/tz/tz-link.htm
echo "Looking for new tzdata..."
#wget -N --no-verbose ‘ftp://munnari.oz.au/pub/tzdata*.tar.gz‘
cp $bionic_zoneinfo_tools_dir/tzdata*.tar.gz $temp_dir/
zoneinfo_version_file=$bionic_zoneinfo_dir/zoneinfo.version
if [ -f "$zoneinfo_version_file" ]; then
current_version=tzdata`sed s/\n// < $zoneinfo_version_file`
else
current_version=missing
fi
latest_archive=`ls -r -v tzdata*.tar.gz | head -n1`
latest_version=`basename $latest_archive .tar.gz`
if [ "$current_version" == "$latest_version" ]; then
echo "You already have the latest tzdata ($latest_version)!"
exit 1
fi
md5_sum=`md5sum $latest_archive`
echo "MD5: $md5_sum"
echo "Extracting $latest_version..."
mkdir $latest_version
tar -C $latest_version -zxf $latest_archive
echo "Compiling $latest_version..."
mkdir data
for i in \
africa \
antarctica \
asia \
australasia \
etcetera \
europe \
factory \
northamerica \
solar87 \
solar88 \
solar89 \
southamerica
do
zic -d data $latest_version/$i
done
echo "Compacting $latest_version..."
(
cat $latest_version/* | grep ‘^Link‘ | awk ‘{print $1, $2, $3}‘
(
cat $latest_version/* | grep ‘^Zone‘ | awk ‘{print $2}‘
cat $latest_version/* | grep ‘^Link‘ | awk ‘{print $3}‘
) | LC_ALL="C" sort
) | grep -v Riyadh8 > setup
javac -d . \
$bionic_zoneinfo_tools_dir/ZoneCompactor.java \
$bionic_zoneinfo_tools_dir/ZoneInfo.java
java ZoneCompactor setup data
echo "Updating bionic to $latest_version..."
mv zoneinfo.dat zoneinfo.idx $bionic_zoneinfo_dir
echo $latest_version | sed ‘s/tzdata//‘ > $bionic_zoneinfo_dir/zoneinfo.version
5. 执行修改完的generate脚本(./generate),执行成功后命令行信息
6. 脚本执行成功后,路径bionic/libc/zoneinfo下会更新zoneinfo.dat zoneinfo.idx和zoneinfo.version三只文件,查看这三只文件的修改时间,应该是最新的时间。
7.将这三只文件push到手机system/usr/share/zoneinfo下测试或者重新build整个工程.
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。