Skip to content

Commit 1bc69dd

Browse files
author
Fabian Meyer
committed
emulator space limited to 23MB. mounting proc, tmpfs, sysfs.
1 parent 6e3d397 commit 1bc69dd

File tree

6 files changed

+29
-12
lines changed

6 files changed

+29
-12
lines changed

.config

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,9 @@ CONFIG_PROC_FS=y
761761
CONFIG_PROC_SYSCTL=y
762762
CONFIG_PROC_PAGE_MONITOR=y
763763
CONFIG_SYSFS=y
764-
# CONFIG_TMPFS is not set
764+
CONFIG_TMPFS=y
765+
# CONFIG_TMPFS_POSIX_ACL is not set
766+
# CONFIG_TMPFS_XATTR is not set
765767
# CONFIG_HUGETLBFS is not set
766768
# CONFIG_HUGETLB_PAGE is not set
767769
# CONFIG_CONFIGFS_FS is not set

application/scripts/inittab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
::sysinit:/etc/init.d/rcS
2-
::askfirst:/bin/sh
2+
tty1::askfirst:/bin/sh

application/scripts/mount.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/bin/sh
22

3+
echo "Mounting proc..."
4+
mount -t proc /proc /proc
35
echo "Mounting sysfs..."
4-
#mount -t sysfs /sys /sys
5-
echo "Mounting procfs..."
6-
#mount -t procfs /proc /proc
6+
mount -t sysfs /sys /sys
7+
echo "Mounting tmpfs..."
8+
mount -t tmpfs /tmp /tmp
9+
echo "Populate dev..."
10+
mdev -s
11+
echo "complete"

application/src/helloworld.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <errno.h>
44
#include <string.h>
55
#include <unistd.h>
6+
#define MB 1000000
67

78
void printHelloWorld();
89
int printSysInfo();
@@ -36,8 +37,8 @@ int printSysInfo()
3637
}
3738

3839
printf("Uptime: %lu\n", l_sysinfo.uptime);
39-
printf("Total RAM: %lu\n", l_sysinfo.totalram);
40-
printf("Free RAM: %lu\n", l_sysinfo.freeram);
40+
printf("Total RAM: %lu MB\n", l_sysinfo.totalram / MB);
41+
printf("Free RAM: %lu MB\n", l_sysinfo.freeram / MB);
4142
printf("Process Count:%hi\n", l_sysinfo.procs);
4243
printf("Page size: %d\n", l_sysinfo.mem_unit);
4344
return 0;

emulate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
IMGPATH="arch/x86/boot/bzImage"
44

5-
qemu-system-i386 -kernel $IMGPATH -curses -monitor telnet:127.0.0.1:7777,server
5+
qemu-system-i386 -kernel $IMGPATH -curses -monitor telnet:127.0.0.1:7777,server -m 23

rootFSconfig

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ dir /proc 755 0 0
1111
dir /sys 755 0 0
1212
dir /etc/init.d 755 0 0
1313
nod /dev/console 777 0 0 c 5 1
14-
nod /dev/null 777 0 0 c 1 3
15-
nod /dev/zero 777 0 0 c 1 5
16-
nod /dev/tty0 777 0 0 c 4 0
17-
nod /dev/tty1 777 0 0 c 4 1
1814
file /bin/busybox busybox 755 0 0
1915
file /usr/bin/helloworld application/bin/helloworld 755 0 0
2016
file /etc/inittab application/scripts/inittab 755 0 0
@@ -30,3 +26,16 @@ slink /bin/mv busybox 777 0 0
3026
slink /bin/rm busybox 777 0 0
3127
slink /init /bin/busybox 777 0 0
3228
slink /bin/sleep busybox 777 0 0
29+
slink /bin/mdev busybox 777 0 0
30+
slink /bin/ps busybox 777 0 0
31+
slink /bin/kill busybox 777 0 0
32+
slink /bin/top busybox 777 0 0
33+
slink /bin/rmdir busybox 777 0 0
34+
slink /bin/free busybox 777 0 0
35+
slink /bin/ln busybox 777 0 0
36+
slink /bin/touch busybox 777 0 0
37+
slink /bin/taskset busybox 777 0 0
38+
slink /bin/time busybox 777 0 0
39+
slink /bin/zcat busybox 777 0 0
40+
slink /bin/who busybox 777 0 0
41+
slink /bin/chmod busybox 777 0 0

0 commit comments

Comments
 (0)