mirror of
https://github.com/vyos/vyos-build.git
synced 2025-10-01 20:28:40 +02:00
add build options for clearfog
This commit is contained in:
parent
9077fc0d38
commit
826fa1a973
10
Makefile
10
Makefile
@ -51,6 +51,14 @@ vmware:
|
||||
@scripts/check-vm-build-env
|
||||
@scripts/build-vmware-image
|
||||
|
||||
.PHONY: clearfog
|
||||
.ONESHELL:
|
||||
clearfog: clean prepare
|
||||
@set -e
|
||||
@echo "It's not like I'm building this specially for you or anything!"
|
||||
cd $(build_dir)
|
||||
@../scripts/build-clearfog-legacy
|
||||
|
||||
.PHONY: clean
|
||||
.ONESHELL:
|
||||
clean:
|
||||
@ -61,6 +69,8 @@ clean:
|
||||
rm -f config/binary config/bootstrap config/chroot config/common config/source
|
||||
rm -f build.log
|
||||
rm -f vyos-*.iso
|
||||
rm -f *.img
|
||||
rm -f *.xz
|
||||
|
||||
.PHONY: purge
|
||||
purge:
|
||||
|
||||
@ -1 +1,2 @@
|
||||
deb http://dev.packages.vyos.net/vyos current main
|
||||
deb http://security.debian.org/ jessie/updates main
|
||||
|
||||
@ -2,5 +2,11 @@
|
||||
|
||||
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
|
||||
|
||||
if [ -e /etc/apt/sources.list.d/zz-sources.list ] ; then
|
||||
cp /etc/apt/sources.list /etc/apt/sources.list.d/zz-non-free.list
|
||||
sed -i 's/main/non-free/g' /etc/apt/sources.list.d/zz-non-free.list
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
apt-get -y install firmware-linux-nonfree
|
||||
|
||||
1
data/package-lists/vyos-arm.list.chroot
Normal file
1
data/package-lists/vyos-arm.list.chroot
Normal file
@ -0,0 +1 @@
|
||||
grub-efi-arm
|
||||
158
scripts/build-clearfog-image
Executable file
158
scripts/build-clearfog-image
Executable file
@ -0,0 +1,158 @@
|
||||
#!/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-clearfog-image
|
||||
# Purpose:
|
||||
# Build VyOS image for for Solidrun clearfog.
|
||||
|
||||
lb bootstrap
|
||||
lb chroot
|
||||
lb installer
|
||||
lb binary_chroot
|
||||
lb chroot_devpts install
|
||||
lb chroot_proc install
|
||||
lb chroot_selinuxfs install
|
||||
lb chroot_sysfs install
|
||||
lb chroot_hosts install
|
||||
lb chroot_resolv install
|
||||
lb chroot_hostname install
|
||||
lb chroot_sysv-rc install
|
||||
lb chroot_upstart install
|
||||
lb chroot_apt install-binary
|
||||
lb chroot_archives chroot install
|
||||
lb binary_rootfs
|
||||
lb binary_manifest
|
||||
lb binary_package-lists
|
||||
lb binary_linux-image
|
||||
lb binary_memtest
|
||||
lb binary_grub
|
||||
lb binary_grub2
|
||||
lb binary_syslinux
|
||||
lb binary_disk
|
||||
lb binary_loadlin
|
||||
lb binary_win32-loader
|
||||
lb binary_includes
|
||||
lb binary_hooks
|
||||
lb binary_checksums
|
||||
|
||||
# get vyos build version
|
||||
version=$(cat version)
|
||||
dateymd=$(date +%Y%m%d)
|
||||
|
||||
# create sd-card image and partition it
|
||||
qemu-img create -f raw sr-a38x-cf-vyos-"$dateymd"-testing.img 1.8G
|
||||
parted --script sr-a38x-cf-vyos-"$dateymd"-testing.img mklabel msdos
|
||||
parted --script sr-a38x-cf-vyos-"$dateymd"-testing.img mkpart primary fat16 8192s 60
|
||||
parted --script sr-a38x-cf-vyos-"$dateymd"-testing.img mkpart primary ext2 60 1900
|
||||
parted --script sr-a38x-cf-vyos-"$dateymd"-testing.img set 1 boot on
|
||||
|
||||
# mount image and create filesystems
|
||||
losetup /dev/loop0 sr-a38x-cf-vyos-"$dateymd"-testing.img
|
||||
partprobe /dev/loop0
|
||||
mkfs.vfat -n EFI -F 16 -I /dev/loop0p1
|
||||
mkfs.ext2 -L persistence /dev/loop0p2
|
||||
|
||||
# mount image partitions
|
||||
mkdir -p /boot/efi
|
||||
mount /dev/loop0p1 /boot/efi
|
||||
mkdir -p /mnt
|
||||
mount /dev/loop0p2 /mnt
|
||||
|
||||
# setup files on image
|
||||
mkdir -p /mnt/boot/grub
|
||||
mkdir -p /mnt/boot/"$version"/rw
|
||||
echo "/ union" > /mnt/persistence.conf
|
||||
cp binary/live/filesystem.squashfs /mnt/boot/"$version"/"$version.squashfs"
|
||||
cp binary/live/initrd.img-* /mnt/boot/"$version"/initrd.img
|
||||
cp binary/live/vmlinuz-* /mnt/boot/"$version"/vmlinuz
|
||||
cp ../tools/armada-388-clearfog.dtb /boot/efi/armada-388-clearfog.dtb
|
||||
|
||||
# create boot script
|
||||
cat > /boot/efi/boot.script << EOF
|
||||
# load DTB
|
||||
echo "Loading armada-388-clearfog.dtb"
|
||||
load mmc 0:1 \$fdt_addr_r armada-388-clearfog.dtb
|
||||
fdt addr \$fdt_addr_r 20000
|
||||
|
||||
# load efi
|
||||
echo "Loading EFI image ..."
|
||||
load mmc 0:1 \$loadaddr EFI/debian/grubarm.efi
|
||||
|
||||
# Sleep a while so the MMC driver can settle down
|
||||
echo "Sleeping 5 seconds ..."
|
||||
sleep 5
|
||||
|
||||
# boot
|
||||
echo "Booting ..."
|
||||
bootefi \$loadaddr
|
||||
EOF
|
||||
|
||||
# compile boot script for u-boot
|
||||
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d /boot/efi/boot.script /boot/efi/boot.scr
|
||||
|
||||
# create grub config file to include
|
||||
cat > load.cfg << EOF
|
||||
set root=(hd0,msdos2)
|
||||
set prefix=(hd0,msdos2)/boot/grub
|
||||
devicetree (hd0,msdos1)/armada-388-clearfog.dtb
|
||||
insmod normal
|
||||
normal
|
||||
EOF
|
||||
|
||||
# create grub menu
|
||||
cat > /mnt/boot/grub/grub.cfg << EOF
|
||||
set default=0
|
||||
set timeout=5
|
||||
|
||||
echo -n Press ESC to enter the Grub menu...
|
||||
if sleep --verbose --interruptible 5 ; then
|
||||
terminal_input console serial
|
||||
fi
|
||||
|
||||
|
||||
menuentry "VyOS $version (Serial console)" {
|
||||
linux /boot/"$version"/vmlinuz boot=live quiet vyatta-union=/boot/"$version" console=ttyS0,115200n8
|
||||
initrd /boot/"$version"/initrd.img
|
||||
}
|
||||
|
||||
menuentry "Lost password change $version (Serial console)" {
|
||||
linux /boot/"$version"/vmlinuz boot=live quiet vyatta-union=/boot/"$version" console=ttyS0,115200n8 init=/opt/vyatta/sbin/standalone_root_pw_reset
|
||||
initrd /boot/"$version"/initrd.img
|
||||
}
|
||||
EOF
|
||||
|
||||
# install efi grub to image
|
||||
grub-install --efi-directory /boot/efi --boot-directory /mnt/boot -d /usr/lib/grub/arm-efi /dev/loop0
|
||||
|
||||
# create grub efi executable
|
||||
grub-mkimage -O arm-efi -p /boot/grub -d /usr/lib/grub/arm-efi -c load.cfg \
|
||||
ext2 iso9660 linux echo configfile \
|
||||
search_label search_fs_file search \
|
||||
search_fs_uuid ls normal gzio \
|
||||
png fat gettext font minicmd \
|
||||
gfxterm gfxmenu video video_fb \
|
||||
part_msdos part_gpt > /boot/efi/EFI/debian/grubarm.efi
|
||||
|
||||
# unmount image partitions
|
||||
umount /mnt
|
||||
umount /boot/efi
|
||||
|
||||
# write u-boot to image
|
||||
dd if=../tools/u-boot-spl.kwb of=/dev/loop0 bs=512 seek=1
|
||||
|
||||
# unmount image
|
||||
sudo losetup -D
|
||||
|
||||
# compress image
|
||||
xz -v sr-a38x-cf-vyos-"$dateymd"-testing.img
|
||||
@ -46,7 +46,7 @@ def get_default_build_by():
|
||||
# Options dict format:
|
||||
# '$option_name_without_leading_dashes': { ('$help_string', $default_value_generator_thunk, $value_checker_thunk) }
|
||||
options = {
|
||||
'architecture': ('Image target architecture (amd64 or i586)', lambda: 'amd64', lambda x: x in ['amd64', 'i586']),
|
||||
'architecture': ('Image target architecture (amd64 or i586 or armhf)', lambda: 'amd64', lambda x: x in ['amd64', 'i586', 'armhf']),
|
||||
'build-by': ('Builder identifier (e.g. jrandomhacker@example.net)', get_default_build_by, None),
|
||||
'debian-mirror': ('Debian repository mirror for ISO build', lambda: defaults.DEBIAN_MIRROR, None),
|
||||
'pbuilder-debian-mirror': ('Debian repository mirror for pbuilder env bootstrap', lambda: defaults.DEBIAN_MIRROR, None),
|
||||
|
||||
@ -30,3 +30,8 @@ fi
|
||||
if [ $BUILD_ARCH = 'amd64' -o $BUILD_ARCH = 'i686' ]; then
|
||||
cp data/package-lists/vyos-x86.list.chroot build/config/package-lists/
|
||||
fi
|
||||
|
||||
# Install grub-efi-arm if it's an arm build
|
||||
if [ $BUILD_ARCH = 'armhf' -o $BUILD_ARCH = 'armel' -o $BUILD_ARCH = 'arm' ]; then
|
||||
cp data/package-lists/vyos-arm.list.chroot build/config/package-lists/
|
||||
fi
|
||||
|
||||
BIN
tools/armada-388-clearfog.dtb
Executable file
BIN
tools/armada-388-clearfog.dtb
Executable file
Binary file not shown.
BIN
tools/u-boot-spl.kwb
Normal file
BIN
tools/u-boot-spl.kwb
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user