当前位置:网站首页>Onie supports pice hard disk

Onie supports pice hard disk

2022-07-06 07:41:00 Caicai azhuang

introduction

We know ,SATA Hard disk and pcie The hard disk dev The device name is different :

SATA The device name is generally sd*, for example sda sdb, The device name after partition is sda1,sda2 etc. ;
 and pcie The interface hard disk device name is generally nvme0n*, The device name after partition is nvme0n1p1 nvme0n1p2 etc. .

onie How to support will onie Installed on the designated hard disk ?

onie Support pice Type of hard disk

stay installer/grub-arch/install-arch Medium install_image Interface , take $onie_dev Variable as onie Installation position , from echo "Installing ONIE on: $onie_dev" You can also see this .
onie_dev A variable is in init_onie_install Interface , adopt [ -b "$onie_dev" ] || onie_dev="$(install_device_platform)" Defined .
therefore , You need to support the specified hard disk , Just need to be in your own vendor_modules Lower heavy load install_device_platform Interface , And return the corresponding hard disk device name . For example, support nvme Hard disk :

install_device_platform()
{
    
    mass_bus="nvme0"
    for i in 1 2 3 4 ; do
        if $(ls -l /sys/block/nvme0n$i/device 2>/dev/null | grep -q "$mass_bus") ; then
            echo "/dev/nvme0n$i"
            return 0
        fi
    done
    echo "storage-not-found"
    return 1
}

Interface as long as it returns /dev/nvme0n1 that will do .
Similarly, if necessary onie The installation to SATA Hard disk or U disc , Interface to return /dev/sda /dev/sdb Just wait .

原网站

版权声明
本文为[Caicai azhuang]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060738551505.html