Saturday, January 20, 2018

some mips

*** try mips debian virtual machine ***
1- download
$ wget https://people.debian.org/~aurel32/qemu/mips/vmlinux-3.2.0-4-5kc-malta
$ wget https://people.debian.org/~aurel32/qemu/mips/debian_wheezy_mips_standard.qcow2



2- run
- redirect serial io to console terminal
$ qemu-system-mips64 -nographic -serial mon:stdio -M malta -kernel vmlinux-3.2.0-4-5kc-malta -hda debian_wheezy_mips_standard.qcow2 -append "root=/dev/sda1 console=ttyS0" -net nic,macaddr=DE:AD:B0:EF:E0:01 -net tap,ifname=tap1

-with graphic

$ qemu-system-mips64 -M  malta -kernel vmlinux-3.2.0-4-5kc-malta -hda debian_wheezy_mips_standard.qcow2 -append "root=/dev/sda1 console=tty0"



***compile and run test***

1- c
#include<stdio.h>

int main()
{
    printf("Hello World\n");
    printf("319*319=%d\n",319*319);
    return 1;

}


2- compile
$ mipsel-linux-gnu-gcc-5 hello.c -o hellomips -static -march=5kc
or
$ mipsel-linux-gnu-gcc-5 hello.c -o hellomips -static -march=mips2

3- go
package main
import "fmt"
func main() {
    fmt.Println("hello world")
    fmt.Println("319*319=",319*319)
}



 4- compile
$ mips-linux-gnu-gccgo hello.go -o hellomips -static


5- to run
$ qemu-mips hellomips
 



No comments:

Post a Comment