Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.

Commit 4de156f

Browse files
authored
Merge pull request #192 from nathanchance/mips
Add support for MIPS 32-bit little endian
2 parents 0e5c67a + d0c1253 commit 4de156f

File tree

5 files changed

+51
-17
lines changed

5 files changed

+51
-17
lines changed

buildroot/mipsel.config

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
BR2_mipsel=y
2+
BR2_OPTIMIZE_3=y
3+
BR2_KERNEL_HEADERS_4_4=y
4+
BR2_BINUTILS_VERSION_2_31_X=y
5+
BR2_GCC_VERSION_8_X=y
6+
BR2_TARGET_GENERIC_ROOT_PASSWD="root"
7+
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
8+
BR2_ROOTFS_OVERLAY="../overlay-poweroff"
9+
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
10+
BR2_PACKAGE_BASH=y
11+
BR2_TARGET_ROOTFS_CPIO=y
12+
BR2_TARGET_ROOTFS_EXT2=y
13+
BR2_TARGET_ROOTFS_EXT2_4=y
14+
BR2_TARGET_ROOTFS_EXT2_SIZE="20M"
15+
# BR2_TARGET_ROOTFS_TAR is not set

buildroot/rebuild.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ CONFIGS=()
2525
while (( ${#} )); do
2626
case ${1} in
2727
all) for CONFIG in *.config; do CONFIGS+=( "../${CONFIG}" ); done ;;
28-
arm64|arm|ppc32|ppc64le|x86_64) CONFIGS+=( "../${1}.config" ) ;;
28+
arm64|arm|mipsel|ppc32|ppc64le|x86_64) CONFIGS+=( "../${1}.config" ) ;;
2929
*) echo "Unknown parameter '${1}', exiting!"; exit 1 ;;
3030
esac
3131
shift

driver.sh

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,17 @@ setup_variables() {
8989
-append "console=ttyAMA0 root=/dev/vda" )
9090
export CROSS_COMPILE=aarch64-linux-gnu- ;;
9191

92-
"x86_64")
93-
case ${REPO} in
94-
common-*)
95-
config=x86_64_cuttlefish_defconfig
96-
qemu_cmdline=( -append "console=ttyS0"
97-
-initrd "images/x86_64/rootfs.cpio" ) ;;
98-
*)
99-
config=defconfig
100-
qemu_cmdline=( -drive "file=images/x86_64/rootfs.ext4,format=raw,if=ide"
101-
-append "console=ttyS0 root=/dev/sda" ) ;;
102-
esac
103-
# Use KVM if the processor supports it (first part) and the KVM module is loaded (second part)
104-
[[ $(grep -c -E 'vmx|svm' /proc/cpuinfo) -gt 0 && $(lsmod 2>/dev/null | grep -c kvm) -gt 0 ]] && qemu_cmdline=( "${qemu_cmdline[@]}" -enable-kvm )
105-
image_name=bzImage
106-
qemu="qemu-system-x86_64" ;;
92+
"mipsel")
93+
config=malta_defconfig
94+
image_name=vmlinux
95+
qemu="qemu-system-mipsel"
96+
qemu_cmdline=( -machine malta
97+
-cpu 24Kf
98+
-append "root=/dev/sda"
99+
-drive "file=images/mipsel/rootfs.ext4,format=raw,if=ide" )
100+
export ARCH=mips
101+
export CROSS_COMPILE=mipsel-linux-gnu- ;;
102+
107103
"ppc32")
108104
config=ppc44x_defconfig
109105
image_name=zImage
@@ -129,6 +125,22 @@ setup_variables() {
129125
export ARCH=powerpc
130126
export CROSS_COMPILE=powerpc64le-linux-gnu- ;;
131127

128+
"x86_64")
129+
case ${REPO} in
130+
common-*)
131+
config=x86_64_cuttlefish_defconfig
132+
qemu_cmdline=( -append "console=ttyS0"
133+
-initrd "images/x86_64/rootfs.cpio" ) ;;
134+
*)
135+
config=defconfig
136+
qemu_cmdline=( -drive "file=images/x86_64/rootfs.ext4,format=raw,if=ide"
137+
-append "console=ttyS0 root=/dev/sda" ) ;;
138+
esac
139+
# Use KVM if the processor supports it (first part) and the KVM module is loaded (second part)
140+
[[ $(grep -c -E 'vmx|svm' /proc/cpuinfo) -gt 0 && $(lsmod 2>/dev/null | grep -c kvm) -gt 0 ]] && qemu_cmdline=( "${qemu_cmdline[@]}" -enable-kvm )
141+
image_name=bzImage
142+
qemu="qemu-system-x86_64" ;;
143+
132144
# Unknown arch, error out
133145
*)
134146
echo "Unknown ARCH specified!"
@@ -293,7 +305,14 @@ build_linux() {
293305
}
294306

295307
boot_qemu() {
296-
local kernel_image=${tree}/arch/${ARCH}/boot/${image_name}
308+
local kernel_image
309+
310+
if [[ ${image_name} = "vmlinux" ]]; then
311+
kernel_image=${tree}/vmlinux
312+
else
313+
kernel_image=${tree}/arch/${ARCH}/boot/${image_name}
314+
fi
315+
297316
test -e ${kernel_image}
298317
qemu=( timeout 2m unbuffer "${qemu}"
299318
-m "${qemu_ram:=512m}"

images/mipsel/rootfs.cpio

3.63 MB
Binary file not shown.

images/mipsel/rootfs.ext4

20 MB
Binary file not shown.

0 commit comments

Comments
 (0)