Open cesargithedgehog opened 3 months ago
ONIE USB Drive Requirements
There are two prerequisites for using a USB drive to install an operating system utilizing the automatic zero-touch option. The USB drive needs to be in a FAT32 or EXT2 format (ONIE doesn't support NTFS). The file name needs to be a qualified name that starts with “onie-installer”.
Installing using a USB thumb drive
To install via USB simply copy the installer image to the root directory of the USB thumb drive, using the file name onie-installer.
For this guide, assume the NOS installer image is named ACME_XYZ1234_PowerPC_Installer.bin. Let’s assume the USB drive shows up at /dev/sdd1 under Linux (it might be different on your system and OS).
Copy the installer file to the root of the USB thumb drive like this:
linux:~$ sudo mkdir /mnt/usb
linux:~$ sudo mount /dev/sdd1 /mnt/USB
linux:~$ sudo cp ACME_XYZ1234_PowerPC_Installer.bin /mnt/usb/onie-installer
linux:~$ sudo umount /mnt/USB
Now remove the USB drive from your computer and insert it into the USB port on the front (or rear) panel of your ONIE-enabled device. Power on the device and ONIE will discover the onie-installer file on the root of the USB drive and execute it.
*https://opencomputeproject.github.io/onie/user-guide/index.html
ONIE: Image Discovery and Execution
The primary responsibility of ONIE is to locate a network operating system (NOS) installer and execute it.
Platform Name and Identification
For identifying the running platform. ONIE uses the following definitions:
arm. PowerPC. x86_64.
The allowable characters in the above strings are:
VENDOR - cannot contain (underscore) or - (hyphen) characters. MODEL - cannot contain - (hyphen) character. (underscore) is OK. ARCH - cannot contain _ (underscore) or - (hyphen) characters.
Installer Discovery Methods
ONIE attempts to locate the installer through several discovery methods. The first successful method found is used to download and run an installer. Even though an installer is successfully found, the installer can fail, in which case ONIE moves on to the next discovery method.
The following methods are tried in this order:
The discovery methods are tried repeatedly, forever, until a successful image install occurs.
The general image discovery procedure is illustrated by this pseudo-code:
while (true) {
Configure Ethernet management console
Attempt discovery method 1
Attempt discovery method 2
...
Attempt discovery method N
Sleep for 20 seconds
}
Default File Name Search Order
In a number of the following methods, ONIE searches for default file names in a specific order. All the methods use the same default file names and search order. The default installer file names are searched for in the following order:
ONIE 2017.08 added the .bin extension to all the default file names. Previous ONIE versions do not look for file names with the .bin extension.
For a hypothetical x86_64 machine, the default installer file names would be:
onie-installer-x86_64-VENDOR_MACHINE-r0
onie-installer-x86_64-VENDOR_MACHINE-r0.bin
onie-installer-x86_64-VENDOR_MACHINE
onie-installer-x86_64-VENDOR_MACHINE.bin
onie-installer-VENDOR_MACHINE
onie-installer-VENDOR_MACHINE.bin
onie-installer-x86_64-SWITCH_SILICON_VENDOR
onie-installer-x86_64-SWITCH_SILICON_VENDOR.bin
onie-installer-x86_64
onie-installer-x86_64.bin
onie-installer
onie-installer.bin
ONIE 2016.05 introduced onie-installer-
- . All previous ONIE versions do not include this naming item. For the exact file names used for your specific hardware platform please contact your NOS vendor or your hardware vendor.
Local File System Method - USB Stick
In this method, ONIE searches the partitions of locally attached storage devices looking for one of the ONIE default installer file names. This method is intended for the case where the NOS installer is available on a USB memory stick plugged into the front panel.
Two file system types are supported, the popular vFAT partition type (common on commercially available USB sticks) and Linux’s ext2.
Note:
OSX’s Disk Utility by default will write out an unsupported partition type. Please use the diskutil command line tool for formatting:
Find USB drive
% diskutil list /dev/disk2
: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *8.1 GB disk2 1: Windows_NTFS ONIE 8.1 GB disk2s1
Write out correctly label (wipes all data on drive)
% sudo diskutil eraseDisk FAT32 ONIE MBRFormat /dev/disk2 Started erase on disk2 Unmounting disk Creating the partition map Waiting for the disks to reappear Formatting disk2s1 as MS-DOS (FAT32) with name ONIE 512 bytes per physical sector /dev/rdisk2s1: 15697944 sectors in 1962243 FAT32 clusters (4096 bytes/cluster) bps=512 spc=8 res=32 nft=2 mid=0xf8 spt=32 hds=255 hid=2 drv=0x80 bsec=15728638 bspf=15331 rdcl=2 infs=1 bkbs=6 Mounting disk Finished erase on disk2
The general algorithm for locating the installer on local storage proceeds as follows:
foreach $partition in /proc/partitions {
if able to mount $partition then {
if default file name exists {
Add partition to found_list
}
}
}
foreach $partition in found_list {
Run installer from $partition
}
Execution Environment
After ONIE locates and downloads an installer, the next step is to run the installer.
Before execution, ONIE prepares an execution environment:
ONIE exports the following environment variables:
Task:
Preparing an onie build for kvm :
Steps:
1 - git clone --recurse-submodules git@github.com:opencomputeproject/onie.git
2 - ./due --create --platform linux/amd64 --name onie-build-debian-11 --prompt ONIE-11 --tag onie-11 --use-template onie --from debian:11 --description 'ONIE Build Debian 11'
3 - due --run
4 - cd onie/build-config
5 - make MACHINE=kvm_x86_64 signing-keys-generate
6 - make MACHINE=kvm_x86_64 -j4 shim-self-sign
7 - make MACHINE=kvm_x86_64 -j4 all demo recovery-iso
8 - cd /onie/emulation: ./onie-vm.sh update-m-usb ./onie-vm.sh run --m-embed-onie --m-onie-iso ../build/images/onie-recovery-x86_64-kvm_x86_64-r0.iso
Artifacts available at:
*The onie/emulation/onie-vm.sh script was introduced when the component-upgrade-2020 changes were merged into the master.
https://github.com/CumulusNetworks/DUE/tree/master/templates/onie
Hedgehog ONIE Build for KVM: