downshiftertech.eu

Describe your website

Email LinkedIn

/* Title: Installing Tiny Core Linux on a Lenovo Thinkpad T410 Description: An off-topic article that hopefully makes it to a whole new website Date: 2015/12/20 Category: System administration Keywords: Linux, Thinkpad, T410, Lenovo, TinyCoreLinux Template: post_eng */

This article describes steps you need to follow to run Tiny Core Linux on a Thinkpad T410 with Antergos pre-installed.

It is a follow-up to another article I’ve written some time ago. It’s called Setting Up Antergos on a Thinkpad T410


Getting Tiny Core Linux

Tiny Core Linux provides great speed for your system, so I decided to triple-boot my Thinkpad T410 by adding Tiny Core Linux to the list.

Tiny Core Linux can be downloaded here. Installing Tiny Core Linux on an empty system is out of the scope of this article. You can check out the awesome guides on Tiny Core Linux website.

In case you already have any version of Linux installed on your system, you just need to get vmlinuz and core.gz. Both of them are available here

To get the necessary files for the 64-bit version, head over here. In this case, the files you are looking for are vmlinuz64 and corepure64.gz.

I am also going to get dCore utopic and dCore jessie installed on my system.


Copying the files to /boot

Once you have downloaded the kernel and initramfs, just copy them over to your /boot folder. It should look something like this:

/boot
drwxr-xr-x  4 root   root      1024 Oct 30 01:44 .
drwxr-xr-x 19 root   root      4096 Oct  9 00:45 ..
-rw-r--r--  1 root   root   6636603 Jun  8  2015 core.gz
-rw-r--r--  1 root   root  11924182 Aug  6 16:06 dCore-jessie.gz
-rw-r--r--  1 root   root  11595283 Aug  6 16:10 dCore-utopic.gz
-rw-r--r--  1 root   root  12847730 Aug  6 16:06 dCore-vivid.gz
drwxr-xr-x  6 root   root      1024 Aug  6 16:29 grub
-rw-r--r--  1 root   root  18490548 Oct 30 01:45 initramfs-linux-fallback.img
-rw-r--r--  1 root   root   3915986 Oct 30 01:45 initramfs-linux.img
-rw-r--r--  1 root   root   3465360 Aug  6 16:06 jessie-vmlinuz
drwx------  2 root   root     12288 May 26  2015 lost+found
-rw-r--r--  1 root   root   3465360 Aug  6 16:10 utopic-vmlinuz
-rw-r--r--  1 root   root   3380112 Jun  8  2015 vmlinuz
-rw-r--r--  1 root   root   4091824 Oct 27 09:29 vmlinuz-linux

Editing GRUB

If you are running Antergos, edit your /etc/grub.d/40_custom and add the following to the end of the file:

