Skip to content

Commit 76f5d3d

Browse files
authored
Merge pull request torvalds#456 from luckyluke/lkl_i386_fix
support i386
2 parents 7750a5a + 1589abb commit 76f5d3d

File tree

7 files changed

+23
-4
lines changed

7 files changed

+23
-4
lines changed

.circleci/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ jobs:
9999
MKARG: "dpdk=yes"
100100
<<: *do_steps
101101

102+
i386:
103+
docker:
104+
- image: luckytmp/circleci-i386:latest
105+
environment:
106+
CROSS_COMPILE: ""
107+
<<: *do_steps
108+
102109
mingw32:
103110
docker:
104111
- image: lkldocker/circleci-mingw:0.6
@@ -165,6 +172,7 @@ workflows:
165172
- android-aarch64
166173
- freebsd11_x86_64
167174
- checkpatch
175+
- i386
168176
nightly:
169177
triggers:
170178
- schedule:

arch/lkl/Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ include arch/lkl/auto.conf
22

33
KBUILD_CFLAGS += -fno-builtin
44

5-
ifneq (,$(filter $(OUTPUT_FORMAT),elf64-x86-64 elf64-x86-64-freebsd elf32-littlearm elf64-littleaarch64))
5+
ifneq (,$(filter $(OUTPUT_FORMAT),elf64-x86-64 elf32-i386 elf64-x86-64-freebsd elf32-littlearm elf64-littleaarch64))
66
KBUILD_CFLAGS += -fPIC
77
else ifneq (,$(filter $(OUTPUT_FORMAT),pe-i386 pe-x86-64 ))
88
ifneq ($(OUTPUT_FORMAT),pe-x86-64)
@@ -24,7 +24,13 @@ endif
2424

2525
LDFLAGS_vmlinux += -r
2626
LKL_ENTRY_POINTS := lkl_start_kernel lkl_sys_halt lkl_syscall lkl_trigger_irq \
27-
lkl_get_free_irq lkl_put_irq lkl_is_running
27+
lkl_get_free_irq lkl_put_irq lkl_is_running lkl_bug lkl_printf
28+
29+
ifeq ($(OUTPUT_FORMAT),elf32-i386)
30+
LKL_ENTRY_POINTS += \
31+
__x86.get_pc_thunk.bx __x86.get_pc_thunk.dx __x86.get_pc_thunk.ax \
32+
__x86.get_pc_thunk.cx __x86.get_pc_thunk.si __x86.get_pc_thunk.di
33+
endif
2834

2935
core-y += arch/lkl/kernel/
3036
core-y += arch/lkl/mm/

arch/lkl/scripts/headers_install.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ def replace(h):
178178
q = re.compile("(\w+)\s*(,|=[^,]*|$)", re.M|re.S)
179179
find_enums(p, q, defines)
180180

181+
# needed for i386
182+
defines.add("__NR_stime")
183+
181184
def process_header(h):
182185
print(" REPLACE\t%s" % (out_dir + "/" + os.path.basename(h)))
183186
replace(h)

tools/lkl/Makefile.autoconf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ define posix_host
5858
$(if $(strip $(call find_include,archive.h)),$(call set_autoconf_var,ARCHIVE,y))
5959
$(if $(strip $(call find_include,linux/if_tun.h)),$(call set_autoconf_var,VIRTIO_NET_MACVTAP,y))
6060
$(if $(filter $(1),elf64-x86-64-freebsd),$(call set_autoconf_var,NEEDS_LARGP,y))
61+
$(if $(filter $(1),elf32-i386),$(call set_autoconf_var,I386,y))
6162
endef
6263

6364
define nt64_host

tools/lkl/Targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ endif
66
LDFLAGS_lib/hijack/liblkl-hijack-y += -shared -nodefaultlibs
77
LDLIBS_lib/hijack/liblkl-hijack-y += -ldl
88
LDLIBS_lib/hijack/liblkl-hijack-$(LKL_HOST_CONFIG_ANDROID) += -lgcc -lc
9+
LDLIBS_lib/hijack/liblkl-hijack-$(LKL_HOST_CONFIG_I386) += -lc_nonshared
910

1011
progs-$(LKL_HOST_CONFIG_FUSE) += lklfuse
1112
LDLIBS_lklfuse-y := -lfuse

tools/lkl/include/lkl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extern "C" {
3535
int inet_pton(int af, const char *src, void *dst);
3636
#endif
3737

38-
#if defined(__ANDROID__) && __LKL__BITS_PER_LONG == 32
38+
#if __LKL__BITS_PER_LONG == 32 && (defined(__ANDROID__) || defined(__i386__))
3939
#define __lkl__NR_fcntl __lkl__NR_fcntl64
4040
#endif
4141

tools/lkl/tests/disk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function prepfs()
1010

1111
file=`mktemp`
1212

13-
dd if=/dev/zero of=$file bs=1024 count=102400
13+
dd if=/dev/zero of=$file bs=1024 count=204800
1414

1515
yes | mkfs.$1 $file
1616

0 commit comments

Comments
 (0)