2020年10月13日 星期二

UEFI and BIOS

UEFI and BIOS


UEFI stands for Unified Extensible Firmware Interface and BIOS stands for Basic Input/Output System.

Both UEFI and BIOS are low-level software that starts when you boot your PC before booting your operating system, but UEFI is a more modern solution, supporting larger hard drives, faster boot times, more security features, and—conveniently—graphics and mouse cursors.

How does a computer boot?

You press the power button on your laptop/desktop.

The CPU starts up, but needs some instructions to work on.

The firmware (UEFI or BIOS) launches a Power On Self Test (POST), initializes the hardware, detects the connected peripherals (mouse, keyboard, pendrive etc.) and checks if all connected devices are healthy. If successful, a 'beep' will be heard.

Finally, the firmware code cycles through all storage devices and looks for a boot-loader (usually located in first sector of a disk). If the boot-loader is found, then the firmware hands over control of the computer to it.

So now that the boot-loader is loaded, its job is to load the rest of the operating system. GRUB is one such boot-loader that is capable of loading unix-like operating systems and is also able to chain-load Windows OS. Boot-loader is only available in the first sector of a disk, which is 512 bytes. Given the complexity of modern operating systems, some of these boot-loaders tend to do multi-stage loading, where the main boot-loader loads the second-stage-boot-loader in an environment which is not restricted to 512 bytes.

The boot-loader then loads the kernel into memory. Linux operating systems will run the init process (the master process, from which other processes are forked/executed) and finally initialize the run-levels.

Whereas in Windows, wininit.exe is loaded along with some other processes like services.exe for service control, lsass.exe for local security and authority (similar to run-levels) and lsm.exe for local session management.

After all this, and after some other drivers are initialized, the Graphical User Inferface (GUI) will be loaded and you will be presented with the login screen.



BIOS is stored on an EPROM (Erasable Programmable Read-Only Memory), allowing the manufacturer to push out updates easily. It provides many helper functions that allow reading boot sectors of attached storage and printing things on screen. You can access BIOS during the initial phases of the boot procedure by pressing del, F2 or F10.

UEFI does the same job as a BIOS, but with one basic difference: it stores all data about initialization and startup in an .efi file, instead of storing it on the firmware. This .efi file is stored on a special partition called EFI System Partition (ESP) on the hard disk. This ESP partition also contains the bootloader.

UEFI was designed to overcome many limitations of the old BIOS, including:

UEFI supports drive sizes upto 9 zettabytes, whereas BIOS only supports 2.2 terabytes.

UEFI provides faster boot time.

UEFI has discrete driver support, while BIOS has drive support stored in its ROM, so updating BIOS firmware is a bit difficult.

UEFI offers security like "Secure Boot", which prevents the computer from booting from unauthorized/unsigned applications. This helps in preventing rootkits, but also hampers dual-booting, as it treats other OS as unsigned applications.

UEFI runs in 32bit or 64bit mode, whereas BIOS runs in 16bit mode. So UEFI is able to provide a GUI (navigation with mouse) as opposed to BIOS which allows navigation only using the keyboard.


You might not need UEFI

Though all modern computers come equipped with UEFI by default, some reasons why you might choose BIOS over UEFI are:

If you're beginner and don't care about messing with any type of firmware, BIOS is for you.

If you have < 2 TB per hard disk or partition, you can go with BIOS.

BIOS allows running multiple operating systems without changing any settings This can be a security issue from a modern standpoint, but hey, no hassles for the user.

BIOS provides system information to the operating system. So if your OS runs in 16 bit mode, it does not require writing code for interacting with hardware. It can directly use methods provided by BIOS. Else if the OS switches over to 32bit or 64bit mode, then it needs to provide its own subroutines for interacting with hardware.

If you are someone who prefers a keyboard and text based UI over navigation with a mouse and GUI, then BIOS is for you.


UEFI takes these limitations into account and provides a Legacy mode. In it you can run everything as if you had a BIOS firmware. But keep in mind that Intel has announced that it won't support traditional BIOS from 2020.

The traditional BIOS still has serious limitations. It can only boot from drives of 2.1 TB or less. 3 TB drives are now common, and a computer with a BIOS can’t boot from them. That limitation is due to the way the BIOS’s Master Boot Record system works.

The BIOS must run in 16-bit processor mode, and only has 1 MB of space to execute in. It has trouble initializing multiple hardware devices at once, which leads to a slower boot process when initializing all the hardware interfaces and devices on a modern PC.

The BIOS has needed replacement for a long time. Intel started work on the Extensible Firmware Interface (EFI) specification back in 1998. Apple chose EFI when it switched to the Intel architecture on its Macs in 2006, but other PC manufacturers didn’t follow. In 2007, Intel, AMD, Microsoft, and PC manufacturers agreed on a new Unified Extensible Firmware Interface (UEFI) specification. This is an industry-wide standard managed by the Unified Extended Firmware Interface Forum, and isn’t solely driven by Intel. UEFI support was introduced to Windows with Windows Vista Service Pack 1 and Windows 7. The vast majority of computers you can buy today now use UEFI rather than a traditional BIOS.


How UEFI Replaces and Improves on the BIOS

There’s no way to switch from BIOS to UEFI on an existing PC. You need to buy new hardware that supports and includes UEFI, as most new computers do. Most UEFI implementations provide BIOS emulation so you can choose to install and boot old operating systems that expect a BIOS instead of UEFI, so they’re backwards compatible.

This new standard avoids the limitations of the BIOS. The UEFI firmware can boot from drives of 2.2 TB or larger—in fact, the theoretical limit is 9.4 zettabytes. That’s roughly three times the estimated size of all the data on the Internet. That’s because UEFI uses the GPT partitioning scheme instead of MBR. It also boots in a more standardized way, launching EFI executables rather than running code from a drive’s master boot record.

