http://blog.csdn.net/flydream0/article/details/9163119
之前已讲解了如何下载及编译tizen源码(http://blog.csdn.net/flydream0/article/details/9004746),接下来我将讲解如下将制作镜像文件。
1 安装mic工具
tizen是使用MIC工具来制作其镜像文件的,因此我们首先得安装它。
- $ sudo apt-get install mic
查看MIC工具的当前版本:
- $ mic --version
- mic 0.19.1 (Ubuntu 12.04 precise)
2 下载ks文件
- wget http://download.tizen.org/releases/daily/2.0alpha/ivi-wayland/tizen-2.0alpha_20130522.2/images/ivi-wayland-release/ivi-wayland-release.ks
下载完后会在当前目录下有一个名为ivi-wayland-release.ks的文件,打开此文件,如下内容:
- # -*-mic2-options-*- -f raw --copy-kernel --compress-disk-image=bz2 --generate-bmap -*-mic2-options-*-
- #
- # Do not Edit! Generated by:
- # kickstarter.py
- #
- lang en_US.UTF-8
- keyboard us
- timezone --utc America/Los_Angeles
- part /boot --size 64 --ondisk sdb --fstype=ext4 --label boot --active --align 1024
- part /opt --size 676 --ondisk sdb --fstype=ext4 --label opt --align 1024
- part / --size 3072 --ondisk sdb --fstype=ext4 --label platform --align 1024
- rootpw tizen
- xconfig --startxonboot
- bootloader --timeout=0 --append="rootwait rootfstype=ext4 quiet" --ptable=gpt
- desktop --autologinuser=tizen
- user --name tizen --groups audio,video --password 'tizen'
- repo --name=Tizen-base --baseurl=https://download.tizen.org/snapshots/2.0alpha/ivi-wayland/@BUILD_ID@/repos/base/ia32/packages/ --ssl_verify=no
- repo --name=Tizen-ivi-wayland --baseurl=https://download.tizen.org/snapshots/2.0alpha/ivi-wayland/@BUILD_ID@/repos/ivi-wayland/ia32/packages/ --ssl_verify=no
- %packages
- @adaptation-automotive-intel
- @commonwayland
- @ivi-middleware
- @appswayland
- @toyota-ui
- kernel-x86-ivi
- release-repos
- -simulator-opengl
- -opengl-es
- %end
- %prepackages
- eglibc
- systemd
- busybox
- libacl
- libcap
- dbus-libs
- libgcc
- libudev
- libattr
- default-files-slp
- openssl
- libprivilege-control
- libprivilege-control-conf
- security-server
- libdlog
- libsecurity-server-client
- sqlite
- tzdata-slp
- vconf
- tizen-coreutils
- %end
- %post
- # to make udev happy
- ln -sf /bin/busybox /sbin/blkid
- # where in the world is xinitrc?
- ln -sf /etc/X11/xinitrc /usr/etc/X11/xinitrc
- # inittab hack to fix console - UI switching
- sed -ri 's/--noclear tty1/tty3/' /etc/inittab
- sed -ri 's/tty2/tty4/' /etc/inittab
- # modprobe fuse for sqlfs-mount
- /bin/sed -i "3i /sbin/modprobe fuse || :" /etc/rc.d/init.d/sqlfs-mount
- if [ -d /etc/init.d ]; then
- cp /etc/init.d/* /etc/rc.d/init.d/ -rdf
- fi
- rm -rf /etc/init.d*
- ln -sf /etc/rc.d/init.d /etc/init.d
- rm -rf /etc/localtime
- ln -sf /opt/etc/localtime /etc/localtime
- # Without this line the rpm doesn't get the architecture right.
- # echo -n 'armv7l-tizen-linux' > /etc/rpm/platform
- > /etc/rpm/platform
- ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_key -N ""
- ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ""
- ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ""
- pkg_initdb
- rm -fr /opt/dbspace/.app_info.*
- INITDB=1 ail_initdb
- # ims-service domain setting
- RESULT=`grep "192.168.0.163 config.45001.rcse" /etc/hosts`
- if [ -z "$RESULT" ]; then
- echo "Set domain for auto configuration"
- echo "192.168.0.163 config.45001.rcse" >> /etc/hosts
- else
- echo "Already setted domain for test auto configuration"
- fi
- # ims-service domain setting
- cat > /usr/bin/press << EOF
- #!/bin/sh
- JUNK="SLP"
- [ "\$1" ] && TIMEOUT="\$1" || TIMEOUT="1"
- echo "Press return key to stop scripts"
- read -t \$TIMEOUT JUNK
- exit \$?
- EOF
- chmod +x /usr/bin/press
- ln -s /opt/etc/X11/xkb /usr/share/X11
- ln -s /home/app /opt/home/app
- ln -s /home/developer /opt/home/developer
- echo "UDEV_PERSISTENT_STORAGE=no" >> /etc/sysconfig/udev
- rm -rf /usr/share/man
- rm -rf /usr/share/doc
- ldconfig
- mkdir -p /opt/var/lib/dbus
- rm -f /var/lib/rpm/__db*
- mv -f /var/lib/rpm /opt/var/lib/
- ln -sf /opt/var/lib/rpm /var/lib/rpm
- rpmdb --rebuilddb
- if [ -e /usr/bin/build-backup-data.sh ]; then
- /usr/bin/build-backup-data.sh
- fi
- sed -i s/ENGINE=gl/ENGINE=fb/ /etc/profile.d/menu-screen.sh
- # enable USB networking with IP address 192.168.1.1 by default
- cat >/etc/rc.d/rc3.d/S01usbnet.sh <<END
- #!/bin/sh
- echo 0 > /sys/class/android_usb/android0/enable
- echo adb,rndis > /sys/class/android_usb/android0/functions
- echo 1 > /sys/class/android_usb/android0/enable
- ifconfig rndis0 192.168.100.1
- END
- chmod 755 /etc/rc.d/rc3.d/S01usbnet.sh
- ln -sf /etc/rc.d/init.d/ssh /etc/rc.d/rc3.d/S90ssh
- # this file should be deleted after elegant fix merged
- ############################### hacks to get
- # usbnet, udev, ssh, and other stuff
- cat > /etc/rc.d/rc3.d/S01debug << EOF
- # udev
- /sbin/udevd --daemon
- /sbin/udevadm trigger
- EOF
- chmod +x /etc/rc.d/rc3.d/S01debug
- ###############################
- mkdir /root
- chmod 755 /root
- %end
- %post --nochroot
- if [ -n "$IMG_NAME" ]; then
- echo "BUILD: $IMG_NAME" >> $INSTALL_ROOT/etc/tizen-release
- fi
- %end
此文件为mic的配置文件,描述mic如何制作镜像文件。有关此文件的说明请参考:http://blog.csdn.net/flydream0/article/details/9162187 一文的第5章。
默认情况下repo使用的是远程资料库的RPM包。
3 使用MIC工具从远程repo下载RPM包并制作镜像文件
使用如下指令生成镜像文件:
- $ sudo mic create raw ivi-wayland-release.ks --pack-to=test.tar.bz2 --logfile=log
其
中 create表示创建镜像文件,raw表示raw格式的镜像, ivi-way...这里指定ks文件. --pack-to=xxx
表示打包生成test.tar.bz2文件,即此raw镜像文件打包到test.tar.bz2,
--logfile=xxx表示将打印信息存放到log文件中.
如下图:
最终结束后,会在当前目录生成log文件,保存制作镜像文件过程中的打印信息,同时会生成mic-output目录,压缩打包后的镜像文件test.tar.bz2文件就放在此目录下。
- $ tree mic-output/ -L 3
- mic-output/
- ├── ivi-wayland-release-201306251509.xml
- └── test.tar.bz2
- 0 directories, 2 files
注:默认情况下,mic工具会在/var/tmp目录下创建一mic目录,然后在mic目录下创建cache目录用来保存从远程repo下载的RPM包:
- $ tree mic -L 2
- mic
- ├── build
- ├── cache
- │ ├── etc
- │ ├── packages
- │ ├── raw
- │ ├── solv
- │ ├── Tizen-base
- │ ├── Tizen-ivi-wayland
- │ └── var
- └── device
- └── loop0
4 使用本地RPM包生成镜像文件
使用如下指令:
- $ sudo mic create raw ivi-wayland-release.ks --pack-to=local_test.tar.bz2 --logfile=log1 --local-pkgs-path=/home/arthur/GBS-ROOT/local/repos
其中--local-pkgs-path=后面为使用gbs build时生成的本地repo的所在目录。见:http://blog.csdn.net/flydream0/article/details/9004746一文的2.3节。
注:如果gbs build生成的目录下,即repos的tizenxxx目录下包含多个硬件平台架构的目录时,可以在MIC指令后通过-A选项来指令目标平台的架构,如:
- $ sudo mic create raw ivi-wayland-release.ks --pack-to=local_test.tar.bz2 --logfile=log1 --local-pkgs-path=/home/arthur/GBS-ROOT/local/repos -A i586
下一章我将讲述如何在目标设备上烧录镜像文件,敬请关注!
注:有关如何烧录镜像文件,请参考下一篇文章:http://blog.csdn.net/flydream0/article/details/9179143