$(hide) isohybrid --uefi $@ || echo -e "isohybrid not found.\nInstall syslinux 4.0 or higher if you want to build a usb bootable iso."
@echo -e "\n\n$@ is built successfully.\n\n"
-rpm: $(LOCAL_PATH)/rpm/rpm.spec $(BUILT_IMG)
+rpm: $(wildcard $(LOCAL_PATH)/rpm/*) $(BUILT_IMG)
@echo ----- Making an rpm ------
- OUT=$(abspath $(PRODUCT_OUT)); mkdir -p $$OUT/rpm/BUILD; rm -rf mv $$OUT/rpm/RPMS/*; \
+ OUT=$(abspath $(PRODUCT_OUT)); mkdir -p $$OUT/rpm/BUILD; rm -rf $$OUT/rpm/RPMS/*; $(ACP) $< $$OUT; \
rpmbuild -bb --target=$(if $(filter x86,$(TARGET_ARCH)),i686,x86_64) -D"cmdline $(BOARD_KERNEL_CMDLINE)" \
-D"_topdir $$OUT/rpm" -D"_sourcedir $$OUT" -D"systemimg $(notdir $(systemimg))" -D"ver $(VER)" \
$(if $(BUILD_NAME_VARIANT),-D"name $(BUILD_NAME_VARIANT)") \
- -D"install_prefix $(if $(INSTALL_PREFIX),$(INSTALL_PREFIX),android-$(VER))" $<; \
+ -D"install_prefix $(if $(INSTALL_PREFIX),$(INSTALL_PREFIX),android-$(VER))" $(filter %.spec,$^); \
mv $$OUT/rpm/RPMS/*/*.rpm $$OUT
# Note: requires dosfstools
# By Chih-Wei Huang <cwhuang@linux.org.tw>
# and Thorsten Glaser <tg@mirbsd.org>
#
-# Last updated 2017/03/24
+# Last updated 2017/04/23
#
# License: GNU Public License
# We explicitely grant the right to use the scripts
mkdir /mnt/iso
mount -o loop /iso/$iso /mnt/iso
SRC=iso
- elif [ ! -e /mnt/$SRC/$RAMDISK ]; then
+ fi
+ if [ -e /mnt/$SRC/$RAMDISK ]; then
+ zcat /mnt/$SRC/$RAMDISK | cpio -id > /dev/null
+ elif [ -b /dev/$RAMDISK ]; then
+ zcat /dev/$RAMDISK | cpio -id > /dev/null
+ else
return 1
fi
- zcat /mnt/$SRC/$RAMDISK | cpio -id > /dev/null
if [ -e /mnt/$SRC/system.sfs ]; then
mount -o loop,noatime /mnt/$SRC/system.sfs /sfs
mount -o loop,noatime /sfs/system.img system
elif [ -d /mnt/$SRC/system ]; then
remount_rw
mount --bind /mnt/$SRC/system system
+ elif [ -e /mnt/build.prop ]; then
+ mount --bind /mnt system
else
rm -rf *
return 1
echo -n Detecting Android-x86...
[ -z "$SRC" -a -n "$BOOT_IMAGE" ] && SRC=`dirname $BOOT_IMAGE`
-[ -z "$RAMDISK" ] && RAMDISK=ramdisk.img
+[ -z "$RAMDISK" ] && RAMDISK=ramdisk.img || RAMDISK=${RAMDISK##/dev/}
for c in `cat /proc/cmdline`; do
case $c in
#
# By Chih-Wei Huang <cwhuang@linux.org.tw>
-# Last updated 2017/01/10
+# Last updated 2017/04/23
#
# License: GNU Public License
# We explicitely grant the right to use the scripts
if [ -b "/dev/$blk" ]; then
[ ! -e /dev/block/$blk ] && ln /dev/$blk /dev/block
mount -o noatime /dev/block/$blk data
+ elif [ "$DATA" = "9p" ]; then
+ modprobe 9pnet_virtio
+ mount -t 9p -o trans=virtio data data -oversion=9p2000.L,posixacl,cache=loose
else
remount_rw
mkdir -p /mnt/$SRC/$DATA
--- /dev/null
+#!/bin/bash
+# By Chih-Wei Huang <cwhuang@linux.org.tw>
+# License: GNU Generic Public License v2
+
+continue_or_stop()
+{
+ echo "Please Enter to continue or Ctrl-C to stop."
+ read
+}
+
+QEMU_ARCH=`uname -m`
+QEMU=qemu-system-${QEMU_ARCH}
+
+which $QEMU > /dev/null 2>&1 || QEMU=qemu-system-i386
+if ! which $QEMU > /dev/null 2>&1; then
+ echo -e "Please install $QEMU to run the program.\n"
+ exit 1
+fi
+
+cd ${OUT:-ANDROID_ROOT}
+
+[ -e system.img ] && SYSTEMIMG=system.img || SYSTEMIMG=system.sfs
+
+if [ -d data ]; then
+ if [ `id -u` -eq 0 ]; then
+ DATA="-virtfs local,id=data,path=data,security_model=passthrough,mount_tag=data"
+ DATADEV='DATA=9p'
+ else
+ echo -e "\n$(realpath data) subfolder exists.\nIf you want to save data to it, run $0 as root:\n\n$ sudo $0\n"
+ continue_or_stop
+ fi
+elif [ -e data.img ]; then
+ if [ -w data.img ]; then
+ DATA="-drive index=2,if=virtio,id=data,file=data.img"
+ DATADEV='DATA=vdc'
+ else
+ echo -e "\n$(realpath data.img) exists but is not writable.\nPlease grant the write permission if you want to save data to it.\n"
+ continue_or_stop
+ fi
+fi
+
+$QEMU -enable-kvm -vga std -sdl \
+ -kernel kernel \
+ -append "CMDLINE console=ttyS0 RAMDISK=vdb $DATADEV" \
+ -initrd initrd.img \
+ -m 2048 -smp 2 -cpu host \
+ -soundhw ac97 \
+ -net nic,model=e1000 -net user \
+ -serial mon:stdio \
+ -boot menu=on \
+ -drive index=0,if=virtio,id=system,file=$SYSTEMIMG,format=raw,readonly \
+ -drive index=1,if=virtio,id=ramdisk,file=ramdisk.img,format=raw,readonly \
+ $DATA $@
Source2: initrd.img
Source3: ramdisk.img
Source4: %{systemimg}
+Source5: qemu-android
License: Apache Public License / GPLv2
Group: Operating system/Android
URL: http://www.android-x86.org
%install
rm -rf %{buildroot}
-mkdir -p %{buildroot}/%{install_prefix}
+mkdir -p %{buildroot}/%{install_prefix} %{buildroot}%{_bindir}
install -m644 %{S:1} %{S:2} %{S:3} %{S:4} %{buildroot}/%{install_prefix}
+install -m755 %{S:5} %{buildroot}%{_bindir}
+sed -i "s|ANDROID_ROOT|/%{install_prefix}|; s|CMDLINE|%{cmdline}|" %{buildroot}%{_bindir}/`basename %{S:5}`
%post
. /etc/os-release
%files
/%{install_prefix}/*
+%{_bindir}/*