Skip to content

Commit 93a215b

Browse files
feat(ports): add python
Signed-off-by: Anhad Singh <[email protected]>
1 parent 0ca27da commit 93a215b

File tree

23 files changed

+354
-106
lines changed

23 files changed

+354
-106
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ KERNEL_TARGET := src/target/x86_64-unknown-none/release/aero_kernel
2121
clean:
2222
rm -rf src/target
2323

24+
.PHONY: check
25+
check:
26+
cd src && cargo check
27+
2428
$(KERNEL_TARGET): $(shell find $(SOURCE_DIR) -type f -not -path '$(SOURCE_DIR)/target/*')
2529
cd src && cargo build --package aero_kernel --release
2630
./build-support/mkiso.sh
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
diff --git python-clean/configure.ac python-workdir/configure.ac
2+
index cd69f0e..74fc416 100644
3+
--- python-clean/configure.ac
4+
+++ python-workdir/configure.ac
5+
@@ -553,6 +553,9 @@ then
6+
*-*-cygwin*)
7+
ac_sys_system=Cygwin
8+
;;
9+
+ *-*-aero*)
10+
+ ac_sys_system=Aero
11+
+ ;;
12+
*-*-vxworks*)
13+
ac_sys_system=VxWorks
14+
;;
15+
@@ -619,6 +622,9 @@ if test "$cross_compiling" = yes; then
16+
*-*-vxworks*)
17+
_host_cpu=$host_cpu
18+
;;
19+
+ *-*-aero*)
20+
+ _host_cpu=$host_cpu
21+
+ ;;
22+
wasm32-*-* | wasm64-*-*)
23+
_host_cpu=$host_cpu
24+
;;
25+
@@ -3216,6 +3222,9 @@ then
26+
CYGWIN*)
27+
LDSHARED="gcc -shared -Wl,--enable-auto-image-base"
28+
LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";;
29+
+ Aero*)
30+
+ LDSHARED='$(CC) -shared'
31+
+ LDCXXSHARED='$(CXX) - shared';;
32+
*) LDSHARED="ld";;
33+
esac
34+
fi
35+
@@ -3268,7 +3277,9 @@ then
36+
else CCSHARED="-Kpic -belf"
37+
fi;;
38+
VxWorks*)
39+
- CCSHARED="-fpic -D__SO_PICABILINUX__ -ftls-model=global-dynamic"
40+
+ CCSHARED="-fpic -D__SO_PICABILINUX__ -ftls-model=global-dynamic";;
41+
+ Aero*)
42+
+ CCSHARED="-fPIC";;
43+
esac
44+
fi
45+
AC_MSG_RESULT([$CCSHARED])
46+
@@ -3338,6 +3349,8 @@ then
47+
LINKFORSHARED='-Wl,-E -N 2048K';;
48+
VxWorks*)
49+
LINKFORSHARED='-Wl,-export-dynamic';;
50+
+ Aero*)
51+
+ LINKFORSHARED='-export-dynamic';;
52+
esac
53+
fi
54+
AC_MSG_RESULT([$LINKFORSHARED])

recipes/python

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name=python
2+
version=3.13.0
3+
tarball_url="https://www.python.org/ftp/python/${version}/Python-${version}a1.tar.xz"
4+
tarball_blake2b="62612d22ce652f4b1d7ce93aa30bd5814dbf271dbe98e321b99d003d7da8f74798e55f556db75fc39b676295c1d1f7b31919c444fe3c667d2fbd2ea16799a211"
5+
source_deps="autoconf-archive"
6+
source_hostdeps="automake autoconf libtool pkg-config"
7+
hostdeps="gcc autoconf automake libtool pkg-config"
8+
deps="core-libs libexpat"
9+
10+
regenerate() {
11+
autotools_recursive_regen
12+
}
13+
14+
build() {
15+
mkdir -p ./build
16+
cd ./build
17+
18+
# XXX make this a host dep
19+
if ! [ -f built ]; then
20+
${source_dir}/configure
21+
22+
make -j${parallelism}
23+
touch built
24+
fi
25+
26+
cd -
27+
28+
CONFIG_SITE=${base_dir}/build-support/python/python-config-site autotools_configure \
29+
--with-system-ffi \
30+
--with-system-expat \
31+
--disable-ipv6 \
32+
--without-ensurepip \
33+
--host=x86_64-aero \
34+
--build=x86_64-linux-gnu \
35+
--with-build-python="$(pwd -P)/build/python" \
36+
--with-pkg-config=yes
37+
38+
make -j${parallelism}
39+
}
40+
41+
package() {
42+
DESTDIR="${dest_dir}" make install
43+
ln -sv python3 "${dest_dir}${prefix}/bin/python"
44+
post_package_strip
45+
}
46+

