sidecartridge / atarist-toolkit-docker

Docker image with the tools to develop Atari ST software in a modern environment
Other
22 stars 3 forks source link

Using Windows #3

Open shooking opened 2 months ago

shooking commented 2 months ago

Here's a brief write up of getting your latest image working under Windows 11 with WSL2 and Docker Desktop

  1. Install Docker Desktop
  2. Configure settings to allow docker to interact with WSL
  3. Install an Ubuntu Linux WSL
  4. Pull down linux.sh script and modify installation
  5. Enjoy

More details

Step 2

DockerDestopWSL_Settings1

Step 3 - from a cmd prompt

wsl --install

Installing: Ubuntu
Ubuntu has been installed.
Launching Ubuntu...
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: XXXusernameXXX
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.153.1-microsoft-standard-WSL2 x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

This message is shown once a day. To disable it please create the
/home/XXXusernameXXX/.hushlogin file.

DockerDestopWSL_Settings2

Step 4

Modify original script

#!/bin/bash

if [ -x "$(command -v docker)" ]; then
    echo "Docker is installed..."
else
    echo "Docker not installed. Please install Docker first and then run this script again."
    exit 1
fi

VERSION=$1
if [ $# -eq 0 ]
  then
    echo "No version supplied. Using latest version."
    VERSION="latest"
fi

echo "Pulling image logronoide/atarist-toolkit-docker:$VERSION..."
docker pull logronoide/atarist-toolkit-docker:$VERSION

echo "Installing the command stcmd in /usr/local/bin. Please enter your root password if prompted..."
cat <<EOF > stcmd
#!/bin/bash
 if [ -z \$VERSION ]
 then
     VERSION=latest
 fi
 if [ -z \$ST_WORKING_FOLDER ]
 then
       echo 'ST_WORKING_FOLDER is empty. It should have the absolute path to the source code working folder.'
       exit 1
 fi
 docker run -it --rm  -v \$ST_WORKING_FOLDER:'/tmp' logronoide/atarist-toolkit-docker:\$VERSION \$@

EOF

chmod +x stcmd
sudo cp -p stcmd /usr/local/bin/stcmd

You will need to sudo using your password that you created your WSL2 Ubuntu with

Enjoy

mkdir my-st-megademo
export ST_WORKING_FOLDER=${HOME}/my-st-megademo

cd ${HOME}/my-st-megademo
cat <<EOF > hello.c
#include <stdio.h>

void main()
{
    printf("Hello World!\n");
    printf("Press Enter");
    getchar();
}

EOF

stcmd gcc hello.c -o hello.tos

shooking@GAYMER:~/my-st-megademo$ ls
hello.c  hello.tos
shooking commented 2 months ago

thanks for all your excellent Atari ST work - hopefully now I can play along under Windows! When I tried this under Raspberry Pi the complaint was the image was wrong platform. At least WSL/DockerDesktop believes I have a x86/64.