LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices



Reply
 
Search this Thread
Old 02-20-2014, 05:31 PM   #1
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-{14.1,current} on a Lenovo Thinkpad W520
Posts: 4,676

Rep: Reputation: 1237Reputation: 1237Reputation: 1237Reputation: 1237Reputation: 1237Reputation: 1237Reputation: 1237Reputation: 1237Reputation: 1237
Questions about fbterm's usage in Slint or Slackware installer


I want to be able to display Chinese characters in Slint installer (that could benefit to the genuine Slackware installer in the future :-)

Of course we can't use a console font in a Linux console for that, as we need to be able to display thousands of characters.

And I won't consider shipping an X server inside the installer

But a volunteer to do Chinese translation told me that I could use fbterm instead.

He's right and fortunately fbterm can work either on top of a framebuffer if available, else fallback to vesa, and still use TTF fonts to display tens of thousands of characters.

So far, so good, I made some tries and that seems to work (installing in the installer mainly fbterm + fontconfig + freetype + wqy-zenhei-font-ttf), but I have an open issue and a question.
  • Open issue: I don't know ho to launch fbterm automatically, as if done in the console of the installer it complains "stdin isn't a interactive tty", so at the moment the user needs to open another terminal (Alt+F2 for instance) and run fbterm manually before typing "setup", which is not acceptable. Is there a way I can do that automatically, for instance adding some instructions at the end of rc.S (either making of the console an interactive tty or opening another tty and running fbterm in it, before any dialog box appears)?
  • Question: to automate launching of fbterm, if I detect that we have no framebuffer (as there is no /dev/fb0), I will have to choose the VESA resolution. I can scan what's available with fbterm --vesa-mode=list, but should I choose simply 640x480 8 bit (the safe choice) of e.g. 1024x768 or more if available?
Thanks for any clue.

Last edited by Didier Spaier; 02-20-2014 at 05:47 PM.
 
Old 02-21-2014, 10:02 AM   #2
Darth Vader
Member
 
Registered: May 2008
Location: Romania
Distribution: DARKSTAR Linux 2008.1
Posts: 660

Rep: Reputation: 138Reputation: 138
On the ol'good days, DARKSTAR Linux used to have a graphical installer, written in Qt, called YaLI. One of the YaLI's variants was capable to run directly from framebuffer, and technically launched directly in the installer initrd, from rc.d scripts, as runlevel 4...

But that damn application was a environment nazi, requiring strictly a root console to properly work.

So, the solution was to use SU. If I remember right, something like:

Code:
/bin/su -l -c /usr/sbin/YaLI
I hope it helps...

Last edited by Darth Vader; 02-21-2014 at 10:11 AM.
 
Old 03-05-2014, 06:09 PM   #3
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-{14.1,current} on a Lenovo Thinkpad W520
Posts: 4,676

Original Poster
Rep: Reputation: 1237Reputation: 1237Reputation: 1237Reputation: 1237Reputation: 1237Reputation: 1237Reputation: 1237Reputation: 1237Reputation: 1237
Eventually I closed the issue and answered the question stated in the first post of this thread.

1. Closing the issue


The reason why FbTerm complained "stdin isn't a interactive tty" was that I launched it too soon, i.e. before udev had created the ttys.

To avoid that I made following changes in the installer.

I modified Pat's /etc/inittab, that now begins like this
Code:
# /etc/inittab
# Boot-time system configuration/initialization script.
# This is run first except when booting in single-user mode.
# Initialization is now split in two parts, so that we can use an FbTerm for
# the second (interactive) part: as FbTerm needs to be run inside an
# interactive tty, we have to wait until the ttys be created by udev. Didier Spaier
::sysinit:/etc/rc.d/rc.S1
tty1::sysinit:/etc/rc.d/start_rc.S2

# Login /bin/sh invocations on selected ttys.
# /bin/sh being run in interactive mode reads /etc/profile that now sets ENV to
# /etc/rc.d/start_FbTerm.sh, that sets the font size then starts an FbTerm. Didier Spaier
tty1::respawn:-/bin/sh
tty2::askfirst:-/bin/sh
tty3::askfirst:-/bin/sh
So now init works this way:
  1. It launches the first (non interactive) part of rc.S, (script rc.S1)
  2. Then it launches start_rc.S2, that run the new script SetFont (see below) then starts an FbTerm running rc.S2, which is the second (interactive) part of rc.S.
  3. After that three ttys become available for interaction between the user and the system. Their expected usage is through FbTerm, but the user can close the FbTerm simply typing "exit", then launch a new one typing "logout", as init respawns the tty with a FbTerm in it.
This may look convoluted, but seems to work

2. Answering the question

Eventually I don't set the VESA mode (I can do that only if no frame buffer is used anyway), but set the size of the font to optimize usage of the display.

By "optimize" I mean: choose the biggest font size that allows to display at least 90 columns and 26 lines in the terminal, whatever be the display size.

Thanks to ability of FbTerm to work either with a VESA driver or a frame buffer driver, the installer will thus have a similar appearance, regardless of display size or method used for drawing.

To do that I wrote the script /etc/rc.d/SetFont (called by /etc/rc.d/start_rc.S2 and /etc/rc.d/start_FbTerm.sh as well) that finds the greatest available VESA display size (in pixels) and sets the size of the font accordingly. That font size is then set as an optional parameter of the fbterm command.

The appropriate font size for a given display size (e.g. 1024x768) is not computed "on the fly" (doing that is an exercise left to te reader :-) but simply recorded for the display sizes most used in recent years, as retrieved for instance here. In case of an unusual (i.e. not recorded in SetFont) display size, FbTerm's default size is be used.

Of course the optimal font size depends on font's dimensions (width and height), but we will use only two fonts, both mono spaced: DejaVu Sans Mono for most European scripts and WenQuanYi Zen Hei Mono, mostly for CJK (Chinese, Japanese and Korean). Fortunately these fonts are already included in Slackware, thanks Pat.

Those who didn't fell asleep reading this boring post up to this point (congratulations!) and wanting to know more (if any :-) will be able to see the scripts in the ISO installers in directory http://slint.fr/testing. Just mount the ISO file somewhere and unpack the initrd.

I'll post about using the "testing" installers and request help to check the list of usual display sizes in specific threads later.

Last edited by Didier Spaier; 03-05-2014 at 06:50 PM. Reason: ISO files are uploaded now.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] [TESTERS WANTED] Slint installers for Slackware 14.1 => LAST CALL Didier Spaier Slackware 11 11-22-2013 07:22 AM
[ANN] slint (Slackware Internationalized) 14.1 beta is ready: please test Didier Spaier Slackware 0 09-19-2013 04:44 PM
unclear about capabilities of fbterm CapRandom Linux - Newbie 5 03-10-2012 11:39 PM
LXer: FbTerm: Better terminal windows when you don't have X LXer Syndicated Linux News 0 08-05-2008 06:50 PM


All times are GMT -5. The time now is 05:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration