Leinninger.com

October 19th, 2016:
Upgrade Amibian and Enable WiFi

In my previous post I outlined the (many) steps involved in setting up a raspberry pi 3 in a pi-top laptop case as an Amiga laptop. Since, I can’t leave well enough alone, I decided that I wanted to get wifi working and make sure my distribution was more up-to-date than the official Amibian distribution offered. Here are the steps I took to make this happen (at least the steps that I can remember):

It might be worthwhile to use Win32DiskImager (or equivalent) to make a backup of your SD card before trying this. I did and it gave me great peace of mind.

Update Your Pi

(Make sure your connected to a network with Ethernet. Each step will take a while to execute… that’s normal.)

  1. “apt-get update”
  2. “apt-get upgrade”
  3. “apt-get dist-upgrade”
  4. “apt-get rpi-update”
  5. “rpi-update”
Fix Automatic Login
  1. Login using the Amibian defaults: root/1234… or whatever you’ve changed them to
  2. Edit (see the previous article for file editing from the shell) /etc/systemd/system/getty.target.wants/getty@tty1.service as such:
    1. Change the “ExecStart=” line to: “ExecStart=-/sbin/agetty –autologin root %I”
    2. Change the “Restart=” line to: “Restart=no”
  3. Save and exit the editor
  4. “reboot”

Functionally, you should be back to where you were before starting the upgrade process: Your computer boots and automatically starts the Amiga Emulator. Note, however, that when you quit the emulator “exit” no longer restarts the emulator. Instead it exits the current terminal session. If you want to restart the emulator, just execute your startup script with “/bin/bash ~/.profile”. If you accidentally type “exit” out of habit and want to get back into a terminal session, press alt-fn-F2 (or any other alt-function-key combination) to switch to a different terminal session.

Install The Wireless Stuff

These instructions assume that you’re using a Raspberry Pi 3 with a built-in wifi interface. Other adapters might be able to leverage some of this info, but the firmware parts probably won’t apply.

  1. Install the wireless tools package: “apt-get install wireless-tools”
  2. Install wpa supplicant for secured wireless networks: “apt-get install wpasupplicant”
  3. Configure your wireless connection:
    1. Create and edit a wireless network config file named “/etc/wpa_supplicant/wpa_supplicant.conf” that contains:
      ctrl_interface=/var/run/wpa_supplicant
              ctrl_interface_group=0
              update_config=1
      
              network={
                ssid="network_id"
                psk="password"
                proto=WPA
                key_mgmt=WPA-PSK
                pairwise=TKIP
                group=TKIP
                id_str="Nickname"
              }
    2. Change “network_id” and “password” to your access point’s SSID and passphrase. Keep the quotes around the values in that file, though!
  4. Configure your wireless network interface:
    1. edit “/etc/network/interfaces”
    2. Change or add the wlan0 section to…
      auto wlan0
                  iface wlan0 inet dhcp
                  wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
  5. Unplug your Ethernet and “reboot”
  6. When your computer restarts, Quit the emulator and test your wireless configuration from the shell with: “ifconfig -a”. You should see something like:
    eth0      Link encap:Ethernet  HWaddr b8:27:eb:07:e5:49  
              UP BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:8 errors:0 dropped:0 overruns:0 frame:0
              TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1 
              RX bytes:1104 (1.0 KiB)  TX bytes:1104 (1.0 KiB)
    
    wlan0     Link encap:Ethernet  HWaddr b8:27:eb:52:b0:1c  
              inet addr:192.168.0.45  Bcast:192.168.0.255  Mask:255.255.255.0
              inet6 addr: fe80::ba27:ebff:fe52:b01c/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:14966 errors:0 dropped:9 overruns:0 frame:0
              TX packets:1307 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:1728707 (1.6 MiB)  TX bytes:171182 (167.1 KiB)

    With an IP address properly configured for wlan0.

There you have it! The official Amibian distribution will be updated soon, but I couldn’t wait. If this all seems a little over your head, it might be worth waiting for a packaged solution such as theirs. Please comment with corrections, suggestions, and feedback! Happy Amiga-ing!

