Ejemplo n.º 1
0
def buildBootloader():
    os.chdir(getScriptDir())

    # This might need partner repos enabled
    ensureDependencies(['ia32-libs'])

    print('Building bootloader')

    # Clone RCN's git repository
    gitCloneAndEnter('git://github.com/RobertCNelson/Bootloader-Builder.git',
                     '607af4c206a3f')

    # Patch the bootloader
    # GPIO mux settings can be found in u-boot/board/ti/beagle/beagle.h
    patches = [
        '0001-Only-build-for-beagleboard.patch',
        '0002-Add-patch-to-change-boot-delay-to-0-seconds.patch',
        '0003-Add-patch-to-set-BeagleBoard-xM-pin-mux.patch'
    ]
    patchdir = os.path.realpath(
        os.path.join(getScriptDir(), 'patches', 'Bootloader-Builder'))
    for patch in patches:
        subprocess.call(['git', 'am', os.path.join(patchdir, patch)])

    # Build the bootloader
    subprocess.call(['./build.sh'])
    os.chdir('..')
Ejemplo n.º 2
0
def buildQemu():
	os.chdir(getScriptDir())
	# Install dependencies
	ensureDependencies(['libglib2.0-dev', 'binfmt-support', 'qemu'])
	subprocess.call(['sudo', 'apt-get', '-y', 'build-dep', 'qemu'])
	
	# Clone RCN's git repository
	print('Building under Qemu')
	gitCloneAndEnter('git://github.com/RobertCNelson/linaro-tools.git', '4a1cb42df6e58')
	
	# Build and install qemu
	os.chdir('qemu') # MUST CD INTO DIRECTORY
	subprocess.call(['./build_qemu.sh'])
	os.chdir('..')
	os.chdir('..')
Ejemplo n.º 3
0
def buildKernel():
    os.chdir(getScriptDir())
    loadSettings()

    # Install dependencies (Ubuntu needs u-boot-tools, Debian needs uboot-mkimage)
    ensureDependencies(
        ['gcc-arm-linux-gnueabi', 'u-boot-tools', 'device-tree-compiler'])

    # Clone the linux kernel source tree
    print('Cloning the Linux kernel source tree')
    linuxDirName = gitCloneAndEnter(
        'git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git',
        'master')
    os.chdir('..')

    # Clone RCN's git repository
    print('Building kernel')
    gitCloneAndEnter('git://github.com/RobertCNelson/stable-kernel.git',
                     '4d82ccd1b2093')

    # Configure the kernel build script
    shutil.copyfile('system.sh.sample',
                    'system.sh')  # Overwrites existing file
    file = open('system.sh', 'a')  # Open for appending
    file.write('LINUX_GIT=' +
               os.path.join(os.path.realpath('..'), linuxDirName) + '\n')
    file.write('ZRELADDR=0x80008000' +
               '\n')  # For TI: OMAP3/4/AM35xx (BB is OMAP3)
    #file.write('BUILD_UIMAGE=1' + '\n') # Do I need to build uImage?
    file.write('MMC=' + getSetting('mmc') + '\n')
    # Pull in Torvalds current master tree before applying local patchset
    # This is very useful during an intial 'rc0' merge.
    # It is never supported... Enable at your own risk
    #file.write('LATEST_GIT=1' + '\n')
    file.write(
        'LOCAL_PATCH_DIR=' +
        os.path.join(os.path.realpath('..'), 'patches', 'stable-kernel') +
        '\n')
    file.close()
    # Adding the CC parameter is a little more complex... we need to seek out
    # the config line and uncomment it.
    replaceAll('system.sh', '#CC=arm-linux-gnueabi-', 'CC=arm-linux-gnueabi-')

    # Build the kernel
    subprocess.call(['./build_deb.sh'])
    os.chdir('..')
