“GPT MBR 主分区扩展分区和逻辑分区各种硬盘常识”与“Game”:页面之间的差异

来自linuxsa wiki
(页面间差异)
跳转到导航 跳转到搜索
Evan留言 | 贡献
 
Evan留言 | 贡献
 
第1行: 第1行:
=GPT and  MBR=
[[category:devops]]
==MBR==
=贪吃蛇=
如果你一个普通用户,对技术细节不是那么感兴趣,那其实关于MBR分区方案你需要记住的只有两点:
<pre>
#pre
sudo yum install mesa-libGL-devel


    1、本来MBR分区表只能保存四个分区的信息,但通过扩展分区与逻辑分区的使用,MBR突破了这个限制。
yum install libudev-devel
    2、由于MBR分区表中,表示地址的参数是只有4个字节,所以导致MBR分区方案中,分区的起始位置不能大于2TB,分区的最大容量,也不能大于2TB。所以,对2TB以上容量的物理硬盘,不适合使用MBR分区方案。


==GPT==
sudo yum install gcc-c++ cmake make libX11-devel libXrandr-devel \
相比较于MBR,GPT是新一代的分区方案,如果你使用的电脑很新,有可能该电脑上的硬盘就是使用了GPT分区方
                freetype-devel openal-soft-devel libjpeg-turbo-devel \
                libvorbis-devel flac-devel


以上就是GPT分区方案的大致内容,其实也不算复杂了。对普通用户而言,其实需要了解的GPT最重要的特点是:使用GPT分区方案,没有硬盘容量不能超过2TB大小的限制,这是GPT区别于MBR的特点与优点!
wget https://www.sfml-dev.org/files/SFML-2.5.1-sources.zip
unzip SFML-2.5.1-sources.zip
cd SFML-2.5.1


现在,可能你会觉得如何使用MBR与GPT了:硬盘容量小于或等于2TB时,用MBR或GPT都行;硬盘容量大于2TB时,用GPT。这种说法没错,但实际情况比这个要复杂些。因为,正确的使用MBR或GPT,你还需要了解另外一些知识:比如BIOS与EFI。
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
sudo make install


=BIOS 与 EFI=
sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/sfml.conf'
那BIOS与EFI是什么呢?可以把BIOS理解为硬件与软件的中介,操作系统等软件通过BIOS或EFI这个中介来间接操作硬件。
sudo ldconfig


实际上操作系统等软件是可以直接操作硬件的,但这么做,太麻烦了。比如你让打印机打印一个字母A,如果不通过BIOS或EFI这个中介,你至少需要写二十行以上的汇编代码,而且这些代码中,大部分都是例行公事的一些打印准备工作,无聊透顶。所以BIOS与EFI作为硬件软件的中介,是必须的,非常重要。


BIOS与EFI又是什么关系呢?可以这样理解:BIOS是早期的硬件软件中介方式,随着硬件与软件技术的快速发展,BIOS这种中介方式不能适应先进的硬件软件了,于是就出现了EFI这种新的中介方式。


你可能在一些计算机方面的文章中看到过UEFI这个词,简单的说,UEFI就是新版的EFI,事实上现在我们接触到的EFI,都是UEFI。一个计算机是使用BIOS还是使用UEFI,是由这台计算机的主板决定的,如果你使用的计算机比较老,多半用的是支持BIOS的主板;如果很新,多半用的是支持UEFI的主板。
# 安装依赖(Ubuntu示例)
sudo apt install sfml2.5-dev g++
#代码
https://github.com/evan886/snake_game.git


需要说明的是:出于兼容性的考虑,大多数UEFI主板,可以选择仍然使用BIOS方式,就是说UEFI主板,既可以使用新的UEFI中介,还可以使用老的BIOS中介(通常这种方式被称为Legacy BIOS)。关于BIOS与EFI,还有很多东西可以写,但估计写的更多,会让你更加困惑,所以,暂时只介绍这么多。
# 创建构建目录
mkdir build && cd build


UEFI + GPT
# 生成Makefile
同上一种情况相对应,新式的UEFI主板,并且采用了UEFI方式,那么,请给硬盘采用GPT分区方案。
cmake .. -DCMAKE_BUILD_TYPE=Release


我知道一些电脑高手一定会笑话我,你也可能会有一些疑惑,因为你在网上轻易的就发现很多教你用相反的方式,即BIOS+GPT或UEFI+MBR安装windows的文章。但我还是要建议你,如果你不是玩家,不是高手,请按BIOS + MBR或UEFI + GPT的方式选择硬盘的分区方式,这样做有两个好处:
# 编译
make -j$(nproc)


    1、 能够让硬件与软件的效率更高,速度更快;
