diff --git a/src/rootfsinstall.sh b/src/rootfsinstall.sh index fb91dc7..4364942 100755 --- a/src/rootfsinstall.sh +++ b/src/rootfsinstall.sh @@ -14,9 +14,10 @@ function usage() { echo "Usage: $0 device rootfs-archive [-bpi|-cubox|-rpi] [-a archive] [-c command] [-fs fstype] [-k kernel] [-p password] [-y]" echo echo "Target platform (optional):" - echo "-bpi : make a BananaPi SD with boot partition" - echo "-cubox : make a Cubox SD with boot partition" - echo "-rpi : make a RaspberryPi SD with boot partition" + echo "-baytrail : make a BayTrail image with boot partition" + echo "-bpi : make a BananaPi image with boot partition" + echo "-cubox : make a Cubox image with boot partition" + echo "-rpi : make a RaspberryPi image with boot partition" echo echo "Options:" echo "-a archive : additional archive to unpack in rootfs root" @@ -46,6 +47,7 @@ function usage() { while [ "$1" ]; do case $1 in -y) ASSUMEYES=1 ;; + -baytrail) TARGETDEVICE=baytrail ;; -cubox) TARGETDEVICE=cubox ;; -bpi) TARGETDEVICE=bpi ;; -rpi) TARGETDEVICE=rpi ;; @@ -157,6 +159,16 @@ else fi case $TARGETDEVICE in + baytrail) ARCH=x86_64 + BOOTFSTYPE=fat16 + BOOTFSSIZE=22M + BOOTFSSTART=1049k + KERNELDEST="@BOOT@/kernel.img" + INSTALLPACKAGES="kernel-baytrail kernel-baytrail-headers \ + chipone_ts grub-efi rtl8723bs_bt rtl8723bs axpd $INSTALLPACKAGES" + REMOVEPACKAGES="kernel-mamba-x86_64" + FSTAB_ROOT_DEVICE="/dev/sda2" + ;; bpi) ARCH=arm BOOTFSTYPE=fat32 BOOTFSSIZE=22M @@ -258,6 +270,10 @@ if [ "$BOOTFSTYPE" ]; then echo "ERROR: unable to format $PARTITION1; aborting." exit 1 } ;; + fat16) mkfs.vfat -s 1 -F 16 -n "boot" $PARTITION1 || { + echo "ERROR: unable to format $PARTITION1; aborting." + exit 1 + } ;; ext*) mke2fs -q -t $BOOTFSTYPE -j -L "boot" $PARTITION1 || { echo "ERROR: unable to format $PARTITION1; aborting." exit 1 @@ -371,7 +387,62 @@ KERNELDEST2=`echo $KERNELDEST2 | sed "s|@BOOT@|$BOOTMP|g"` # # Prepare boot partition # -if [ "$TARGETDEVICE" = "bpi" ]; then +if [ "$TARGETDEVICE" = "baytrail" ]; then + # create EFI Grub 64 bit image + mkdir -p $BOOTMP/EFI/BOOT/ + grub-mkimage -o $BOOTMP/EFI/BOOT/bootx64.efi -O x86_64-efi -p /efi/boot \ + part_gpt part_msdos ntfs ntfscomp hfsplus fat ext2 normal chain boot linux echo \ + help gfxterm gettext png efi_gop efi_uga search search_label search_fs_uuid \ + usb_keyboard all_video || { + errorAndExit $"Error: unable to create GRUB x86_64-efi image" &>>$LOGFILE + } + + cat >> $BOOTMP/EFI/BOOT/grub.cfg << _EOF +# +# GRUB configuration generated by openmamba rootfsinstall tool +# +font=unicode +#set gfxmode=auto +set gfxmode=1200x1920 +insmod all_video +insmod gfxterm +insmod gettext +insmod usb_keyboard +terminal_output=gfxterm +set timeout=0 +# theme +insmod=png +set menu_color_normal=white/black +set menu_color_highlight=white/green +search --no-floppy --label --set=root openmamba + +# +# Boot entries taken from ISO bootloader +# + +menuentry "4.9.9-baytrail" { +echo "Loading /boot/vmlinuz-4.9.9-baytrail" +linux /boot/vmlinuz-4.9.9-baytrail root=/dev/sda2 ro intel_idle.max_cstate=1 intel_pstate=disabled fbcon=rotate:1 quiet splash +echo "Loading /boot/initramfs-4.9.9-baitrail.img" +initrd /boot/initramfs-4.9.9-baytrail.img +} +_EOF + + cat >> $ROOTMP/etc/X11/xorg.conf.d/50-rotatemonitor.conf << _EOF +Section "Monitor" + Identifier "DSI1" + Option "Rotate" "right" +EndSection +_EOF + cat >> $ROOTMP/etc/X11/xorg.conf.d/99-calibration.conf << _EOF +Section "InputClass" + Identifier "calibration" + MatchProduct "CHPN0001:00" + Option "Calibration" "1920 0 1200 0" +EndSection +_EOF + : +elif [ "$TARGETDEVICE" = "bpi" ]; then # TODO cp $ROOTMP/boot/Bananapi-script.bin $BOOTMP/ IMAGE=`ls $ROOTMP/boot/uImage-*-sunxi | head -n 1`