summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2013-08-01 18:00:58 +0800
committerVishal Bhoj <vishal.bhoj@linaro.org>2013-08-02 16:20:44 +0530
commitb327762182364f28585a8e87ec6ff2f7c24faec0 (patch)
tree16b67b2f3ab4bf33ec7dc9e5b76b3b443721df8c
parent7344816517e646fdaac97acb5bcb2065e6bde9ed (diff)
downloadlinaro-android-tools-b327762182364f28585a8e87ec6ff2f7c24faec0.tar.gz
nfs tools: add support to boot from nfs
Add the script for creating root file system to support booting from nfs, and script to create the boot.scr script to use boot from nfs. Change-Id: I0397da5db416f47bc846a37e9cc41f4c941df4d4 Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rwxr-xr-xlinaro-android-nfs-tool.sh468
-rwxr-xr-xlinaro-create-boot-script151
-rwxr-xr-xnfs-sample.sh35
3 files changed, 654 insertions, 0 deletions
diff --git a/linaro-android-nfs-tool.sh b/linaro-android-nfs-tool.sh
new file mode 100755
index 0000000..d1102d4
--- /dev/null
+++ b/linaro-android-nfs-tool.sh
@@ -0,0 +1,468 @@
+#!/bin/bash
+
+# Author: Linaro Android Team <linaro-dev@lists.linaro.org>
+#
+# These files are Copyright (C) 2013 Linaro Limited and they
+# are licensed under the Apache License, Version 2.0.
+# You may obtain a copy of this license at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+OLD_PWD=`pwd`
+PARENT=$(cd $(dirname $0);pwd)
+install_binaries=false
+
+function show_usage() {
+ echo "Usage:"
+ echo -e "\t`basename $0`"
+ echo -e "\t\t create-rootfs [--rootfs-dir <rootfs-dir>] [--install-binaries] --nfs-entry-option <options> \\"
+ echo -e "\t\t\t\t --boot <boot.tar.bz2> --system <system.tar.bz2> --userdata <userdata.tar.bz2> "
+ echo -e "\t\t delete-rootfs --rootfs-dir <rootfs-dir>"
+ echo -e "\t\t create-boot-scr --device <device-type> --board-ip <ip-addr>|dhcp [--server-ip <server-ip>] [--gateway <gateway>] [--netmask <netmask>]"
+ echo -e "\t\t\t where device type is one of the following:"
+ echo -e "\t\t\t\t vexpress,snowball_emmc,mx6qsabrelite,vexpress-a9,origen_quad,panda,iMX53,smdkv310,arndale,snowball_sd,beagle,origen,mx53loco"
+ echo -e "\t\t manage-nfs-service start|stop|restart"
+ echo -e "\t\t manage-nfs-entry list"
+ echo -e "\t\t manage-nfs-entry add --nfs-entry-path <nfs-entr-path> [--nfs-entry-option <options>]"
+ echo -e "\t\t manage-nfs-entry delete --nfs-entry-path <nfs-entry-path>"
+ echo -e "\t\t batch [--rootfs-dir <rootfs-dir>] [--nfs-entry-option <options>] \\"
+ echo -e "\t\t\t\t --boot <boot.tar.bz2> --system <system.tar.bz2> --userdata <userdata.tar.bz2> \\"
+ echo -e "\t\t\t\t --device <device-type> --board-ip <ip>|dhcp [--server-ip <server-ip>] [--gateway <gateway>] [--netmask <netmask>]"
+ echo -e "\t\t\t\t do the steps of create-rootfs/create-boot-scr/manage-nfs-entry add/manage-nfs-service start/ togather with one command"
+ echo ""
+ echo -e "\t`basename $0` --help|-h"
+ echo -e "\t\tPrint out this help information"
+}
+
+function parse_argv() {
+ sub_cmd=$1
+ if [ -z "${sub_cmd}" ]; then
+ echo "Please specify the sub command you want to do"
+ show_usage
+ exit 1
+ fi
+ if [ "X${sub_cmd}" == "X--help" ] || [ "X${sub_cmd}" == "X--h" ]; then
+ show_usage
+ exit 0
+ fi
+ shift
+ while test -n "$1"; do
+ case "$1" in
+ --help|-h)
+ show_usage
+ exit 0
+ ;;
+ --boot)
+ file_boot=$2;
+ shift 2
+ ;;
+ --system)
+ file_system=$2;
+ shift 2
+ ;;
+ --userdata)
+ file_userdata=$2;
+ shift 2
+ ;;
+ --rootfs-dir)
+ rootfs_dir=$2;
+ shift 2
+ ;;
+ --nfs-entry-path)
+ nfs_entry_path=$2;
+ shift 2
+ ;;
+ --nfs-entry-option)
+ nfs_entry_option=$2;
+ shift 2
+ ;;
+ --install-binaries)
+ install_binaries=true
+ shift 1
+ ;;
+ --netmask)
+ netmask=$2
+ shift 2
+ ;;
+ --gateway)
+ gateway=$2
+ shift 2
+ ;;
+ --board-ip)
+ board_ip=$2
+ shift 2
+ ;;
+ --server-ip)
+ server_ip=$2
+ shift 2
+ ;;
+ --device)
+ device=$2
+ shift 2
+ ;;
+ *)
+ if [ -n "${operation}" ]; then
+ show_usage
+ echo "Too many arguments, see --help for details"
+ exit 1
+ else
+ operation="$1"
+ shift
+ fi
+ ;;
+ esac
+ done
+}
+
+function check_parameters(){
+ if [ -z "${sub_cmd}" ]; then
+ echo "Please specify the sub command for what you want to do"
+ show_usage
+ exit 1
+ fi
+
+ check_subcommand
+ check_para_for_create_rootfs
+ check_para_for_delete_rootfs
+ check_para_for_manage_nfs_service
+ check_para_for_manage_nfs_entry
+ check_para_for_create_boot_scr
+}
+
+function check_subcommand(){
+ echo "X${sub_cmd}"|egrep '^\-' &>/dev/null
+ if [ $? -eq 0 ];then
+ echo "There is no sub command starts with hyphen(-) character, please check the sub command you specified"
+ show_usage
+ exit 1
+ fi
+ valid_sub_cmds="create-rootfs delete-rootfs manage-nfs-service manage-nfs-entry batch create-boot-scr"
+ check_word_in_set "${valid_sub_cmds}" "${sub_cmd}"
+ if [ $? -ne 0 ]; then
+ echo "The specified sub command($sub_cmd) is not supported."
+ show_usage
+ exit 1
+ fi
+}
+
+function check_para_for_delete_rootfs(){
+ if [ "X${sub_cmd}" != "Xdelete-rootfs" ]; then
+ return
+ fi
+ if [ -z "${rootfs_dir}" ]; then
+ echo "Please specify the path of the root file system via the --rootfs-dir option for this delete-rootfs sub command"
+ exit 1
+ fi
+
+}
+
+function check_para_for_create_boot_scr(){
+ if [ "X${sub_cmd}" != "Xcreate-boot-scr" ] && [ "X${sub_cmd}" != "Xbatch" ]; then
+ return
+ fi
+ if [ -z "${device}" ]; then
+ echo "You must specify the device type for the --device option to create the boot script"
+ exit 1
+ fi
+
+ if [ -z "${board_ip}" ]; then
+ echo "You must specify the ip information via the --board-ip option when create the boot script for booting via nfs"
+ echo "It should be dhcp or the ip address the board will use"
+ exit 1
+ fi
+}
+
+function check_para_for_create_rootfs(){
+ if [ "X${sub_cmd}" != "Xcreate-rootfs" ] && [ "X${sub_cmd}" != "Xbatch" ]; then
+ return
+ fi
+
+ if [ ! -f "${file_boot}" ];then
+ echo "The specified file for --boot option does not exist"
+ exit 1
+ fi
+ if [ ! -f "${file_system}" ];then
+ echo "The specified file for --system option does not exist"
+ exit 1
+ fi
+ if [ ! -f "${file_userdata}" ];then
+ echo "The specified file for --userdata option does not exist"
+ exit 1
+ fi
+}
+
+function check_para_for_manage_nfs_service(){
+ if [ "X${sub_cmd}" != "Xmanage-nfs-service" ]; then
+ return
+ fi
+
+ if [ -z "${operation}" ]; then
+ echo "Please specify the operation start or stop for this sub command"
+ exit 1
+ fi
+
+ words_set="start stop restart"
+ check_word_in_set "${words_set}" "${operation}"
+ if [ $? -ne 0 ]; then
+ echo "Please specify the operation in [${words_set}] for this sub command"
+ exit 1
+ fi
+}
+
+function check_para_for_manage_nfs_entry(){
+ if [ "X${sub_cmd}" != "Xmanage-nfs-entry" ]; then
+ return
+ fi
+
+ if [ -z "${operation}" ]; then
+ echo "Please specify the operation add or delete for this sub command"
+ exit 1
+ fi
+
+ words_set="list add delete"
+ check_word_in_set "${words_set}" "${operation}"
+ if [ $? -ne 0 ]; then
+ echo "Please specify the operation in [${words_set}] for this sub command"
+ exit 1
+ fi
+
+ if [ "X${operation}" == "Xlist" ];then
+ return
+ fi
+ if [ -z "${nfs_entry_path}" ];then
+ echo "Please specify the value for the --nfs-entry-path option"
+ exit 1
+ fi
+ echo "${nfs_entry_path}"|egrep '^/' &>/dev/null
+ if [ $? -ne 0 ];then
+ echo "The value for the --nfs-entry-path option should be an absolute path"
+ exit 1
+ fi
+
+}
+
+function uncompress_uinitrd(){
+ uinitrd_f="$1"
+
+ uinitrd_dir=`dirname $uinitrd_f`
+ uinitrd_name=`basename $uinitrd_f`
+
+ dd if=${uinitrd_dir}/${uinitrd_name} of=${uinitrd_dir}/uInitrd.data ibs=64 skip=1
+ mv ${uinitrd_dir}/uInitrd.data ${uinitrd_dir}/ramdisk.cpio.gz
+ gzip -d -f ${uinitrd_dir}/ramdisk.cpio.gz
+ cpio -i -F ${uinitrd_dir}/ramdisk.cpio
+}
+
+function uncompress_tarball(){
+ tarball=$1
+ tar -jxvf $tarball
+ if [ $? -ne 0 ]; then
+ echo "Failed to uncompress the specified file: $tarball"
+ exit 1
+ fi
+}
+
+function update_init_files(){
+ file_fstab="${nfs_entry_path}/fstab.omap4pandaboard"
+ sed -i "\%\s\+/data\s\+%d" ${file_fstab}
+ sed -i "\%\s\+/system\s\+%d" ${file_fstab}
+ sed -i "\%\s\+/cache\s\+%d" ${file_fstab}
+
+ #hack on installd command to support boot via nfs
+ sed -i "/on boot/a\ setprop hack.installd.for.nfs 1" "${nfs_entry_path}/init.omap4pandaboard.rc"
+}
+
+function func_install_binaries(){
+ DL_URL='https://dl.google.com/dl/android/aosp/imgtec-panda-20120430-67545da7.tgz'
+ binaries_path="${nfs_entry_path}/binaries"
+ mkdir "${binaries_path}"
+ cd "${binaries_path}"
+ wget --no-check-certificate $DL_URL
+ tar -zxvf `basename $DL_URL`
+ sh extract-imgtec-panda.sh
+ if [ $? -ne 0 ]; then
+ echo "Failed to extact the binaries files"
+ exit 1
+ fi
+
+ system_root="${nfs_entry_path}/system"
+ mkdir -p ${system_root}/vendor/bin/
+ mkdir -p ${system_root}/vendor/lib/egl
+ cp ${binaries_path}/vendor/imgtec/panda/proprietary/pvrsrvinit ${system_root}/vendor/bin/pvrsrvinit
+ cp ${binaries_path}/vendor/imgtec/panda/proprietary/pvrsrvinit ${system_root}/bin/pvrsrvinit
+ chmod a+x ${system_root}/vendor/bin/pvrsrvinit
+ cp ${binaries_path}/vendor/imgtec/panda/proprietary/libEGL_POWERVR_SGX540_120.so ${system_root}/vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
+ cp ${binaries_path}/vendor/imgtec/panda/proprietary/libGLESv1_CM_POWERVR_SGX540_120.so ${system_root}/vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
+ cp ${binaries_path}/vendor/imgtec/panda/proprietary/libGLESv2_POWERVR_SGX540_120.so ${system_root}/vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
+ cp ${binaries_path}/vendor/imgtec/panda/proprietary/gralloc.omap4.so ${system_root}/vendor/lib/hw/gralloc.omap4.so
+ cp ${binaries_path}/vendor/imgtec/panda/proprietary/libglslcompiler.so ${system_root}/vendor/lib/libglslcompiler.so
+ cp ${binaries_path}/vendor/imgtec/panda/proprietary/libIMGegl.so ${system_root}/vendor/lib/libIMGegl.so
+ cp ${binaries_path}/vendor/imgtec/panda/proprietary/libpvr2d.so ${system_root}/vendor/lib/libpvr2d.so
+ cp ${binaries_path}/vendor/imgtec/panda/proprietary/libpvrANDROID_WSEGL.so ${system_root}/vendor/lib/libpvrANDROID_WSEGL.so
+ cp ${binaries_path}/vendor/imgtec/panda/proprietary/libPVRScopeServices.so ${system_root}/vendor/lib/libPVRScopeServices.so
+ cp ${binaries_path}/vendor/imgtec/panda/proprietary/libsrv_init.so ${system_root}/vendor/lib/libsrv_init.so
+ cp ${binaries_path}/vendor/imgtec/panda/proprietary/libsrv_um.so ${system_root}/vendor/lib/libsrv_um.so
+ cp ${binaries_path}/vendor/imgtec/panda/proprietary/libusc.so ${system_root}/vendor/lib/libusc.so
+ chmod -R 755 ${system_root}/vendor/lib/
+}
+
+function func_create_rootfs(){
+ if [ -z "${rootfs_dir}" ];then
+ template=$(date '+%y%m%d-%H%M%S')
+ rootfs_dir=`mktemp -d -u --tmpdir=${default_nfs_root_dir} -t $template.XXX`
+ fi
+ mkdir -p "$rootfs_dir"
+ if [ $? -ne 0 ]; then
+ echo "Failed to create the specified rootfs_dir($rootfs_dir)"
+ exit 1
+ fi
+
+ rootfs_dir=$(cd "$rootfs_dir"; pwd)
+ cd "${rootfs_dir}"
+ uncompress_tarball ${file_boot}
+ uncompress_uinitrd boot/uInitrd
+ uncompress_tarball $file_system
+ uncompress_tarball $file_userdata
+ cd "${OLD_PWD}"
+ nfs_entry_path="${rootfs_dir}"
+
+ if [ "X${device}" == "Xpanda" ];then
+ install_binaries=true;
+ fi
+ if ${install_binaries}; then
+ func_install_binaries
+ fi
+ update_init_files
+}
+
+function func_delete_rootfs(){
+ if [ -z "${rootfs_dir}" ]; then
+ return
+ fi
+ prompt="Are you sure to delete the following entire directory and its entry in /etc/exports:"$'\n'$'\t'$'\t'"${rootfs_dir}"$'\n'"yes or no:"
+ local _response
+ read -p "$prompt" _response
+ if [ "X${_response}" == "Xyes" ]; then
+ rm -fr ${rootfs_dir}
+ operation="delete"
+ nfs_entry_path=${rootfs_dir}
+ func_manage_nfs_entry
+ else
+ return
+ fi
+}
+
+function func_create_boot_scr(){
+ if [ -n "${server_ip}" ]; then
+ nfs_server_ip=${server_ip}
+ else
+ nfs_server_ip=$(ifconfig eth0 | grep 'inet addr' | awk '{print $2}' | cut -f2 -d':')
+ fi
+ nfs_root="${nfs_server_ip}:${nfs_entry_path}"
+ board_ip=${board_ip-""}
+ gateway=${gateway-""}
+ netmask=${netmask-""}
+ device=${device-""}
+ if [ "X${board_ip}" = "Xdhcp" ];then
+ ip="dhcp"
+ else
+ ip="${board_ip}:${nfs_server_ip}:${gateway}:${netmask}:${device}:eth0:off"
+ fi
+
+ bootargs_nfs="ip=${ip} root=/dev/nfs nfsroot=${nfs_root}"
+ ${PARENT}/linaro-create-boot-script --dev "${device}" --nfs-root "${nfs_entry_path}" --nfs-args "${bootargs_nfs}"
+}
+
+function func_manage_nfs_service(){
+ sudo service nfs-kernel-server $operation
+ sudo exportfs -rv
+}
+
+function func_manage_nfs_entry(){
+ if [ "X${operation}" == "Xlist" ]; then
+ showmount -e localhost
+ return
+ fi
+ if [ -z "$nfs_entry_path" ]; then
+ echo "The path of the nfs entry to be added is not set yet"
+ return
+ fi
+ shopt -s extglob
+ nfs_entry_path=${nfs_entry_path//+(\/)/\/}
+ nfs_entry_path=${nfs_entry_path%%+(\/)}
+ shopt -u extglob
+
+ if [ -z "${nfs_entry_option}" ];then
+ nfs_entry_option=${default_nfs_entry_option}
+ fi
+
+ if [ "X${operation}" != "Xadd" ] && [ "X${operation}" != "Xdelete" ]; then
+ echo "Unsupported operation specified: $operation"
+ exit 1
+ fi
+ nfs_export_file="/etc/exports"
+ cp -uvf "${nfs_export_file}" "${nfs_export_file}.cpy"
+
+ sed -i "\%^\\s*${nfs_entry_path} %d" ${nfs_export_file}.cpy
+ if [ $? -ne 0 ]; then
+ echo "Failed to delete the nfs entries for path: ${nfs_entry_path}"
+ exit 1
+ fi
+ if [ "X${operation}" == "Xadd" ];then
+ nfs_entry="${nfs_entry_path} ${nfs_entry_option}"
+ sed -i "\$a\\${nfs_entry}" ${nfs_export_file}.cpy
+ if [ $? -ne 0 ]; then
+ echo "Failed to add the new nfs entry: ${nfs_entry}"
+ exit 1
+ fi
+ fi
+
+ #-rw-r--r-- 1 root root 389 Jul 23 15:45 /etc/exports
+ mv -v "${nfs_export_file}" "${nfs_export_file}.org"
+ mv -v "${nfs_export_file}.cpy" "${nfs_export_file}"
+ operation="restart"
+ func_manage_nfs_service restart
+}
+
+function func_batch(){
+ func_create_rootfs
+ func_create_boot_scr
+ operation="add"
+ func_manage_nfs_entry
+ operation="restart"
+ func_manage_nfs_service
+}
+
+function check_word_in_set(){
+ words_set=$1
+ word=$2
+ if [ -z "${words_set}" ]; then
+ return 1
+ fi
+ if [ -z "${word}" ]; then
+ echo "The key word to check is empty string"
+ return 0
+ fi
+
+ echo $words_set |egrep -e "\s+${word}\s*$|^\s*${word}\s+|\s+${word}\s+" &>/dev/null
+ return $?
+}
+
+function main(){
+ default_nfs_root_dir="/srv/linaro/android/nfs_root"
+ default_nfs_entry_option="*(rw,sync,no_root_squash,no_subtree_check)"
+
+ parse_argv "$@"
+ check_parameters
+
+ check_word_in_set "delete-rootfs manage-nfs-service manage-nfs-entry batch" "${sub_cmd}"
+ if [ $? -eq 0 ]; then
+ if [ "X$(id -u)" != "X0" ]; then
+ echo "You need have the root permission to manage the nfs service or nfs entry"
+ exit 0
+ fi
+ fi
+
+ sub_cmd_func="func_$(echo ${sub_cmd}|tr \- _)"
+ ${sub_cmd_func}
+}
+main "$@"
diff --git a/linaro-create-boot-script b/linaro-create-boot-script
new file mode 100755
index 0000000..1d5c2b9
--- /dev/null
+++ b/linaro-create-boot-script
@@ -0,0 +1,151 @@
+#!/usr/bin/env python
+# Copyright (C) 2011 Linaro
+#
+# This file is part of Linaro Image Tools.
+#
+# Linaro Image Tools is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Linaro Image Tools is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Linaro Image Tools. If not, see <http://www.gnu.org/licenses/>.
+import argparse
+import os
+
+from linaro_image_tools.media_create.boards import make_boot_script
+from linaro_image_tools.media_create.android_boards import (
+ get_board_config,
+ )
+from linaro_image_tools.utils import (
+ additional_android_option_checks,
+ andorid_hwpack_in_boot_tarball,
+ ensure_command,
+ get_logger,
+ )
+
+from linaro_image_tools.media_create import (
+ get_version,
+ ANDROID_KNOWN_BOARDS,
+ add_common_options,
+ )
+
+
+def ensure_required_commands(args):
+ """Ensure we have the commands that we know are going to be used."""
+ required_commands = ['mkimage']
+ for command in required_commands:
+ ensure_command(command)
+
+
+def get_bootcmd(board_config):
+ """Get the bootcmd for this board.
+
+ In general subclasses should not have to override this.
+ """
+ replacements = dict(
+ fatload_command=board_config.fatload_command, uimage_path=board_config.uimage_path,
+ mmc_option=board_config.mmc_option, kernel_addr=board_config.kernel_addr,
+ load_interface=board_config.load_interface)
+
+ boot_script = (
+ ("%(fatload_command)s %(load_interface)s %(mmc_option)s "
+ "%(kernel_addr)s %(uimage_path)suImage; ")) % replacements
+ boot_script += (("bootm %(kernel_addr)s")) % replacements
+ return boot_script
+
+
+def get_android_args_parser_for_boot_script():
+ """Get the ArgumentParser for the arguments given on the command line."""
+ parser = argparse.ArgumentParser(version='%(prog)s ' + get_version())
+ parser.add_argument(
+ '--hwpack', required=False,
+ help=('An Android hardware pack file with the board configuration.'))
+ parser.add_argument(
+ '--dev', required=True, dest='dev', choices=ANDROID_KNOWN_BOARDS,
+ help='Generate boot script for the given board.')
+ parser.add_argument(
+ '--console', action='append', dest='consoles', default=[],
+ help=('Add a console to kernel boot parameter; this parameter can be '
+ 'defined multiple times.'))
+ parser.add_argument(
+ '--nfs-root', default=None, required=True,
+ help=('The root directory exported as nfs used'
+ ' for booting android via nfs'))
+ parser.add_argument(
+ '--nfs-args', default=None, required=False,
+ help=('bootarg when want to boot via nfs'))
+ add_common_options(parser)
+ return parser
+
+
+if __name__ == '__main__':
+ parser = get_android_args_parser_for_boot_script()
+ args = parser.parse_args()
+
+ logger = get_logger(debug=args.debug)
+
+ additional_android_option_checks(args)
+
+ nfs_entry = args.nfs_root
+
+ if args.dev == 'iMX53':
+ # XXX: remove this and the corresponding entry in android_board_configs
+ logger.warning("DEPRECATION WARNING: iMX53 is deprecated, please "
+ "use mx53loco.")
+
+ ensure_required_commands(args)
+
+ board_config = get_board_config(args.dev)
+
+ hwpack_exists, config_file = andorid_hwpack_in_boot_tarball(nfs_entry)
+ if not args.hwpack and not hwpack_exists:
+ # No hwpack in the boot tarball nor provided on the command line.
+ logger.warning("No hwpack found in the boot tarball nor passed on "
+ "the command line. Default values will be used.")
+ elif not args.hwpack and hwpack_exists:
+ board_config.from_file(config_file)
+ elif args.hwpack:
+ logger.warning("Values from the hwpack provided on the command line "
+ "will be used.")
+ board_config.from_file(args.hwpack)
+
+ board_config.add_boot_args(args.extra_boot_args)
+ board_config.add_boot_args_from_file(args.extra_boot_args_file)
+
+ ## only generate the uImage part in the bootcmd,
+ ## not include the uInitrd and board.dtb part
+ if args.nfs_args:
+ board_config.initrd_addr = False
+ boot_env = board_config._get_boot_env(args.consoles)
+
+ cmdline_filepath = os.path.join(nfs_entry, 'boot', "cmdline")
+ cmdline_file = open(cmdline_filepath, 'r')
+ android_kernel_cmdline = cmdline_file.read().strip()
+ boot_env['bootargs'] = boot_env['bootargs'] + ' ' + \
+ android_kernel_cmdline
+ cmdline_file.close()
+
+ if args.nfs_args:
+ boot_env['bootargs'] = boot_env['bootargs'] + ' ' + args.nfs_args
+
+ bootargs_array = boot_env['bootargs'].split()
+ new_bootargs = []
+ for i in range(len(bootargs_array)):
+ if bootargs_array[i] == 'ro':
+ new_bootargs.append('rw')
+ else:
+ new_bootargs.append(bootargs_array[i])
+ boot_env['bootargs'] = ' '.join(new_bootargs)
+
+ boot_env['bootcmd'] = get_bootcmd(board_config)
+
+ boot_script_path = os.path.join(nfs_entry, 'boot',
+ board_config.boot_script)
+ make_boot_script(boot_env, boot_script_path)
+ print "The boot script is created here: %s" % boot_script_path
diff --git a/nfs-sample.sh b/nfs-sample.sh
new file mode 100755
index 0000000..1347af6
--- /dev/null
+++ b/nfs-sample.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+rootfs_dir="/srv/linaro/android/nfs_root/test"
+images_dir="/data/linaro/linaro-android/tracking/stable/out/target/product/pandaboard"
+server_ip="192.168.9.109"
+gateway="192.168.9.1"
+netmask="255.255.255.0"
+board_ip="192.168.9.110"
+#board_ip="dhcp"
+
+rm -fr "${rootfs_dir}"
+if [ $? -ne 0 ]; then
+ echo "Faild to remove the old ${rootfs_dir}"
+ exit 1
+fi
+if [ "X${board_ip}" = "Xdhcp" ]; then
+ ./linaro-android-nfs-tool.sh batch \
+ --rootfs-dir "${rootfs_dir}" \
+ --boot "${images_dir}/boot.tar.bz2" \
+ --system "${images_dir}/system.tar.bz2" \
+ --userdata "${images_dir}/userdata.tar.bz2" \
+ --device "panda" \
+ --board-ip "dhcp" \
+ --server-ip "${server_ip}"
+else
+ ./linaro-android-nfs-tool.sh batch \
+ --rootfs-dir "${rootfs_dir}" \
+ --boot "${images_dir}/boot.tar.bz2" \
+ --system "${images_dir}/system.tar.bz2" \
+ --userdata "${images_dir}/userdata.tar.bz2" \
+ --device "panda" \
+ --board-ip "${board_ip}" --gateway "${gateway}" --netmask "${netmask}" \
+ --server-ip "${server_ip}"
+fi
+echo "Please copy the contents in $rootfs_dir/boot to your boot partition(normal the first vfat partition), and reboot your board"