Skip to content

Commit e1f80e4

Browse files
committed
Improve build shell scripts, move fs image to /disk-image folder
1 parent 53b3212 commit e1f80e4

20 files changed

Lines changed: 90 additions & 25 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ net0.pcap
1212
*.dd
1313
.llvmbox
1414
/test/generated_tests
15+
/disk-image

crates/console/build.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#!/usr/bin/env bash
22

33
set -ex
4+
cd "$(dirname "$0")"
45

56
BIN="console"
67
TARGET=aarch64-unknown-none-softfloat
78
PROFILE=${PROFILE-"release"}
89

910
cargo rustc --profile="${PROFILE}" \
10-
--target=${TARGET} -- \
11-
-C relocation-model=static
11+
--target="${TARGET}" \
12+
--bin="${BIN}" \
13+
-- -C relocation-model=static
1214

1315
if test "$PROFILE" = "dev" ; then
1416
BINARY=../../target/${TARGET}/debug/${BIN}
@@ -17,3 +19,7 @@ else
1719
fi
1820

1921
cp "${BINARY}" "${BIN}".elf
22+
23+
if test -n "$DESTDIR" ; then
24+
cp "${BINARY}" "$DESTDIR/"
25+
fi

crates/display-server/build.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#!/usr/bin/env bash
22

33
set -ex
4+
cd "$(dirname "$0")"
45

56
BIN="display-server"
67
TARGET=aarch64-unknown-none-softfloat
78
PROFILE=${PROFILE-"release"}
89

910
cargo rustc --profile="${PROFILE}" \
10-
--target=${TARGET} -- \
11-
-C relocation-model=static
11+
--target="${TARGET}" \
12+
--bin="${BIN}" \
13+
-- -C relocation-model=static
1214

1315
if test "$PROFILE" = "dev" ; then
1416
BINARY=../../target/${TARGET}/debug/${BIN}
@@ -17,3 +19,7 @@ else
1719
fi
1820

1921
cp "${BINARY}" "${BIN}".elf
22+
23+
if test -n "$DESTDIR" ; then
24+
cp "${BINARY}" "$DESTDIR/"
25+
fi

crates/display-server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ fn handle_conns(mut fb: framebuffer::Framebuffer, server_socket: FileDesc) {
795795
}
796796

797797
fn spawn_console() {
798-
let path = b"/console.elf";
798+
let path = b"/console";
799799
let file = ulib::sys::openat(3, path, 0, 0).unwrap();
800800
ulib::sys::spawn_elf(&ulib::sys::SpawnArgs {
801801
fd: file,

crates/doomgeneric/build.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
cd "$(dirname "$0")"
5+
6+
BIN="doomgeneric"
7+
TARGET=aarch64-unknown-none-softfloat
8+
PROFILE=${PROFILE-"release"}
9+
10+
CC=clang cargo rustc --profile="${PROFILE}" \
11+
--target="${TARGET}" \
12+
--bin="${BIN}"
13+
14+
if test "$PROFILE" = "dev" ; then
15+
BINARY=../../target/${TARGET}/debug/${BIN}
16+
else
17+
BINARY=../../target/${TARGET}/${PROFILE}/${BIN}
18+
fi
19+
20+
cp "${BINARY}" "${BIN}".elf
21+
22+
if test -n "$DESTDIR" ; then
23+
cp "${BINARY}" "$DESTDIR/"
24+
fi

crates/init/build.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
#!/usr/bin/env bash
22

33
set -ex
4+
cd "$(dirname "$0")"
45

56
BIN="init"
67
TARGET=aarch64-unknown-none-softfloat
78
PROFILE=${PROFILE-"release"}
89

9-
mkdir -p fs
10+
FS_PATH="../../disk-image"
11+
mkdir -p "$FS_PATH"
1012

11-
# ./shell.rs
12-
# cp shell.elf fs/
13-
# ./ls.rs
14-
# cp ls.elf fs/
1513
./sharedMemTest.rs
16-
cp sharedMemTest.elf fs/
14+
cp sharedMemTest.elf "$FS_PATH/"
1715

1816

19-
cargo run -q -p initfs --bin util \
20-
-- create --compress --out fs.arc --root fs fs --verbose
17+
cargo run -q -p initfs --bin util --release \
18+
-- create --compress --out fs.arc --root "$FS_PATH" "$FS_PATH" --verbose
2119

2220
# cargo clean
2321
cargo rustc --profile="${PROFILE}" \
24-
--target=${TARGET} -- \
25-
-C relocation-model=static
22+
--target="${TARGET}" \
23+
--bin="${BIN}" \
24+
-- -C relocation-model=static
2625

2726
if test "$PROFILE" = "dev" ; then
2827
BINARY=../../target/${TARGET}/debug/${BIN}

crates/init/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub extern "C" fn main() {
2121

2222
let root_fd = 3;
2323

24-
let path = b"display-server.elf";
24+
let path = b"display-server";
2525
let file = ulib::sys::openat(root_fd, path, 0, 0).unwrap();
2626
spawn_elf(&ulib::sys::SpawnArgs {
2727
fd: file,
@@ -36,7 +36,7 @@ pub extern "C" fn main() {
3636
.unwrap();
3737

3838
for _ in 0..4 {
39-
let console_path = "console.elf".as_bytes();
39+
let console_path = "console".as_bytes();
4040
let shell_path = "shell".as_bytes();
4141

4242
spawn_elf(&ulib::sys::SpawnArgs {

crates/kernel/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ log = { version = "0.4", default-features = false }
1515
device-tree = { path = "../device-tree" }
1616
endian = { path = "../endian" }
1717
elf = { path = "../elf" }
18-
initfs = { path = "../initfs"}
1918
filesystem = { path = "../filesystem" }
19+
initfs = { path = "../initfs"}

crates/kernel/scripts/attach-serial.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env bash
2+
13
SERIAL_DEV=/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_B0044ASI-if00-port0
24
LOGFILE=log/$(date -Is).log
35
echo "Logging to $LOGFILE"

crates/kernel/scripts/build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env bash
22

33
set -ex
4+
cd "$(dirname "$0")/.."
45

5-
EXAMPLE=${1-"net"}
6+
EXAMPLE=${1-"user"}
67
TARGET=aarch64-unknown-none-softfloat
78
PROFILE=${PROFILE-"release"}
89

0 commit comments

Comments
 (0)