操作系统实验1:操作系统的引导

news2024/11/25 0:52:26

操作系统实验1:操作系统的引导

  • 现在是2022年12月22日,本人一如既往又是ddl战神😅 (虽然一周前刚立过flag)
    • 两个月前就布置了的内容硬是拖到现在,这波实在是看不下去自己了😅😅😅
  • 拖到了ddl的最后一天,明早十点要交八个lab的代码+实验报告 😭

  • 更新:老师是我的神! ddl突然变成了12月27号下午4点,先不管这个了
    • 先去赶另一个布置了一个月但只是调通了环境的大作业了(((😅, 这个的ddl是明晚八点…
  • 下面是一些记录(有些地方用英语是为了practice 一下 English:)

  • bksw,再赶这些的时候已经是12月26了,这篇写于12月26下午五点

文章目录

  • 操作系统实验1:操作系统的引导
  • 一.过程记录
    • 1.把文件从win发到Linux上面
    • 2.搭建环境(不然没法make all)
      • 安装as86
      • 安装gcc-3.4
      • 更新gcc版本优先级
      • 安装gcc-multilib
      • 安装build-essential
      • 安装bochs
      • 可以make all了!!!
      • 运行run脚本
      • 芜湖
    • 3.修改内核代码
    • 4.重新编译内核
  • 二.Linux基本操作一些小总结
    • cd
    • ls
    • rm
    • Linux文件打包和解压缩
      • tar
        • tar打包
        • tar解包
      • 文件压缩命令
        • bzip2
        • gzip
        • zip
        • 一步到位:tar命令打包结合前面的几个指令进行压缩
    • 其他
  • 三.一些基础知识
    • vim中如何搜索代码
    • gcc 、g++ 、GCC、GNU
    • gcc-multilib
    • dpkg
    • wget
    • make 和 make all
    • bochs
    • Linux0.11
    • apt-file
    • .so文件
    • apt update 和 apt-get update
    • i386和amd64
  • 四.常见问题 lock

一.过程记录

1.把文件从win发到Linux上面

  • scp命令将windows上的“hit-oslab-linux-20110823.tar.gz”文件传到Linux上面

    • 命令格式

      scp 要传的文件的路径 用户名@IP地址:目标路径
      
    • 若是要传到传到/usr、/root等目录下,需要在scp的时候使用root用户

    Now,the file is on the Desktop of my ubuntu.

    image-20221222122218893
  • The next step is to unzip such file.

    I search this question in stackoverflow :
    https://stackoverflow.com/a/651028/18159372

    tar xzf file.tar.gz
    
    • The letters are:

      • x - extract
      • z - gunzip the input
      • f - Read from a file, not stdin
  • Then I get the folder ‘oslab’ after I unzipping the file.

    image-20221222125046933
  • 我们看看oslab文件夹里面有哪些文件

    image-20221222125444022

    • 脚本文件run*:以不同模式运行虚拟机,脚本 run 采用正常模式,脚本 rundbg 采用 bochs 调试模式(汇编级),脚本 rungdb 采用 gdb 调试模式( C 语句级),这三个模式都用于内核测试。 用于启动虚拟机的内核映像文件是cur/linux/目录下的Image; 虚拟机的根文件系统是images文件夹下的rootimage-0.11

2.搭建环境(不然没法make all)

  • 下一步是cd 到 linux-0.11目录下面进行make all

    However,so much errors.

    image-20221222130346620

    Then I type make: as86: Command not found into google search .

安装as86

找到了同是做HIT oslab的uu记录的经验贴

  • 参考他的做法

    • 首先sudo apt-cache search as86 查找as86所在的软件包

      显示as86在bin86里面

    • 下一步安装bin86:sudo apt-get install bin86

安装gcc-3.4

  • 于是继续make all, 这次是显示缺少gcc-3.4

    image-20221222131051992

    我去看了看原先的gcc版本,显示是gcc -7.5

    image-20221222131146879
    • 参考资料
      • https://www.cnblogs.com/mirage-mc/p/12681366.html
      • https://www.cnblogs.com/mirage-mc/p/12683481.html
      • 哈工大操作系统系列实验0-熟悉实验环境
  • 我先新建了一个文件夹/usr/bin/gcc3_4 ,然后wget要安装的gcc的deb文件

    wget http://old-releases.ubuntu.com/ubuntu/pool/main/g/gcc-3.4/cpp-3.4_3.4.6-6ubuntu2_amd64.deb
    
    wget http://old-releases.ubuntu.com/ubuntu/pool/main/g/gcc-3.4/gcc-3.4-base_3.4.6-6ubuntu2_amd64.deb
    
    wget http://old-releases.ubuntu.com/ubuntu/pool/main/g/gcc-3.4/gcc-3.4_3.4.6-6ubuntu2_amd64.deb
    
    

    image-20221226132437507

  • 然后用dpkg安装

    dpkg -i cpp-3.4_3.4.6-6ubuntu2_amd64.deb gcc-3.4_3.4.6-6ubuntu2_amd64.deb gcc-3.4-base_3.4.6-6ubuntu2_amd64.deb 
    

    image-20221226132714305

  • 看看装到哪里了

    whereis gcc-3.4
    

    image-20221226132855305

    ls /usr/bin/gcc* -ll
    

    The ls command is a utility that is used to list the contents of a directory. When used with the /usr/bin/gcc* argument, it will list the contents of the /usr/bin directory that match the pattern gcc*, which means any file or directory that begins with gcc.

    The -ll option tells ls to use a long listing format, which means it will show detailed information about each file or directory that is listed. This includes the permissions, owner, size, and modification date for each file, as well as the number of links and the file type for each directory.

    For example, if you run the following command:

    ls /usr/bin/gcc* -ll
    

    It will list the contents of the /usr/bin directory that match the pattern gcc*, using the long listing format. This might include files such as gcc, gcc-10, gcc-7, and other files that begin with gcc.

    Note that the * character is a wildcard(通配符) that is used to match any characters. In this case, it is used to match any file or directory that begins with gcc.

    image-20221226133132761

更新gcc版本优先级

  • To set the priority of different versions of GCC on a Debian-based system, you can use the update-alternatives command. This command allows you to specify which version of a given program should be used by default.

    To set the priority of GCC 3.4 over GCC 7.5, you can use the following steps:

    • First, check the available versions of GCC by running the following command:

      update-alternatives --list gcc
      

      This will show you the available versions of GCC that are installed on your system.

    • To set the priority of GCC 3.4, you will need to specify its path and the priority value that you want to use. You can find the path of GCC 3.4 by running the following command:

      which gcc-3.4
      

      This will show you the path of the gcc-3.4 executable.

    • Once you have the path of GCC 3.4, you can use the update-alternatives command to set its priority. For example:

      sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-3.4 50
      

      This will set the priority of GCC 3.4 to 50. The higher the priority value, the higher the priority of the program.

      image-20221226134147968

    • To verify that the priority has been set correctly, you can run the following command:

      update-alternatives --display gcc
      

      This will show you the available versions of GCC and their priority values. You should see that GCC 3.4 has a higher priority than GCC 7.5.

      image-20221226134217259

Note that the update-alternatives command can also be used to set the priority of other programs, such as g++ and cpp. You can use the same steps as above to set the priority of these programs.

  • 现在看看gcc的默认版本是否更改过来了

    image-20221226134305993

  • 之前在做cs61a的lab0的时候,还用过sudo update-alternatives --config设置优先级,这里也可以

    那么其实就是设置priority和config选择编号都可以

    image-20221226134359260

    • 问问chatgpt!

      Q:我通过sudo update-alternatives --config 和 设置priority的值 这两种方式来设置优先级有什么区别

      A:update-alternatives 是一个 Linux 命令,它允许您在系统中管理多个可供选择的程序版本,以便用户可以在这些程序之间进行切换。您可以使用 update-alternatives 命令来设置一个默认程序版本,也可以使用该命令来查看系统中可用的程序版本。

      使用 update-alternatives 命令时,您可以使用 --config 选项来查看可用的程序版本并选择一个默认版本。例如,假设您有两个可供选择的版本的 gcc 编译器,您可以使用以下命令来查看可用的版本并选择一个默认版本:

      sudo update-alternatives --config gcc
      

      此命令会显示所有可用的 gcc 版本,并提示您选择一个版本。
      另一方面,您还可以使用 update-alternatives 命令的 --set 选项来设置默认版本,并指定其优先级。例如,假设您想要将版本 2 设为默认版本,并且希望其优先级为 1000,您可以使用以下命令:

      sudo update-alternatives --set gcc /usr/bin/gcc-2 1000
      

      在这种情况下,您不需要查看可用的版本并手动选择,而是可以直接使用命令指定版本和优先级。

      总而言之,如果您想要更改系统中的默认程序版本,则可以使用 update-alternatives 命令的 --config--set 选项。
      使用 --config 选项时,您可以查看可供选择的程序版本并选择一个默认版本。这是一种更加交互式的方法,因为您可以看到所有可用的版本,并且可以通过选择编号来选择默认版本。
      使用 --set 选项时,您可以直接指定默认版本的文件路径,并可以选择为该版本设置优先级。这是一种更加简单的方法,但是您必须知道要设为默认版本的文件路径,并且无法查看可用的其他版本。
      总的来说,使用 --config 选项更适合交互式使用,而使用 --set 选项则更适合脚本化使用。取决于您的需求,可以使用适当的选项来设置默认程序版本。

安装gcc-multilib

  • 安装完gcc-3.4

    我尝试去linux0.11下make all,结果报了一堆错误

    image-20221226135455757
  • 还需要安装gcc-multilib

    sudo apt-get install gcc-multilib
    

    网络问题,装了两遍

安装build-essential

  • 命令如下

    sudo apt-get install build-essential
    
  • 日常感叹chatgpt tql

    image-20221226140749929

安装bochs

  • 命令如下

    sudo apt-get install bochs bochs-x bochs-sdl
    

可以make all了!!!

  • make all 成功啦

    image-20221226142759213
  • 此时也出现了Image文件夹

    image-20221226144254739

运行run脚本

  • 首战告负

    image-20221226145113020

  • 网上有很多xd遇到这个问题,参考这篇博客来搞一下

    • 打印动态链接配置

      ldconfig -p | grep libSM.so.6
      

      打印结果为 libSM.so.6 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libSM.so.6

  • 安装apt-file

    sudo apt install apt-file
    
  • 搜索

    apt-file search libSM.so.6
    

    遇到如下问题

    image-20221226145848208

    这个错误信息提示系统中的软件包信息缓存已经清空,因此无法执行查找操作。

    在使用 apt-file 命令查找文件的时候,apt-file 会在本地的软件包信息缓存中查找,如果缓存为空,那么就会出现这个错误。

    要解决这个问题,要先运行 apt update 命令来更新软件包信息缓存,然后再尝试使用 apt-file 命令查找文件。

  • 根据提示来运行apt update

    结果遇到了这个经常遇到的问题

    image-20221226150043665

    这个错误通常是由于在系统中已经有一个进程正在使用 dpkg 命令进行软件包管理操作,导致其他进程无法获取 dpkg 的锁而产生的。

    要解决这个问题,你需要等待正在使用 dpkg 的进程结束,或者手动杀掉这个进程。

    参考这个

    sudo killall apt apt-get
    sudo rm /var/lib/apt/lists/lock
    sudo rm /var/cache/apt/archives/lock
    sudo rm /var/lib/dpkg/lock*
    sudo dpkg --configure -a
    sudo apt update
    

    泪目,等了很久

    image-20221226153849576

  • apt-file search libSM.so.6

    image-20221226154121801

    得到其对应的包名为libsm6,安装对应的32位库

    sudo apt-get install libsm6:i386
    

  • 接着切回oslab运行run脚本,还是报错

    image-20221226154425413

    libX11.so.6 is a shared library that provides support for the X Window System, which is a network-transparent window system for displaying graphical user interfaces (GUIs) on Unix-like operating systems. It is part of the X Window System library, which provides a set of functions and data structures that allow applications to interact with the X Window System. The .so extension stands for “shared object,” which means that the library is compiled in a way that allows it to be loaded and used by multiple programs at the same time. The .6 at the end of the file name is the version number of the library.

  • 按照上面的方法依葫芦画瓢,apt-file search libX11.so.6,但是有两个对应包名🤔

    image-20221226154853098

  • 不知道搞哪个了,接着跟着博客走

    • 使用dpkg-query工具

      dpkg-query -S libX11.so.6
      

      dpkg-query is a command-line tool that is used to manage packages in a Debian-based Linux system. It can be used to perform a variety of tasks, such as listing the packages installed on the system, displaying information about a specific package, or searching for a package that provides a particular file.

      image-20221226155257844

  • 于是安装对应的包

    上面我这没显示i386, 但还是按照博主写的来装32位的吧

    libx11-6:i386 and libx11-6:amd64 are package names for the X Window System library. These packages are used to provide support for the X Window System, which is a network-transparent window system for displaying graphical user interfaces (GUIs) on Unix-like operating systems.

    The main difference between libx11-6:i386 and libx11-6:amd64 is the architecture of the processor that they are compiled for. The i386 architecture refers to 32-bit processors, while the amd64 architecture refers to 64-bit processors. These packages contain the same set of files and functions, but they are compiled in a way that is optimized for the specific processor architecture.

    In general, you should use the libx11-6:i386 package on a 32-bit system and the libx11-6:amd64 package on a 64-bit system. This will ensure that the package is compatible with your system and that you get the best performance possible.

    It is also worth noting that these packages are typically used as dependencies for other software packages, rather than being installed directly. This means that you might not need to install them directly unless you are trying to resolve a dependency issue or are installing software that specifically requires these packages.

    sudo apt-get install libx11-6:i386
    
  • 继续尝试./run

    新的错误👇

    ./bochs/bochs-gdb: error while loading shared libraries: libXpm.so.4: cannot open shared object file: No such file or directory
    
  • 依葫芦画瓢

    dpkg-query -S libXpm.so.4
    

    我这还是只显示了amd64的

    libxpm4:amd64: /usr/lib/x86_64-linux-gnu/libXpm.so.4
    libxpm4:amd64: /usr/lib/x86_64-linux-gnu/libXpm.so.4.11.0
    

    但还是安装32位的

    sudo apt-get install libxpm4:i386
    

芜湖

image-20221226160251846

3.修改内核代码

  • 进入oslab的boot目录下,修改bootsect.s

    • 在Vim中快速定位到相应的地方(相当于ctrl+f)
  • 首先找到msg1,修改语句

在vim中输入/msg1可快速定位,然后输入i修改代码

image-20221226165753904

image-20221226162625544
  • bootsect.s文件中第92行到105行为有关屏幕输出的相关代码。

    ! Print some inane message
    
        mov ah,#0x03 ! read cursor pos
        xor bh,bh
        int 0x10
        
        mov cx,#24
        mov bx,#0x0007 ! page 0, attribute 7 (normal)
        mov bp,#msg1
        mov ax,#0x1301 ! write string, move cursor
        int 0x10
    
    

    如上所示 3-5行:读入光标位置

    7行:指明要显示的字符串的长度

  • 修改后如下所示。其中es:bp是显示字符串的地址,相比与 linux-0.11 中的代码,需要增加对 es 的 处理,因为原代码中在输出之前已经处理了 es。这里需要修改的是字符串长度,即用需要输出的字符串 长度替换 mov cx,#24 中的 24。

    • 要注意:除了我们设置的字符串 msg1 之外,还有三个换行 + 回车, 一共是 6 个字符。

      下面的66是我的msg1里面的句子的长度60 + 6

      !Print some inane message 
      
      	mov ah,#0x03 ! read cursor pos 
      	xor bh,bh 
      	int 0x10 
      	
      	mov cx,#66 
      	mov bx,#0x0007 ! page 0, attribute 7 (normal) 
      	mov bp,#msg1 
      	mov ax,#0x07c0 
      	mov es,ax 
      	mov ax,#0x1301 ! write string, move cursor 
      	int 0x10  
      

      image-20221226171827631

    • 接下来就是修改输出的字符串了,字符串msg1在 bootsect.s 文件末尾的位置:

      ! msg1 处放置字符串
      msg1: 
      ! 换行 + 回车 
      	.byte 13,10 
      	.ascii "要输出的句子" 
      ! 两对换行 + 回车 
      	.byte 13,10,13,10
      

      比如若这里 句子是Hello OS world, my name is XXX 的长度是 30,加上 6 后是 36,所以 代码应该修改为 mov cx,#36

    • 我懒得数我的句子的长度了,用python帮我数

      sentence="xxxxxxxxxxxxxxxxxxxxxx." #替换成自己想要的句子
      letters = [letter for letter in sentence]
      letter_count = len(letters)
      
      print(letters)
      print(letter_count)
      

      image-20221226171710761

4.重新编译内核

  • 去linux-0.11目录下make

  • 然后回到oslab下./run,芜湖!

    image-20221226172902347

二.Linux基本操作一些小总结

  • 参考
    • https://www.educoder.net/paths/7eafpj36
    • https://www.educoder.net/tasks/o5zghlrtf2wn

cd

  • cd使用方法总结

    • 相对路径切换:以当前目录为起点去切换。
    • 绝对路径切换:以根目录为起点去切换。
    • 常用👇
    cd 进入用户主目录;
    cd / 切换到根目录
    cd ~ 进入用户主目录;
    cd - 返回进入此目录之前所在的目录;
    cd .. 返回上级目录(若当前目录为”/“,则执行完后还在”/“;”..”为上级目录的意思);
    cd ../.. 返回上两级目录;
    cd !$ 把上个命令的参数作为cd参数使用。
    

    若记不全路径,可以使用按两次 Tab 查看有哪些目录可选。

ls

  • ls命令总结

    ls -l 可以 缩写为 ll

    ls -l:以长格式显示目录下的内容列表。输出的信息从左到右依次包括文件名,文件类型、权限模式、硬连接数、所有者、组、文件大小和文件的最后修改时间等;
    ls -a:显示所有文件和文件夹(包括隐藏文件/文件夹)

rm

  • rm命令总结

    rm [命令选项] filename

  • 常用命令选项

     -f:强制删除文件或目录;
     -r或-R:递归处理,将指定目录下的所有文件与子目录一并处理;
     -i:删除已有文件或目录之前先询问用户。
    

Linux文件打包和解压缩

tar

tartape archive的简写)其名称源于它的原始功能-创建和读取归档文件和备份磁带。

tar打包

tar命令可以将多个文件/目录进行打包,将多个文件生成一个文件,生成的文件后缀为.tar

具体打包命令如下:

  • tar -cvf 生成的tar包名 要打包的文件/目录列表

常用命令参数如下:

-c 建立新的归档文件;
-v 处理过程中输出相关信息;
-f 对普通文件操作;

tar解包

tar命令可以将已经打包好的文件解压出来。

  • 具体打包命令如下:tar -xvf 解压包名 -C 解压到指定目录

  • 常用命令参数如下:

    -x 或--ext\fract或--get:从备份文件中还原文件;
    -v 处理过程中输出相关信息;
    -f  对普通文件操作;
    -C <目的目录> 切换到指定的目录;
    

    如果不使用-C(大写)参数,则默认解压到当前目录下。

文件压缩命令

  • Linux下存在多个文件压缩工具,常用的有bzip2gzipzip。这三个工具都是可以将一个文件进行压缩操作,使其在不丢失任何信息的情况下占用较少的磁盘空间。

  • 对于多文件/目录的压缩操作分为两步:第一步是将其进行打包,然后将打包过后的文件进行压缩操作。

bzip2

  • bzip2命令用于创建和管理(包括解压缩).bz2格式的压缩包。

  • 具体命令如下:

    bzip2 命令参数 指定要压缩的文件
    

    常用命令参数如下:

    -z或——compress:强制执行压缩;
    -d或——decompress:执行解压缩;
    -f或-force:bzip2在压缩或解压缩时,若输出文件与现有文件同名,预设不会覆盖现有文件。若要覆盖。请使用此参数;
    -v或——verbose:压缩或解压缩文件时,显示详细的信息;
    

gzip

  • gzip命令用于创建和管理(包括解压缩).gz格式的压缩包。

  • 具体命令如下:

    gzip 命令参数 指定要压缩的文件
    
  • 常用命令参数如下:

    -d或--decompress或----uncompress:解开压缩文件;
    -f或——force:强行压缩文件。不理会文件名称或硬连接是否存在以及该文件是否为符号连接;
    -l或——list:列出压缩文件的相关信息;
    -r或——recursive:递归处理,将指定目录下的所有文件及子目录一并处理;
    -v或——verbose:显示指令执行过程;
    

zip

  • zip命令对文件进行打包操作。zip是个使用广泛的压缩程序,文件经它压缩后会另外产生具有.zip扩展名的压缩文件。

  • 具体命令如下:

    zip 命令参数 指定生成的压缩文件名 要被压缩的文件/目录列表
    
  • 常用命令

    -d:从压缩文件内删除指定的文件;
    -q:不显示指令执行过程;
    -r:递归处理,将指定目录下的所有文件和子目录一并处理;
    -v:显示指令执行过程或显示版本信息;
    -u:更换较新的文件到压缩文件内;
    -x<范本样式>:压缩时排除符合条件的文件;
    

一步到位:tar命令打包结合前面的几个指令进行压缩

  • tar命令可以对多个文件/目录进行打包操作,如果针对多文件/目录进行压缩操作时,首先使用tar将其打包生成一个文件,然后使用bzip2gzip对其进行压缩,那么这里也可以使用tar命令一步就实现对多文件/目录进行压缩操作。

  • 采用bzip2方式执行tar命令进行压缩的具体命令如下:

    tar -jcvf 指定生成的压缩文件名 要被压缩的文件/目录列表
    

    常用命令参数如下:

    -c 建立新的归档文件;
    -v 处理过程中输出相关信息;
    -f 对普通文件操作;
    -j 以bzip2对文件/目录进行压缩;
    
  • 采用gzip进行压缩的具体命令如下:

    tar -zcvf 指定生成的压缩文件名 要被压缩的文件/目录列表
    

    常用命令参数如下:

    -c 建立新的归档文件;
    -v 处理过程中输出相关信息;
    -f 对普通文件操作;
    -z 以gzip对文件/目录进行压缩;
    

其他

  • 记得多用tab补全命令

  • 未解决:ctrl+alt+t打不开我的terminal了,去settings里面修改也没有用

    • 查了一下,是因为我把python默认版本换了的问题
    • 暂时先不解决,留一个链接在这里 :https://askubuntu.com/a/1239610/1659304
  • scp命令搞清楚逻辑、用户名(有的路径需要权限)

    • CSDN上一个关于scp使用比较不错的总结:scp命令传文件

三.一些基础知识

vim中如何搜索代码

  • How to search code in Vim?

    To search for a specific string of text in Vim, you can use the / key followed by the string you want to search for. For example, to search for the word “foo”, you would type /foo and press Enter.

    You can also use regular expressions in your search by enclosing the search string in / characters. For example, to search for any line that contains the word “foo”, you could use the regular expression /foo.

    To move to the next occurrence of the search string, use the n key. To move to the previous occurrence, use the N key.

    If you want to perform a case-insensitive search, you can use the \c flag. For example, to search for the word “foo” without regard to case, you would use the search string /foo\c.

    You can also use the * key to search for the word under the cursor. For example, if the cursor is on the word “foo”, pressing * will search for the next occurrence of “foo” in the document.

    For more information on searching in Vim, you can consult the Vim documentation by typing :help searching within Vim.

gcc 、g++ 、GCC、GNU

  • What is gcc 、 g++ and gnu ? What is their relationship?
    • GCC (GNU Compiler Collection) is a collection of compilers and libraries for C, C++, Fortran, and other programming languages. It is developed and maintained by the Free Software Foundation (FSF) as part of the GNU Project.
    • GCC includes front-ends for several programming languages, including C, C++, and Fortran. The C and C++ front-ends are called gcc and g++, respectively. These are the compilers that are used to compile C and C++ source code into executable programs.
    • GNU (GNU’s Not Unix) is a project that aims to develop a complete, free software operating system. The GCC compiler collection is one of the core components of the GNU Project, along with other tools such as the GNU C Library (glibc) and the GNU debugger (GDB).
    • In summary, GCC is a collection of compilers and libraries for several programming languages, including C and C++. The gcc and g++ compilers are part of GCC and are used to compile C and C++ source code, respectively. GCC is developed and maintained by the FSF as part of the GNU Project, which aims to create a complete, free software operating system.

gcc-multilib

  • gcc-multilib is a package that provides support for building software that can run on multiple architectures or platforms with the GNU Compiler Collection (GCC). GCC is a collection of compilers and libraries for various programming languages, including C, C++, and Fortran.

  • gcc-multilib enables GCC to build software that can run on multiple architectures, such as 32-bit and 64-bit architectures, by providing support for compiling and linking programs for different architectures. This can be useful for developers who want to create software that can run on a variety of systems, or for users who need to build software that is compatible with multiple architectures.

dpkg

  • what is dpkg?

    • dpkg is a package manager for Debian and its derivatives such as Ubuntu and Linux Mint. It is used to install, remove, and manage packages in these operating systems.
    • A package in this context refers to a bundle of software that includes all the files necessary for a specific program or application to run on a computer. Packages are typically distributed as files with the extension .deb.
    • dpkg is a command-line tool that is used to install and manage these packages. It can be used to install a package from a local file or from a repository on the internet. It can also be used to remove packages and to list the packages that are installed on the system.
    • In addition to managing packages, dpkg can also be used to manage the package database on the system, which keeps track of all the installed packages and their associated files. This can be useful for troubleshooting(故障排除;疑难解答;疑难排解) issues with installed packages or for cleaning up the system by removing unused or orphaned packages.(这对于解决已安装软件包的问题或通过删除未使用或孤立的软件包来清理系统可能很有用。)
  • What is the relationship between .deb and dpkg?

    .deb files are package files that are used to distribute software on Debian and its derivatives(衍生品) such as Ubuntu and Linux Mint. dpkg is a command-line tool that is used to install, remove, and manage these packages on these operating systems.

    In other words, .deb files are the packages that contain the software and its associated files, while dpkg is the tool that is used to install, remove, and manage these packages on the system.

    To install a .deb file on a Debian-based system, you can use the dpkg command with the -i option, followed by the name of the .deb file. For example:

    sudo dpkg -i package.deb
    

    This will install the package contained in the .deb file on the system.

    To remove a package that was installed from a .deb file, you can use the dpkg command with the -r option, followed by the name of the package. For example:

    sudo dpkg -r package
    

    This will remove the package and its associated files from the system, but it will not remove any dependencies that were installed along with the package.

    In summary, .deb files are package files that contain the software and its associated files, while dpkg is the tool that is used to install, remove, and manage these packages on Debian-based systems.

wget

  • What is wget? How to use wget?

    • wget is a command-line utility(实用工具,实用程序) that is used to download files from the internet. It is commonly used to download files from websites or FTP servers, but it can also be used to download files from other sources such as HTTP or HTTPS servers.

    • To use wget, you simply need to specify the URL of the file you want to download as an argument to the wget command. For example:

      wget http://example.com/file.zip
      

      This will download the file file.zip from the website http://example.com and save it in the current directory.

  • wget has many options that allow you to control various aspects of the download process, such as the location where the file is saved, the number of retries, and the maximum download speed. Here are a few common options:

    • -O: Specifies the name of the file where the downloaded content will be saved.
    • -c: Resumes a partially-downloaded file.
    • -t: Specifies the number of retries if the download fails.
    • --limit-rate: Specifies the maximum download speed in bytes per second.

    For example, to download a file and save it as myfile.zip, you can use the -O option like this:

    wget -O myfile.zip http://example.com/file.zip
    

    To resume(恢复) a partially-downloaded file, you can use the -c option:

    wget -c http://example.com/file.zip
    

    To specify the number of retries, you can use the -t option:

    wget -t 3 http://example.com/file.zip
    

    To specify the maximum download speed, you can use the --limit-rate option:

    wget --limit-rate=1024k http://example.com/file.zip
    
  • hhh

    image-20221226131331870

make 和 make all

  • make is a command-line tool that is used to build and maintain software projects. It is typically used in Unix-like systems, including Linux and macOS. make reads a file called a Makefile and executes the instructions contained in it to build the project.

  • The Makefile specifies a set of targets, each of which represents a specific aspect of the project, such as building an executable or creating documentation. Each target has a set of dependencies, which are other targets or files that must be built or updated before the target can be built.

  • The make command can be used to build a specific target by specifying the target name on the command line. For example, to build the all target in a Makefile, you can run the following command:

    make all
    

    The all target is a special target that is often used to build the entire project. It is typically specified as the first target in the Makefile, and it depends on all other targets in the project.

  • By default, make will build the first target in the Makefile if no target is specified on the command line. This means that if you simply run make, it will build the all target if it is the first target in the Makefile, or it will build the first target if all is not specified.

  • In addition to building targets, make can also be used to clean up the build environment, run tests, and perform other tasks related to building and maintaining a software project.

bochs

何为bochs

  • Bochs is an open-source software emulator that allows you to run operating systems and applications in a virtual environment on your computer. It is often used for testing and development purposes, as it allows you to run software on different hardware architectures and operating systems without the need for physical hardware.

  • Bochs emulates a complete computer system, including the CPU, memory, and other hardware components, in software. This allows you to run operating systems and applications on top of the emulator, as if they were running on real hardware. Bochs can be used to run a wide variety of operating systems, including Linux, Windows, and macOS.

  • Bochs is a useful tool for developers and users who want to test software on different platforms without the need for multiple physical machines. It is also useful for running legacy(遗留,遗产)software on newer systems(它对于在较新的系统上运行旧软件也很有用), or for running operating systems that are not supported on your physical hardware.

  • To use Bochs, you will need to install it on your system and create a virtual machine configuration. You will then be able to install an operating system or applications in the virtual machine and run them using Bochs. Consult the Bochs documentation for more information on using the emulator.

Linux0.11

  • Linux 0.11 is a version of the Linux kernel, which is the core component of the Linux operating system. The Linux kernel is responsible for managing the hardware and software resources of a computer, and it provides a interface between the hardware and the operating system’s userland programs.
  • Linux 0.11 was released in 1991 and was one of the earliest versions of the Linux kernel. It was developed by Linus Torvalds, who is considered to be the founder of the Linux operating system. Linux 0.11 was a significant milestone in the development of Linux, as it was the first version of the kernel that was released to the public and made available for download.
  • Linux 0.11 was a monolithic(庞大的) kernel, which means that it included all of the kernel’s components, including device drivers, in a single executable file. Monolithic kernels are now considered to be outdated, and most modern kernels use a microkernel architecture, which separates the kernel’s components into smaller, more modular pieces.
  • Linux 0.11 supported a limited set of hardware devices and supported only a single processor architecture (Intel x86). It did not include support for modern features such as preemptive multitasking, memory protection, or virtual memory.
  • Despite its limitations, Linux 0.11 played a crucial role in the development of the Linux operating system and laid the foundation for the more advanced and feature-rich kernels that followed. It is still used by some enthusiasts and developers for educational purposes or to run old software on modern systems.

apt-file

  • apt-file is a command-line utility that is used to search for files in software packages that are available in the Advanced Packaging Tool (APT) package manager on Debian-based systems such as Ubuntu.

  • The apt-file command allows you to search for a specific file or a pattern of files in the package metadata of the APT package repository. This can be useful if you need to find out which package contains a specific file that you are looking for, or if you want to verify that a package contains a particular file before installing it.

  • To use apt-file, you will need to install it on your system and update the package metadata. You can do this by running the following commands:

    apt-get update
    sudo apt-get install apt-file
    sudo apt-file update
    
  • Once apt-file is installed and the package metadata is up to date, you can use the apt-file search command to search for a file or pattern of files in the package metadata. For example, you can use the following command to search for the file libc.so:

    apt-file search libc.so
    

    This will search the package metadata for any packages that contain the file libc.so and display a list of the packages that match the search criteria.

  • apt-file is a useful tool for finding packages that contain specific files, especially when you are not sure which package provides a particular file or when you want to verify that a package contains a particular file before installing it.

.so文件

  • What is .so file

  • A file with the .so extension is a shared object file. Shared object files, also known as shared libraries or dynamic-link libraries (DLLs), are compiled code that can be shared by multiple programs. They are often used to provide common functionality that is needed by many different programs, such as basic input/output operations or networking functions.

    Shared object files are typically stored in a specific location on the system and are loaded by programs at runtime when they are needed. This allows multiple programs to use the same shared object file, rather than each program needing to include its own copy of the code. This can save space and improve performance by reducing the amount of code that needs to be loaded into memory.

    Shared object files are typically compiled in a platform-specific format, such as ELF (Executable and Linkable Format) on Linux systems or DLL on Windows systems. They are often used to implement software libraries or to provide plug-in functionality for applications.

    To use a shared object file, a program must be linked to it at compile time or dynamically load it at runtime. This is typically done using the ld linker or the dlopen() function, respectively.

    Shared object files are an important part of many modern operating systems and are used to provide a wide range of functionality to applications and libraries.

apt update 和 apt-get update

  • What means apt update and apt-get update? What’s the difference and relationship between them?

  • apt update and apt-get update are commands that are used to download package lists from repositories and update the local database of available packages. They are used to ensure that the system has an up-to-date list of available packages and their dependencies, which is necessary in order to install or upgrade packages using the apt or apt-get command.

    The apt update command is part of the apt package manager, which is a newer package management tool that was introduced in Debian 8 (Jessie) and is now used by many Linux distributions. The apt-get update command is part of the apt-get package manager, which is an older package management tool that has been around since the early days of Debian.

    The apt and apt-get commands are closely related and can often be used interchangeably. However, there are some differences in how they work and the options they support. In general, the apt command is more user-friendly and provides a more concise and straightforward syntax, while apt-get is more flexible and allows for more advanced usage.

    For example, the apt update command is generally used to download package lists and update the local database of available packages, while the apt-get update command can also be used to upgrade all installed packages to the latest available version.

    Overall, the apt and apt-get commands are both useful tools for managing packages on a Linux system, and you can use either one depending on your needs and preferences.

i386和amd64

  • i386 and amd64 are different architectures for computer processors.

    i386 refers to the 32-bit x86 architecture, which is a CPU architecture that was widely used in personal computers in the 1980s and 1990s. It is still used today in some older systems, as well as in some embedded devices.

    amd64 refers to the 64-bit x86 architecture, which is a more modern version of the x86 architecture that was introduced by AMD in the mid-2000s. It is now the most widely used CPU architecture for personal computers, and it is supported by most modern operating systems.

    The main difference between i386 and amd64 is the amount of data that they can process at one time. The i386 architecture is limited to 32 bits, which means that it can only process data in blocks of 32 bits at a time. The amd64 architecture, on the other hand, is capable of processing data in blocks of 64 bits at a time, which provides much higher performance and allows it to handle larger amounts of data.

    In general, amd64 systems are faster and more powerful than i386 systems, but they also require more resources and are not as compatible with older software.

四.常见问题 lock

  • 解决方案

    sudo killall apt apt-get
    sudo rm /var/lib/apt/lists/lock
    sudo rm /var/cache/apt/archives/lock
    sudo rm /var/lib/dpkg/lock*
    sudo dpkg --configure -a
    sudo apt update
    

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/116465.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

String、StringBuffer、StringBuilder的区别

文章目录一、StringBuffer1、介绍2、StringBuffer中方法二、StringBuilder1.介绍2.常用方法总结一、StringBuffer 1、介绍 是可以存储和操作字符串&#xff0c;即包含多个字符的字符串数据。对于StringBuffer而言&#xff0c;本身是一个具体的操作类&#xff0c;所以不能像St…

推送MOBPUSH-API说明

消息监听接口 MobPushReceiver: 消息监听接口&#xff08;包含接收自定义消息、通知消息、通知栏点击事件、别名和标签变更操作等&#xff09; MobPush.addPushReceiver(MobPushReceiver receiver): 设置消息监听 MobPush.removePushReceiver(MobPushReceiver receiver): 移除…

2022年全国最新消防设施操作员模拟试题题库及答案

百分百题库提供消防设施操作员考试试题、消防设施操作员考试预测题、消防设施操作员考试真题、消防设施操作员证考试题库等,提供在线做题刷题&#xff0c;在线模拟考试&#xff0c;助你考试轻松过关。 38.下列说法正确的是&#xff08;&#xff09;。 A.低压供配电系统中&…

vue的基本概念与vue2的指令

目录 一、 Vue的基本概念 1、前端技术的发展&#xff08;html、CSS、JavaScript&#xff09; ​ 2、MVVM架构&#xff1a; 数据的双向绑定&#xff1a; 二、Vue开发的方式 1、基本方式&#xff1a;在页面中引入vue.js文件。&#xff08;vscode&#xff09; 2、组件…

智能网 联汽车信息安全发展趋势

智能网 联汽车信息安全发展趋势 智能网联汽车行业发展 根据工信部发布的《国家车联网产业标准体系建设 指南&#xff08;智能网联汽车&#xff09;》的定义&#xff0c;智能网联汽车是指搭载先进的车载传感器 、控制器、执行器等装置&#xff0c;并融合现代通信与网络技术&a…

Android设计模式详解之备忘录模式

前言 备忘录模式是一种行为模式&#xff0c;该模式用于保存对象当前状态&#xff0c;并且在之后可以再次恢复到此状态&#xff1b; 定义&#xff1a;在不破坏封闭的前提下&#xff0c;捕获一个对象的内部状态&#xff0c;并在该对象之外保存这个状态&#xff0c;这样&#xf…

【单目3D目标检测】MonoDLE论文精读与代码解析

文章目录PrefaceAbstractContributionsDiagnostic ExperimentsPipelineRevisiting Center DetectionTraining SamplesIoU Oriented OptimizationExperimental ResultsPreface [CVPR2021] Ma X, Zhang Y, Xu D. Delving into localization errors for monocular 3d object detec…

Docker技术原理

一、Docker架构 Docker包括三个基本概念&#xff1a; 镜像&#xff08;Image&#xff09;: Docker 镜像&#xff08;Image&#xff09;&#xff0c;就相当于是一个 root 文件系统。比如官方镜像 ubuntu:16.04 就包含了完整的一套 Ubuntu16.04 最小系统的 root 文件系统。容器…

vue中使用tinymce富文本编辑器

之前都是用的quill富文本&#xff0c;但是因为要实现添加表格的功能&#xff0c;quill没有tinymce强大&#xff0c;所以改用了tinymce。当时也是百度了一堆的教程可是没有记录下来&#xff0c;现在发现有的细节忘记了&#xff0c;所以这个文章可能会有错误 。 当时看了好几个安…

全球智能网联汽车出货量预计

IDC 于 2020 年最新发布的《全球智能网 联汽车预测报告&#xff08;2020-2024&#xff09;》数据显示&#xff0c;尽管受新冠肺炎疫情冲击&#xff0c;2020 年全球智能网联汽车出货量预计较上一年下滑 10.6%&#xff0c;约为 4440 万辆&#xff0c;但到 2024 年全球智能网联汽车…

数据可视化之excel和finebi报表实现对比

当我们拿到数据&#xff0c;想对数据实现可视化报表设计。第一步就是要了解什么是数据可视化分析&#xff0c;且数据可视化分析的方法有什么&#xff1f;而且当我们拿到excel表格的数据&#xff0c;第一个想法是excel表格自身实现报表数据可视化&#xff0c;除了用excel本身实现…

JMeter

Apache JMeter—压力测试工具 一.什么是Apache JMeter Apache JMeter 是 Apache 组织基于 Java 开发的压力测试工具&#xff0c;用于对软件做压力测试。 JMeter 最初被设计用于 Web 应用测试&#xff0c;但后来扩展到了其他测试领域&#xff0c;可用于测试静态和动态资源&am…

Linux-redis 集群配置

1、redis主从复制(Master/Slave) a、集群结构 三个节点&#xff1a;一个主节点&#xff0c;二个从节点 b、准备实例和配置 在虚拟机开启3个redis 实例&#xff0c;来模拟主从集群模式&#xff0c;信息如下&#xff1a; ippost角色192.168.150.1017001master192.168.150.101…

服务器硬件规格常用查看命令——HCA卡相关命令

使用不同厂商的InfiniBand设备&#xff0c;可能需要到不同厂商的官网下载相应的工具包&#xff0c; Matrox的HCA卡操作命令由infiniband-diags-1.6.5.MLNX20150902.0e83419-0.1.x86_64工具 包提供。由于这类工具的功能与厂商有关&#xff0c;且是针对特定设备的&#xff0c;所以…

融云CEO董晗:国产化进程加速,助推政企数智办公平台深化发展

政策催化加疫情助推下&#xff0c;办公线上化迅速完成着市场教育已经成为当前的主流趋势。而随着“国产化”成为各行业数字化发展道路上的关键词&#xff0c;政企办公领域国产替代的发展确定性更加凸显。关注【融云全球互联网通信云】了解更多 近期&#xff0c;融云与艾瑞咨询…

SpringBoot基础篇和运维篇

目录 parent starter 引导类 ​编辑 辅助功能 REST开发 REST简介 入门案例&#xff1a; 1、设置http请求方式​编辑 2、设置请求参数 知识点&#xff1a; 1&#xff0c;RequestMapping 2、PathVariable注解 3、三个有关页面请求参数的注解 4、REST风格的注解简化&…

基于数字孪生技术在水电站的探索应用

数字孪生技术作为一种新的技术趋势&#xff0c;日益被千行百业产业所重视。那么&#xff0c;是否可以使用数字孪生技术来构建一个数字孪生水电站&#xff1f;让传统的水电行业也能把握住最新的数字技术的发展趋势&#xff0c;促进水电事业的发展呢。 基于数字孪生技术在水电站 …

三、解构赋值、函数默认值、数组解构、对象解构

三、解构赋值、函数默认值、数组解构、对象解构 函数传参为undefined/不传值&#xff0c;解构赋值时值为undefined/不传值时&#xff0c;都可以去取自己定义的默认值。 一、函数默认值 1.1 函数默认值 ES5语法函数参数赋默认值 function foo(a, b){var a typeof(argument…

11.Linux文件管理命令---diff比较两个文件

11.Linux文件管理命令—diff比较两个文件 文章目录diff比较两个文件练习案例diff比较两个文件 作用&#xff1a;找出两个文件的不同点。 用法&#xff1a;diff [选项] 源文件 目标文件 主要选项如下。 下面是 GNU 所接受的 diff 所有选项的概要。大多数选项有两个相同的名字&…

单机模拟集群(三主两从)

引言 操作系统环境&#xff1a;Ubuntu 20.04 Redis版本&#xff1a;6.2.8 准备工作 如果已经安装过了&#xff0c;找到自己的安装路径。如果没有安装过&#xff0c;去官网下载 当前最新版本是7.0&#xff0c;我这里用的是6.0&#xff0c;下载 redis-6.2.8.tar.gz&#xff0c…