Mailing List Archive

1 2  View All
Re: Console scrollback [ In reply to ]
Hello, Laurence.

On Tue, Jan 19, 2021 at 17:09:03 +0000, Laurence Perkins wrote:


> On Sun, 2021-01-17 at 05:17 +0000, Thomas Mueller wrote:
> > On Sat, 16 Jan 2021 12:01:48 +0000, Alan Mackenzie wrote:

> > > I don't know what I'll be doing, long term. For the moment, I'll
> > > be hanging onto the working kernel I've got, old though it may be
> > > (4.19.97). It might be possible (I'm not sure) to hook up a user
> > > space program to the keys <shift>-<PageUp/Down> which would take
> > > care of the scrolling. This would obviously not work with early
> > > kernel messages, but would be better than nothing. I had a look at
> > > the GNU screen source code yesterday to see how it managed such
> > > things, but it is very sparsely commented, and thus hard work to
> > > understand. Maybe I should just cut my losses, and convert to
> > > using one of the BSDs.

> > 2000 posts per day on Linux kernel list would be more than
> > unmanageable for me! I wouldn't say "almost"!

> > Is Linus Torvalds' removal of console scrolling the reason why Scroll
> > Lock does not work on the console with System Rescue CD or USB, while
> > with FreeBSD and NetBSD, I can press Scroll Lock and scroll back?

> > I like that ability but don't think Linus Torvalds is listening or
> > reading this.

> > Further, with System Rescue console, the lines/text go only partway
> > down.

> > Using screen, now at v4.8, means having to remember a lot of key
> > functions, you need a separate reference screen to look them up.

> > There is also tmux, which is part of the base system in NetBSD but
> > not FreeBSD.

> > If Linus cared about his users, he could make the kernel headers more
> > user-friendly, installing kernel headers should not be any more
> > complicated than copying or downloading.

> > Console scrolling is especially useful with an OS or distro that is
> > built from the ground up, like Gentoo, Void or Arch, as opposed to
> > being installed all at once.

> > If more Linux users would go to and try NetBSD or FreeBSD, those OSes
> > would have more users, more ideas, more ability to improve.

> > You can even cross-compile NetBSD from Linux. You'd need NetBSD
> > source tree, but don't have to do anything special to install kernel
> > headers.

> > Tom


> You're getting this second-hand since it was my brother who actually
> looked into it, so pardon anything I misremember, but the big problem
> is that adding unicode support to vgacon would need a near total
> rewrite, and nobody wants to do that since it's a terrible hackjob to
> start with.

> kmscon is slated to be the replacement. You might want to see if that
> can do what you need.

I looked kmscon up on Wikipedia, and apparently development ceased
several years ago.

What I have in mind now is writing a Linux driver, a small piece of code
which would piggy-back on the existing virtual terminal drivers, and
simply pass everything through to and from the main driver, filtering out
things relevant to scrolling, and processing these in my new driver.
I've spent the last few evenings reading up on drivers, and reading the
relevant source code from 4.19.97. I can understand the kernel
maintainers not being enthusiastic about the existing code. But that
dates from, I believe, the 1990s, when RAM was measured in megabytes, and
processor speeds in megahertz. Optimisation for speed and store usage
just isn't important any more.

> LMP

--
Alan Mackenzie (Nuremberg, Germany).
Re: Console scrollback [ In reply to ]
On Thu, Jan 21, 2021 at 8:53 AM Wols Lists <antlists@youngman.org.uk> wrote:
>

> https://lwn.net/Articles/842415/
>
> Take a read, as it's mentioned in this article.
>
Paywalled... :(

Jorge Almeida
Re: Console scrollback [ In reply to ]
On 20/01/21 19:59, Alan Mackenzie wrote:
> I can understand the kernel
> maintainers not being enthusiastic about the existing code. But that
> dates from, I believe, the 1990s, when RAM was measured in megabytes, and
> processor speeds in megahertz. Optimisation for speed and store usage
> just isn't important any more.

I thin you're being highly optimistic. Bear in mind that this is the
code that was responsible for Alan Cox ceasing linux development, it's
such a pile of steaming manure ...

Don't ask me why it is, but I think it's got so much stuff wrong with it
that the entire system is marked "beware here be dragons".

https://lwn.net/Articles/842415/

Take a read, as it's mentioned in this article.

Cheers,
Wol
Re: Console scrollback [ In reply to ]
On Thu, Jan 21, 2021 at 08:58:42AM +0000, Jorge wrote in
<CAKpSnpJjZ21+ut8jgEdKBrnREP0Lb_6XQAZ=P63LLTKpJNDgkw@mail.gmail.com>:
>On Thu, Jan 21, 2021 at 8:53 AM Wols Lists <antlists@youngman.org.uk> wrote:
>>
>
>> https://lwn.net/Articles/842415/
>>
>> Take a read, as it's mentioned in this article.
>>
>Paywalled... :(

Try this link: https://lwn.net/SubscriberLink/842415/5bc3e39b4d4f52fe/
Re: Console scrollback [ In reply to ]
On Thu, Jan 21, 2021 at 12:40 PM Remco R?nders <remco@webconquest.com> wrote:
>
> On Thu, Jan 21, 2021 at 08:58:42AM +0000, Jorge wrote in
> <CAKpSnpJjZ21+ut8jgEdKBrnREP0Lb_6XQAZ=P63LLTKpJNDgkw@mail.gmail.com>:
> >On Thu, Jan 21, 2021 at 8:53 AM Wols Lists <antlists@youngman.org.uk> wrote:
> >>
> >
> >> https://lwn.net/Articles/842415/
> >>
> >> Take a read, as it's mentioned in this article.
> >>
> >Paywalled... :(
>
> Try this link: https://lwn.net/SubscriberLink/842415/5bc3e39b4d4f52fe/
>
Works. Thanks.

Jorge Almeida
Re: Console scrollback [ In reply to ]
Hello, Wol.

On Thu, Jan 21, 2021 at 09:32:13 +0000, Wols Lists wrote:
> On 20/01/21 19:59, Alan Mackenzie wrote:
> > I can understand the kernel maintainers not being enthusiastic about
> > the existing code. But that dates from, I believe, the 1990s, when
> > RAM was measured in megabytes, and processor speeds in megahertz.
> > Optimisation for speed and store usage just isn't important any more.

> I think you're being highly optimistic. Bear in mind that this is the
> code that was responsible for Alan Cox ceasing linux development, it's
> such a pile of steaming manure ...

It is indeed a tortuous mess of code, with far too many abstractions, and
far too little overview.

> Don't ask me why it is, but I think it's got so much stuff wrong with it
> that the entire system is marked "beware here be dragons".

Over the weekend, I achieved the first part of my task, getting a
transparent new driver into the kernel, which would merely pass through
to and from /dev/sctty3 to and from /dev/tty3, etc. This works.

Now I have to hook up with the /dev/vcs drivers to buffer the text
written to the screen, so as to be able to output it again in the event
of a <Ctrl>-<PageUp/Down>.

I would guess I'm around 50% through the task (as in the first 50% takes
the first 90% of the time, and the second 50% takes the second 90% of the
time).

> https://lwn.net/Articles/842415/

> Take a read, as it's mentioned in this article.

The website said it would become freely available on 2021-01-28, so I'll
read it then.

> Cheers,
> Wol

--
Alan Mackenzie (Nuremberg, Germany).
Re: Console scrollback [ In reply to ]
Hello, Gentoo.

On Wed, Jan 20, 2021 at 19:59:09 +0000, Alan Mackenzie wrote:

[.Context: Scrolling on the Linux text console using the keys
<shift><PgUp> and <shift><PgDn> has been removed from the kernel. This
is not a Good Thing.]

> What I have in mind now is writing a Linux driver, a small piece of code
> which would piggy-back on the existing virtual terminal drivers, and
> simply pass everything through to and from the main driver, filtering out
> things relevant to scrolling, and processing these in my new driver.
> I've spent the last few evenings reading up on drivers, and reading the
> relevant source code from 4.19.97. I can understand the kernel
> maintainers not being enthusiastic about the existing code. But that
> dates from, I believe, the 1990s, when RAM was measured in megabytes, and
> processor speeds in megahertz. Optimisation for speed and store usage
> just isn't important any more.

I finally got around to looking into this seriously in the last couple
of weeks. The above plan turned out not to be the right thing.

I've now cobbled together a working console scroll on Linux
5.4.80-gentoo-r1. In the end, I reused much of the old machinery which
was still present in 4.19.97. Once I've tidied it up, I hope that the
resulting patch file will apply cleanly also to later versions than
5.4.80-r1.

As a matter of interest, the kernel code for the console is not the
easiest in the world to deal with, having too many abstractions and too
few comments. ;-(

I've enhanced the mechanism so that each tty has its own scrollback
buffer, rather than one buffer being shared between all tty's. The
default size of these buffers is now 128kB, but can be set in make
menuconfig. I'm intending to make sharing a buffer between all tty's be
an option, but haven't implemented that yet.

The code, as yet, is a bit scruffy (in fact, very scruffy), and I have
several technical problems:

(i) The scrolling doesn't work on /dev/tty1 aka the console.
(ii) When, e.g., /dev/tty6 has been scrolled upwards a bit, and then
<Alt><F2> pressed to go to /dev/tty2, on returning to /dev/tty6, the
scrolling has been cancelled and the cursor is no longer visible.
However, the scrollback buffer is still present.

I think I'm fairly likely to be able to solve (ii). However, (i), the
problem with /dev/tty1, has me baffled. I don't know where to start
looking for the problem. If anybody with some kernel knowledge could
make any suggestions, I'd be very grateful.

--
Alan Mackenzie (Nuremberg, Germany).
Re: Console scrollback [ In reply to ]
Alex Mackenzie:
...
> I've now cobbled together a working console scroll on Linux
> 5.4.80-gentoo-r1. In the end, I reused much of the old machinery which
> was still present in 4.19.97. Once I've tidied it up, I hope that the
> resulting patch file will apply cleanly also to later versions than
> 5.4.80-r1.
...

Nice, where is the patch so I can try ?

> (i) The scrolling doesn't work on /dev/tty1 aka the console.
> (ii) When, e.g., /dev/tty6 has been scrolled upwards a bit, and then
> <Alt><F2> pressed to go to /dev/tty2, on returning to /dev/tty6, the
> scrolling has been cancelled and the cursor is no longer visible.
> However, the scrollback buffer is still present.
>
> I think I'm fairly likely to be able to solve (ii). However, (i), the
> problem with /dev/tty1, has me baffled. I don't know where to start
> looking for the problem. If anybody with some kernel knowledge could
> make any suggestions, I'd be very grateful.

What happens if you set /dev/console to be /dev/ttyS0, i.e. make sure
that tty1 is the only one using the first virtual console.

Regards,
/Karl Hammar
Re: Console scrollback [ In reply to ]
Hello, Karl.

Thanks for the reply.

On Fri, Apr 02, 2021 at 21:32:04 +0200, karl@aspodata.se wrote:
> Alan Mackenzie:
> ...
> > I've now cobbled together a working console scroll on Linux
> > 5.4.80-gentoo-r1. In the end, I reused much of the old machinery which
> > was still present in 4.19.97. Once I've tidied it up, I hope that the
> > resulting patch file will apply cleanly also to later versions than
> > 5.4.80-r1.
> ...

> Nice, where is the patch so I can try ?

I've attached a patch to this post. To apply it, the following seems to
work from the top directory of a kernel source tree, e.g. 5.4.80-r1:

$ patch -p0 < diff.20210402.diff

.. Then you'll need to run make menuconfig (or whatever), going down to
Device Drivers/Graphic support/Console display driver support and there
accepting the defaults for the new config variables. (This is assuming
you've got FRAMEBUFFER support enabled in a neighbouring page.)

Then build the kernel as normal, and put the new version into whatever
boot loader you use. It should (??) run, with a scrollback buffer on
each virtual terminal.

Just a word about the current state of the source - it is rough, with
things unfinished. The "word" STOUGH (pronounced "stuff") is just a
word I use which appears nowhere else and enables me to find changes
quickly and unambiguously.

As I said, I'm not finished with the changes, and swapping from and back
to a scrolled tty isn't completely satisfactory. Nevertheless, I hope
it works for you and you have fun with it.

> > (i) The scrolling doesn't work on /dev/tty1 aka the console.
> > (ii) When, e.g., /dev/tty6 has been scrolled upwards a bit, and then
> > <Alt><F2> pressed to go to /dev/tty2, on returning to /dev/tty6, the
> > scrolling has been cancelled and the cursor is no longer visible.
> > However, the scrollback buffer is still present.
> >
> > I think I'm fairly likely to be able to solve (ii). However, (i), the
> > problem with /dev/tty1, has me baffled. I don't know where to start
> > looking for the problem. If anybody with some kernel knowledge could
> > make any suggestions, I'd be very grateful.

> What happens if you set /dev/console to be /dev/ttyS0, i.e. make sure
> that tty1 is the only one using the first virtual console.

I will try than. Thanks!

> Regards,
> /Karl Hammar

--
Alan Mackenzie (Nuremberg, Germany).

1 2  View All