Devon and Cornwall GNU/Linux Users Group

  • About DCGLUG
    • FAQ
    • Join
    • Meetings
    • Mailing List Archive
  • About : GNU / Linux
    • Federated social media
    • Video on Free software
    • Video on DRM
    • Video on Creative Commons
    • Hacker / Hacking definition
  • Tutorials
    • BASH Tutorials
    • e-learning
    • My Sql
    • LaTeX and Overleaf
    • Send Plain text e-mail
    • Tutorial : GnuPG – Encryption & Signing
  • CHAT (IRC) / Matrix
    • IRC – Client Setup
      • Weechat Setup guide
      • Hexchat Setup
      • IRSSI Configuration
      • xchat – setup
      • ERC Setup
      • Chat – Matrix
    • DCGLUG on Mastodon

Author Archives: Matthew Lugg

Basic OS development with Visual Studio

Posted on 2021-01-11 by Matthew Lugg

Recently I came across an add-on for Visual Studio 2013 named Cosmos, which lets you use C# or Visual Basic to develop a fully independent OS. I have been working on one now for a couple of weeks. Sadly, Cosmos is still in early development stages, but it is still possible to make basic graphical OS’s. This post uses C#, but it is just as easy to use Visual Basic. My current code is:

Source code   
using System;
using System.Collections.Generic;
using System.Text;
using Sys = Cosmos.System;
using Cosmos.Hardware;
using Cosmos.Hardware.BlockDevice;
 
namespace CosmosOS
{
    public class Kernel : Sys.Kernel
    {
        protected override void BeforeRun()
        {
            while (true)
            {
                Run();
            }
        }
 
        protected override void Run()
        {
            string input = Console.ReadLine();
            string input1 = input.ToLower();
            if (input1 == "shutdown" || input1 == "quit" || input1 == "exit") Shutdown();
            else if (input1 == "reboot" || input1 == "restart" || input1 == "reload") Reboot();
 
            else Console.WriteLine("Command \"" + input1 + "\" not recognized!");
        public void Shutdown()
        {
            this.Stop();
            Cosmos.Core.Bootstrap.CPU.Halt();
        }
        public void Reboot()
        {
 
        }
        public static void WriteData(byte[] aData, ulong block)
        {
            if (BlockDevice.Devices.Count > 0)
            {
                for (int i = 0; i < BlockDevice.Devices.Count; i++)
                {
                    var xDevice = BlockDevice.Devices[i];
                    if (xDevice is Partition)
                    {
                        xDevice.WriteBlock(block, 1, aData);
                    }
                }
 
            }
 
        }
        public static byte[] ReadData(ulong block)
        {
            byte[] aData = new byte[] { 1 };
            if (BlockDevice.Devices.Count > 0)
            {
                for (int i = 0; i < BlockDevice.Devices.Count; i++)
                {
                    var xDevice = BlockDevice.Devices[i];
                    if (xDevice is Partition)
                    {
                        aData = xDevice.NewBlockArray(1);
                        xDevice.ReadBlock(block, 1, aData);
                    }
                }
 
            }
            return aData;
        }
    }
}

Lets go over some of this code.

Source code   
protected override void BeforeRun()
        {
            while (true)
            {
                Run();
            }
        }

This Run function is looped by default anyway, but it loops slightly faster when this code is put in BeforeRun.

 

Source code   
protected override void Run()
        {
            string input = Console.ReadLine();
            string input1 = input.ToLower();
            if (input1 == "shutdown" || input1 == "quit" || input1 == "exit") Shutdown();
            else if (input1 == "reboot" || input1 == "restart" || input1 == "reload") Reboot();
 
            else Console.WriteLine("Command \"" + input1 + "\" not recognized!");

This is fairly trivial code for a command-line OS, simple input.

 

Source code   
public void Shutdown()
        {
            this.Stop();
            Cosmos.Core.Bootstrap.CPU.Halt();
        }
        public void Reboot()
        {
 
        }

This is my own shutdown code. I have yet to figure out reboot, though.

 

Source code   
public static void WriteData(byte[] aData, ulong block)
        {
            if (BlockDevice.Devices.Count > 0)
            {
                for (int i = 0; i < BlockDevice.Devices.Count; i++)
                {
                    var xDevice = BlockDevice.Devices[i];
                    if (xDevice is Partition)
                    {
                        xDevice.WriteBlock(block, 1, aData);
                    }
                }
 
            }
 
        }
        public static byte[] ReadData(ulong block)
        {
            byte[] aData = new byte[] { 1 };
            if (BlockDevice.Devices.Count > 0)
            {
                for (int i = 0; i < BlockDevice.Devices.Count; i++)
                {
                    var xDevice = BlockDevice.Devices[i];
                    if (xDevice is Partition)
                    {
                        aData = xDevice.NewBlockArray(1);
                        xDevice.ReadBlock(block, 1, aData);
                    }
                }
 
            }
            return aData;
        }

I got this code from a forum and modified it a little to make it work – it writes arrays of bytes to the hard disk. Sadly the built-in FAT fileystem can currently only read files, so you will have to make your own.

 

This is a fun tool to just play around with, although it is extremely limited at the moment.
http://www.nikeairmaxfreerun.com nike air max thea

Posted in Uncategorized | 2 Comments |

Cluster Progress

Posted on 2015-02-19 by Matthew Lugg

At the Raspberry Pi Jam on Saturday the 14th I was working on creating a cluster supercomputer with a piece of software, GNU Parallel. It was successful, and I did a test with the prime number generator Paul made. It seems to require me to copy all files involved to all computers involved. However, it appears around 40% faster when using two computers instead of just one.

It appears that GNU Parallel has trouble finding the amount of cores on each computer, which is likely the reason for Paul’s inital results, which showed not using parallel to be faster. For all computers it says ‘Could not find the amount of cpu’s on 192.168.1.x, using 1’. It is possible to specify to parallel how many cores computers have, so I will research this.

At Minecraft club on Wednesday, we attempted to link Parkfield’s netbooks together with their switch. We discovered something extremely odd; the Linux netbooks there, along with one of the laptops from Raspberry Pi jams, do not have OpenSSH Server (sshd) installed, even though it is meant to be installed by default on Linux. One of the netbooks wouldn’t let us install it either, but that didn’t really matter – it just meant we had to use parallel on that machine instead of another. We didn’t get time to run a test, but we should have time next Wednesday.

Although so far we have just used GNU Parallel with a python program, it can be extremely useful. For example if you have a password-protected archive with important files, but you forgot the password, you can decrypt the folder much quicker with more processing power.

Posted in Uncategorized | 2 Comments |

Recent Posts

  • LibreOffice 24.8.7 is available for download
  • EU security bug database
  • Mission Libre
  • Gopher 2
  • Assembler programming

RSS Debian Security

  • DSA-5918-1 varnish - security update
  • DSA-5917-1 libapache2-mod-auth-openidc - security update
  • DSA-5916-1 chromium - security update

RSS Debian News

  • Updated Debian 12: 12.10 released
  • The Debian Project mourns the loss of Steve Langasek (vorlon)
  • Updated Debian 12: 12.9 released

CyberChimps WordPress Themes

© 2021 Devon and Cornwall GNU/Linux Users Group