Ejemplo n.º 4
0
def installRosDeps():
	# Make sure our current working dir is the script's location
	os.chdir(getScriptDir())
	
	if not os.path.exists('rosdeps'):
		os.makedirs('rosdeps')
	os.chdir('rosdeps')
	
	# yaml-cpp
	# Required by the navigation stack
	# If 0.3.0 doesn't work, use https://github.com/wg-debs/yaml_cpp-release (0.2.7)
	if not os.path.exists('/usr/local/lib/libyaml-cpp.a'):
		if os.path.exists('yaml-cpp'):
			subprocess.call(['rm', '-rf', 'yaml-cpp'])
		get('http://yaml-cpp.googlecode.com/files/yaml-cpp-0.3.0.tar.gz')
		os.chdir('yaml-cpp')
		os.makedirs('build')
		os.chdir('build')
		subprocess.call(['cmake', '..'])
		subprocess.call(['make'])
		subprocess.call(['sudo', 'make', 'install'])
		os.chdir('..')
		os.chdir('..')
		subprocess.call(['rm', '-rf', 'yaml-cpp'])
	
	# ros-fuerte-pcl
	# Required by the perception_pcl stack
	if not os.path.exists('/usr/local/lib/libpcl_common.so'):
		# Install build dependencies (others may be required)
		subprocess.call(['sudo', 'apt-get', 'install', 'libflann-dev'])
		if os.path.exists('pcl'):
			subprocess.call(['rm', '-rf', 'pcl'])
		gitCloneAndEnter('git://github.com/wg-debs/pcl.git', 'master')
		os.makedirs('build')
		os.chdir('build')
		subprocess.call(['cmake', '-DUSE_ROS=ON', '..'])
		subprocess.call(['make'])
		subprocess.call(['sudo', 'make', 'install'])
		os.chdir('..')
		os.chdir('..')
		subprocess.call(['rm', '-rf', 'pcl'])
	
	# All done
	os.chdir('..')
	subprocess.call(['rm', '-rf', 'rosdeps'])
Ejemplo n.º 5
0
def installRosDeps():
    # Make sure our current working dir is the script's location
    os.chdir(getScriptDir())

    if not os.path.exists('rosdeps'):
        os.makedirs('rosdeps')
    os.chdir('rosdeps')

    # yaml-cpp
    # Required by the navigation stack
    # If 0.3.0 doesn't work, use https://github.com/wg-debs/yaml_cpp-release (0.2.7)
    if not os.path.exists('/usr/local/lib/libyaml-cpp.a'):
        if os.path.exists('yaml-cpp'):
            subprocess.call(['rm', '-rf', 'yaml-cpp'])
        get('http://yaml-cpp.googlecode.com/files/yaml-cpp-0.3.0.tar.gz')
        os.chdir('yaml-cpp')
        os.makedirs('build')
        os.chdir('build')
        subprocess.call(['cmake', '..'])
        subprocess.call(['make'])
        subprocess.call(['sudo', 'make', 'install'])
        os.chdir('..')
        os.chdir('..')
        subprocess.call(['rm', '-rf', 'yaml-cpp'])

    # ros-fuerte-pcl
    # Required by the perception_pcl stack
    if not os.path.exists('/usr/local/lib/libpcl_common.so'):
        # Install build dependencies (others may be required)
        subprocess.call(['sudo', 'apt-get', 'install', 'libflann-dev'])
        if os.path.exists('pcl'):
            subprocess.call(['rm', '-rf', 'pcl'])
        gitCloneAndEnter('git://github.com/wg-debs/pcl.git', 'master')
        os.makedirs('build')
        os.chdir('build')
        subprocess.call(['cmake', '-DUSE_ROS=ON', '..'])
        subprocess.call(['make'])
        subprocess.call(['sudo', 'make', 'install'])
        os.chdir('..')
        os.chdir('..')
        subprocess.call(['rm', '-rf', 'pcl'])

    # All done
    os.chdir('..')
    subprocess.call(['rm', '-rf', 'rosdeps'])
Ejemplo n.º 6
0
def buildKernel():
    os.chdir(getScriptDir())
    loadSettings()

    # Install dependencies (Ubuntu needs u-boot-tools, Debian needs uboot-mkimage)
    ensureDependencies(["gcc-arm-linux-gnueabi", "u-boot-tools", "device-tree-compiler"])

    # Clone the linux kernel source tree
    print("Cloning the Linux kernel source tree")
    linuxDirName = gitCloneAndEnter("git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git", "master")
    os.chdir("..")

    # Clone RCN's git repository
    print("Building kernel")
    gitCloneAndEnter("git://github.com/RobertCNelson/stable-kernel.git", "4d82ccd1b2093")

    # Configure the kernel build script
    shutil.copyfile("system.sh.sample", "system.sh")  # Overwrites existing file
    file = open("system.sh", "a")  # Open for appending
    file.write("LINUX_GIT=" + os.path.join(os.path.realpath(".."), linuxDirName) + "\n")
    file.write("ZRELADDR=0x80008000" + "\n")  # For TI: OMAP3/4/AM35xx (BB is OMAP3)
    # file.write('BUILD_UIMAGE=1' + '\n') # Do I need to build uImage?
    file.write("MMC=" + getSetting("mmc") + "\n")
    # Pull in Torvalds current master tree before applying local patchset
    # This is very useful during an intial 'rc0' merge.
    # It is never supported... Enable at your own risk
    # file.write('LATEST_GIT=1' + '\n')
    file.write("LOCAL_PATCH_DIR=" + os.path.join(os.path.realpath(".."), "patches", "stable-kernel") + "\n")
    file.close()
    # Adding the CC parameter is a little more complex... we need to seek out
    # the config line and uncomment it.
    replaceAll("system.sh", "#CC=arm-linux-gnueabi-", "CC=arm-linux-gnueabi-")

    # Build the kernel
    subprocess.call(["./build_deb.sh"])
    os.chdir("..")