menuentry "Tiny Core" {
  linux /vmlinuz quiet vga=791 multivt showapps blacklist=pcspkr kmap=qwerty/et tz=EET-2EEST laptop
  initrd /core.gz

menuentry "Tiny Core 64" {
  linux /vmlinuz64 quiet vga=791 multivt showapps blacklist=pcspkr kmap=qwerty/et tz=EET-2EEST laptop
  initrd /corepure64.gz
}

menuentry "dCore utopic" {
  linux /utopic-vmlinuz quiet vga=791 blacklist=pcspkr kmap=qwerty/et tz=EET-2EEST laptop
  initrd /dCore-utopic.gz
}

menuentry "dCore jessie" {
  linux /jessie-vmlinuz quiet vga=791 blacklist=pcspkr kmap=qwerty/et tz=EET-2EEST laptop
  initrd /dCore-jessie.gz
}
  • vga=791 sets your preferred resolution (mine is 1024x768x16). You can find the right one for you in the FAQ section of Tiny Core Linux website.

  • blacklist=pcspkr disables the built-in motherboard speaker/beeper.

  • kmap=qwerty/et sets your console keyboard layout (this is not related to the GUI). Mine is Estonian.

  • tz=EET-2EEST sets the timezone. I am located in Estonia.

  • laptop loads some laptop specific modules, according to the FAQ.

You will have to find the correct values for your personal use case yourself, I won’t be covering this.

Next, we need to re-generate grub.cfg: run grub-mkconfig -o /boot/grub/grub.cfg

At this point you can reboot your system and select Tiny Core at the Grub screen.

There are a few more steps you need to perform to get the system running, though.


Installing the kmaps extension

Simply specifying the desired keyboard layout inside the GRUB config won’t give you the actual layout in Tiny Core. You have to install a corresponding extension, named kmaps.

To install it and automatically run it at system boot, type: tce-load -wi kmaps If everything worked, you can now finally reboot by issuing: sudo reboot Your system is finally ready.


Setting up console fonts

In case you only use English for your everyday work, you can skip this step. My situation is a bit more complicated: I speak 3 languages fluently. This means that when I’m working inside the console, I want to be able to view the contents of text files properly (if you have ever tried opening a text file written in Russian, you will know what I mean). We need a console font that supports both Estonian and Russian glyphs besides the English ones. In Tiny Core you have to use the setfont extension for that. Install it by running: tce-load -wi setfont to have it loaded into RAM on every boot. The font packs are located in /usr/local/share/consolefonts/

I have found 2 font packs that provide the desired functionality: LatArCyrHeb and drdos. Both work fine and offer different sizes. Choose the appropriate by running one of the following:

  • setfont LatArCyrHeb-08
  • setfont LatArCyrHeb-14
  • setfont LatArCyrHeb-16
  • setfont LatArCyrHeb-16+
  • setfont LatArCyrHeb-19
  • setfont drdos8x6
  • setfont drdos8x8
  • setfont drdos8x14
  • setfont drdos8x16

Loading the correct font automatically on system boot will be described later.

Please note, that setfont extension is not present in the repo for x64. So the only way to show non-ASCII characters in this case would be to run a full Xorg session. This will be described later.


Getting wifi to work

Over the course of writing this article, I have upgraded to a newer laptop, a Lenovo X270, which has another wireless chip in it, compared to the T410. Nevertheless, I’ll describe the process for both models.

First thing is to find out which extension you need for your particular model. Tiny Core Linux has separated the wireless subsystem into 2 parts for the sake of convenience. There are separate extensions for the firmware files and the wireless subsystem. Both are needed, but they are independent from each other. So, in order to find the right firmware, you need to first get the subsystem files: tce-load -w wireless_tools wifi

You then use tce-ab to search for extensions that correspond to the wireless firmware. You can try searching for the term firmware, ath, atheros, broadcomm or iwl. This can be a slow process and involves multiple reboots. To test if the firmware suits your hardware, do the following:

  • tce-load -w <firmare_extension>
  • tce-load -i <firmware_extension> wifi
  • sudo wifi.sh

If you get an error, try the next firmware. In my case, the corresponding firmware extensions were:

  • T410: firmware-iwlwifi
  • X270: firmware-iwl8000

Once you have found the right firmware, you can autostart it at boot using: tce-load -wi <firmware_extension>. You can then manually load the wireless subsystem by loading *wifi.tcz* and running sudo wifi.sh`. Please note, that we are still running without persistence, which will be described later on.


Using multiple keyboard layouts

Tiny Core Linux is perfectly suited for those who only use English language. In case you need to write text files in some other language, things get complicated. Besides, as I mentioned earlier, setfont extension is not available for x64 architecture. In order to input text in Russian, we need to use a full Xorg session, not just the console. I have tried getting Xvesa to work with Russian, but don’t you waste your time on it, you need Xorg.

In a similar fashion as it was with wireless, the graphical things in Tiny Core Linux are separated into the graphics drivers and Xorg itself. I must also point out that aterm, the default terminal emulator that is a dependency of any window manager in Tiny Core Linux, doesn’t support unicode, you should use rxvt or others.

Again, as with wireless, you need to find the right graphics driver for you particular hardware. In my case, it was Intel. So in my case, I used tce-load -wi xf86-video-intel to have it load on every boot. This only works if you have persistent storage set up. I will describe it later.

Once you have the correct graphics driver loaded, you need to load the window manager of your choice, the terminal emulator and Xorg itself: tce-load -w(i) rxvt Xorg-7.7 flwm_topside (openbox). You can then start the Xorg session by running: startx. Congratulations!

Right-click on the desktop, and open up the terminal emulator. You can notice that the keyboard layout defaults to English. In order to have 2 keyboard layouts (Estonian & Russian) with Alt+Shift as the switcher, I used: setxkbmap -layout "ee,ru" -option "grp:alt_shift_toggle".

At this point, you can switch the layouts, but the non-English text files will still not be displayed properly. I have only found one workaround for this, and it’s not ideal, but it works for me.


Viewing & editing non-ASCII text files in Xorg

The only working solution I have found so far is this:

  • get the getlocale extension by running: tce-load -w(i) getlocale.
  • sudo getlocale.sh if you are inside the console. If you are in an Xorg session, a separate terminal emulator will open automatically after loading the getlocale extension.
  • select the language you are looking for (mine is ru_RU.UTF-8).
  • press to have the script generate the locales. If you are running the script for the second time, or you have persistence set up, make sure you remove the symlink to locale-archive. Look at the error to find the correct path. This should be /usr/lib/locale/locale-archive.
  • reboot into Antergos and edit the /etc/grub.d/40_custom script and append lang=ru_RU.UTF-8 to all the entries.
  • run sudo update-grub
  • reboot into Tiny Core Linux
  • you should now be able to view & edit non-ASCII text files in the terminal editor.

Please note, that this is not a perfect solution. Firstly, standard vi, mc & bundled graphical Editor do not fully support UTF-8. I suggest you get the vim extension. Secondly, mc will show you hints & dates in Russian. This won’t work well if you’re logged out of the Xorg session.


Persistence

The easiest way to have persistence in Tiny Core Linux is to create a folder called /tce from within Antergos. This way, all your downloaded extensions will be saved there and you will be able to make changes to Tiny Core Linux config files from your usual operating system. Please note, that you will have to think twice when running a tce-load command. tce-load -w will simply download the extension, while tce-load -wi will make it load on boot each time. So if you are testing various firmware extensions or just trying out new software, make sure you use tce-load -w initially, and then load those extensions as you need them using tce-load -i.


Running custom commands during boot

If you are loading Xorg automatically at boot, it would be reasonable to have the layout switcher configured as well. In order to run custom commands at every boot, you should edit /opt/bootlocal.sh and include the aforementioned setxbkmap command.

You can also add the setfont command here to load the proper console font at boot time.

Remember to separate to commands with & or && if you want them to run in parallel or in sequence, respectively.

In order to have the file saved, you need to run backup.sh. It would make sense to comment out the home folder in /opt/.filetool.lst before performing backup, as there are unnecessary files that get created there, including you bash history.

Some of the notable files that can be included in the backup from the /home folder:

  • wifi.db: wifi passwords
  • .ashrc: if you would like to make aliases for certain repetitive tasks

Follow-up notes

Here are some useful extensions to have:

  • mc: file browser, file editor, FTP client
  • vim: a very advanced text editor that can handle Cyrillic files very well
  • alsa-config: to get the sound working

Some useful aliases to put into ~/.ashrc:

  • alias x='tce-load -i rxvt Xorg-7.7 flwm_topside && startx'
  • alias wifi='tce-load -i wifi.sh && sudo wifi.sh'
  • alias ee-ru='setxkbmap -layout "ee,ru" -option "grp:alt_shift_toggle'