- Duane

October 14th, 2016:
How To Build An Amiga Laptop Using Raspberry Pi 3

My wife tells me that I’ve been overcompensating for my adolescent technolust now that I can actually afford some gadgets. I’m not arguing… especially with my latest project: an Amiga laptop that gets about 10 hours of battery life. I wanted an Amiga so badly when I was younger. They were expensive though and I made do with my Commodore 64c. I’ve since owned 4 Amigas (A600, A1200, A2000 w/ Video Toaster and A4000T w/ Video Toaster), and still own 2 of them. When laptops became more attainable, I lusted for one as well… finally buying on with my web development earnings in 1997. So, I figured that there must be some way to combine two of my fixations into one sill creation: The Amibian Laptop.

Amibian Laptop

WARNING: Always properly shut down your Pi from the command line before powering off. SD Cards tend to corrupt when abruptly powered off while reading/writing. The commands are simple: “poweroff” (turns off the power) and “reboot” restarts the Pi.

The Parts

  1. Pi-Top Laptop Case (includes keyboard, 13″ display, trackpad, and interface for rpi). I also recommend buying a pi-top speaker.
  2. Raspberry Pi 3 (Model 3 has the best performance and can be purchased from pi-top above or separately for less convenience and possibly a lower price)
  3. A heatsink for the Pi. (It gets quite hot when emulating.)
  4. A good-sized micro-sd card. I like having a few around to experiment with new versions and make backups. 32-64 gigs will store every WHDLoad game and demo ever made with room to spare for MOD files and Deluxe Paint.
  5. A 1080p hdmi display (might work with other television resolutions, but I used a 1080p monitor… more on this later)…
  6. An Ethernet cable to copy software, games, music, etc. once you’re set up.

The Software

  1. Amibian! So far the most direct, lightweight, and best performing UAE image I’ve used.
  2. SD Card Formatter
  3. A way to extract the Amibian RAR file such as 7-Zip for Windows, The Unarchiver for MacOS or just use unrar for Linux.
  4. Software to write the image file to your micro sd on aWindows, Mac or Linux system.
  5. Kickstart ROMs. This is the “bios” (and part of the operating system) for Amiga computers. There are 2 ways to get these legally, both via Cloanto. I used the Amiga Forever distribution, which is a great product in and of itself (get the “plus” version at least to ensure you get all of the kickstart versions for WHDLoad). Alternatively, you can buy the Amiga Forever Essentials for Android and extract the ROM files for a little less money. I haven’t done it, so your mileage may vary.
  6. Workbench 3.1 adf files. This is the operating system that we will install. ADF stands for Amiga Disk File. Workbench 3.0 will work too, but 3.1 has some nice refinements. Cloanto’s Amiga Forever Plus distribution includes Workbench 3.1 adf files.
  7. Classic Workbench from Bloodwych. I recommend the UAE build available here.

The Process