Ejemplo n.º 7
0
def buildBootloader():
	os.chdir(getScriptDir())

	# This might need partner repos enabled
	ensureDependencies(['ia32-libs'])

	print('Building bootloader')

	# Clone RCN's git repository
	gitCloneAndEnter('git://github.com/RobertCNelson/Bootloader-Builder.git', '607af4c206a3f')
	
	# Patch the bootloader
	# GPIO mux settings can be found in u-boot/board/ti/beagle/beagle.h
	patches = [
		'0001-Only-build-for-beagleboard.patch',
		'0002-Add-patch-to-change-boot-delay-to-0-seconds.patch',
		'0003-Add-patch-to-set-BeagleBoard-xM-pin-mux.patch']
	patchdir = os.path.realpath(os.path.join(getScriptDir(), 'patches', 'Bootloader-Builder'))
	for patch in patches:
		subprocess.call(['git', 'am', os.path.join(patchdir, patch)])
	
	# Build the bootloader
	subprocess.call(['./build.sh'])
	os.chdir('..')
Ejemplo n.º 8
0
def buildImage():
	os.chdir(getScriptDir())
	loadSettings()
	
	# Look for a kernel image
	imgpath = False # Discovered image goes here
	for path in ['images', os.path.join('stable-kernel', 'deploy')]:
		if not os.path.exists(path):
			continue
		files = sorted(os.listdir(path), reverse=True)
		for f in files:
			if f.endswith('.deb') and 'image' in f:
				imgpath = os.path.realpath(os.path.join(path, f))
				print('Found kernel image: ' + imgpath)
				print('rootstock will use this local image instead of http://rcn-ee.net')
				break
		if imgpath:
			break
	
	# Clone RCN's git repository
	print('Building Ubuntu image')
	gitCloneAndEnter('git://github.com/RobertCNelson/omap-image-builder.git', '73e92f5cef5d3')
	#subprocess.call(['git', 'reset', '--hard', 'HEAD'])
	
	patches = [
		'0001-Only-build-Precise-image.patch',
		'0002-Include-additional-packages-specified-in-settings.xm.patch',
		'0003-Force-MAC-address.patch',
		'0004-Remove-text-from-etc-flash-kernel.conf.patch',
		'0005-Copy-keys-to-the-new-filesystem.patch']
	if imgpath:
		patches.append('0006-Primary-kernel-is-on-local-filesystem.patch')
	if False:
		patches.append('0007-Run-script-to-install-ros.patch')
	for p in patches:
		subprocess.call(['git', 'am', os.path.join(getScriptDir(), 'patches',
			'omap-image-builder', p)])
	
	#subprocess.call(['git', 'checkout', 'v2012.4-1', '-b', 'v2012.4-1'])
	
	# Configure image builder
	replaceAll('build_image.sh', 'FQDN="arm"', 'FQDN="' + getSetting('fqdn') + '"')
	replaceAll('build_image.sh', 'USER_LOGIN="******"', 'USER_LOGIN="******"')
	replaceAll('build_image.sh', 'USER_PASS="******"', 'USER_PASS="******"')
	replaceAll('build_image.sh', 'USER_NAME="Demo User"', 'USER_NAME="' + getSetting('name') + '"')
	replaceAll('var/pkg_list.sh', '__MECANUM_PACKAGES__', ','.join(getSetting('packages')))
	if imgpath:
		# Kernel image, e.g. linux-image-3.2.18-x12_1.0precise_armhf.deb
		replaceAll('build_image.sh', '__KERNEL_DEB_FILE__', imgpath)
	
	replaceAll('tools/fixup.sh', 'DE:AD:BE:EF:CA:FE', getSetting('macaddress'))
	# Attempt to copy our ssh keys to the new filesystem
	try:
		id_rsa = open(getScriptDir() + '../../ssh_keys/id_rsa', 'r')
		rsa_private = id_rsa.read()
		id_rsa.close()
		id_rsa_pub = open(getScriptDir() + '../../ssh_keys/id_rsa.pub', 'r')
		rsa_public = id_rsa_pub.read()
		id_rsa_pub.close()
		if (len(rsa_private) and len(rsa_public)):
			replaceAll('tools/fixup.sh', '#USER_NAME=__USER_NAME__', 'USER_NAME="' + getSetting('username') + '"')
			replaceAll('tools/fixup.sh', '__RSA_PRIVATE__', rsa_private)
			replaceAll('tools/fixup.sh', '__RSA_PUBLIC__', rsa_public)
	except:
		pass
	
	# Build the image
	subprocess.call(['./build_image.sh'])
	os.chdir('..')