# 运行
    2、 能够避免安装与运行windows时,可能出现的很多问题。对于高手,这些问题大部分都可以解决;但对于普通用户,有些问题难于解决或者即使能够解决,也会花费你大量的时间与精力。
./SnakeGame
</pre>


=err=
<pre>


一些朋友可能会问:我的主板是新的UEFI主板,我使用Legacy BIOS模式好不好呢?
[100%] Linking CXX executable ../bin/dbserver
/home/evan/roserver/lib/linux/9.2.0/libprotobuf.a(common.o): In function `google::protobuf::internal::LogMessage::operator<<(google::protobuf::uint128 const&)':
common.cc:(.text+0x6c7): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
/home/evan/roserver/lib/linux/9.2.0/libprotobuf.a(int128.o): In function `google::protobuf::operator<<(std::ostream&, google::protobuf::uint128 const&)':
int128.cc:(.text+0x6f8): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
collect2: error: ld returned 1 exit status
make[2]: *** [dbserver/CMakeFiles/dbserver.dir/build.make:3479: bin/dbserver] Error 1
make[1]: *** [CMakeFiles/Makefile2:431: dbserver/CMakeFiles/dbserver.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
[root@evan-NUC11PAHi5 dbserver]#


我的建议是:除非你的硬盘很小,否则请选择EFI模式,不要使用Legacy BIOS模式,这样机器会更有效率,运行速度更快。因为EFI+GPT相比较BIOS+MBR要稍微多占用一点点硬盘空间(100M多一点),如果你的硬盘很小,非常在意这一点硬盘空间,可以选择Legacy BIOS模式。
</pre>


再重复一下本文到此知识上的要点及使用上的建议,其实就两条:
=怎么搞=
<pre>


    1. MBR不能管理容量超过2TB的大硬盘,GPT则没有这个限制,所以,如果硬盘大于2TB,请使用GPT。
换台centos7 ?
    2. 使用传统BIOS主板的电脑,建议使用MBR;使用UEFI主板的电脑,建议使用GPT。
全 ro1  and then  全 ro




关于MBR与GPT,我们了解这么多就够了吗?不够,真的不够,因为,你还要必须要了解你使用的Windows版本,对MBR与GPT的支持情况。
</pre>


=分区要注意的=
=ro=
centos8


GPT格式的磁盘只能创建主分区,不能也不需要创建逻辑分区,GPT格式就是为了解决MBR格式只能创建4个主分区的问题,GPT支持128个主分区的,逻辑分区就是在主分区不够用的情况下,在主分区上虚拟设置逻辑分区的,要想用逻辑分区,就只能把硬盘转换成MBR格式
=jdk=
https://repo.huaweicloud.com:8443/artifactory/java-local/jdk/8u151-b12/
==compile lib ==
<pre>
第一个没成功 第二个成功
[root@evan-NUC11PAHi5 roserver]# ls lib/librogamelibs.a  -l
lrwxrwxrwx. 1 root root 50 May 17 09:18 lib/librogamelibs.a -> ../rogamelibs/buildtool/Server/lib/librogamelibs.a
[root@evan-NUC11PAHi5 roserver]# ll  lib/libconfiglib.a
lrwxrwxrwx. 1 root root 55 May 17 09:18 lib/libconfiglib.a -> ../rogamelibs/table/buildtool/Server/lib/libconfiglib.a
[root@evan-NUC11PAHi5 roserver]#


然后要进cmos把win的uefi保护关了。


=see also=
/home/evan/rogamelibs/table_manager/entity_table_manager.cpp: In member function 'virtual bool ROGameLibs::EntityTableManager::Init()':
[https://www.eassos.cn/jiao-cheng/ying-pan/mbr-vs-gpt.php  MBR 与 GPT,关于分区表你应该知道的一些知识 - 硬盘使用知识大全(8]
/home/evan/rogamelibs/table_manager/entity_table_manager.cpp:88:33: error: 'class TableLib::EntityHandBookTable::RowData' has no member named 'RelationEntityId'
            if (!book_row_data->RelationEntityId().empty())
                                ^~~~~~~~~~~~~~~~
/home/evan/rogamelibs/table_manager/entity_table_manager.cpp:90:50: error: 'class TableLib::EntityHandBookTable::RowData' has no member named 'RelationEntityId'
                for (int32_t id : book_row_data->RelationEntityId())
                                                  ^~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/rogamelibs.dir/build.make:2316: CMakeFiles/rogamelibs.dir/table_manager/entity_table_manager.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/rogamelibs.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
make build_linux error!
[root@evan-NUC11PAHi5 buildtool]#


</pre>


[https://blog.csdn.net/buzaikoulan/article/details/44405915 主分区、扩展分区和逻辑分区的区别,系统分区、引导分区和启动分区的区别]




[https://www.zhihu.com/question/28471913 UEFI+GPT与BIOS+MBR各自有什么优缺点]
[[Ubuntu24 mysql5.7]]
 
== trouble shooting==
<pre>
[  7%] Linking CXX executable ../bin/masterserver
/usr/bin/ld: cannot find -loauth
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
make[2]: *** [masterserver/CMakeFiles/masterserver.dir/build.make:12594: bin/masterserver] Error 1
make[1]: *** [CMakeFiles/Makefile2:803: masterserver/CMakeFiles/masterserver.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
[root@evan-NUC11PAHi5 masterserver]#
 
sudo dnf install liboauth-devel openssl-devel
</pre>
 
=知道整个游戏界面各个按钮什么的对应哪里=

2025年5月20日 (二) 15:35的最新版本

贪吃蛇

#pre
sudo yum install mesa-libGL-devel

yum install libudev-devel

sudo yum install gcc-c++ cmake make libX11-devel libXrandr-devel \
                 freetype-devel openal-soft-devel libjpeg-turbo-devel \
                 libvorbis-devel flac-devel

wget https://www.sfml-dev.org/files/SFML-2.5.1-sources.zip
unzip SFML-2.5.1-sources.zip
cd SFML-2.5.1

mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
sudo make install

sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/sfml.conf'
sudo ldconfig



# 安装依赖(Ubuntu示例)
sudo apt install sfml2.5-dev g++
#代码
https://github.com/evan886/snake_game.git

# 创建构建目录
mkdir build && cd build

# 生成Makefile
cmake .. -DCMAKE_BUILD_TYPE=Release

# 编译
make -j$(nproc)

# 运行
./SnakeGame

err

[100%] Linking CXX executable ../bin/dbserver
/home/evan/roserver/lib/linux/9.2.0/libprotobuf.a(common.o): In function `google::protobuf::internal::LogMessage::operator<<(google::protobuf::uint128 const&)':
common.cc:(.text+0x6c7): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
/home/evan/roserver/lib/linux/9.2.0/libprotobuf.a(int128.o): In function `google::protobuf::operator<<(std::ostream&, google::protobuf::uint128 const&)':
int128.cc:(.text+0x6f8): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
collect2: error: ld returned 1 exit status
make[2]: *** [dbserver/CMakeFiles/dbserver.dir/build.make:3479: bin/dbserver] Error 1
make[1]: *** [CMakeFiles/Makefile2:431: dbserver/CMakeFiles/dbserver.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
[root@evan-NUC11PAHi5 dbserver]#

怎么搞

换台centos7 ?
全 ro1  and then  全 ro 


ro

centos8

jdk

https://repo.huaweicloud.com:8443/artifactory/java-local/jdk/8u151-b12/

compile lib

第一个没成功 第二个成功
[root@evan-NUC11PAHi5 roserver]# ls lib/librogamelibs.a  -l 
lrwxrwxrwx. 1 root root 50 May 17 09:18 lib/librogamelibs.a -> ../rogamelibs/buildtool/Server/lib/librogamelibs.a
[root@evan-NUC11PAHi5 roserver]# ll  lib/libconfiglib.a 
lrwxrwxrwx. 1 root root 55 May 17 09:18 lib/libconfiglib.a -> ../rogamelibs/table/buildtool/Server/lib/libconfiglib.a
[root@evan-NUC11PAHi5 roserver]# 


/home/evan/rogamelibs/table_manager/entity_table_manager.cpp: In member function 'virtual bool ROGameLibs::EntityTableManager::Init()':
/home/evan/rogamelibs/table_manager/entity_table_manager.cpp:88:33: error: 'class TableLib::EntityHandBookTable::RowData' has no member named 'RelationEntityId'
             if (!book_row_data->RelationEntityId().empty())
                                 ^~~~~~~~~~~~~~~~
/home/evan/rogamelibs/table_manager/entity_table_manager.cpp:90:50: error: 'class TableLib::EntityHandBookTable::RowData' has no member named 'RelationEntityId'
                 for (int32_t id : book_row_data->RelationEntityId())
                                                  ^~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/rogamelibs.dir/build.make:2316: CMakeFiles/rogamelibs.dir/table_manager/entity_table_manager.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/rogamelibs.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
make build_linux error!
[root@evan-NUC11PAHi5 buildtool]# 


Ubuntu24 mysql5.7

trouble shooting

[  7%] Linking CXX executable ../bin/masterserver
/usr/bin/ld: cannot find -loauth
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
make[2]: *** [masterserver/CMakeFiles/masterserver.dir/build.make:12594: bin/masterserver] Error 1
make[1]: *** [CMakeFiles/Makefile2:803: masterserver/CMakeFiles/masterserver.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
[root@evan-NUC11PAHi5 masterserver]# 

sudo dnf install liboauth-devel openssl-devel

知道整个游戏界面各个按钮什么的对应哪里