UEFI can run in 32-bit or 64-bit mode and has more addressable address space than BIOS, which means your boot process is faster. It also means that UEFI setup screens can be slicker than BIOS settings screens, including graphics and mouse cursor support. However, this isn’t mandatory. Many PCs still ship with text-mode UEFI settings interfaces that look and work like an old BIOS setup screen.

UEFI is packed with other features. It supports Secure Boot, which means the operating system can be checked for validity to ensure no malware has tampered with the boot process. It can support networking features right in the UEFI firmware itself, which can aid in remote troubleshooting and configuration. With a traditional BIOS, you have to be sitting in front of a physical computer to configure it.

It’s not just a BIOS replacement, either. UEFI is essentially a tiny operating system that runs on top of the PC’s firmware, and it can do a lot more than a BIOS. It may be stored in flash memory on the motherboard, or it may be loaded from a hard drive or network share at boot.

Different PCs with UEFI will have different interfaces and features. It’s all up to your PC manufacturer, but the basics will be the same on each PC.


How to Access UEFI Settings on Modern PCs

If you’re a normal PC user, switching to a computer with UEFI won’t be a noticeable change. Your new computer will boot up and shut down faster than it would have with a BIOS, and you can use drives of 2.2 TB or more in size.

If you need to access low-level settings, there may be a slight difference. You may need to access the UEFI settings screen through the Windows boot options menu rather than pressing a key while your computer starts. With PCs now booting so quickly, PC manufacturers don’t want to slow down the boot process by waiting to see if you press a key. However, we’ve also seen PCs with UEFI that allow you to access the BIOS in the same way, by pressing a key during the boot-up process.

While UEFI is a big upgrade, it’s largely in the background. Most PC users will never notice—or need to care—that their new PCs use UEFI instead of a traditional BIOS. They’ll just work better and support more modern hardware and features.

2020年8月30日 星期日

How to Share Folders on Home Network in Manjaro Linux


How to Share Folders on Home Network in Manjaro Linux


My purpose of sharing files or folders over home network is to allow me to move away from the PC desk and watch any PC video files either on a tablet or on a TV. Sitting properly before a PC monitor to watch a large video file is sometimes quite tiresome and cannot be compared to the comfort of sitting on a sofa and watch it on a tablet or TV.

Previously, sharing a folder using Samba in Linux was quite troublesome, not as easy as that for Windows. But as time goes by and technique evolves, it is now just an easy job, particularly on Manjaro Linux with a Gnome desktop environment. The procedures are like these.

In the Gnome desktop of Manjaro, goto Settings and select Sharing. Turn on the sharing function by clicking the button at the top right corner.



To share a media folder, choose Media Sharing. You will see there are default shared folders: Music, Pictures and Videos. You may copy and paste your videos to these default shared folder, say Videos, then you can start watching. If you want to share files other than these, scroll down the menu until you see the Add(+) sign.


Clicking on the + sign, a window will pop up allowing you to browse through your computer to choose the folders that you want to share. If you want the folder, say, “Violin and Cello Sonata” to be shared, select it. After that, turn on the Wired connection 1 Button to enable the sharing process.
 

Done!

How to watch a video with a tablet (VLC Player)

Launch the VLC Player in an android device (say, Samsung Tablet), tab on the Menu icon (三)and choose Local Network


The following screen will appear


Choose kai’s media on kai-ms7a74, the following screen will appear


Choose Files & Folders, two shared folders appear


Open any of the folders, and click on any item (video) inside the folder, the video will be played on VLC as below



How to watch on a TV

To watch it on TV, I need a TV Box because my TV is not a smart one. Nowadays, TV Boxes are very chap on Taobao, with no more than a 100 bucks, you can get a quite good one:


On the TV Box, just install the VLC Player and follow the procedures as that a tablet above, then you can view the video clips your TV.

Note:

I have found that sharing folders other than the defaulted ones, Music, Pictures and Videos, is not a once and for all business. That is, if you share a folder this time, the next time you reboot your computer, you will not find your shared folder. A way to get around this, is to delete the shared folder and add it again to the shared list before watching it.

2020年8月15日 星期六

神級播放器 - MPV Player

 神級播放器 - MPV Player


MPV 是一个基于 MPlayer mplayer2 开源极简全能播放器。支持各种视频格式、音频解码、支持特效字幕(电影动漫的ass特效字幕都没啥问题),不仅支持本地播放,同样支持网络播放。重点是 MPV 具有多系统平台支持、命令行、自定义、GPU 解码、脚本支持等特点……

由于默认情况下,MPV 播放器简约到连 GUI 界面都没有提供,需要通过命令行或配置文件设置,因此它较少出现于大众媒体的视野,但它配置灵活、性能优秀,支持硬件解码,播放高清分辨率的 4K 视频也可以很流畅,轻巧且强大的特点一直使它成为玩软高手、技术爱好者们的挚爱。

甚至,得益于开源,基于 MPV 还衍生出来一大批第三方播放器,比如最近火热的 Mac 平台上的 IINA,以及 Baka MPlayerbomimpc-qtxt7-player-mpv 等,它们的“核心”其实就是 MPV。这恰恰说明 MPV 才是无数开发者和技术爱好者心目中的神器

 OSC 界面操作說明

常用快捷鍵控制

減少/增加音量

90 (數字鍵盤區的不可用)

在音量符號上向前/向後旋轉鼠標滾軸

暫停、繼續播放

p, Space bar

上一個/下一個視頻(播放列表中)

< >, 在視頻中向前/向後旋轉鼠標滾軸

下一個視頻

Enter

靜音

m

截屏

s

進入/退出全屏

f

顯示視訊的詳情引數

i