Preparation

PA0 is a guide to GNU/Linux development environment configuration. You are guided to install a GNU/Linux development environment. All PAs and Labs are done in this environment. If you are new to GNU/Linux, and you encounter some troubles during the configuration, which are not mentioned in this lecture note (such as "No such file or directory"), that is your fault. Go back to read this lecture note carefully. Remember, the machine is always right!

Infobox description

There are information boxes in the handouts, whose color and icon in the upper left corner indicate the type of information. For example, this infobox is for tips and hints. Other categories include

Tips related to the progress of the experiment

Further Reading

optional questionnaire

optional programming question

Mandatory contents of the lab

Must-read information related to the progress of the lab

Principles and Methods of Importance Beyond Labs

Yes, you read that right, except for some important information, the PA0 lab handouts are all in English!

With the development of science and technology, the use of English in international academic exchanges has become the norm. Top papers are invariably written in English, and internationally recognized classics in the field of computing are written in English. Top papers are not translated into Chinese; if you need information, you should read it in English rather than wait for a translation to be published. "I'm Chinese, I only read Chinese" is no longer the trend of the times, and it is important to be on the cutting edge of the times. The ability to read materials in English is indispensable to stay at the forefront of the times.

Reading English materials is simply a matter of "looking up words you don't know in the dictionary, and reading sentences you don't understand over and over again". Nowadays, there are all kinds of dictionaries available on the Internet, but improving your English reading skills is a matter of persistence. "At first, I felt inefficient in reading English" is an unavoidable experience for all Chinese people. If you find yourself surrounded by great readers who can read English materials with ease, it's because they've already overcome these difficulties. To quote Mr. Chen Daoxu: stick with it for one year, and you'll see a difference; stick with it for two years, and you'll see a big difference.

Leaving aside these lofty topics, what does reading English materials have to do with you? Yes! Because what accompanies you in PA is that there are no Chinese versions of various manuals (e.g. [riscv manual](https://github.com/riscv/riscv-isa-manual/releases/download/draft-20210813-7d0006e/riscv-spec. pdf)). And of course `man': if you are not willing to read English materials, you are not destined to complete PA on your own.

As a transition, we have prepared a full English version of PA0. The purpose of PA0 is to configure the environment and familiarize yourself with how things work under GNU/Linux. The steps involved are operational, and you don't need to think about deep questions in order to complete PA0. You need to complete PA0 on your own, so please read each character in the handout carefully and follow the instructions: When the handout mentions searching for something on the Internet, you search for it on the Internet. If you make a mistake, please read the handout carefully and repeatedly, The machine is always right. If you are a first time user of GNU/Linux, you will need to consult a lot of information or tutorials to learn how to use some of the new tools. This takes a lot of time (e.g. you might need to spend an afternoon, just to type two lines in a file using vim). It's like reading material in English, you'll feel inefficient at first, but over time you'll become more and more proficient with these tools. On the contrary, if you complete your PA0 by "tricking" yourself, you will immediately run into trouble in PA1. As etone said, your professional inferiority will come back to haunt you sooner or later.

Also, PA0's handouts only give procedures, they do not explain the details and principles of these operations. If you want to know about them, please search for them on the Internet.

We are going to install the Ubuntu 22.04open in new window distribution directly over your physical machine. If you already have one copy of GNU/Linux distribution, and you want to use your copy as the development environment, just use it! But if you encounter some troubles because of platform disparity, please search the Internet for trouble-shooting.

It is also OK to use virtual machines, such as VMWare or VirtualBox. If you decide to do this and you do not have a copy of GNU/Linux, please install Ubuntuopen in new window distribution in the virtual machine. Also, please search the Internet for trouble-shooting if you have any problems about virtual machines.

You must use 64-bit GNU/Linux with a GUI.

If you plan to use an existing GNU/Linux platform, make sure it is 64-bit. Some features of PA will depend on 64-bit platforms and graphical displays.

Some reasons to use a native GNU/Linux machine(not a VM).

  • A real machine is more stable than a virtual machine (e.g. crash consistencyopen in new window, etc.).
  • The performance of a real machine will be higher than a virtual machine (but it doesn't affect the experiment score),
  • The real machine is a good choice if you want to get a smoother gaming experience in the later stages of the experiment.

Recommended to experience the OS installation on real machine

Although you don't study computer science to fix computers and install systems, it's not a good idea to tell your relatives you're in computer science program while you've never installed an OS. Now is your chance, if you have never installed an operating system before, We strongly recommend that you try install an OS on a real computer to get a feel for what it takes to install an operating system.

Mac users' misfortune

The digital circuits lab course offered in conjunction with ICS requires the Vivado/Quartus tools to perform the labs, but unfortunately neither of these tools is available for the Mac. Unfortunately, neither of these tools is available for Mac. In order to use them, you have to install Windows or GNU/Linux. So, why not kill two birds with one stone, and install a real GNU/Linux machine now, and solve all the above problems.

If you don't have to take the NJU course, you can ignore this problem.

First of all, of course, backup your important data!

If you are installing an operating system for the first time, you may have deleted important files on your disk by mistake. Backing up your data is definitely a very important operation, so that later on you can experiment with the installation process and do whatever you want with it.

Of course, even if your installation appears to be correct, it is possible that a hardware compatibility issue may prevent the operating system from booting. If this does happen, search the Internet for a solution. Therefore, it's important to get started with PA0 as soon as possible.

Please reserve at least one partitions (20GB ~ 50GB) on the disk for Ubuntu to install. If you want to install Vivado/Quartus in Ubuntu, please reserve about 100GB of disk space. For how to do this, please search the Internet. For example, if you use Windows, you can search for 压缩卷 Windows.

Installing Ubuntu

Please search the Internet for "Ubuntu 22.04 installation" and follow the tutorial.

Can I choose another version of Ubuntu?

Yes, you can. However, the version of tools in different versions of Ubuntu may differ slightly, especially the compiler GCC. If you choose a different version, you may encounter a few problems with it, but this will not significantly affect the experiment.

Select English, not Chinese, when choosing a language.

Using Chinese system environment will bring inconvenience to some command line operations, and even increase the difficulty of troubleshooting errors. Every year, some students who choose Chinese environment are unable to find effective solutions on the Internet when the tool reports errors, which affects the progress of the experiment.

In fact, even in an English system, it is possible to type in Chinese by installing a Chinese output method.

Do not use Ubuntu's Software Updater

After completing the installation and logging in to Ubuntu for the first time, Software Updater will pop up a reminder box to remind the user to update the software (as shown in the figure below) Be sure to ignore the prompt and do not click "Install". Otherwise the installation will change the state of the package manager in Ubuntu. This will conflict with the subsequent instructions in the handout, and will eventually cause the system to crash and not be accessible again.

Ubuntu Software Updater

It is recommended to disable the Software Updater function so that it does not prompt you, please search for a solution on the Internet. Thank you to Ho-Lun Peng, Class of 2020, for identifying this issue.