Assembly and Basic Set Up
  1. Assemble your pi-top following the latest instructions provided. Of course, you don’t need a pi-top to make a modern Amiga emulation box, but c’mon… IT’S AN AMIGA LAPTOP!!!
  2. Boot into pi-top os using the provided micro-sd card. Make sure everything works. Read the inside of the pi-top speaker box to install the software for the speaker. Make sure your audio is working in pi-top os (go to youtube or something) before you try setting it up for Amibian. Knowing your hardware is working beforehand might save you some time later.
  3. Using another computer, format your new, larger micro-sd card using SD Card Formatter (see software, above).
  4. Extract the Amibian image file downloaded in step 1 of The Software, above, using the unRAR software from step 3, above.
  5. Image your freshly formatted micro-sd card with the extracted image using the software from step 4 above. Note: you will probably not be able to mount the .img file, nor read the micro-sd card once you have imaged it. Your OS will likely even tell you that it is corrupt. If you’ve followed these instructions, I’m 91.675% certain it’s not corrupt as you’ll see in a few steps.
  6. Insert the new Amibian-imaged micro-sd card into your pi-top (if you use the ethernet method below, connect an ether cable before powering on) and turn it on. You pi-top screen is going to look bad… like “OMG, I just cooked this thing” bad. But, Amibian is just configured with a really incompatible screen mode by default. Here’s where that 1080p display comes in handy:
    1. Disconnect the pi-top display from the raspberry pi board’s hdmi connector and plug in your HDMI 1080p display. You should now see the uae4arm-rpi menu.
    2. Click “quit”. (Pro-tip: once you’ve quit UAE, you can restart from the shell by simply typing “exit”… or just type “reboot” to reboot and UAE will start automatically, again.
    3. From the command line/shell prompt, use your favorite (cough-VI-cough) text editor to modify /boot/config.txt. (If you don’t know how to use vi, which is built-in to this distribution, install “joe” with “apt-get install joe”. Open the file to edit by typing “joe /boot/config.txt”. Move around the file with the cursor keys. Save and exit by pressing “ctrl-k”, then “x”. To cancel (exit without saving), press “ctrl-c”.)
    4. Add “hdmi_drive=2” (without the quotes, of course).
    5. Change “hdmi_group=1” to “hdmi_group=2”.
    6. Change “hdmi_mode=16” (or whatever it is by default, I don’t remember) to “hdmi_mode=81”.
    7. For more information on these settings check out https://www.raspberrypi.org/documentation/configuration/config-txt.md.
    8. Save your changes
    9. Type “reboot”
    10. Your pi-top should reboot and be quite nice to look at now.
    11. Follow the instructions on the Amibian site to get your system set up. I’ll also cover what worked for me in the steps below as of the time of this writing.
  7. From the uae4arm-rpi menu, click “quit” (again) and type “raspi-config” and press enter
  8. Choose “Expand Filesystem” to let the Rasbian installation expand to fill your entire micro-sd card.
  9. While you’re in the config screens, change a few settings that will help later:
    1. Configure your location and keymap in Internationalsation Options
    2. Enable SSH in Advanced Options -> SSH (you’ll need this for SFTP/copying files and remote management of your PI, the username is “root”, the password is “1234”… really…)
    3. Enable SPI (Advanced Options -> SPI) which will allow you have your laptop automatically poweroff when you poweroff your Pi as well as adjust display brightness.
    4. Enable I2C (Advanced Options -> I2C) which you will need for your pi-top speaker (pt-speaker) to work.
    5. Set your audio to “auto” (Advanced Options -> Audio) so that you can choose your audio output manually later if needed.
    6. “Back” out of the setting menus and click on “Finish”. You will be prompted to reboot, which you should do.
Amibian/uae4arm-rpi Configuration

Reality check time: you should have a booting system with a display that is working at native resolution in the shell and use4arm-rpi menu. We’ve set up your kernel modules for sound and power control. It’s time to install Workbench (Amiga OS). You can simply install a vanilla version of Workbench 3.1 using the adf files from Amiga Forever Plus, but I will be detailing the instructions for the beautiful Magic Workbench for UAE from Bloodwych. Either way, you’re going to need the Workbench ADF files…

Here are the modified instructions from Bloodwych to configure both a Picasso 96 (fancy, hi-res desktop) install as well as a more compatible ADVSP install (that you can switch between):

  1. Unpack the archive by double clicking its icon (do this on your regular computer)
  2. Place an uncompressed 3.0 (or 3.1) ROM file into the ROMS directory (on your pi-top), renaming it “kick3.rom” (I copied amiga-os-310-a1200.rom from the Amiga Forever Plus “shared” directory to my pi-top’s “/root/amiga/kickstarts” directory using sftp, then renames it to “kick3.rom”… if you have the space, just copy all of the rom files over. You’ll be using some of them to set up WHDLoad later. Then create a directory in /root/amiga called “hdd”. Copy “System_ADVSP.hdf” and “System_P96.hdf” from the unpacked Classic Workbench folder (ClassicWB_UAE_v28) to “/root/amiga/hdd” on your pi-top using sftp. Copy the entire “Software” directory from Classic Workbench’s “Hard Disk” directory to “/root/amiga/” on your pi-top. Finally, copy the Workbench ADF files from Amiga Forever Plus’s “shared” folder to the “/root/amiga/floppys” directory on your pi-top using the same method.)
  3. (Start or restart your pi-top. Remember, if you’re already in the UAE menu, click “quit”, then type “reboot” and press enter.)
  4. (Go “Configurations” in the left menu and click on “Run Me First, then Delete” ONCE.)
  5. Select “Paths” from the left hand menu – tick “Use relative paths” and click “Reset to defaults” (This step doesn’t apply to uae4arm-rpi. Instead, select “ROM” from the left hand menu. Then click on the “…” button, navigate to “/root/amiga/kickstarts” and choose kick3.rom. Click on “Hard drives” in the left menu and navigate to “/root/amiga/hdd” and choose “System_P96.hdf” for DH0:, “root/amiga/Software” for DH1 and “/root/amiga/PC” for the device named “PC”. Select “Configurations” and save.
  6. When asked to insert a Workbench 3 disk, hit F12 (use the “fn” key to get F12 to work), enter the Floppy Drives tab and select an ADF for DF0: (Select “amiga-os-310-workbench.adf” that you copied to “floppys” above. I ran through the entire installation process following the instructions when prompted until it told me to remove the Workbench disk and reboot.)
  7. Go to the “Configurations” section and double-click/load (single click) “Run Me Second then Delete”
  8. Select “ROM” from the left hand menu. Then click on the “…” button, navigate to “/root/amiga/kickstarts” and choose kick3.rom. Click on “Hard drives” in the left menu and navigate to “/root/amiga/hdd” and choose “System_ADVSP.hdf” for DH0: this time, “root/amiga/Software” for DH1 and “/root/amiga/PC” for the device named “PC”. Select “Configurations” and save.
  9. Click “Restart” and follow the on-screen instructions.
  10. When asked to instert a Workbench 3 disk, hit F12, enter the Floppy Drives tab and select an ADF for DF0: (Select “amiga-os-310-workbench.adf” that you copied to “floppys” above.)
  11. In the “Configuration” menu, select, then “Load” each of the A1200 and A4000 configurations. Using the information from the steps above, then select the appropriate Kickstart ROM (kick3.rom should work, or you can try the other ROMs available if you like) and fix the paths for the Hard Drives.
  12. Pat yourself on the back, grab your favourite bev and enjoy! (Whew! That was a lot of work!)
Making It Pretty

From here on out, you have a working Amiga laptop. Be sure that you “Quit” UAE from the F12 menu, and “Shutdown” from the shell/command line before powering off your pi-top!

Time for another reality check. You’re practically a pro at this stuff now. You should now be able to boot into one of your configurations. I prefer the A4000 Turbo, myself. You probably wish it was a little higher, resolution, right. Well, here’s how we do that:

  1. In your emulated Amiga, open the “System” hard drive icon on the left. Then open “Prefs”, followed by “ScreenMode”. In the left-hand menu, scroll down and select “UAE: 1024×768 32bit RGBA”, then click “Use”. This doesn’t save the setting, so if you reboot, you’ll be back at the lower-resolution ScreenMode. If everything looks good, open the “ScreenMode” Pref again, select “UAE: 1024×768 32bit RGBA” and click “Save”… now it will stick.
  2. If you prefer to use every pixel of your display (like I do), you can change the aspect ratio in your UAE settings. Press fn+F12 (which I’ll just refer to as F12 from now on) to open the UAE menu. Make sure you’ve selected the correct configuration, then select the “Display” category from the left. Uncheck “4/3 ration shrink”. Return to the “Configuration” menu and click “Save”. If you like, you can mess around with the other settings in the “Display” section, but make sure you either save your settings or write them down beforehand. If you want a more accurate display, you can re-check “4/3 ratio shrink” any time you feel the need.
Optional: Tweaking Your Setup (Sound, Power and Display Brightness)

This section is optional, but I believe it really completes the configuration. Without making these changes, you will need to manually power off your pi-top when shutting down, your display won’t be as bright as it could be, and you will need to use your headphones instead of the pt-speaker.

Display Brightness
  1. The detailed instructions can be found here. I’ve summarized them for reference with additional notes specific to Amibian. The installation scripts and instructions on github assume you’re using the normal Raspberian distribution, which we are not.
  2. Quit UAE (F12, click “Quit”).
  3. From the shell prompt, type “mkdir Downloads”, this creates a Downloads directory
  4. Type “apt-get install wiringpi git “
  5. “cd Downloads”
  6. “clone git://github.com/rricharz/pi-top-install”
  7. “cd pi-top-install”
  8. “chmod +x install*”
  9. “apt-get update”
  10. “apt-get upgrade”
  11. “cp brightness /usr/bin”
  12. “chmod +x /usr/bin/brightness”
  13. You can now adjust your display brightness with “brightness [0-10]” (use a number between 0 and ten to set brightness directly) or just “brightness increase” and “brightness decrease”.
Auto Poweroff When You Shutdown
  1. “cd /root/Downloads/pi-top-install”
  2. “mkdir /opt/pi-top”
  3. “cp poweroff /opt/pi-top”
  4. “chmod 755 /opt/pi-top/poweroff”
  5. “systemctl disable pt-poweroff.service”
  6. “cp pt-poweroff.service /lib/systemd/system”
  7. “cd /lib/systemd/system”
  8. “systemctl enable pt-poweroff.service”
  9. Now, when you quit UAE and execute either a “shutdown now” or “poweroff” command, your pi-top will actually turn off!
Sound via pt-speaker
  1. This was the most difficult part of the installation. It took a lot of guesswork and I don’t know if I recall every step. You may need to refer to the instructions on github to figure it all out. This is what worked for me in the end.
  2. “apt-get install -y python-smbus wiringpi i2c-tools”
  3. “cd /etc/apt/sources.list.d”
  4. “joe pi-top.list” (or use another editor)
  5. add this on it’s own line in the file: “deb http://apt.pi-top.com/raspbian/ jessie main”
  6. Save and exit
  7. “wget http://apt.pi-top.com/apt.pi-top.com.gpg.key”
  8. “apt-key add apt.pi-top.com.gpg.key”
  9. “mkdir /etc/xdg” (it might already exist and that’s fine)
  10. “mkdir /etc/xdg/lxsession” (it might already exist and that’s fine)
  11. “mkdir /etc/xdg/lxsession/LXDE-pi” (the pt-speaker package expects this directory to be here to install correctly even though we don’t need it)
  12. “apt-get install -y pt-speaker”
  13. Add this line to /etc/rc.local before “exit 0”: “/usr/bin/pt-speaker &” (this initializes the speaker when your computer starts)
  14. Reboot with either “reboot” or “shutdown -r now”
  15. You should now be able to hear audio. Test it out with Eagle Player and listen to a MOD file. If you are unable to hear audio through the pt-speaker, check out the troubleshooting info in the instructions.

There you have it! A fully functional Amiga laptop… with a not so great keyboard… but all, in all, it’s a great device! If you want to boot into a UAE configuration without the menu appearing first, just uncheck “Show GUI on startup” in the F12 menu, under “Miscellaneous” and change “./uae4arm -f conf/autostart.uae” in /root/.profile to point to your prefered configuration, such as “./uae4arm -f conf/A4000\ Turbo\ v2.uae”.

Check back in a little bit. I may post a summary of the steps needed to get WHDLoad configured to play almost every game and demo ever made for the Amiga. WHDLoad is already installed in Classic Workbench, but there’s some more work to do to get it working. You can read about it here, or check out Nostaligia Nerd’s quick video overview here.

It is likely that I missed a step or have a few typos. I completed this project over a few days and documented everything very late at night a few days after I finished. Please share your questions and suggestions in the comments below. Note that comments are moderated so yours may not show up immediately. Thanks and good luck!

- Duane

Devtroit