mirror of
https://github.com/Fennix-Project/Userspace.git
synced 2025-05-25 22:14:28 +00:00
Update userspace
This commit is contained in:
parent
7c81f026ce
commit
961ddd0bd8
7
.gitmodules
vendored
7
.gitmodules
vendored
@ -1,13 +1,6 @@
|
|||||||
[submodule "apps/user/games/doomgeneric"]
|
[submodule "apps/user/games/doomgeneric"]
|
||||||
path = apps/user/games/doomgeneric
|
path = apps/user/games/doomgeneric
|
||||||
url = https://github.com/Fennix-Project/doomgeneric.git
|
url = https://github.com/Fennix-Project/doomgeneric.git
|
||||||
[submodule "apps/base/bash"]
|
|
||||||
path = apps/base/bash
|
|
||||||
url = https://github.com/Fennix-Project/bash.git
|
|
||||||
[submodule "musl"]
|
[submodule "musl"]
|
||||||
path = musl
|
path = musl
|
||||||
url = https://github.com/Fennix-Project/musl.git
|
url = https://github.com/Fennix-Project/musl.git
|
||||||
[submodule "apps/base/busybox"]
|
|
||||||
path = apps/base/busybox
|
|
||||||
url = git://busybox.net/busybox.git
|
|
||||||
branch = 1_36_stable
|
|
2
Makefile
2
Makefile
@ -45,7 +45,7 @@ endif
|
|||||||
cd out/lib && ln -s /lib/libc.so ./ld-musl-x86_64.so.1 && \
|
cd out/lib && ln -s /lib/libc.so ./ld-musl-x86_64.so.1 && \
|
||||||
ln -s /lib/libc.so ./ld.so
|
ln -s /lib/libc.so ./ld.so
|
||||||
mkdir -p out/include/fennix
|
mkdir -p out/include/fennix
|
||||||
cp ../Kernel/syscalls.h out/include/fennix/syscall.h
|
cp ../Kernel/include/interface/syscalls.h out/include/fennix/syscall.h
|
||||||
|
|
||||||
create_out:
|
create_out:
|
||||||
rm -rf out
|
rm -rf out
|
||||||
|
@ -20,43 +20,11 @@ else
|
|||||||
export CFLAGS := --sysroot=$(cwd)/../../out/ -I$(cwd)/../../out/include/
|
export CFLAGS := --sysroot=$(cwd)/../../out/ -I$(cwd)/../../out/include/
|
||||||
endif
|
endif
|
||||||
|
|
||||||
build_bash:
|
|
||||||
ifeq ($(wildcard $(CACHE_DIR)/bash),)
|
|
||||||
mkdir -p $(CACHE_DIR)/bash
|
|
||||||
cd $(CACHE_DIR)/bash && \
|
|
||||||
../../apps/base/bash/configure --prefix=$(PREFIX) \
|
|
||||||
--host=$(TARGET) \
|
|
||||||
--enable-minimal-config
|
|
||||||
endif
|
|
||||||
LDFLAGS="--static" make -C $(CACHE_DIR)/bash -j$(shell nproc)
|
|
||||||
make -C $(CACHE_DIR)/bash install
|
|
||||||
|
|
||||||
BUSYBOX_CROSS_PATH := $(cwd)/../../../tools/cross/bin/$(TARGET)-
|
|
||||||
|
|
||||||
build_busybox:
|
|
||||||
ifeq ($(wildcard $(CACHE_DIR)/busybox),)
|
|
||||||
mkdir -p $(CACHE_DIR)/busybox
|
|
||||||
cd $(CACHE_DIR)/busybox && \
|
|
||||||
make KBUILD_SRC=../../apps/base/busybox \
|
|
||||||
CROSS_COMPILE=$(BUSYBOX_CROSS_PATH) \
|
|
||||||
-f ../../apps/base/busybox/Makefile \
|
|
||||||
allnoconfig
|
|
||||||
endif
|
|
||||||
cd $(CACHE_DIR)/busybox && \
|
|
||||||
make -C $(CACHE_DIR)/busybox \
|
|
||||||
CROSS_COMPILE=$(BUSYBOX_CROSS_PATH) -j$(shell nproc)
|
|
||||||
cd $(CACHE_DIR)/busybox && \
|
|
||||||
make -C $(CACHE_DIR)/busybox \
|
|
||||||
CONFIG_PREFIX=$(PREFIX) \
|
|
||||||
CROSS_COMPILE=$(BUSYBOX_CROSS_PATH) install
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
make -C utest build
|
make -C utest build
|
||||||
make -C cross_test build
|
make -C cross_test build
|
||||||
make -C echo build
|
make -C echo build
|
||||||
make -C fsh build
|
make -C fsh build
|
||||||
# $(MAKE) build_busybox
|
|
||||||
# $(MAKE) build_bash
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
make -C utest clean
|
make -C utest clean
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 07d7e008172fd30d786917d7924c9aba9a2d14fc
|
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 1a64f6a20aaf6ea4dbba68bbfa8cc1ab7e5c57c4
|
|
@ -1,9 +1,97 @@
|
|||||||
|
#define _POSIX_SOURCE
|
||||||
|
#define _DEFAULT_SOURCE
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <pty.h>
|
||||||
|
#include <termios.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
|
#ifndef __GLIBC__
|
||||||
|
#define __GLIBC__ 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GLIBC_MINOR__
|
||||||
|
#define __GLIBC_MINOR__ 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int ptmx_test()
|
||||||
|
{
|
||||||
|
int masterFD;
|
||||||
|
int slaveFD;
|
||||||
|
char slaveName[100];
|
||||||
|
|
||||||
|
masterFD = open("/dev/ptmx", O_RDWR | O_NOCTTY);
|
||||||
|
if (masterFD < 0)
|
||||||
|
{
|
||||||
|
perror("Failed to open /dev/ptmx");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grantpt(masterFD) < 0)
|
||||||
|
{
|
||||||
|
perror("Failed to grantpt");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unlockpt(masterFD) < 0)
|
||||||
|
{
|
||||||
|
perror("Failed to unlockpt");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ptsname_r(masterFD, slaveName, sizeof(slaveName)) != 0)
|
||||||
|
{
|
||||||
|
perror("Failed to get slave name");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Slave terminal: %s\n", slaveName);
|
||||||
|
|
||||||
|
slaveFD = open(slaveName, O_RDWR | O_NOCTTY);
|
||||||
|
if (slaveFD < 0)
|
||||||
|
{
|
||||||
|
perror("Failed to open slave terminal");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct termios t;
|
||||||
|
tcgetattr(slaveFD, &t);
|
||||||
|
cfmakeraw(&t);
|
||||||
|
tcsetattr(slaveFD, TCSANOW, &t);
|
||||||
|
|
||||||
|
char *message = "Hello from master!\n";
|
||||||
|
write(masterFD, message, strlen(message));
|
||||||
|
|
||||||
|
char buffer[100];
|
||||||
|
int len = read(slaveFD, buffer, sizeof(buffer) - 1);
|
||||||
|
if (len > 0)
|
||||||
|
{
|
||||||
|
buffer[len] = '\0';
|
||||||
|
printf("Received from slave: %s\n", buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
close(masterFD);
|
||||||
|
close(slaveFD);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[], char *envp[])
|
int main(int argc, char *argv[], char *envp[])
|
||||||
{
|
{
|
||||||
printf("glibc: Hello, World!\n");
|
printf("glibc %d.%d: Hello, World!\n", __GLIBC__, __GLIBC_MINOR__);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
ptmx_test();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -32,10 +32,10 @@ FILENAME = utest
|
|||||||
|
|
||||||
HEADERS = $(sort $(dir $(wildcard $(WORKSPACE)out/include/*)))
|
HEADERS = $(sort $(dir $(wildcard $(WORKSPACE)out/include/*)))
|
||||||
|
|
||||||
LDFLAGS =
|
LDFLAGS = -static
|
||||||
CFLAGS = -I$(WORKSPACE)out/include \
|
CFLAGS = -I$(WORKSPACE)out/include \
|
||||||
-DGIT_COMMIT='"$(GIT_COMMIT)"' \
|
-DGIT_COMMIT='"$(GIT_COMMIT)"' \
|
||||||
-DGIT_COMMIT_SHORT='"$(GIT_COMMIT_SHORT)"'
|
-DGIT_COMMIT_SHORT='"$(GIT_COMMIT_SHORT)"' -static
|
||||||
WARNCFLAG = -Wall -Wextra
|
WARNCFLAG = -Wall -Wextra
|
||||||
|
|
||||||
ifeq ($(DEBUG), 1)
|
ifeq ($(DEBUG), 1)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
build:
|
build:
|
||||||
cp -r include/* ../out/include
|
cp -r include/* ../out/include
|
||||||
cp ../../Kernel/syscalls.h ../out/include/fennix/syscall.h
|
cp ../Kernel/include/interface/syscalls.h ../out/include/fennix/syscall.h
|
||||||
make -C runtime build
|
make -C runtime build
|
||||||
make -C src build
|
make -C src build
|
||||||
make -C ElfInterpreter build
|
make -C ElfInterpreter build
|
||||||
|
Loading…
x
Reference in New Issue
Block a user