src/aero_kernel/src/arch/x86_64/task.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,14 @@
3333
use alloc::alloc::alloc_zeroed;
3434

3535
use aero_syscall::{MMapFlags, MMapProt};
36-
use alloc::boxed::Box;
3736
use alloc::vec::Vec;
3837
use raw_cpuid::CpuId;
3938

4039
use core::alloc::Layout;
4140
use core::ptr::Unique;
4241

43-
use crate::arch::controlregs::MxCsr;
4442
use crate::arch::interrupts::InterruptErrorStack;
4543
use crate::fs::cache::DirCacheItem;
46-
use crate::mem::alloc_boxed_buffer;
4744
use crate::mem::paging::*;
4845
use crate::syscall::ExecArgs;
4946
use crate::userland::vm::Vm;

src/aero_kernel/src/arch/x86_64/time.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn pit_irq_handler(_stack: &mut InterruptStack) {
109109

110110
if value % PIT_FREQUENCY_HZ == 0 {
111111
UPTIME_SEC.fetch_add(1, Ordering::Relaxed); // Increment uptime seconds
112-
crate::syscall::check_timers();
112+
crate::syscall::time::check_timers();
113113
}
114114
}
115115

src/aero_kernel/src/drivers/mouse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl INodeInterface for Mouse {
147147
assert_eq!(buffer.len(), size);
148148

149149
unsafe {
150-
*(buffer.as_mut_ptr() as *mut Packet) = packet;
150+
*(buffer.as_mut_ptr().cast::<Packet>()) = packet;
151151
}
152152

153153
Ok(size)

src/aero_kernel/src/fs/devfs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ impl INodeInterface for DevFb {
310310
count = buffer.len() - ((offset + buffer.len()) - fb.len());
311311
}
312312

313-
let raw = buffer.as_ptr() as *const u32;
313+
let raw = buffer.as_ptr().cast::<u32>();
314314
let src = unsafe { core::slice::from_raw_parts(raw, count) };
315315

316316
fb[offset..offset + count].copy_from_slice(src);

src/aero_kernel/src/fs/eventfd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl INodeInterface for EventFd {
6060

6161
// SAFETY: We have above verified that it is safe to dereference
6262
// the value.
63-
let value = unsafe { &mut *(buffer.as_mut_ptr() as *mut u64) };
63+
let value = unsafe { &mut *(buffer.as_mut_ptr().cast::<u64>()) };
6464
let mut count = self.wq.block_on(&self.count, |e| **e != 0)?;
6565

6666
*value = *count;
@@ -75,7 +75,7 @@ impl INodeInterface for EventFd {
7575
assert!(buffer.len() >= chunk_size);
7676

7777
// TODO: use bytemuck to remove the unsafe.
78-
let target = unsafe { *(buffer.as_ptr() as *const u64) };
78+
let target = unsafe { *(buffer.as_ptr().cast::<u64>()) };
7979

8080
if target == u64::MAX {
8181
return Err(FileSystemError::NotSupported);

src/aero_kernel/src/fs/ext2/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ use self::group_desc::GroupDescriptors;
4040
use super::block::{self, BlockDevice, CachedAccess};
4141

4242
use super::cache::{DirCacheItem, INodeCacheItem};
43+
use super::path::PathBuf;
4344
use super::{cache, FileSystemError};
4445

4546
use super::inode::{DirEntry, INodeInterface, Metadata, PollFlags, PollTable};
@@ -518,7 +519,7 @@ impl INodeInterface for INode {
518519
self.make_inode(name, FileType::Socket, Some(inode))
519520
}
520521

521-
fn resolve_link(&self) -> super::Result<String> {
522+
fn resolve_link(&self) -> super::Result<PathBuf> {
522523
if !self.metadata()?.is_symlink() {
523524
return Err(FileSystemError::NotSupported);
524525
}

0 commit comments

Comments
 (0)