- FULL GUIDE: How to run Linux on nspire calculators
- 11 May 2022 09:53:38 am
- Last edited by he77789 on 16 May 2022 09:25:45 am; edited 1 time in total
WARNING: I'm not responsible for any damage to your calculator and your PC. Read the guide carefully and use common sense.
This is pretty complex and it's normal to get stuck. You can ask in this thread, or ask in #ndless-dev @ EFNet on irc. This guide will probably take a whole weekend, or more.
Now that you have been warned, let's go.
Materials required:
An nspire calculator with ndless installed (basically all nspires except those with OS 4.5.5, 5.3.2 or 5.4.0; even the monochrome nspires should work.)
A USB mini-B to USB OTG adapter (one end should plug into the USB port on the calculator and the other end should be able to accept a USB thumb drive) They can be purchased on Taobao, Aliexpress or Amazon for a very low price (<1 USD on aliexpress)
A USB thumb drive with at least 2GB capacity (seriously, who still uses 1GB thumb drives in 2022) This drive will be formatted later (all data will be wiped), so backup everything on the drive first.
A USB hub capable of using external power (technically not necessary, but highly, highly recommended. Not using one may cause the nspire to be unable to detect the thumb drive)
A USB keyboard (you could use the built in keypad instead, but a dedicated keyboard would be much more comfortable; you will be doing a lot of typing)
A USB wifi dongle (Optional)
A PC running Debian Linux (or derivatives, e.g. Ubuntu). This is only required during setup; after setup is finished, it is not needed anymore.
Now to the actual steps.
Part 1: The Kernel
Step 1: Install Vagrant from http://www.vagrantup.com/downloads (Virtualbox is required also)
Step 2: Start a Buildroot Vagrantfile by creating a new directory and running
Code:
in the directory.
Step 3: Copy the defconfig for the kernel from https://pastebin.com/AhphzF5h and place it in the buildroot directory
Step 4: In the VM, go into the buildroot directory, and run
Code:
Step 5: In the “Target Options” tab, set Target Architecture to ARM (little endian), Target Binary Format to ELF, and Floating point strategy to soft float. After that, select exit to go back to the menu that you started with, for the next step.
Step 6. In the “Toolchain” tab, change C library to glibc, enable C++ support and enable MMU support.
Step 7. In the “Kernel” tab, select the latest kernel version, and change the Kernel configuration to Using a custom (def)config file. After that, change “Configuration file path” to point to the defconfig that you have copied in step 3. Finally, change Kernel Binary format to zimage and the kernel compression format to gzip compression. Exit the buildroot config utility.
Step 8: (optional) run
Code:
to fine tune the kernel compilation settings.
Step 9: You are now ready to compile the linux kernel. Run
Code:
and buildroot will automatically start building the kernel. This may take a few minutes (or more).
Step 10: Copy the output/images/zImage file (the built kernel) to /vagrant, where it can be accessed outside the VM. After that, exit the VM.
Part 2: Root Filesystem
Step 1: Install required packages.
Code:
Step 2: Make a new directory, and run
Code:
. This may take a few minutes.
Step 3: Copy /usr/bin/qemu-arm-static into <your directory>/usr/bin
Step 4: Run
Code:
. You should now be in the chroot environment of the new debian root filesystem. The following steps are assumed to be done in the chrooted system unless otherwise specified.
Step 5: (optional) change the hostname of the system (that will eventually be running on your calculator) by editing /etc/hostname.
Step 6: Replace the default /etc/apt/sources.list according to https://wiki.debian.org/SourcesList
Step 7: Run
Code:
. Again, this may take a few minutes (or more).
Step 8: Run passwd to set the root password.
Step 9: Install packages with
Code:
Highly recommended:
sudo
If you have a wifi dongle:
connman
<Firmware for your USB wifi dongle, e.g. firmware-misc-nonfree>
Misc/for fun:
irssi (IRC client, requires network access)
xorg xserver-xorg-core xinit (plus a lightweight WM, e.g. fluxbox) (note: some people have gotten X to work, but I haven't been able to make it work yet. YMMV.)
links or netsurf (web browsers)
vlc (do not expect smooth decoding)
Step 10: Exit the chroot, and go into the chroot directory (with cd, not chroot)
Step 11: Plug your USB drive into the PC.
Step 12: Open gparted (install it if necessary)
Step 13: Reformat your USB drive to ext4 with gparted. WARNING: be ABSOLUTELY sure you selected the correct drive: if you accidentally select the wrong drive, it will wipe your PC. You have been warned.
Step 14: Mount the newly formatted USB drive, and close gparted.
Step 15: Run
Code:
Step 16: Unmount the USB drive and wait until it allows you to unplug it.
Part 3: Copying stuff to the calculator
Step 1: (optional, but recommended so that everything will be organized) Make a folder on your calculator, named "linux"
Step 2: Rename the zImage (that you created in Part 1) into zImage.tns, and copy it from the PC onto the calculator into the folder.
Step 3: Download linuxloader2 and the correct dtb from https://tiplanet.org/nspire_linux_builds/. Linuxloader2 is the same for everyone, but please select the correct dtb for your model (CAS/non-CAS doesn't matter).
For CX II users, download it from https://tiplanet.org/forum/download/file.php?id=5626 . WARNING: due to the unfinished support for the USB controller on the CX II, this DTB for the CX II will turn on the +5V rail regardless of the connection to the calculator. If you attempt to connect the calculator to a PC while Linux is running on the CX II, the calculator or the PC may get damaged.
Step 4: modify your ndless.cfg.tns on your calculator (either use nTxt, or copy the file to a PC for editing; it's a plain text file) to add a line:
Code:
Step 5: create a text file on a PC, named boot.ll2.tns
Contents:
Code:
Step 6: Copy it into the calculator.
Part 4: Finally booting
Step 1: connect the OTG adapter to the calculator, and the powered hub into the OTG adapter. Connect the powered hub into a power source, e.g. a power bank.
Step 2: connect your keyboard, USB thumb drive (from Part 2) and your wifi dongle into the hub.
Step 3: after installing ndless, click the boot.ll2.tns. it should initially be the bootloader screen (black text on white background), then to the kernel output (white text on black background). It will take a few minutes to boot.
Step 4: Voila! Linux is now booted and running on your calculator.
Part 5: Configuration on the calculator (optional, recommended)
Step 1: Create a new non-root account with
Code:
and follow the on screen instructions. This is a common security and safety measure.
Step 2: Add the user into the sudo group with
Code:
Step 3: Setup the internet, following the guide at http://wiki.debian.org/WiFi/HowToUse
Step 4: Enjoy!
Extras: how to shutdown/reboot
Do the normal shutdown/reboot commands. On the nspire, they do not have a difference, because reboot does not actually reboot; it only shuts down. After shutting down completely, use a pencil or a toothpick to poke the small reset button on the back of the calculator. You will now be back into TI-OS, and you can boot into Linux again, if you want.
I hope that helped you. Post comments, feedback or questions below.
This is pretty complex and it's normal to get stuck. You can ask in this thread, or ask in #ndless-dev @ EFNet on irc. This guide will probably take a whole weekend, or more.
Now that you have been warned, let's go.
Materials required:
An nspire calculator with ndless installed (basically all nspires except those with OS 4.5.5, 5.3.2 or 5.4.0; even the monochrome nspires should work.)
A USB mini-B to USB OTG adapter (one end should plug into the USB port on the calculator and the other end should be able to accept a USB thumb drive) They can be purchased on Taobao, Aliexpress or Amazon for a very low price (<1 USD on aliexpress)
A USB thumb drive with at least 2GB capacity (seriously, who still uses 1GB thumb drives in 2022) This drive will be formatted later (all data will be wiped), so backup everything on the drive first.
A USB hub capable of using external power (technically not necessary, but highly, highly recommended. Not using one may cause the nspire to be unable to detect the thumb drive)
A USB keyboard (you could use the built in keypad instead, but a dedicated keyboard would be much more comfortable; you will be doing a lot of typing)
A USB wifi dongle (Optional)
A PC running Debian Linux (or derivatives, e.g. Ubuntu). This is only required during setup; after setup is finished, it is not needed anymore.
Now to the actual steps.
Part 1: The Kernel
Step 1: Install Vagrant from http://www.vagrantup.com/downloads (Virtualbox is required also)
Step 2: Start a Buildroot Vagrantfile by creating a new directory and running
Code:
curl -O https://buildroot.org/downloads/Vagrantfile; vagrant up
Step 3: Copy the defconfig for the kernel from https://pastebin.com/AhphzF5h and place it in the buildroot directory
Step 4: In the VM, go into the buildroot directory, and run
Code:
make menuconfig
Step 5: In the “Target Options” tab, set Target Architecture to ARM (little endian), Target Binary Format to ELF, and Floating point strategy to soft float. After that, select exit to go back to the menu that you started with, for the next step.
Step 6. In the “Toolchain” tab, change C library to glibc, enable C++ support and enable MMU support.
Step 7. In the “Kernel” tab, select the latest kernel version, and change the Kernel configuration to Using a custom (def)config file. After that, change “Configuration file path” to point to the defconfig that you have copied in step 3. Finally, change Kernel Binary format to zimage and the kernel compression format to gzip compression. Exit the buildroot config utility.
Step 8: (optional) run
Code:
make linux-menuconfig
Step 9: You are now ready to compile the linux kernel. Run
Code:
make linux
Step 10: Copy the output/images/zImage file (the built kernel) to /vagrant, where it can be accessed outside the VM. After that, exit the VM.
Part 2: Root Filesystem
Step 1: Install required packages.
Code:
sudo apt-get install debootstrap qemu-user-static
Step 2: Make a new directory, and run
Code:
sudo debootstrap --foreign --arch=armel stable <the directory that you created>
Step 3: Copy /usr/bin/qemu-arm-static into <your directory>/usr/bin
Step 4: Run
Code:
sudo chroot <your directory> qemu-arm-static --cpu=arm926 /bin/bash
Step 5: (optional) change the hostname of the system (that will eventually be running on your calculator) by editing /etc/hostname.
Step 6: Replace the default /etc/apt/sources.list according to https://wiki.debian.org/SourcesList
Step 7: Run
Code:
/debootstrap/debootstrap --second-stage
Step 8: Run passwd to set the root password.
Step 9: Install packages with
Code:
apt-get install <the package>
Highly recommended:
sudo
If you have a wifi dongle:
connman
<Firmware for your USB wifi dongle, e.g. firmware-misc-nonfree>
Misc/for fun:
irssi (IRC client, requires network access)
xorg xserver-xorg-core xinit (plus a lightweight WM, e.g. fluxbox) (note: some people have gotten X to work, but I haven't been able to make it work yet. YMMV.)
links or netsurf (web browsers)
vlc (do not expect smooth decoding)
Step 10: Exit the chroot, and go into the chroot directory (with cd, not chroot)
Step 11: Plug your USB drive into the PC.
Step 12: Open gparted (install it if necessary)
Step 13: Reformat your USB drive to ext4 with gparted. WARNING: be ABSOLUTELY sure you selected the correct drive: if you accidentally select the wrong drive, it will wipe your PC. You have been warned.
Step 14: Mount the newly formatted USB drive, and close gparted.
Step 15: Run
Code:
sudo cp -R <your rootfs folder>/* <your USB drive's mount point>
Step 16: Unmount the USB drive and wait until it allows you to unplug it.
Part 3: Copying stuff to the calculator
Step 1: (optional, but recommended so that everything will be organized) Make a folder on your calculator, named "linux"
Step 2: Rename the zImage (that you created in Part 1) into zImage.tns, and copy it from the PC onto the calculator into the folder.
Step 3: Download linuxloader2 and the correct dtb from https://tiplanet.org/nspire_linux_builds/. Linuxloader2 is the same for everyone, but please select the correct dtb for your model (CAS/non-CAS doesn't matter).
For CX II users, download it from https://tiplanet.org/forum/download/file.php?id=5626 . WARNING: due to the unfinished support for the USB controller on the CX II, this DTB for the CX II will turn on the +5V rail regardless of the connection to the calculator. If you attempt to connect the calculator to a PC while Linux is running on the CX II, the calculator or the PC may get damaged.
Step 4: modify your ndless.cfg.tns on your calculator (either use nTxt, or copy the file to a PC for editing; it's a plain text file) to add a line:
Code:
ext.ll2=linuxloader2
Step 5: create a text file on a PC, named boot.ll2.tns
Contents:
Code:
kernel linux/zImage.tns
dtb linux/<the name of your dtb>
cmdline root=/dev/sda1,rootdelay=10
boot
Step 6: Copy it into the calculator.
Part 4: Finally booting
Step 1: connect the OTG adapter to the calculator, and the powered hub into the OTG adapter. Connect the powered hub into a power source, e.g. a power bank.
Step 2: connect your keyboard, USB thumb drive (from Part 2) and your wifi dongle into the hub.
Step 3: after installing ndless, click the boot.ll2.tns. it should initially be the bootloader screen (black text on white background), then to the kernel output (white text on black background). It will take a few minutes to boot.
Step 4: Voila! Linux is now booted and running on your calculator.
Part 5: Configuration on the calculator (optional, recommended)
Step 1: Create a new non-root account with
Code:
add user <username>
Step 2: Add the user into the sudo group with
Code:
usermod -aG sudo <username>
Step 3: Setup the internet, following the guide at http://wiki.debian.org/WiFi/HowToUse
Step 4: Enjoy!
Extras: how to shutdown/reboot
Do the normal shutdown/reboot commands. On the nspire, they do not have a difference, because reboot does not actually reboot; it only shuts down. After shutting down completely, use a pencil or a toothpick to poke the small reset button on the back of the calculator. You will now be back into TI-OS, and you can boot into Linux again, if you want.
I hope that helped you. Post comments, feedback or questions below.