Ejemplo n.º 9
0
def buildImage():
    os.chdir(getScriptDir())
    loadSettings()

    # Look for a kernel image
    imgpath = False  # Discovered image goes here
    for path in ['images', os.path.join('stable-kernel', 'deploy')]:
        if not os.path.exists(path):
            continue
        files = sorted(os.listdir(path), reverse=True)
        for f in files:
            if f.endswith('.deb') and 'image' in f:
                imgpath = os.path.realpath(os.path.join(path, f))
                print('Found kernel image: ' + imgpath)
                print(
                    'rootstock will use this local image instead of http://rcn-ee.net'
                )
                break
        if imgpath:
            break

    # Clone RCN's git repository
    print('Building Ubuntu image')
    gitCloneAndEnter('git://github.com/RobertCNelson/omap-image-builder.git',
                     '73e92f5cef5d3')
    #subprocess.call(['git', 'reset', '--hard', 'HEAD'])

    patches = [
        '0001-Only-build-Precise-image.patch',
        '0002-Include-additional-packages-specified-in-settings.xm.patch',
        '0003-Force-MAC-address.patch',
        '0004-Remove-text-from-etc-flash-kernel.conf.patch',
        '0005-Copy-keys-to-the-new-filesystem.patch'
    ]
    if imgpath:
        patches.append('0006-Primary-kernel-is-on-local-filesystem.patch')
    if False:
        patches.append('0007-Run-script-to-install-ros.patch')
    for p in patches:
        subprocess.call([
            'git', 'am',
            os.path.join(getScriptDir(), 'patches', 'omap-image-builder', p)
        ])

    #subprocess.call(['git', 'checkout', 'v2012.4-1', '-b', 'v2012.4-1'])

    # Configure image builder
    replaceAll('build_image.sh', 'FQDN="arm"',
               'FQDN="' + getSetting('fqdn') + '"')
    replaceAll('build_image.sh', 'USER_LOGIN="******"',
               'USER_LOGIN="******"')
    replaceAll('build_image.sh', 'USER_PASS="******"',
               'USER_PASS="******"')
    replaceAll('build_image.sh', 'USER_NAME="Demo User"',
               'USER_NAME="' + getSetting('name') + '"')
    replaceAll('var/pkg_list.sh', '__MECANUM_PACKAGES__',
               ','.join(getSetting('packages')))
    if imgpath:
        # Kernel image, e.g. linux-image-3.2.18-x12_1.0precise_armhf.deb
        replaceAll('build_image.sh', '__KERNEL_DEB_FILE__', imgpath)

    replaceAll('tools/fixup.sh', 'DE:AD:BE:EF:CA:FE', getSetting('macaddress'))
    # Attempt to copy our ssh keys to the new filesystem
    try:
        id_rsa = open(getScriptDir() + '../../ssh_keys/id_rsa', 'r')
        rsa_private = id_rsa.read()
        id_rsa.close()
        id_rsa_pub = open(getScriptDir() + '../../ssh_keys/id_rsa.pub', 'r')
        rsa_public = id_rsa_pub.read()
        id_rsa_pub.close()
        if (len(rsa_private) and len(rsa_public)):
            replaceAll('tools/fixup.sh', '#USER_NAME=__USER_NAME__',
                       'USER_NAME="' + getSetting('username') + '"')
            replaceAll('tools/fixup.sh', '__RSA_PRIVATE__', rsa_private)
            replaceAll('tools/fixup.sh', '__RSA_PUBLIC__', rsa_public)
    except:
        pass

    # Build the image
    subprocess.call(['./build_image.sh'])
    os.chdir('..')