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:
curl -O https://buildroot.org/downloads/Vagrantfile; vagrant up
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:
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
to fine tune the kernel compilation settings.
Step 9: You are now ready to compile the linux kernel. Run

Code:
make linux
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:
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>
. This may take a few minutes.
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
. 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:
/debootstrap/debootstrap --second-stage
. Again, this may take a few minutes (or more).
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>
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:
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.
Thanks for making this guide! I'm excited to try it out and it's really nice to have something like this available for Linux noobs like me Razz
This is really cool! I attempted using Windows Subsystem for Linux but apparently Vagrant is still in early development for WSL and won't feasibly work. I'll definitely be trying again with a proper Linux machine.
This is a really good guide, but as an inexperienced Linux user there's a few things that could be more clear.

Part 1, step 2
If you have never used vagrant before, you will also need to install virtualbox with

Code:
sudo apt-get install virtualbox

Then run vagrant with

Code:
curl -O https://buildroot.org/downloads/Vagrantfile; vagrant up --provider virtualbox


Part 1, step 4
"In the VM" means you need to SSH into the machine simply with

Code:
vagrant ssh


Part 1, step 7
An example of a path to the defconfig would be nice so I know I'm getting the format right the first time. I personally put

Code:
/home/vagrant/buildroot-2022.02.1/defconfig


Part 1, step 9
0x5 saying "a few minutes" makes it sound like compiling should only take 10-15 minutes. It took just over 2 hours for my old laptop to finish. Granted, it has an i5-6300U which is dual core so it's not exactly a fast chip.
Edit: Mateo confirmed it only took 10 minutes on his machine. Moral of the story is, don't use an old laptop and expect quick compile times. Laughing


Part 2, step 2
This only took 10 minutes even on my slow machine.

Part 2, step 4
I believe there's a typo. The = should be a whitespace. I ran

Code:
sudo chroot <your directory> qemu-arm-static --cpu arm926 /bin/bash


Part 2, step 5
To edit text files, cat and tee are the pre-installed options I used.

Part 2, step 6
I don't really know what's useful and what's unnecessary yet. I just copied the guide's example sources.list

Part 2, step 7
I'm actually stuck here and I know TIny_Hacker is having some issues too at this step. For the record I'm using Mint Cinnamon and TIny is using plain Ubuntu.

When I ran `/debootstrap/debootstrap --second-stage` I received a list of errors, here's my terminal input and output (including the log file): https://1drv.ms/t/s!Al_ZukYl7XyymJdJrBBIinPv2q8BKQ

After searching how to fix "error processing package systemd", I found these solutions and tried both of them.

The first answer appeared to do nothing. All folders were owned by root except `/`. I tried to take ownership with `chown root /` but it appeared to have no effect, the owner was still "unknown".

The second answer seems to have made things worse. I followed the commands provided (I did not use sudo) and tried to `run /debootstrap/debootstrap --second-stage` again but got errors much quicker. Again, here's my terminal input, output, and log file: https://1drv.ms/t/s!Al_ZukYl7XyymJdISF2OxeBxdvrJJQ

Is there more information you need to diagnose this?
I had also encountered that issue (on Ubuntu); I wrote what worked for me. If I recall correctly, if it fails once, then you have to clean the directory and try again.

https://openbenchmarking.org/test/pts/build-linux-kernel-1.13.0 my CPU takes around 70 seconds, and the median is 80 seconds so I thought a few minutes would be suitable. I think that should only compile the kernel, but perhaps it made a whole rootfs (which takes much longer)?
Quote:
To edit text files, cat and tee are the pre-installed options I used.


Oh no. For the Windows user, I recommend nano or pico, but I'm a hardcore vim user myself, which requires a very different mindset than the typical editor.
KermMartian wrote:
Quote:
To edit text files, cat and tee are the pre-installed options I used.


Oh no. For the Windows user, I recommend nano or pico, but I'm a hardcore vim user myself, which requires a very different mindset than the typical editor.


nano and pico weren't installed by default (Neither was vim) TLM asked in SAX and in the end I believe cat and tee were the only ones that were already there.
KermMartian wrote:
Quote:
To edit text files, cat and tee are the pre-installed options I used.


Oh no. For the Windows user, I recommend nano or pico, but I'm a hardcore vim user myself, which requires a very different mindset than the typical editor.


None of the options you mentioned are available in the chroot before running the second stage of debootstrap; you would have to use them outside of the chroot jail, so any editor, including graphical stuff such as gedit, can be used, if you prefer.
KermMartian wrote:

TheLastMillennial wrote:
To edit text files, cat and tee are the pre-installed options I used.


Oh no. For the Windows user, I recommend nano or pico, but I'm a hardcore vim user myself, which requires a very different mindset than the typical editor.

TLM I was completely joking Laughing
I am having problems getting this to work (I am like 85% noob and am surprised i got this far. Laughing )
I am using a ti-nspire cx ii cas with these files: Kernel, DTP, Initrd, the guide's linuxloader2, and os that was built in the guide
When ever I boot(the linuxloader2 scripts don't work so i have to type it in manually) it mounts the usb drive (dev/sda1) and does a bunch of stuff then gets stuck constantly spitting out "Error: could not open /dev/tty0 no such file or directory." I don't know what is wrong
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement