mirror of
https://github.com/vyos/vyos-build.git
synced 2025-10-01 20:28:40 +02:00
Merge branch 'current' of github.com:vyos/vyos-build into current
This commit is contained in:
commit
9077fc0d38
7
Makefile
7
Makefile
@ -44,6 +44,13 @@ qemu:
|
||||
@scripts/check-vm-build-env
|
||||
@scripts/build-qemu-image
|
||||
|
||||
.PHONY: vmware
|
||||
.ONESHELL:
|
||||
vmware:
|
||||
@set -e
|
||||
@scripts/check-vm-build-env
|
||||
@scripts/build-vmware-image
|
||||
|
||||
.PHONY: clean
|
||||
.ONESHELL:
|
||||
clean:
|
||||
|
||||
25
README.md
25
README.md
@ -52,11 +52,32 @@ Individual packages may have other build dependencies. If some packages are miss
|
||||
Before you can build an image, you need to configure your build.
|
||||
|
||||
To build an image, use the following commands:
|
||||
./configure
|
||||
make iso
|
||||
|
||||
```
|
||||
./configure
|
||||
make iso
|
||||
```
|
||||
|
||||
The ./configure script has a number of options that you can see by calling it with --help
|
||||
|
||||
## Building the images for virtualization platforms
|
||||
|
||||
* QEMU
|
||||
|
||||
Run following command after building the ISO image.
|
||||
|
||||
```
|
||||
make qemu
|
||||
```
|
||||
|
||||
* VMware
|
||||
|
||||
Run following command after building the QEMU image.
|
||||
|
||||
```
|
||||
make vmware
|
||||
```
|
||||
|
||||
# Development process
|
||||
|
||||
## git branches
|
||||
|
||||
3
data/live-build-config/hooks/13-vyos_replace.chroot
Executable file
3
data/live-build-config/hooks/13-vyos_replace.chroot
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
apt-get -y install vyos-replace
|
||||
6
data/live-build-config/hooks/14-firmware-linux-nonfree.chroot
Executable file
6
data/live-build-config/hooks/14-firmware-linux-nonfree.chroot
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
cp /etc/apt/sources.list /etc/apt/sources.list.d/non-free.list
|
||||
sed -i 's/main/non-free/g' /etc/apt/sources.list.d/non-free.list
|
||||
apt-get update
|
||||
apt-get -y install firmware-linux-nonfree
|
||||
3
data/live-build-config/hooks/20-rm_ddclient_hook.chroot
Executable file
3
data/live-build-config/hooks/20-rm_ddclient_hook.chroot
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -f /etc/dhcp/dhclient-exit-hooks.d/ddclient
|
||||
@ -27,4 +27,4 @@ export PACKER_LOG=1
|
||||
|
||||
mkdir -p ${PACKER_BUILD_DIR}
|
||||
|
||||
packer build -only=qemu scripts/packer.json
|
||||
packer build -only=qemu-image scripts/packer.json
|
||||
|
||||
74
scripts/build-vmware-image
Executable file
74
scripts/build-vmware-image
Executable file
@ -0,0 +1,74 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2016 VyOS maintainers and contributors
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 or later as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# File: build-vmware-image
|
||||
# Purpose:
|
||||
# Build VyOS OVA and OVF for VMware.
|
||||
|
||||
if [ ! $(which vmdk-convert) ]; then
|
||||
echo "Your system doesn't have vmdk-convert. Please install it from https://github.com/vmware/open-vmdk."
|
||||
exit 1
|
||||
else
|
||||
echo "Your system has vmdk-convert."
|
||||
fi
|
||||
|
||||
if [ ! $(which ovftool) ]; then
|
||||
echo "Your system doesn't have ovftool. Please install it from https://www.vmware.com/support/developer/ovf/."
|
||||
exit 1
|
||||
else
|
||||
echo "Your system has ovftool."
|
||||
fi
|
||||
|
||||
export PACKER_BUILD_DIR=packer_build
|
||||
|
||||
DST_DIR=${PACKER_BUILD_DIR}/vmware
|
||||
mkdir -p ${DST_DIR}
|
||||
|
||||
# Convert raw image to VMDK
|
||||
source_image=${PACKER_BUILD_DIR}/qemu/vyos_qemu_image.img
|
||||
tmp_vmdk=${DST_DIR}/tmp.vmdk
|
||||
vmdk=${DST_DIR}/vyos_vmware_image.vmdk
|
||||
ovf=${DST_DIR}/vyos_vmware_image.ovf
|
||||
qemu-img convert -f raw ${source_image} -O vmdk -o adapter_type=lsilogic ${tmp_vmdk}
|
||||
vmdk-convert ${tmp_vmdk} ${vmdk}
|
||||
|
||||
# Generate OVF
|
||||
echo 'Generating OVF file...'
|
||||
vmdk_file_size=$(du --bytes ${vmdk} | cut -f1)
|
||||
vmdk_populated_size=$(vmdk-convert -i ${vmdk} | jq .used)
|
||||
version=$(cat build/version)
|
||||
sed scripts/template.ovf \
|
||||
-e "s/{{vmdk_file_size}}/${vmdk_file_size}/" \
|
||||
-e "s/{{vmdk_populated_size}}/${vmdk_populated_size}/" \
|
||||
-e "s/{{version}}/${version}/" \
|
||||
> ${ovf}
|
||||
|
||||
# Generate manifest file
|
||||
cd ${DST_DIR}
|
||||
openssl sha1 *.vmdk *.ovf > vyos_vmware_image.mf
|
||||
|
||||
# Convert the OVF to signed OVA...
|
||||
echo 'Converting the OVF to signed OVA...'
|
||||
private_key=${PRIVATE_KEY_PATH:-"../../key/privatekey.pem"}
|
||||
if [ ! -f ${private_key} ]; then
|
||||
echo 'Please put your key to "key/privatekey.pem" in repository root, or set PRIVATE_KEY_PATH to environment variables.'
|
||||
exit 1
|
||||
fi
|
||||
ovftool --privateKey=${PRIVATE_KEY_PATH} vyos_vmware_image.ovf vyos_vmware_image-signed.ova
|
||||
|
||||
# Convert the OVF to signed OVF...
|
||||
echo 'Converting the OVF to signed OVF...'
|
||||
ovftool --privateKey=${PRIVATE_KEY_PATH} vyos_vmware_image.ovf vyos_vmware_image-signed.ovf
|
||||
@ -26,7 +26,7 @@ import util
|
||||
|
||||
deps = {
|
||||
'packages': [
|
||||
'make',
|
||||
'jq',
|
||||
'qemu-system-x86',
|
||||
'qemu-utils'
|
||||
],
|
||||
|
||||
@ -36,7 +36,7 @@ lb config noauto \
|
||||
--architectures {{architecture}} \
|
||||
--bootappend-live "boot=live components hostname=vyos username=live nopersistence noautologin nonetworking union=overlay" \
|
||||
--linux-flavours {{architecture}}-vyos \
|
||||
--linux-packages linux-image-4.4.1 \
|
||||
--linux-packages linux-image-4.4.5 \
|
||||
--bootloader syslinux \
|
||||
--binary-images iso-hybrid \
|
||||
--debian-installer false \
|
||||
|
||||
29
scripts/packer-scripts/vmware.sh
Normal file
29
scripts/packer-scripts/vmware.sh
Normal file
@ -0,0 +1,29 @@
|
||||
#!/bin/vbash
|
||||
source /opt/vyatta/etc/functions/script-template
|
||||
|
||||
# Add Debian Jessie repository
|
||||
set system package repository jessie url 'http://ftp.nl.debian.org/debian/'
|
||||
set system package repository jessie distribution 'jessie'
|
||||
set system package repository jessie components 'main contrib non-free'
|
||||
commit
|
||||
save
|
||||
|
||||
# Install open-vm-tools
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install open-vm-tools
|
||||
|
||||
# Delete Debian Jessie repository
|
||||
delete system package repository jessie
|
||||
commit
|
||||
save
|
||||
|
||||
# Removing leftover leases and persistent rules
|
||||
sudo rm -f /var/lib/dhcp3/*
|
||||
|
||||
# Removing apt caches
|
||||
sudo rm -rf /var/cache/apt/*
|
||||
|
||||
# Removing hw-id
|
||||
delete interfaces ethernet eth0 hw-id
|
||||
commit
|
||||
save
|
||||
@ -7,6 +7,7 @@
|
||||
"builders":
|
||||
[
|
||||
{
|
||||
"name": "qemu-image",
|
||||
"type": "qemu",
|
||||
"iso_url": "{{user `iso_url`}}",
|
||||
"iso_checksum": "{{user `iso_checksum`}}",
|
||||
@ -16,46 +17,78 @@
|
||||
"disk_size": 4096,
|
||||
"format": "raw",
|
||||
"headless": true,
|
||||
"accelerator": "kvm",
|
||||
"accelerator": "tcg",
|
||||
"ssh_host_port_min": 2222,
|
||||
"ssh_host_port_max": 2229,
|
||||
"ssh_username": "vyos",
|
||||
"ssh_password": "vyos",
|
||||
"ssh_port": 22,
|
||||
"ssh_wait_timeout": "30s",
|
||||
"ssh_wait_timeout": "300s",
|
||||
"vm_name": "vyos_qemu_image.img",
|
||||
"net_device": "virtio-net",
|
||||
"disk_interface": "virtio",
|
||||
"boot_wait": "5s",
|
||||
"boot_command":
|
||||
[
|
||||
"<enter><wait3m>",
|
||||
"vyos<enter><wait5>",
|
||||
"vyos<wait><enter><wait10>",
|
||||
"install image<enter><wait5>",
|
||||
"<enter><wait5>",
|
||||
"<enter><wait5>",
|
||||
"<enter><wait5>",
|
||||
"Yes<enter><wait5>",
|
||||
"<enter><wait10>",
|
||||
"<enter><wait5>",
|
||||
"<enter><wait5>",
|
||||
"vyos<enter><wait5>",
|
||||
"vyos<enter><wait10>",
|
||||
"<enter><wait10><wait10>",
|
||||
"vyos<enter><wait>",
|
||||
"vyos<enter><wait>",
|
||||
"install image<enter><wait>",
|
||||
"<enter><wait>",
|
||||
"<enter><wait>",
|
||||
"<enter><wait>",
|
||||
"Yes<enter><wait>",
|
||||
"<enter><wait10>",
|
||||
"<enter><wait>",
|
||||
"<enter><wait>",
|
||||
"vyos<enter><wait>",
|
||||
"vyos<enter><wait>",
|
||||
"<enter><wait10>",
|
||||
"reboot<enter><wait>",
|
||||
"Yes<enter><wait10><wait10><wait10>",
|
||||
"vyos<enter><wait>",
|
||||
"vyos<enter><wait>",
|
||||
"configure<enter><wait>",
|
||||
"delete system console<enter><wait>",
|
||||
"set interface ethernet eth0 address dhcp<enter><wait>",
|
||||
"set service ssh<enter><wait>",
|
||||
"commit<enter><wait>",
|
||||
"save<enter><wait>",
|
||||
"exit<enter><wait>",
|
||||
"reboot<enter><wait>",
|
||||
"Yes<enter><wait10><wait10><wait10><wait10><wait10>"
|
||||
"reboot<enter><wait5>",
|
||||
"Yes<enter><wait3m>",
|
||||
"vyos<enter><wait5>",
|
||||
"vyos<enter><wait10>",
|
||||
"configure<enter><wait5>",
|
||||
"set interface ethernet eth0 address dhcp<enter><wait5>",
|
||||
"set service ssh<enter><wait5>",
|
||||
"commit<enter><wait5>",
|
||||
"save<enter><wait5>",
|
||||
"delete interface ethernet eth0 hw-id<enter><wait5>",
|
||||
"commit<enter><wait5>",
|
||||
"save<enter><wait5>",
|
||||
"exit<enter><wait5>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "vmware-image",
|
||||
"type": "qemu",
|
||||
"iso_url": "{{user `output_directory`}}/qemu/vyos_qemu_image.img",
|
||||
"iso_checksum_type": "none",
|
||||
"output_directory": "{{user `output_directory`}}/vmware",
|
||||
"shutdown_command": "sudo halt -p",
|
||||
"disk_image": true,
|
||||
"disk_size": 4096,
|
||||
"format": "raw",
|
||||
"headless": true,
|
||||
"accelerator": "tcg",
|
||||
"ssh_host_port_min": 2222,
|
||||
"ssh_host_port_max": 2229,
|
||||
"ssh_username": "vyos",
|
||||
"ssh_password": "vyos",
|
||||
"ssh_port": 22,
|
||||
"ssh_wait_timeout": "300s",
|
||||
"vm_name": "vyos_vmware_image.img",
|
||||
"net_device": "virtio-net",
|
||||
"disk_interface": "virtio",
|
||||
"boot_wait": "5s"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "shell",
|
||||
"only": ["vmware-image"],
|
||||
"scripts": [
|
||||
"scripts/packer-scripts/vmware.sh"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
121
scripts/template.ovf
Normal file
121
scripts/template.ovf
Normal file
@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Envelope vmw:buildId="build-3018522" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<References>
|
||||
<File ovf:href="vyos_vmware_image.vmdk" ovf:id="file1" ovf:size="{{vmdk_file_size}}"/>
|
||||
</References>
|
||||
<DiskSection>
|
||||
<Info>Virtual disk information</Info>
|
||||
<Disk ovf:capacity="4" ovf:capacityAllocationUnits="byte * 2^30" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:populatedSize="{{vmdk_populated_size}}"/>
|
||||
</DiskSection>
|
||||
<NetworkSection>
|
||||
<Info>The list of logical networks</Info>
|
||||
<Network ovf:name="VM Network">
|
||||
<Description>The VM Network network</Description>
|
||||
</Network>
|
||||
</NetworkSection>
|
||||
<VirtualSystem ovf:id="vm">
|
||||
<Info>A virtual machine</Info>
|
||||
<Name>vyos</Name>
|
||||
<OperatingSystemSection ovf:id="1" vmw:osType="other26xLinux64Guest">
|
||||
<Info>The kind of installed guest operating system</Info>
|
||||
</OperatingSystemSection>
|
||||
<VirtualHardwareSection>
|
||||
<Info>Virtual hardware requirements</Info>
|
||||
<System>
|
||||
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
|
||||
<vssd:InstanceID>0</vssd:InstanceID>
|
||||
<vssd:VirtualSystemIdentifier>vyos</vssd:VirtualSystemIdentifier>
|
||||
<vssd:VirtualSystemType>vmx-09</vssd:VirtualSystemType>
|
||||
</System>
|
||||
<Item>
|
||||
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
|
||||
<rasd:Description>Number of Virtual CPUs</rasd:Description>
|
||||
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
|
||||
<rasd:InstanceID>1</rasd:InstanceID>
|
||||
<rasd:ResourceType>3</rasd:ResourceType>
|
||||
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
|
||||
</Item>
|
||||
<Item>
|
||||
<rasd:AllocationUnits>byte * 2^30</rasd:AllocationUnits>
|
||||
<rasd:Description>Memory Size</rasd:Description>
|
||||
<rasd:ElementName>1GB of memory</rasd:ElementName>
|
||||
<rasd:InstanceID>2</rasd:InstanceID>
|
||||
<rasd:ResourceType>4</rasd:ResourceType>
|
||||
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
|
||||
</Item>
|
||||
<Item>
|
||||
<rasd:Address>0</rasd:Address>
|
||||
<rasd:Description>SCSI Controller</rasd:Description>
|
||||
<rasd:ElementName>scsiController0</rasd:ElementName>
|
||||
<rasd:InstanceID>3</rasd:InstanceID>
|
||||
<rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
|
||||
<rasd:ResourceType>6</rasd:ResourceType>
|
||||
</Item>
|
||||
<Item>
|
||||
<rasd:Address>1</rasd:Address>
|
||||
<rasd:Description>IDE Controller</rasd:Description>
|
||||
<rasd:ElementName>ideController1</rasd:ElementName>
|
||||
<rasd:InstanceID>4</rasd:InstanceID>
|
||||
<rasd:ResourceType>5</rasd:ResourceType>
|
||||
</Item>
|
||||
<Item ovf:required="false">
|
||||
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
|
||||
<rasd:ElementName>serial0</rasd:ElementName>
|
||||
<rasd:InstanceID>5</rasd:InstanceID>
|
||||
<rasd:ResourceType>21</rasd:ResourceType>
|
||||
<vmw:Config ovf:required="false" vmw:key="yieldOnPoll" vmw:value="false"/>
|
||||
</Item>
|
||||
<Item ovf:required="false">
|
||||
<rasd:AddressOnParent>0</rasd:AddressOnParent>
|
||||
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
|
||||
<rasd:ElementName>cdrom0</rasd:ElementName>
|
||||
<rasd:InstanceID>6</rasd:InstanceID>
|
||||
<rasd:Parent>5</rasd:Parent>
|
||||
<rasd:ResourceType>15</rasd:ResourceType>
|
||||
</Item>
|
||||
<Item>
|
||||
<rasd:AddressOnParent>0</rasd:AddressOnParent>
|
||||
<rasd:ElementName>disk0</rasd:ElementName>
|
||||
<rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource>
|
||||
<rasd:InstanceID>7</rasd:InstanceID>
|
||||
<rasd:Parent>3</rasd:Parent>
|
||||
<rasd:ResourceType>17</rasd:ResourceType>
|
||||
</Item>
|
||||
<Item>
|
||||
<rasd:AddressOnParent>2</rasd:AddressOnParent>
|
||||
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
|
||||
<rasd:Connection>VM Network</rasd:Connection>
|
||||
<rasd:Description>VmxNet3 ethernet adapter on "VM Network"</rasd:Description>
|
||||
<rasd:ElementName>ethernet0</rasd:ElementName>
|
||||
<rasd:InstanceID>8</rasd:InstanceID>
|
||||
<rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType>
|
||||
<rasd:ResourceType>10</rasd:ResourceType>
|
||||
<vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="false"/>
|
||||
</Item>
|
||||
<Item ovf:required="false">
|
||||
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
|
||||
<rasd:ElementName>video</rasd:ElementName>
|
||||
<rasd:InstanceID>9</rasd:InstanceID>
|
||||
<rasd:ResourceType>24</rasd:ResourceType>
|
||||
</Item>
|
||||
<Item ovf:required="false">
|
||||
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
|
||||
<rasd:ElementName>vmci</rasd:ElementName>
|
||||
<rasd:InstanceID>10</rasd:InstanceID>
|
||||
<rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType>
|
||||
<rasd:ResourceType>1</rasd:ResourceType>
|
||||
</Item>
|
||||
<vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="true"/>
|
||||
<vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="true"/>
|
||||
<vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="soft"/>
|
||||
<vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="soft"/>
|
||||
<vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="soft"/>
|
||||
</VirtualHardwareSection>
|
||||
<ProductSection>
|
||||
<Info>VyOS is a Linux-based network operating system that provides software-based network routing, firewall, and VPN functionality.</Info>
|
||||
<Product>VyOS</Product>
|
||||
<Vendor>VyOS maintainers and contributors</Vendor>
|
||||
<Version>{{version}}</Version>
|
||||
</ProductSection>
|
||||
</VirtualSystem>
|
||||
</Envelope>
|
||||
Loading…
x
Reference in New Issue
Block a user