Posts: 38
nassausky
Joined: 29 Aug 2013
#1
Is there a way I can enable the F2 & F3 buttons to display cheat codes after installing the AntiX 13.2 onto a HDD?

__{{emoticon}}__
Posts: 1,308
BitJam
Joined: 31 Aug 2009
#2
Well, yes and no. Yes, you can modify the boot loader and re-enable the F2 and F3 menus. The problem is that the boot parameters those menus add will not be recognized by the installed system so they won't do anything. Anticapitalista might be able to help you to re-install the scripts that you need but ISTM you would be just asking for a lot of trouble. Anticapitalista is more familiar (than I am) with adding the live init scripts to an installed system. If he thinks it's okay then he can help you and you can ignore my warning.

If you want the functionality of the F2 and F3 bootloader menus then my suggestion is to use either a frugal install or make a LiveUSB. We offer several forms of persistence and also easy remastering for these Live systems. This is the official and supported solution we offer to provide the functionality you want. I think this would be far easier than mixing in parts of the Live system on an installed system.

In case you want to do it the hard way, I've attached new-message.gz. To use it, make a backup of /boot/grub/message and then put the unzipped version of this new file in its place:

Code: Select all

gunzip new-message.gz
sudo mv /boot/grub/message /boot/grub/message.orig
sudo cp new-message /boot/grub/message
I could also provide you with instructions but they are slightly non-trivial (unless you are comfortable working with cpio archives). If you want to enable all of the menus then you can copy the /boot/grub/message file from the live iso. You can mount an iso file for reading with:

Code: Select all

sudo mkdir /mnt/iso
sudo mount -o loop,user,ro -t iso9660 blah-blah-blah.iso /mnt/iso
The message file will be at /mnt/iso/boot/grub/message.
Posts: 38
nassausky
Joined: 29 Aug 2013
#3
That's interesting. How instead might I just add a note on that screen like press F1 for boot options and then just having it display a list of my choice which I can manually add to the boot string. If that's still a bit of work then I might just decide then to reinstall it as a frugal on my HDD.

Thanks and I'm hoping more people will be interested in that nice detail you went into.
Posts: 1,308
BitJam
Joined: 31 Aug 2009
#4
AFAIK, we are the only distro that makes this relatively easy. It would be far easier on a LiveUSB. In fact I suggest you try it out on a LiveUSB first and then when it works there, move it to your installed system.

Note: When you make the LiveUSB you should choose the syslinux bootloader. If you use grub instead then you will have to unpack and repack the cpio archive as explained below. I believe recent versions of the unetbootin program will use the syslinux bootloader when it makes an antiX LiveUSB. Our program that creates a LiveUSB gives you a choice.

On the LiveUSB, instructions for custom menus are in the file /live/boot-dev/boot/syslinux/README. If you just mount an iso file as described above then they will be at /mnt/iso/boot/syslinux/README. Here is the relevant part:

Code: Select all

Custom Menus
============
You can create 3 different custom menus using files named
options1.men, custom1.men, and custom2.men.  You would make
corresponding Fn key assignments like this:

  key.F4=options1
  key.F5=custom1
  key.F6=custom2
Custom Menu file Format
-----------------------
The file format for .men files is straightforward.  The first
line is the title.  The following lines are the label followed by
optional spaces (not tabs) a back-tick character (`) and then the
boot parameters associated with the label.
So all you need to do is create a custom1.men file and then edit the gfxboot.cfg file changing the F2 line to:

Code: Select all

key.F2=custom1
Of course you can use a different function key if you want.

For the installed system, you need to deal with unpacking and repacking the"message" cpio archive. I might add more complete instructions for that later either in a separate post or as an addition to this post. Here is the short version. The file you want to change is /boot/grub/message.

Unpack the archive:

Code: Select all

mkdir cpio-dir
cd cpio-dir
cpio -idum < /boot/grub/message
Then edit the files in the cpio-dir directory. When you are done, repack the archive. You MUST be in the cpio-dir directory when you run the first command:

Code: Select all

find . | cpio -o > ../new-message
sudo mv /boot/grub/message /boot/grub/message.orig
sudo cp ../new-message /boot/grub/message
Good luck! Please have a LiveUSB or LiveCD available just in case you temporarily break grub.

You probably don't need to add a note on the screen since the Fn keys and their titles are rather obvious. If you really want to add text then I suggest using the"convert" program from the imagemagick suite. That's what we use to add the"Live" text to the background image for the live system. The background image is in the file back.jpg in the same directory as gfxboot.cfg and the other files.

If you really want to dive into this stuff I can send you our development kit. One of the neat features it provides is it can make a tiny .iso file that just contains the bootloader. Nothing else. I then boot this iso file in VirtualBox for testing. The time from making a change to testing the change is under a minute. You would also have to install VirtualBox and the gfxboot program in order to get this all working. If you are just adding one custom menu it may not be worth the overhead of getting everything set up for rapid development. Almost 100% of my development work is done using .iso files and VirtualBox.