linuxncurseslinux-mintinitrd

Using ncurses with initrd(linux mint 13 - default kernel)


I am trying to modify Mint 13(ubuntu derivative)'s initrd. The main idea is for a program I am making to be run by the local-top script. That is - when the kernel is started and loads the initrd, my program has to be in that initrd and run before the initrd is unloaded from the ram. Basically I want to show windows and use some of the ncurses lib functions, but I get an error. I have included the library in my initrd file ofcourse. The error I get is: Error opening terminal: linux.

Perhaps someone here has an idea on how to fix that?


Solution

  • It is not enough. Ncurses has a lot of terminal files, they are probably in /etc/terminfo. The actual terminal type is stored always in the TERM environment variable, this is probably "linux" by you. The goal of this structure is to make the ncurses applications compatible, or at least usable anywhere. For example, a wyse terminal (ancient terminal from the antediluvian era) has absolutely different control sequences, as a linux or a freebsd console.

    Only copying the library isn't enough, you need to copy /etc/terminfo/l/linux as well.

    Maybe further files can be needed, this can you test with a strace command (if you can't interpret its output, google is your friend or we are waiting your next question). The syntax:

    strace -s 200 -f -o sux.txt ./theCommandToTest
    

    It will dump the kernel call log of the ./theCommandToTest into the sux.txt text file.

    Anyway, to test this thing, the best solution if you boot your linux in a command shell (f.e. use the init=/bin/bash boot option, or you call a simple bash from the local-top). So you will be able to run this strace, and play with this, to find out, what can be yet needed.

    Good luck!