OS: uos 20 龙芯版
下载龙芯或龙梦提供的4.19源码或从内核官网下载最新kernel(验证过5.9.13)
龙芯源码下载地址:http://ftp.loongnix.org/kernel/linux-4.19.90/Linux-4.19.90-5.tar.gz
龙芯源码下载地址:https://mirrors.tuna.tsinghua.edu.cn/bjlx/pool/main/l/linux-4.19.0-loongson-3/linux-4.19.0-loongson-3_4.19.124-lemote.orig.tar.xz
内核官网:https://www.kernel.org/

下面以龙芯的源码为例,龙梦的源码步骤也是一致

  1. 解压编译

    $ tar xf Linux-4.19.90-5.tar.gz
    $ cd Linux-4.19.90-5
    $ make loongson3_defconfig
    $ make -j4
    $ make install INSTALL_PATH=./_install
    $ make modules_install INSTALL_MOD_PATH=./_install
    
  2. 更换内核

    $ cd _install/
    $ sudo cp vmlinuz-4.19.90-5 /boot/
    
    $ cd lib/modules
    $ sudo cp 4.19.90-5/ -rf /lib/modules
    
    $ sudo su
    //制作initrd文件,4.19.90-5 为当前编译的内核号mkinitramfs会根据这个名去/lib/moudules/4.19.90-5 下打包内核模块文件
    # mkinitramfs 4.19.90-5 -o /boot/initrd.img-4.19.90-5
    cryptsetup: WARNING: The initramfs image may not contain cryptsetup binaries 
        nor crypto modules. If that's on purpose, you may want to uninstall the 
        'cryptsetup-initramfs' package in order to disable the cryptsetup initramfs 
        integration and avoid this warning.
    setupcon is missing. Please install the 'console-setup' package.
    W: plymouth: The plugin label.so is missing, the selected theme might not work as expected.
    W: plymouth: You might want to install the plymouth-themes package to fix this.
    I: The initramfs will attempt to resume from /dev/sda7
    I: (UUID=5c2ea164-88f0-40a1-899c-261d3f5fd4cc)
    I: Set the RESUME variable to override this.
    //更新grub.cfg 
    # grub-mkconfig -o /boot/efi/EFI/BOOT/grub.cfg 
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-4.19.90-5
    Found initrd image: /boot/initrd.img-4.19.90-5
    Found linux image: /boot/vmlinuz-4.19.0-loongson-3-desktop
    Found initrd image: /boot/initrd.img-4.19.0-loongson-3-desktop
    Found initrd image: /boot/deepin-ab-recovery/initrd.img-4.19.0-loongson-3-desktop
    Found recovery image: /recovery/doppel/vmlinuz-4.19.90
    Found initrd image: /recovery/doppel/initrd.img-4.19.90
    Skipped UnionTech OS 20  on /dev/sda4 by user request.
    done
    
  3. 重启试用

    $ uname -a
    Linux loongson-gd-PC 4.19.90-5 #1 SMP PREEMPT Tue Dec 8 12:03:18 CST 2020 mips64 GNU/Linux
    $ lscpu
    Architecture:        mips64
    Byte Order:          Little Endian
    CPU(s):              4
    On-line CPU(s) list: 0-3
    Thread(s) per core:  1
    Core(s) per socket:  4
    Socket(s):           1
    NUMA node(s):        1
    Model name:          Loongson-3A R4 (Loongson-3A4000)
    BogoMIPS:            3594.02
    L1d cache:           64K
    L1i cache:           64K
    L2 cache:            256K
    L3 cache:            2048K
    NUMA node0 CPU(s):   0-3
    
    // 内核官网下载最新kernel 5.9.13
    $ uname -a
    Linux loongson-gd-PC 5.9.13 #1 SMP PREEMPT Fri Dec 11 11:25:31 CST 2020 mips64 GNU/Linux
    $ neofetch 
            #####           loongson-gd@loongson-gd-PC 
           #######          -------------------------- 
           ##O#O##          OS: UnionTech OS Desktop 20 Pro mips64 
           #######          Host: LEMOTE-LS3A4000-7A1000-1w-V0.1-pc 
         ###########        Kernel: 5.9.13 
        #############       Uptime: 2 mins 
       ###############      Packages: 1859 (dpkg) 
       ################     Shell: bash 5.0.3 
      #################     Icons: bloom [GTK2/3] 
    #####################   Terminal: /dev/pts/1 
    #####################   CPU: ICT Loongson-3 V0.4 (4) 
      #################     GPU: AMD ATI Radeon HD 6450/7450/8450 / R5 230 OEM 
                            Memory: 799MiB / 7492MiB                                           
    
Logo

更多推荐