├── Dockerfile ├── README.md ├── build.sh ├── flash ├── flash-l500d ├── flash-l801em ├── flash-p4903 ├── flash-sbj-btrfs └── flash-tbj ├── l500d-eu-lvm.ks ├── l500d-in-lvm.ks ├── l801em-lvm.ks ├── p4903-lvm.ks ├── progs ├── bunzip2 ├── bzcat ├── bzip2 ├── img2simg_android ├── img2simg_jolla ├── mkbootimg ├── pack.sh ├── unpack.sh └── unpackbootimg ├── sbj-btrfs.ks └── tbj-lvm.ks /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM coderus/sailfishos-platform-sdk-base 2 | MAINTAINER Andrey Kozhevnikov 3 | 4 | COPY progs/* /usr/bin/ 5 | COPY build.sh /usr/bin/ 6 | 7 | USER root 8 | WORKDIR /root 9 | 10 | RUN set -ex ;\ 11 | chmod +x /usr/bin/* ;\ 12 | test -f /usr/bin/atruncate || zypper -n in atruncate ;\ 13 | test -f /usr/sbin/lvcreate || zypper -n in lvm2 ;\ 14 | test -f /usr/bin/pigz || zypper -n in pigz ;\ 15 | test -f /usr/sbin/modprobe || zypper -n in kmod ;\ 16 | test -f /bin/grep || ln -s /usr/bin/grep /bin/grep 17 | 18 | ENTRYPOINT ["/usr/bin/build.sh"] 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### Saifish OS image builder 2 | 3 | ## Prepare 4 | 5 | ``` 6 | docker build -t sfos-builder . 7 | ``` 8 | 9 | Grab your Jolla Store repo credentials from existing sailfish device: 10 | ``` 11 | cat /etc/ssu/ssu.ini 12 | ``` 13 | 14 | ## Build 15 | 16 | Check comments at the beginning of build.sh file for details 17 | 18 | ``` 19 | docker run --privileged --rm -it -v $PWD:/share -w /share -e RELEASE=4.3.0.15 -e USERNAME=ssu-ini-username -e PASSWORD=ssu-ini-password -e ARCH=armv7hl -e DEVICE=l500d -e DEVICE_VENDOR=qualcomm sfos-builder l500d-eu-lvm.ks 20 | ``` -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # DEVICE=l801em DEVICE_VENDOR=mediatek ./build.sh l801em-lvm.ks 4 | # DEVICE=p4903 ./build.sh p4903-lvm.ks 5 | # DEVICE=l500d ./build.sh l500d-eu-lvm.ks 6 | # DEVICE=l500d ./build.sh l500d-in-lvm.ks 7 | # DEVICE=sbj PATTERN=SbJ ./build.sh sbj-btrfs.ks 8 | # ARCH=i486 DEVICE=tbj DEVICE_VENDOR=intel ./build.sh tbj-lvm.ks 9 | 10 | ARCH=${ARCH:-armv7hl} 11 | DEVICE_VENDOR=${DEVICE_VENDOR:-qualcomm} 12 | DEVICE=${DEVICE:-l500d} 13 | PATTERN=${PATTERN:-${DEVICE}} 14 | RELEASE=${RELEASE:-4.3.0.15} 15 | 16 | FNAME="${1%.*}" 17 | NAME="$DEVICE-$RELEASE-$FNAME" 18 | 19 | echo "machine store-repository.jolla.com login $USERNAME password $PASSWORD" > /root/.netrc 20 | 21 | mic -v -d \ 22 | create loop \ 23 | --arch=$ARCH \ 24 | --outdir=build-$NAME \ 25 | --tokenmap=DEVICE_VENDOR:$DEVICE_VENDOR,DEVICE:$DEVICE,PATTERN:$PATTERN,RELEASE:$RELEASE,ARCH:$ARCH,EXTRA_NAME:$FNAME \ 26 | $1 27 | -------------------------------------------------------------------------------- /flash/flash-l500d: -------------------------------------------------------------------------------- 1 | fastboot flash aboot emmc_appsboot.mbn 2 | fastboot reboot-bootloader 3 | sleep 10 4 | fastboot flash abootbak emmc_appsboot.mbn 5 | fastboot flash modem NON-HLOS.bin 6 | fastboot flash persist persist.img 7 | fastboot flash rpm rpm.mbn 8 | fastboot flash rpmbak rpm.mbn 9 | fastboot flash sbl1 sbl1.mbn 10 | fastboot flash sbl1bak sbl1.mbn 11 | fastboot flash tz tz.mbn 12 | fastboot flash tzbak tz.mbn 13 | fastboot flash sec sec.dat 14 | fastboot flash splash splash.img 15 | fastboot flash boot hybris-boot.img 16 | fastboot flash recovery hybris-recovery.img 17 | fastboot flash system fimage.img001 18 | fastboot flash userdata sailfish.img001 19 | fastboot reboot -------------------------------------------------------------------------------- /flash/flash-l801em: -------------------------------------------------------------------------------- 1 | fastboot flash lk lk.mbn 2 | fastboot flash boot hybris-boot.img 3 | fastboot flash recovery hybris-recovery.img 4 | fastboot flash logo logo.bin 5 | fastboot flash ITEMS items.ini 6 | fastboot flash secro secro.img 7 | fastboot flash tee1 trustzone.bin 8 | fastboot flash tee2 trustzone.bin 9 | fastboot flash splash splash.img 10 | fastboot flash cache cache.img 11 | fastboot flash system fimage.img001 12 | fastboot flash userdata sailfish.img001 13 | fastboot reboot -------------------------------------------------------------------------------- /flash/flash-p4903: -------------------------------------------------------------------------------- 1 | fastboot flash aboot emmc_appsboot.mbn 2 | fastboot reboot-bootloader 3 | sleep 10 4 | fastboot flash abootbak emmc_appsboot.mbn 5 | fastboot flash modem NON-HLOS.bin 6 | fastboot flash persist persist.img 7 | fastboot flash rpm rpm.mbn 8 | fastboot flash rpmbak rpm.mbn 9 | fastboot flash sbl1 sbl1.mbn 10 | fastboot flash sbl1bak sbl1.mbn 11 | fastboot flash tz tz.mbn 12 | fastboot flash tzbak tz.mbn 13 | fastboot flash sec sec.dat 14 | fastboot flash splash splash.img 15 | fastboot flash boot hybris-boot.img 16 | fastboot flash recovery hybris-recovery.img 17 | fastboot flash system fimage.img001 18 | fastboot flash userdata sailfish.img001 19 | fastboot reboot -------------------------------------------------------------------------------- /flash/flash-sbj-btrfs: -------------------------------------------------------------------------------- 1 | fastboot flash aboot emmc_appsboot.mbn 2 | fastboot reboot-bootloader 3 | sleep 10 4 | fastboot flash modem NON-HLOS.bin 5 | fastboot flash persist persist.img 6 | fastboot flash rpm rpm.mbn 7 | fastboot flash sbl1 sbl1.mbn 8 | fastboot flash sbl2 sbl2.mbn 9 | fastboot flash sbl3 sbl3.mbn 10 | fastboot flash tz tz.mbn 11 | fastboot flash boot boot.img 12 | fastboot flash recovery recovery.img 13 | fastboot flash sailfish sailfish.img001 14 | fastboot flash sailfish sailfish.img002 15 | fastboot flash sailfish sailfish.img003 16 | fastboot flash sailfish sailfish.img004 17 | fastboot flash sailfish sailfish.img005 18 | fastboot reboot -------------------------------------------------------------------------------- /flash/flash-tbj: -------------------------------------------------------------------------------- 1 | fastboot flash osloader efilinux-user.efi 2 | fastboot boot droidboot.img 3 | sleep 10 4 | fastboot oem wipe ESP 5 | fastboot oem wipe reserved 6 | fastboot oem start_partitioning 7 | fastboot flash /tmp/partition.tbl partition.tbl 8 | fastboot oem partition /tmp/partition.tbl 9 | fastboot erase logs 10 | fastboot oem stop_partitioning 11 | fastboot flash ESP esp.img 12 | fastboot flash fastboot droidboot.img 13 | fastboot erase sailfish 14 | fastboot flash boot hybris-boot.img 15 | fastboot flash recovery hybris-recovery.img 16 | fastboot flash fimage fimage.img001 17 | fastboot flash sailfish sailfish.img001 18 | fastboot flash sailfish sailfish.img002 19 | fastboot flash sailfish sailfish.img003 20 | fastboot continue 21 | fastboot reboot -------------------------------------------------------------------------------- /l500d-eu-lvm.ks: -------------------------------------------------------------------------------- 1 | timezone --utc UTC 2 | 3 | part / --fstype="ext4" --size=2200 --label=root 4 | part /home --fstype="ext4" --size=800 --label=home 5 | part /fimage --fstype="ext4" --size=10 --label=fimage 6 | 7 | repo --name="adaptation0-@RELEASE@-@DEVICE_VENDOR@-@DEVICE@-@ARCH@" --baseurl=https://store-repository.jolla.com/releases/@RELEASE@/jolla-hw/adaptation-@DEVICE_VENDOR@-@DEVICE@/@ARCH@/ --ssl_verify=yes 8 | repo --name="adaptation1-@RELEASE@-@DEVICE_VENDOR@-@DEVICE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/jolla-hw/adaptation-common/@ARCH@/ --ssl_verify=yes 9 | repo --name="aliendalvik-@RELEASE@-@DEVICE@" --baseurl=https://store-repository.jolla.com/releases/@RELEASE@/aliendalvik/@DEVICE@/ --ssl_verify=yes 10 | repo --name="apps-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/jolla-apps/@RELEASE@/@ARCH@/ --ssl_verify=yes 11 | repo --name="customer-jolla-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/features/@RELEASE@/customers/jolla/@ARCH@/ --ssl_verify=yes 12 | repo --name="hotfixes-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/hotfixes/@ARCH@/ --ssl_verify=yes 13 | repo --name="jolla-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/jolla/@ARCH@/ --ssl_verify=yes 14 | repo --name="sailfish-eas-@RELEASE@-@ARCH@" --baseurl=https://store-repository.jolla.com/features/@RELEASE@/sailfish-eas/@ARCH@/ --ssl_verify=yes 15 | repo --name="xt9-@RELEASE@-@ARCH@" --baseurl=https://store-repository.jolla.com/features/@RELEASE@/xt9/@ARCH@/ --ssl_verify=yes 16 | 17 | %packages 18 | patterns-sailfish-device-configuration-@PATTERN@ 19 | feature-jolla 20 | feature-sailfish-eas 21 | patterns-sailfish-store-applications 22 | qmf-eas-plugin 23 | feature-xt9 24 | jolla-xt9 25 | jolla-xt9-cp 26 | feature-alien 27 | %end 28 | 29 | %attachment 30 | /boot/* 31 | /etc/hw-release 32 | /etc/sailfish-release 33 | %end 34 | 35 | %pre 36 | export SSU_RELEASE_TYPE=release 37 | ### begin 01_init 38 | touch $INSTALL_ROOT/.bootstrap 39 | ### end 01_init 40 | %end 41 | 42 | %post 43 | export SSU_RELEASE_TYPE=release 44 | ### begin 01_arch-hack 45 | if [ "@ARCH@" == armv7hl ] || [ "armv7hl" == armv7tnhl ]; then 46 | # Without this line the rpm does not get the architecture right. 47 | echo -n "armv7hl-meego-linux" > /etc/rpm/platform 48 | 49 | # Also libzypp has problems in autodetecting the architecture so we force tha as well. 50 | # https://bugs.meego.com/show_bug.cgi?id=11484 51 | echo "arch = armv7hl" >> /etc/zypp/zypp.conf 52 | fi 53 | ### end 01_arch-hack 54 | ### begin 01_rpm-rebuilddb 55 | # Rebuild db using target's rpm 56 | echo -n "Rebuilding db using target rpm.." 57 | rm -f /var/lib/rpm/__db* 58 | rpm --rebuilddb 59 | echo "done" 60 | ### end 01_rpm-rebuilddb 61 | ### begin 50_oneshot 62 | # exit boostrap mode 63 | rm -f /.bootstrap 64 | 65 | # export some important variables until there's a better solution 66 | export LANG=en_US.UTF-8 67 | export LC_COLLATE=en_US.UTF-8 68 | export GSETTINGS_BACKEND=gconf 69 | 70 | # run the oneshot triggers for root and first user uid 71 | UID_MIN=$(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) 72 | DEVICEUSER=`getent passwd $UID_MIN | sed 's/:.*//'` 73 | 74 | if [ -x /usr/bin/oneshot ]; then 75 | /usr/bin/oneshot --mic 76 | su -c "/usr/bin/oneshot --mic" $DEVICEUSER 77 | fi 78 | ### end 50_oneshot 79 | ### begin 60_ssu 80 | if [ "$SSU_RELEASE_TYPE" = "rnd" ]; then 81 | [ -n "@RNDRELEASE@" ] && ssu release -r @RNDRELEASE@ 82 | [ -n "@RNDFLAVOUR@" ] && ssu flavour @RNDFLAVOUR@ 83 | # RELEASE is reused in RND setups with parallel release structures 84 | # this makes sure that an image created from such a structure updates from there 85 | [ -n "@RELEASE@" ] && ssu set update-version @RELEASE@ 86 | ssu mode 2 87 | else 88 | [ -n "@RELEASE@" ] && ssu release @RELEASE@ 89 | ssu mode 4 90 | fi 91 | ### end 60_ssu 92 | %end 93 | 94 | %post --nochroot 95 | export SSU_RELEASE_TYPE=release 96 | ### begin 50_os-release 97 | ( 98 | CUSTOMERS=$(find $INSTALL_ROOT/usr/share/ssu/features.d -name 'customer-*.ini' \ 99 | |xargs --no-run-if-empty sed -n 's/^name[[:space:]]*=[[:space:]]*//p') 100 | 101 | cat $INSTALL_ROOT/etc/os-release 102 | echo "SAILFISH_CUSTOMER=\"${CUSTOMERS//$'\n'/ }\"" 103 | ) > $IMG_OUT_DIR/os-release 104 | ### end 50_os-release 105 | ### begin f5121 106 | cp $INSTALL_ROOT/etc/sailfish-release $IMG_OUT_DIR 107 | ### end f5121 108 | %end 109 | 110 | %pack 111 | export SSU_RELEASE_TYPE=release 112 | ### begin hybris 113 | pushd $IMG_OUT_DIR 114 | 115 | MD5SUMFILE=md5.lst 116 | 117 | DEVICE_VERSION_FILE=./hw-release 118 | 119 | EXTRA_NAME="" 120 | 121 | if [ -n "@EXTRA_NAME@" ] && [ "@EXTRA_NAME@" != @"EXTRA_NAME"@ ]; then 122 | EXTRA_NAME="@EXTRA_NAME@-" 123 | fi 124 | 125 | DEVICE="" 126 | DEVICE_VERSION="" 127 | 128 | if [[ -a $DEVICE_VERSION_FILE ]]; then 129 | source $DEVICE_VERSION_FILE 130 | DEVICE=$MER_HA_DEVICE 131 | DEVICE_VERSION=-$VERSION_ID 132 | fi 133 | 134 | source ./sailfish-release 135 | if [ "$SSU_RELEASE_TYPE" = "rnd" ]; then 136 | RELEASENAME=SailfishOS-${EXTRA_NAME// /_}$SAILFISH_FLAVOUR-$VERSION_ID-$DEVICE$DEVICE_VERSION 137 | else 138 | RELEASENAME=SailfishOS-${EXTRA_NAME// /_}$VERSION_ID-$DEVICE$DEVICE_VERSION 139 | fi 140 | 141 | # Setup LVM image 142 | 143 | IMGSECTORS=0 144 | IMGBLOCKS=0 145 | IMGSIZE=0 146 | BLOCKSIZE=0 147 | 148 | resizeloop() { 149 | local IMG=$1 150 | local LOOP=$(/sbin/losetup -f) 151 | /sbin/losetup $LOOP $IMG 152 | /sbin/e2fsck -f -y $LOOP 153 | 154 | # Get image blocks and free blocks 155 | local BLOCKCOUNT=$(/sbin/dumpe2fs -h $LOOP 2>&1 | grep "Block count:" | grep -o -E '[0-9]+') 156 | local FREEBLOCKS=$(/sbin/dumpe2fs -h $LOOP 2>&1 | grep "Free blocks:" | grep -o -E '[0-9]+') 157 | BLOCKSIZE=$(/sbin/dumpe2fs -h $LOOP 2>&1 | grep "Block size:" | grep -o -E '[0-9]+') 158 | echo "$IMG total block count: $BLOCKCOUNT - Free blocks: $FREEBLOCKS" 159 | 160 | local IMAGEBLOCKS=$(/usr/bin/expr $BLOCKCOUNT - $FREEBLOCKS) 161 | local IMAGESECTORS=$(/usr/bin/expr $IMAGEBLOCKS \* $BLOCKSIZE / 512 ) 162 | 163 | # Shrink to minimum 164 | echo "Shrink $IMG to $IMAGESECTORS" 165 | /sbin/resize2fs $LOOP ${IMAGESECTORS}s -f 166 | 167 | # Get the size after resize. 168 | IMGBLOCKS=$(/sbin/dumpe2fs -h $LOOP 2>&1 | grep "Block count:" | grep -o -E '[0-9]+') 169 | IMGSIZE=$(/usr/bin/expr $IMGBLOCKS \* $BLOCKSIZE) 170 | IMGSECTORS=$(/usr/bin/expr $IMGBLOCKS \* $BLOCKSIZE / 512) 171 | echo "$IMG resized block count: $IMGBLOCKS - Block size: $BLOCKSIZE - Sectors: $IMGSECTORS - Total size: $IMGSIZE" 172 | 173 | /sbin/losetup -d $LOOP 174 | } 175 | 176 | echo "Resize root and home" 177 | 178 | # Resize root and home to minimum 179 | resizeloop root.img 180 | 181 | ROOTSIZE=$IMGSIZE 182 | ROOTBLOCKS=$IMGBLOCKS 183 | ROOTSECTORS=$IMGSECTORS 184 | 185 | resizeloop home.img 186 | 187 | HOMESIZE=$IMGSIZE 188 | HOMEBLOCKS=$IMGBLOCKS 189 | HOMESECTORS=$IMGSECTORS 190 | 191 | # We will add some (100M) extra to temp image. 192 | TEMPIMGSECTORS=$(/usr/bin/expr $ROOTSECTORS + $HOMESECTORS + 200000 ) 193 | 194 | dd if=/dev/zero bs=512 count=0 of=temp.img seek=$TEMPIMGSECTORS 195 | 196 | LVM_LOOP=$(/sbin/losetup -f) 197 | /sbin/losetup $LVM_LOOP temp.img 198 | /usr/sbin/pvcreate $LVM_LOOP 199 | /usr/sbin/vgcreate sailfish $LVM_LOOP 200 | 201 | echo "Create logical volume ROOT size: $ROOTSIZE" 202 | /usr/sbin/lvcreate -L ${ROOTSIZE}B --name root sailfish 203 | 204 | echo "Create logical volume HOME size: $HOMESIZE" 205 | /usr/sbin/lvcreate -L ${HOMESIZE}B --name home sailfish 206 | 207 | /bin/sync 208 | /usr/sbin/vgchange -a y sailfish 209 | 210 | dd if=root.img bs=$BLOCKSIZE count=$ROOTBLOCKS of=/dev/sailfish/root 211 | 212 | dd if=home.img bs=$BLOCKSIZE count=$HOMEBLOCKS of=/dev/sailfish/home 213 | 214 | /usr/sbin/vgchange -a n sailfish 215 | 216 | pigz -7 root.img && md5sum -b root.img.gz > root.img.gz.md5& 217 | pigz -7 home.img && md5sum -b home.img.gz > home.img.gz.md5& 218 | wait 219 | 220 | ROOTSIZE=$(/bin/ls -l root.img.gz | cut -d ' ' -f5) 221 | HOMESIZE=$(/bin/ls -l home.img.gz | cut -d ' ' -f5) 222 | 223 | # Temporary dir for making factory image backups. 224 | FIMAGE_TEMP=$(mktemp -d -p $(pwd)) 225 | 226 | # For some reason loop files created by imager don't shrink properly when 227 | # running resize2fs -M on them. Hence manually growing the loop file here 228 | # to make the shrinking work once we have the image populated. 229 | dd if=/dev/zero bs=512 seek=$(/usr/bin/expr \( $ROOTSIZE + $HOMESIZE + 100000000 \) / 512) count=1 of=fimage.img 230 | /sbin/e2fsck -f -y fimage.img 231 | /sbin/resize2fs -f fimage.img 232 | 233 | mount -o loop fimage.img $FIMAGE_TEMP 234 | mkdir -p $FIMAGE_TEMP/${RELEASENAME} 235 | mv root.img.gz* $FIMAGE_TEMP/${RELEASENAME} 236 | mv home.img.gz* $FIMAGE_TEMP/${RELEASENAME} 237 | umount $FIMAGE_TEMP 238 | rmdir $FIMAGE_TEMP 239 | 240 | /sbin/e2fsck -f -y fimage.img 241 | /sbin/resize2fs -f -M fimage.img 242 | 243 | # To make the file magic right lets convert to single file sparse image. 244 | /usr/bin/img2simg_android fimage.img fimage.img001 245 | rm fimage.img 246 | 247 | /sbin/losetup -d $LVM_LOOP 248 | 249 | mv temp.img sailfish.img 250 | 251 | /usr/bin/atruncate sailfish.img 252 | # To make the file magic right lets convert to single file sparse image. 253 | /usr/bin/img2simg_android sailfish.img sailfish.img001 254 | rm sailfish.img 255 | 256 | pigz -d *.gz 257 | rm -f @EXTRA_NAME@* 258 | FILES=$(find -type f -name "*.*") 259 | md5sum $FILES > ${RELEASENAME}.md5 260 | 261 | # Package stuff to archive 262 | tar -cjf ${RELEASENAME}.tar.bz2 $FILES 263 | 264 | popd 265 | ### end hybris 266 | 267 | mv $IMG_OUT_DIR/${RELEASENAME}* . 268 | %end 269 | -------------------------------------------------------------------------------- /l500d-in-lvm.ks: -------------------------------------------------------------------------------- 1 | timezone --utc UTC 2 | 3 | part / --fstype="ext4" --size=2200 --label=root 4 | part /home --fstype="ext4" --size=800 --label=home 5 | part /fimage --fstype="ext4" --size=10 --label=fimage 6 | 7 | repo --name="adaptation0-@RELEASE@-@DEVICE_VENDOR@-@DEVICE@-@ARCH@" --baseurl=https://store-repository.jolla.com/releases/@RELEASE@/jolla-hw/adaptation-@DEVICE_VENDOR@-@DEVICE@/@ARCH@/ --ssl_verify=yes 8 | repo --name="adaptation1-@RELEASE@-@DEVICE_VENDOR@-@DEVICE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/jolla-hw/adaptation-common/@ARCH@/ --ssl_verify=yes 9 | repo --name="aliendalvik-@RELEASE@-@DEVICE@" --baseurl=https://store-repository.jolla.com/releases/@RELEASE@/aliendalvik/@DEVICE@/ --ssl_verify=yes 10 | repo --name="apps-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/jolla-apps/@RELEASE@/@ARCH@/ --ssl_verify=yes 11 | repo --name="customer-jolla-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/features/@RELEASE@/customers/jolla/@ARCH@/ --ssl_verify=yes 12 | repo --name="hotfixes-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/hotfixes/@ARCH@/ --ssl_verify=yes 13 | repo --name="jolla-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/jolla/@ARCH@/ --ssl_verify=yes 14 | repo --name="sailfish-eas-@RELEASE@-@ARCH@" --baseurl=https://store-repository.jolla.com/features/@RELEASE@/sailfish-eas/@ARCH@/ --ssl_verify=yes 15 | repo --name="xt9-@RELEASE@-@ARCH@" --baseurl=https://store-repository.jolla.com/features/@RELEASE@/xt9/@ARCH@/ --ssl_verify=yes 16 | 17 | %packages 18 | patterns-sailfish-device-configuration-@PATTERN@ 19 | feature-jolla 20 | feature-sailfish-eas 21 | patterns-sailfish-store-applications 22 | qmf-eas-plugin 23 | feature-xt9 24 | jolla-xt9 25 | jolla-xt9-cp 26 | feature-alien 27 | droid-modem-l500d-in 28 | %end 29 | 30 | %attachment 31 | /boot/* 32 | /etc/hw-release 33 | /etc/sailfish-release 34 | %end 35 | 36 | %pre 37 | export SSU_RELEASE_TYPE=release 38 | ### begin 01_init 39 | touch $INSTALL_ROOT/.bootstrap 40 | ### end 01_init 41 | %end 42 | 43 | %post 44 | export SSU_RELEASE_TYPE=release 45 | ### begin 01_arch-hack 46 | if [ "@ARCH@" == armv7hl ] || [ "armv7hl" == armv7tnhl ]; then 47 | # Without this line the rpm does not get the architecture right. 48 | echo -n "armv7hl-meego-linux" > /etc/rpm/platform 49 | 50 | # Also libzypp has problems in autodetecting the architecture so we force tha as well. 51 | # https://bugs.meego.com/show_bug.cgi?id=11484 52 | echo "arch = armv7hl" >> /etc/zypp/zypp.conf 53 | fi 54 | ### end 01_arch-hack 55 | ### begin 01_rpm-rebuilddb 56 | # Rebuild db using target's rpm 57 | echo -n "Rebuilding db using target rpm.." 58 | rm -f /var/lib/rpm/__db* 59 | rpm --rebuilddb 60 | echo "done" 61 | ### end 01_rpm-rebuilddb 62 | ### begin 50_oneshot 63 | # exit boostrap mode 64 | rm -f /.bootstrap 65 | 66 | # export some important variables until there's a better solution 67 | export LANG=en_US.UTF-8 68 | export LC_COLLATE=en_US.UTF-8 69 | export GSETTINGS_BACKEND=gconf 70 | 71 | # run the oneshot triggers for root and first user uid 72 | UID_MIN=$(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) 73 | DEVICEUSER=`getent passwd $UID_MIN | sed 's/:.*//'` 74 | 75 | if [ -x /usr/bin/oneshot ]; then 76 | /usr/bin/oneshot --mic 77 | su -c "/usr/bin/oneshot --mic" $DEVICEUSER 78 | fi 79 | ### end 50_oneshot 80 | ### begin 60_ssu 81 | if [ "$SSU_RELEASE_TYPE" = "rnd" ]; then 82 | [ -n "@RNDRELEASE@" ] && ssu release -r @RNDRELEASE@ 83 | [ -n "@RNDFLAVOUR@" ] && ssu flavour @RNDFLAVOUR@ 84 | # RELEASE is reused in RND setups with parallel release structures 85 | # this makes sure that an image created from such a structure updates from there 86 | [ -n "@RELEASE@" ] && ssu set update-version @RELEASE@ 87 | ssu mode 2 88 | else 89 | [ -n "@RELEASE@" ] && ssu release @RELEASE@ 90 | ssu mode 4 91 | fi 92 | ### end 60_ssu 93 | %end 94 | 95 | %post --nochroot 96 | export SSU_RELEASE_TYPE=release 97 | ### begin 50_os-release 98 | ( 99 | CUSTOMERS=$(find $INSTALL_ROOT/usr/share/ssu/features.d -name 'customer-*.ini' \ 100 | |xargs --no-run-if-empty sed -n 's/^name[[:space:]]*=[[:space:]]*//p') 101 | 102 | cat $INSTALL_ROOT/etc/os-release 103 | echo "SAILFISH_CUSTOMER=\"${CUSTOMERS//$'\n'/ }\"" 104 | ) > $IMG_OUT_DIR/os-release 105 | ### end 50_os-release 106 | ### begin f5121 107 | cp $INSTALL_ROOT/etc/sailfish-release $IMG_OUT_DIR 108 | ### end f5121 109 | %end 110 | 111 | %pack 112 | export SSU_RELEASE_TYPE=release 113 | ### begin hybris 114 | pushd $IMG_OUT_DIR 115 | 116 | MD5SUMFILE=md5.lst 117 | 118 | DEVICE_VERSION_FILE=./hw-release 119 | 120 | EXTRA_NAME="" 121 | 122 | if [ -n "@EXTRA_NAME@" ] && [ "@EXTRA_NAME@" != @"EXTRA_NAME"@ ]; then 123 | EXTRA_NAME="@EXTRA_NAME@-" 124 | fi 125 | 126 | DEVICE="" 127 | DEVICE_VERSION="" 128 | 129 | if [[ -a $DEVICE_VERSION_FILE ]]; then 130 | source $DEVICE_VERSION_FILE 131 | DEVICE=$MER_HA_DEVICE 132 | DEVICE_VERSION=-$VERSION_ID 133 | fi 134 | 135 | source ./sailfish-release 136 | if [ "$SSU_RELEASE_TYPE" = "rnd" ]; then 137 | RELEASENAME=SailfishOS-${EXTRA_NAME// /_}$SAILFISH_FLAVOUR-$VERSION_ID-$DEVICE$DEVICE_VERSION 138 | else 139 | RELEASENAME=SailfishOS-${EXTRA_NAME// /_}$VERSION_ID-$DEVICE$DEVICE_VERSION 140 | fi 141 | 142 | # Setup LVM image 143 | 144 | IMGSECTORS=0 145 | IMGBLOCKS=0 146 | IMGSIZE=0 147 | BLOCKSIZE=0 148 | 149 | resizeloop() { 150 | local IMG=$1 151 | local LOOP=$(/sbin/losetup -f) 152 | /sbin/losetup $LOOP $IMG 153 | /sbin/e2fsck -f -y $LOOP 154 | 155 | # Get image blocks and free blocks 156 | local BLOCKCOUNT=$(/sbin/dumpe2fs -h $LOOP 2>&1 | grep "Block count:" | grep -o -E '[0-9]+') 157 | local FREEBLOCKS=$(/sbin/dumpe2fs -h $LOOP 2>&1 | grep "Free blocks:" | grep -o -E '[0-9]+') 158 | BLOCKSIZE=$(/sbin/dumpe2fs -h $LOOP 2>&1 | grep "Block size:" | grep -o -E '[0-9]+') 159 | echo "$IMG total block count: $BLOCKCOUNT - Free blocks: $FREEBLOCKS" 160 | 161 | local IMAGEBLOCKS=$(/usr/bin/expr $BLOCKCOUNT - $FREEBLOCKS) 162 | local IMAGESECTORS=$(/usr/bin/expr $IMAGEBLOCKS \* $BLOCKSIZE / 512 ) 163 | 164 | # Shrink to minimum 165 | echo "Shrink $IMG to $IMAGESECTORS" 166 | /sbin/resize2fs $LOOP ${IMAGESECTORS}s -f 167 | 168 | # Get the size after resize. 169 | IMGBLOCKS=$(/sbin/dumpe2fs -h $LOOP 2>&1 | grep "Block count:" | grep -o -E '[0-9]+') 170 | IMGSIZE=$(/usr/bin/expr $IMGBLOCKS \* $BLOCKSIZE) 171 | IMGSECTORS=$(/usr/bin/expr $IMGBLOCKS \* $BLOCKSIZE / 512) 172 | echo "$IMG resized block count: $IMGBLOCKS - Block size: $BLOCKSIZE - Sectors: $IMGSECTORS - Total size: $IMGSIZE" 173 | 174 | /sbin/losetup -d $LOOP 175 | } 176 | 177 | echo "Resize root and home" 178 | 179 | # Resize root and home to minimum 180 | resizeloop root.img 181 | 182 | ROOTSIZE=$IMGSIZE 183 | ROOTBLOCKS=$IMGBLOCKS 184 | ROOTSECTORS=$IMGSECTORS 185 | 186 | resizeloop home.img 187 | 188 | HOMESIZE=$IMGSIZE 189 | HOMEBLOCKS=$IMGBLOCKS 190 | HOMESECTORS=$IMGSECTORS 191 | 192 | # We will add some (100M) extra to temp image. 193 | TEMPIMGSECTORS=$(/usr/bin/expr $ROOTSECTORS + $HOMESECTORS + 200000 ) 194 | 195 | dd if=/dev/zero bs=512 count=0 of=temp.img seek=$TEMPIMGSECTORS 196 | 197 | LVM_LOOP=$(/sbin/losetup -f) 198 | /sbin/losetup $LVM_LOOP temp.img 199 | /usr/sbin/pvcreate $LVM_LOOP 200 | /usr/sbin/vgcreate sailfish $LVM_LOOP 201 | 202 | echo "Create logical volume ROOT size: $ROOTSIZE" 203 | /usr/sbin/lvcreate -L ${ROOTSIZE}B --name root sailfish 204 | 205 | echo "Create logical volume HOME size: $HOMESIZE" 206 | /usr/sbin/lvcreate -L ${HOMESIZE}B --name home sailfish 207 | 208 | /bin/sync 209 | /usr/sbin/vgchange -a y sailfish 210 | 211 | dd if=root.img bs=$BLOCKSIZE count=$ROOTBLOCKS of=/dev/sailfish/root 212 | 213 | dd if=home.img bs=$BLOCKSIZE count=$HOMEBLOCKS of=/dev/sailfish/home 214 | 215 | /usr/sbin/vgchange -a n sailfish 216 | 217 | pigz -7 root.img && md5sum -b root.img.gz > root.img.gz.md5& 218 | pigz -7 home.img && md5sum -b home.img.gz > home.img.gz.md5& 219 | wait 220 | 221 | ROOTSIZE=$(/bin/ls -l root.img.gz | cut -d ' ' -f5) 222 | HOMESIZE=$(/bin/ls -l home.img.gz | cut -d ' ' -f5) 223 | 224 | # Temporary dir for making factory image backups. 225 | FIMAGE_TEMP=$(mktemp -d -p $(pwd)) 226 | 227 | # For some reason loop files created by imager don't shrink properly when 228 | # running resize2fs -M on them. Hence manually growing the loop file here 229 | # to make the shrinking work once we have the image populated. 230 | dd if=/dev/zero bs=512 seek=$(/usr/bin/expr \( $ROOTSIZE + $HOMESIZE + 100000000 \) / 512) count=1 of=fimage.img 231 | /sbin/e2fsck -f -y fimage.img 232 | /sbin/resize2fs -f fimage.img 233 | 234 | mount -o loop fimage.img $FIMAGE_TEMP 235 | mkdir -p $FIMAGE_TEMP/${RELEASENAME} 236 | mv root.img.gz* $FIMAGE_TEMP/${RELEASENAME} 237 | mv home.img.gz* $FIMAGE_TEMP/${RELEASENAME} 238 | umount $FIMAGE_TEMP 239 | rmdir $FIMAGE_TEMP 240 | 241 | /sbin/e2fsck -f -y fimage.img 242 | /sbin/resize2fs -f -M fimage.img 243 | 244 | # To make the file magic right lets convert to single file sparse image. 245 | /usr/bin/img2simg_android fimage.img fimage.img001 246 | rm fimage.img 247 | 248 | /sbin/losetup -d $LVM_LOOP 249 | 250 | mv temp.img sailfish.img 251 | 252 | /usr/bin/atruncate sailfish.img 253 | # To make the file magic right lets convert to single file sparse image. 254 | /usr/bin/img2simg_android sailfish.img sailfish.img001 255 | rm sailfish.img 256 | 257 | 258 | pigz -d *.gz 259 | rm -f @EXTRA_NAME@* 260 | FILES=$(find -type f -name "*.*") 261 | md5sum $FILES > ${RELEASENAME}.md5 262 | 263 | # Package stuff to archive 264 | tar -cjf ${RELEASENAME}.tar.bz2 $FILES 265 | 266 | popd 267 | ### end hybris 268 | 269 | mv $IMG_OUT_DIR/${RELEASENAME}* . 270 | %end 271 | -------------------------------------------------------------------------------- /l801em-lvm.ks: -------------------------------------------------------------------------------- 1 | keyboard us 2 | user --name nemo --groups audio,input,video --password nemo 3 | timezone --utc UTC 4 | lang en_US.UTF-8 5 | 6 | part / --fstype="ext4" --size=1800 --label=root 7 | part /home --fstype="ext4" --size=800 --label=home 8 | part /fimage --fstype="ext4" --size=10 --label=fimage 9 | 10 | repo --name="adaptation0-@RELEASE@-@DEVICE_VENDOR@-@DEVICE@-@ARCH@" --baseurl=https://store-repository.jolla.com/releases/@RELEASE@/jolla-hw/adaptation-@DEVICE_VENDOR@-@DEVICE@/@ARCH@/ --ssl_verify=yes 11 | repo --name="adaptation1-@RELEASE@-@DEVICE_VENDOR@-@DEVICE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/jolla-hw/adaptation-common/@ARCH@/ --ssl_verify=yes 12 | repo --name="apps-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/jolla-apps/@RELEASE@/@ARCH@/ --ssl_verify=yes 13 | repo --name="customer-jolla-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/features/@RELEASE@/customers/jolla/@ARCH@/ --ssl_verify=yes 14 | repo --name="hotfixes-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/hotfixes/@ARCH@/ --ssl_verify=yes 15 | repo --name="jolla-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/jolla/@ARCH@/ --ssl_verify=yes 16 | repo --name="sailfish-eas-@RELEASE@-@ARCH@" --baseurl=https://store-repository.jolla.com/features/@RELEASE@/sailfish-eas/@ARCH@/ --ssl_verify=yes 17 | repo --name="xt9-@RELEASE@-@ARCH@" --baseurl=https://store-repository.jolla.com/features/@RELEASE@/xt9/@ARCH@/ --ssl_verify=yes 18 | 19 | %packages 20 | @Jolla Configuration @PATTERN@ 21 | feature-jolla 22 | feature-sailfish-eas 23 | patterns-sailfish-store-applications 24 | qmf-eas-plugin 25 | feature-xt9 26 | jolla-xt9 27 | jolla-xt9-cp 28 | %end 29 | 30 | %attachment 31 | ### Commands from /tmp/sandbox/usr/share/ssu/kickstart/attachment/f5121 32 | /boot/* 33 | /etc/hw-release 34 | /etc/sailfish-release 35 | %end 36 | 37 | %pre 38 | export SSU_RELEASE_TYPE=release 39 | ### begin 01_init 40 | touch $INSTALL_ROOT/.bootstrap 41 | ### end 01_init 42 | %end 43 | 44 | %post 45 | export SSU_RELEASE_TYPE=release 46 | ### begin 01_arch-hack 47 | if [ "@ARCH@" == armv7hl ] || [ "armv7hl" == armv7tnhl ]; then 48 | # Without this line the rpm does not get the architecture right. 49 | echo -n "armv7hl-meego-linux" > /etc/rpm/platform 50 | 51 | # Also libzypp has problems in autodetecting the architecture so we force tha as well. 52 | # https://bugs.meego.com/show_bug.cgi?id=11484 53 | echo "arch = armv7hl" >> /etc/zypp/zypp.conf 54 | fi 55 | ### end 01_arch-hack 56 | ### begin 01_rpm-rebuilddb 57 | # Rebuild db using target's rpm 58 | echo -n "Rebuilding db using target rpm.." 59 | rm -f /var/lib/rpm/__db* 60 | rpm --rebuilddb 61 | echo "done" 62 | ### end 01_rpm-rebuilddb 63 | ### begin 50_oneshot 64 | # exit boostrap mode 65 | rm -f /.bootstrap 66 | 67 | # export some important variables until there's a better solution 68 | export LANG=en_US.UTF-8 69 | export LC_COLLATE=en_US.UTF-8 70 | export GSETTINGS_BACKEND=gconf 71 | 72 | # run the oneshot triggers for root and first user uid 73 | UID_MIN=$(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) 74 | DEVICEUSER=`getent passwd $UID_MIN | sed 's/:.*//'` 75 | 76 | if [ -x /usr/bin/oneshot ]; then 77 | /usr/bin/oneshot --mic 78 | su -c "/usr/bin/oneshot --mic" $DEVICEUSER 79 | fi 80 | ### end 50_oneshot 81 | ### begin 60_ssu 82 | if [ "$SSU_RELEASE_TYPE" = "rnd" ]; then 83 | [ -n "@RNDRELEASE@" ] && ssu release -r @RNDRELEASE@ 84 | [ -n "@RNDFLAVOUR@" ] && ssu flavour @RNDFLAVOUR@ 85 | # RELEASE is reused in RND setups with parallel release structures 86 | # this makes sure that an image created from such a structure updates from there 87 | [ -n "@RELEASE@" ] && ssu set update-version @RELEASE@ 88 | ssu mode 2 89 | else 90 | [ -n "@RELEASE@" ] && ssu release @RELEASE@ 91 | ssu mode 4 92 | fi 93 | ### end 60_ssu 94 | %end 95 | 96 | %post --nochroot 97 | export SSU_RELEASE_TYPE=release 98 | ### begin 50_os-release 99 | ( 100 | CUSTOMERS=$(find $INSTALL_ROOT/usr/share/ssu/features.d -name 'customer-*.ini' \ 101 | |xargs --no-run-if-empty sed -n 's/^name[[:space:]]*=[[:space:]]*//p') 102 | 103 | cat $INSTALL_ROOT/etc/os-release 104 | echo "SAILFISH_CUSTOMER=\"${CUSTOMERS//$'\n'/ }\"" 105 | ) > $IMG_OUT_DIR/os-release 106 | ### end 50_os-release 107 | ### begin f5121 108 | cp $INSTALL_ROOT/etc/sailfish-release $IMG_OUT_DIR 109 | ### end f5121 110 | %end 111 | 112 | %pack 113 | export SSU_RELEASE_TYPE=release 114 | ### begin hybris 115 | pushd $IMG_OUT_DIR 116 | 117 | MD5SUMFILE=md5.lst 118 | 119 | DEVICE_VERSION_FILE=./hw-release 120 | 121 | EXTRA_NAME="" 122 | 123 | if [ -n "@EXTRA_NAME@" ] && [ "@EXTRA_NAME@" != @"EXTRA_NAME"@ ]; then 124 | EXTRA_NAME="@EXTRA_NAME@-" 125 | fi 126 | 127 | DEVICE="" 128 | DEVICE_VERSION="" 129 | 130 | if [[ -a $DEVICE_VERSION_FILE ]]; then 131 | source $DEVICE_VERSION_FILE 132 | DEVICE=$MER_HA_DEVICE 133 | DEVICE_VERSION=-$VERSION_ID 134 | fi 135 | 136 | source ./sailfish-release 137 | if [ "$SSU_RELEASE_TYPE" = "rnd" ]; then 138 | RELEASENAME=SailfishOS-${EXTRA_NAME// /_}$SAILFISH_FLAVOUR-$VERSION_ID-$DEVICE$DEVICE_VERSION 139 | else 140 | RELEASENAME=SailfishOS-${EXTRA_NAME// /_}$VERSION_ID-$DEVICE$DEVICE_VERSION 141 | fi 142 | 143 | # Setup LVM image 144 | dd if=/dev/zero bs=1 count=0 of=temp.img seek=3000M 145 | LVM_LOOP=$(/sbin/losetup -f) 146 | /sbin/losetup $LVM_LOOP temp.img 147 | /usr/sbin/pvcreate $LVM_LOOP 148 | /usr/sbin/vgcreate sailfish $LVM_LOOP 149 | 150 | # Resize root and home to minimum 151 | ROOT_LOOP=$(/sbin/losetup -f) 152 | /sbin/losetup $ROOT_LOOP root.img 153 | /sbin/e2fsck -f -y $ROOT_LOOP 154 | # The "on is al ready" sed hack is added to handle cases when resize2fs 155 | # outputs "The filesystem is already X blocks long" to stderr: 156 | BLOCKS=$(/sbin/resize2fs -M $ROOT_LOOP 2>&1 | tail -n 2 | sed "s/is already/on is al ready/" | /bin/grep "The filesystem on" | /bin/cut -d ' ' -f 7) 157 | echo We got ourselves root blocks _ $BLOCKS _ 158 | SIZE=$(/usr/bin/expr $BLOCKS \* 4096) 159 | echo after maths size _ $SIZE _ 160 | /usr/sbin/lvcreate -L ${SIZE}B --name root sailfish 161 | /bin/sync 162 | /sbin/losetup -d $ROOT_LOOP 163 | /usr/sbin/vgchange -a y 164 | dd if=root.img bs=4096 count=$BLOCKS of=/dev/sailfish/root 165 | 166 | HOME_LOOP=$(/sbin/losetup -f) 167 | /sbin/losetup $HOME_LOOP home.img 168 | /sbin/e2fsck -f -y $HOME_LOOP 169 | # The "on is al ready" sed hack is added to handle cases when resize2fs 170 | # outputs "The filesystem is already X blocks long" to stderr: 171 | BLOCKS=$(/sbin/resize2fs -M $HOME_LOOP 2>&1 | tail -n 2 | sed "s/is already/on is al ready/" | /bin/grep "The filesystem on" | /bin/cut -d ' ' -f 7) 172 | echo We got ourselves home size _ $BLOCKS _ 173 | SIZE=$(/usr/bin/expr $BLOCKS \* 4096) 174 | 175 | /usr/sbin/lvcreate -L ${SIZE}B --name home sailfish 176 | /bin/sync 177 | /sbin/losetup -d $HOME_LOOP 178 | /usr/sbin/vgchange -a y 179 | dd if=home.img bs=4096 count=$BLOCKS of=/dev/sailfish/home 180 | 181 | /usr/sbin/vgchange -a n sailfish 182 | 183 | # Temporary dir for making factory image backups. 184 | FIMAGE_TEMP=$(mktemp -d -p $(pwd)) 185 | 186 | # For some reason loop files created by imager don't shrink properly when 187 | # running resize2fs -M on them. Hence manually growing the loop file here 188 | # to make the shrinking work once we have the image populated. 189 | dd if=/dev/zero bs=1 seek=1400000000 count=1 of=fimage.img 190 | /sbin/e2fsck -f -y fimage.img 191 | /sbin/resize2fs -f fimage.img 192 | 193 | pigz -7 root.img 194 | md5sum -b root.img.gz > root.img.gz.md5 195 | 196 | pigz -7 home.img 197 | md5sum -b home.img.gz > home.img.gz.md5 198 | 199 | mount -o loop fimage.img $FIMAGE_TEMP 200 | mkdir -p $FIMAGE_TEMP/${RELEASENAME} 201 | mv root.img.gz* $FIMAGE_TEMP/${RELEASENAME} 202 | mv home.img.gz* $FIMAGE_TEMP/${RELEASENAME} 203 | umount $FIMAGE_TEMP 204 | rm -rf $FIMAGE_TEMP 205 | 206 | /sbin/e2fsck -f -y fimage.img 207 | /sbin/resize2fs -f -M fimage.img 208 | 209 | /usr/bin/img2simg_android fimage.img fimage.img001 210 | rm fimage.img 211 | 212 | /sbin/losetup -d $LVM_LOOP 213 | 214 | mv temp.img sailfish.img 215 | 216 | /usr/bin/atruncate sailfish.img 217 | /usr/bin/img2simg_android sailfish.img sailfish.img001 218 | rm sailfish.img 219 | 220 | pigz -d *.gz 221 | rm -f @EXTRA_NAME@* 222 | FILES=$(find -type f -name "*.*") 223 | md5sum $FILES > ${RELEASENAME}.md5 224 | 225 | # Package stuff to archive 226 | tar -cjf ${RELEASENAME}.tar.bz2 $FILES 227 | 228 | popd 229 | ### end hybris 230 | 231 | mv $IMG_OUT_DIR/${RELEASENAME}* . 232 | %end 233 | -------------------------------------------------------------------------------- /p4903-lvm.ks: -------------------------------------------------------------------------------- 1 | keyboard us 2 | user --name nemo --groups audio,input,video --password nemo 3 | timezone --utc UTC 4 | lang en_US.UTF-8 5 | 6 | part / --fstype="ext4" --size=1800 --label=root 7 | part /home --fstype="ext4" --size=800 --label=home 8 | part /fimage --fstype="ext4" --size=10 --label=fimage 9 | 10 | repo --name="adaptation0-@RELEASE@-@DEVICE_VENDOR@-@DEVICE@-@ARCH@" --baseurl=https://store-repository.jolla.com/releases/@RELEASE@/jolla-hw/adaptation-@DEVICE_VENDOR@-@DEVICE@/@ARCH@/ --ssl_verify=yes 11 | repo --name="adaptation1-@RELEASE@-@DEVICE_VENDOR@-@DEVICE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/jolla-hw/adaptation-common/@ARCH@/ --ssl_verify=yes 12 | repo --name="apps-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/jolla-apps/@RELEASE@/@ARCH@/ --ssl_verify=yes 13 | repo --name="customer-jolla-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/features/@RELEASE@/customers/jolla/@ARCH@/ --ssl_verify=yes 14 | repo --name="hotfixes-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/hotfixes/@ARCH@/ --ssl_verify=yes 15 | repo --name="jolla-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/jolla/@ARCH@/ --ssl_verify=yes 16 | repo --name="sailfish-eas-@RELEASE@-@ARCH@" --baseurl=https://store-repository.jolla.com/features/@RELEASE@/sailfish-eas/@ARCH@/ --ssl_verify=yes 17 | repo --name="xt9-@RELEASE@-@ARCH@" --baseurl=https://store-repository.jolla.com/features/@RELEASE@/xt9/@ARCH@/ --ssl_verify=yes 18 | 19 | %packages 20 | @Jolla Configuration @PATTERN@ 21 | feature-jolla 22 | feature-sailfish-eas 23 | patterns-sailfish-store-applications 24 | qmf-eas-plugin 25 | feature-xt9 26 | jolla-xt9 27 | jolla-xt9-cp 28 | %end 29 | 30 | %attachment 31 | ### Commands from /tmp/sandbox/usr/share/ssu/kickstart/attachment/f5121 32 | /boot/* 33 | /etc/hw-release 34 | /etc/sailfish-release 35 | %end 36 | 37 | %pre 38 | export SSU_RELEASE_TYPE=release 39 | ### begin 01_init 40 | touch $INSTALL_ROOT/.bootstrap 41 | ### end 01_init 42 | %end 43 | 44 | %post 45 | export SSU_RELEASE_TYPE=release 46 | ### begin 01_arch-hack 47 | if [ "@ARCH@" == armv7hl ] || [ "@ARCH@" == armv7tnhl ]; then 48 | # Without this line the rpm does not get the architecture right. 49 | echo -n "armv7hl-meego-linux" > /etc/rpm/platform 50 | 51 | # Also libzypp has problems in autodetecting the architecture so we force tha as well. 52 | # https://bugs.meego.com/show_bug.cgi?id=11484 53 | echo "arch = armv7hl" >> /etc/zypp/zypp.conf 54 | fi 55 | ### end 01_arch-hack 56 | ### begin 01_rpm-rebuilddb 57 | # Rebuild db using target's rpm 58 | echo -n "Rebuilding db using target rpm.." 59 | rm -f /var/lib/rpm/__db* 60 | rpm --rebuilddb 61 | echo "done" 62 | ### end 01_rpm-rebuilddb 63 | ### begin 50_oneshot 64 | # exit boostrap mode 65 | rm -f /.bootstrap 66 | 67 | # export some important variables until there's a better solution 68 | export LANG=en_US.UTF-8 69 | export LC_COLLATE=en_US.UTF-8 70 | export GSETTINGS_BACKEND=gconf 71 | 72 | # run the oneshot triggers for root and first user uid 73 | UID_MIN=$(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) 74 | DEVICEUSER=`getent passwd $UID_MIN | sed 's/:.*//'` 75 | 76 | if [ -x /usr/bin/oneshot ]; then 77 | /usr/bin/oneshot --mic 78 | su -c "/usr/bin/oneshot --mic" $DEVICEUSER 79 | fi 80 | ### end 50_oneshot 81 | ### begin 60_ssu 82 | if [ "$SSU_RELEASE_TYPE" = "rnd" ]; then 83 | [ -n "@RNDRELEASE@" ] && ssu release -r @RNDRELEASE@ 84 | [ -n "@RNDFLAVOUR@" ] && ssu flavour @RNDFLAVOUR@ 85 | # RELEASE is reused in RND setups with parallel release structures 86 | # this makes sure that an image created from such a structure updates from there 87 | [ -n "@RELEASE@" ] && ssu set update-version @RELEASE@ 88 | ssu mode 2 89 | else 90 | [ -n "@RELEASE@" ] && ssu release @RELEASE@ 91 | ssu mode 4 92 | fi 93 | ### end 60_ssu 94 | %end 95 | 96 | %post --nochroot 97 | export SSU_RELEASE_TYPE=release 98 | ### begin 50_os-release 99 | ( 100 | CUSTOMERS=$(find $INSTALL_ROOT/usr/share/ssu/features.d -name 'customer-*.ini' \ 101 | |xargs --no-run-if-empty sed -n 's/^name[[:space:]]*=[[:space:]]*//p') 102 | 103 | cat $INSTALL_ROOT/etc/os-release 104 | echo "SAILFISH_CUSTOMER=\"${CUSTOMERS//$'\n'/ }\"" 105 | ) > $IMG_OUT_DIR/os-release 106 | ### end 50_os-release 107 | ### begin f5121 108 | cp $INSTALL_ROOT/etc/sailfish-release $IMG_OUT_DIR 109 | ### end f5121 110 | %end 111 | 112 | %pack 113 | export SSU_RELEASE_TYPE=release 114 | ### begin hybris 115 | pushd $IMG_OUT_DIR 116 | 117 | MD5SUMFILE=md5.lst 118 | 119 | DEVICE_VERSION_FILE=./hw-release 120 | 121 | EXTRA_NAME="" 122 | 123 | if [ -n "@EXTRA_NAME@" ] && [ "@EXTRA_NAME@" != @"EXTRA_NAME"@ ]; then 124 | EXTRA_NAME="@EXTRA_NAME@-" 125 | fi 126 | 127 | DEVICE="" 128 | DEVICE_VERSION="" 129 | 130 | if [[ -a $DEVICE_VERSION_FILE ]]; then 131 | source $DEVICE_VERSION_FILE 132 | DEVICE=$MER_HA_DEVICE 133 | DEVICE_VERSION=-$VERSION_ID 134 | fi 135 | 136 | source ./sailfish-release 137 | if [ "$SSU_RELEASE_TYPE" = "rnd" ]; then 138 | RELEASENAME=SailfishOS-${EXTRA_NAME// /_}$SAILFISH_FLAVOUR-$VERSION_ID-$DEVICE$DEVICE_VERSION 139 | else 140 | RELEASENAME=SailfishOS-${EXTRA_NAME// /_}$VERSION_ID-$DEVICE$DEVICE_VERSION 141 | fi 142 | 143 | # Setup LVM image 144 | dd if=/dev/zero bs=1 count=0 of=temp.img seek=3000M 145 | LVM_LOOP=$(/sbin/losetup -f) 146 | /sbin/losetup $LVM_LOOP temp.img 147 | /usr/sbin/pvcreate $LVM_LOOP 148 | /usr/sbin/vgcreate sailfish $LVM_LOOP 149 | 150 | # Resize root and home to minimum 151 | ROOT_LOOP=$(/sbin/losetup -f) 152 | /sbin/losetup $ROOT_LOOP root.img 153 | /sbin/e2fsck -f -y $ROOT_LOOP 154 | # The "on is al ready" sed hack is added to handle cases when resize2fs 155 | # outputs "The filesystem is already X blocks long" to stderr: 156 | BLOCKS=$(/sbin/resize2fs -M $ROOT_LOOP 2>&1 | tail -n 2 | sed "s/is already/on is al ready/" | /bin/grep "The filesystem on" | /bin/cut -d ' ' -f 7) 157 | echo We got ourselves root blocks _ $BLOCKS _ 158 | SIZE=$(/usr/bin/expr $BLOCKS \* 4096) 159 | echo after maths size _ $SIZE _ 160 | /usr/sbin/lvcreate -L ${SIZE}B --name root sailfish 161 | /bin/sync 162 | /sbin/losetup -d $ROOT_LOOP 163 | /usr/sbin/vgchange -a y 164 | dd if=root.img bs=4096 count=$BLOCKS of=/dev/sailfish/root 165 | 166 | HOME_LOOP=$(/sbin/losetup -f) 167 | /sbin/losetup $HOME_LOOP home.img 168 | /sbin/e2fsck -f -y $HOME_LOOP 169 | # The "on is al ready" sed hack is added to handle cases when resize2fs 170 | # outputs "The filesystem is already X blocks long" to stderr: 171 | BLOCKS=$(/sbin/resize2fs -M $HOME_LOOP 2>&1 | tail -n 2 | sed "s/is already/on is al ready/" | /bin/grep "The filesystem on" | /bin/cut -d ' ' -f 7) 172 | echo We got ourselves home size _ $BLOCKS _ 173 | SIZE=$(/usr/bin/expr $BLOCKS \* 4096) 174 | 175 | /usr/sbin/lvcreate -L ${SIZE}B --name home sailfish 176 | /bin/sync 177 | /sbin/losetup -d $HOME_LOOP 178 | /usr/sbin/vgchange -a y 179 | dd if=home.img bs=4096 count=$BLOCKS of=/dev/sailfish/home 180 | 181 | /usr/sbin/vgchange -a n sailfish 182 | 183 | # Temporary dir for making factory image backups. 184 | FIMAGE_TEMP=$(mktemp -d -p $(pwd)) 185 | 186 | # For some reason loop files created by imager don't shrink properly when 187 | # running resize2fs -M on them. Hence manually growing the loop file here 188 | # to make the shrinking work once we have the image populated. 189 | dd if=/dev/zero bs=1 seek=1400000000 count=1 of=fimage.img 190 | /sbin/e2fsck -f -y fimage.img 191 | /sbin/resize2fs -f fimage.img 192 | 193 | pigz -7 root.img 194 | md5sum -b root.img.gz > root.img.gz.md5 195 | 196 | pigz -7 home.img 197 | md5sum -b home.img.gz > home.img.gz.md5 198 | 199 | mount -o loop fimage.img $FIMAGE_TEMP 200 | mkdir -p $FIMAGE_TEMP/${RELEASENAME} 201 | mv root.img.gz* $FIMAGE_TEMP/${RELEASENAME} 202 | mv home.img.gz* $FIMAGE_TEMP/${RELEASENAME} 203 | umount $FIMAGE_TEMP 204 | rm -rf $FIMAGE_TEMP 205 | 206 | /sbin/e2fsck -f -y fimage.img 207 | /sbin/resize2fs -f -M fimage.img 208 | 209 | /usr/bin/img2simg_android fimage.img fimage.img001 210 | rm fimage.img 211 | 212 | /sbin/losetup -d $LVM_LOOP 213 | 214 | mv temp.img sailfish.img 215 | 216 | /usr/bin/atruncate sailfish.img 217 | /usr/bin/img2simg_android sailfish.img sailfish.img001 218 | rm sailfish.img 219 | 220 | pigz -d *.gz 221 | rm -f @EXTRA_NAME@* 222 | FILES=$(find -type f -name "*.*") 223 | md5sum $FILES > ${RELEASENAME}.md5 224 | 225 | # Package stuff to archive 226 | tar -cjf ${RELEASENAME}.tar.bz2 $FILES 227 | 228 | popd 229 | ### end hybris 230 | 231 | mv $IMG_OUT_DIR/${RELEASENAME}* . 232 | %end 233 | -------------------------------------------------------------------------------- /progs/bunzip2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CODeRUS/sfos-builder/5e46e1e0429c96feef99b41f6ab2ecf9c73e3699/progs/bunzip2 -------------------------------------------------------------------------------- /progs/bzcat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CODeRUS/sfos-builder/5e46e1e0429c96feef99b41f6ab2ecf9c73e3699/progs/bzcat -------------------------------------------------------------------------------- /progs/bzip2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CODeRUS/sfos-builder/5e46e1e0429c96feef99b41f6ab2ecf9c73e3699/progs/bzip2 -------------------------------------------------------------------------------- /progs/img2simg_android: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CODeRUS/sfos-builder/5e46e1e0429c96feef99b41f6ab2ecf9c73e3699/progs/img2simg_android -------------------------------------------------------------------------------- /progs/img2simg_jolla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CODeRUS/sfos-builder/5e46e1e0429c96feef99b41f6ab2ecf9c73e3699/progs/img2simg_jolla -------------------------------------------------------------------------------- /progs/mkbootimg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CODeRUS/sfos-builder/5e46e1e0429c96feef99b41f6ab2ecf9c73e3699/progs/mkbootimg -------------------------------------------------------------------------------- /progs/pack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | NAME="$1" 4 | BASENAME=$(ls "$NAME"/*-base) 5 | IMAGE=$(basename ${BASENAME%-*}) 6 | 7 | pushd "$NAME/ramdisk" 8 | find . | cpio -o -H newc | gzip > "../$IMAGE-ramdisk.gz" 9 | popd 10 | 11 | CMDLINE=$(cat "$NAME/$IMAGE-cmdline") 12 | BASE=$(cat "$NAME/$IMAGE-base") 13 | PAGESIZE=$(cat "$NAME/$IMAGE-pagesize") 14 | KERNELOFF=$(cat "$NAME/$IMAGE-kerneloff") 15 | RAMDISKOFF=$(cat "$NAME/$IMAGE-ramdiskoff") 16 | SECONDOFF=$(cat "$NAME/$IMAGE-secondoff") 17 | TAGSOFF=$(cat "$NAME/$IMAGE-tagsoff") 18 | 19 | mkbootimg \ 20 | --kernel "$NAME/$IMAGE-zImage" \ 21 | --ramdisk "$NAME/$IMAGE-ramdisk.gz" \ 22 | --cmdline "$CMDLINE" \ 23 | --base "$BASE" \ 24 | --pagesize "$PAGESIZE" \ 25 | --kernel_offset "$KERNELOFF" \ 26 | --ramdisk_offset "$RAMDISKOFF" \ 27 | --second_offset "$SECONDOFF" \ 28 | --tags_offset "$TAGSOFF" \ 29 | --output "repack-$NAME.img" 30 | 31 | -------------------------------------------------------------------------------- /progs/unpack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | IMAGE="$1" 4 | NAME="${IMAGE%.*}" 5 | 6 | mkdir -p "$NAME/ramdisk" 7 | unpackbootimg -i "$IMAGE" -o "$NAME" 8 | 9 | gunzip "$NAME/$IMAGE-ramdisk.gz" 10 | 11 | pushd "$NAME/ramdisk" 12 | cpio -idm --no-absolute-filenames < "../$IMAGE-ramdisk" 13 | for f in $(find . -type l) 14 | do 15 | ln -sf "/$(readlink $f)" $f 16 | done 17 | popd 18 | 19 | -------------------------------------------------------------------------------- /progs/unpackbootimg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CODeRUS/sfos-builder/5e46e1e0429c96feef99b41f6ab2ecf9c73e3699/progs/unpackbootimg -------------------------------------------------------------------------------- /sbj-btrfs.ks: -------------------------------------------------------------------------------- 1 | keyboard us 2 | user --name nemo --groups audio,input,video --password nemo 3 | timezone --utc UTC 4 | lang en_US.UTF-8 5 | 6 | part / --fstype="btrfs" --ondisk=mmcblk0p --size=2200 --label=sailfish 7 | btrfs / --label=root --subvol --name=@ --parent=sailfish --quota / 8 | btrfs /home --label=/home --subvol --name=@home --parent=sailfish --quota / 9 | btrfs /swap --label=/swap --subvol --name=@swap --parent=sailfish --quota / 10 | btrfs --parent=sailfish --snapshot --name=factory-@ --base=@ 11 | btrfs --parent=sailfish --snapshot --name=factory-@home --base=@home 12 | 13 | repo --name="adaptation0-@RELEASE@-@DEVICE_VENDOR@-@DEVICE@-@ARCH@" --baseurl=https://store-repository.jolla.com/releases/@RELEASE@/jolla-hw/adaptation-@DEVICE_VENDOR@-@DEVICE@/@ARCH@/ --ssl_verify=yes 14 | repo --name="aliendalvik-@RELEASE@-@DEVICE@" --baseurl=https://store-repository.jolla.com/releases/@RELEASE@/aliendalvik/@PATTERN@/ --ssl_verify=yes 15 | repo --name="apps-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/jolla-apps/@RELEASE@/@ARCH@/ --ssl_verify=yes 16 | repo --name="customer-jolla-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/features/@RELEASE@/customers/jolla/@ARCH@/ --ssl_verify=yes 17 | repo --name="hotfixes-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/hotfixes/@ARCH@/ --ssl_verify=yes 18 | repo --name="jolla-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/jolla/@ARCH@/ --ssl_verify=yes 19 | repo --name="sailfish-eas-@RELEASE@-@ARCH@" --baseurl=https://store-repository.jolla.com/features/@RELEASE@/sailfish-eas/@ARCH@/ --ssl_verify=yes 20 | repo --name="xt9-@RELEASE@-@ARCH@" --baseurl=https://store-repository.jolla.com/features/@RELEASE@/xt9/@ARCH@/ --ssl_verify=yes 21 | 22 | %packages 23 | @Jolla Configuration @PATTERN@ 24 | feature-jolla 25 | feature-sailfish-eas 26 | patterns-sailfish-store-applications 27 | qmf-eas-plugin 28 | feature-xt9 29 | jolla-xt9 30 | jolla-xt9-cp 31 | feature-alien 32 | jolla-developer-mode 33 | %end 34 | 35 | %attachment 36 | ### Commands from /tmp/sandbox/usr/share/ssu/kickstart/attachment/f5121 37 | /boot/* 38 | /etc/hw-release 39 | /etc/sailfish-release 40 | %end 41 | 42 | %pre 43 | export SSU_RELEASE_TYPE=release 44 | ### begin 01_init 45 | touch $INSTALL_ROOT/.bootstrap 46 | ### end 01_init 47 | %end 48 | 49 | %post 50 | export SSU_RELEASE_TYPE=release 51 | ### begin 01_arch-hack 52 | if [ "armv7hl" == armv7hl ] || [ "armv7hl" == armv7tnhl ]; then 53 | # Without this line the rpm does not get the architecture right. 54 | echo -n "armv7hl-meego-linux" > /etc/rpm/platform 55 | 56 | # Also libzypp has problems in autodetecting the architecture so we force tha as well. 57 | # https://bugs.meego.com/show_bug.cgi?id=11484 58 | echo "arch = armv7hl" >> /etc/zypp/zypp.conf 59 | fi 60 | ### end 01_arch-hack 61 | ### begin 01_rpm-rebuilddb 62 | # Rebuild db using target's rpm 63 | echo -n "Rebuilding db using target rpm.." 64 | rm -f /var/lib/rpm/__db* 65 | rpm --rebuilddb 66 | echo "done" 67 | ### end 01_rpm-rebuilddb 68 | ### begin 50_oneshot 69 | # exit boostrap mode 70 | rm -f /.bootstrap 71 | 72 | # export some important variables until there's a better solution 73 | export LANG=en_US.UTF-8 74 | export LC_COLLATE=en_US.UTF-8 75 | export GSETTINGS_BACKEND=gconf 76 | 77 | # run the oneshot triggers for root and first user uid 78 | UID_MIN=$(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) 79 | DEVICEUSER=`getent passwd $UID_MIN | sed 's/:.*//'` 80 | 81 | if [ -x /usr/bin/oneshot ]; then 82 | /usr/bin/oneshot --mic 83 | su -c "/usr/bin/oneshot --mic" $DEVICEUSER 84 | fi 85 | ### end 50_oneshot 86 | ### begin 60_ssu 87 | if [ "$SSU_RELEASE_TYPE" = "rnd" ]; then 88 | [ -n "@RNDRELEASE@" ] && ssu release -r @RNDRELEASE@ 89 | [ -n "@RNDFLAVOUR@" ] && ssu flavour @RNDFLAVOUR@ 90 | # RELEASE is reused in RND setups with parallel release structures 91 | # this makes sure that an image created from such a structure updates from there 92 | [ -n "@RELEASE@" ] && ssu set update-version @RELEASE@ 93 | ssu mode 2 94 | else 95 | [ -n "@RELEASE@" ] && ssu release @RELEASE@ 96 | ssu mode 4 97 | fi 98 | ### end 60_ssu 99 | %end 100 | 101 | %post --nochroot 102 | export SSU_RELEASE_TYPE=release 103 | ### begin 50_os-release 104 | ( 105 | CUSTOMERS=$(find $INSTALL_ROOT/usr/share/ssu/features.d -name 'customer-*.ini' \ 106 | |xargs --no-run-if-empty sed -n 's/^name[[:space:]]*=[[:space:]]*//p') 107 | 108 | cat $INSTALL_ROOT/etc/os-release 109 | echo "SAILFISH_CUSTOMER=\"${CUSTOMERS//$'\n'/ }\"" 110 | ) > $IMG_OUT_DIR/os-release 111 | ### end 50_os-release 112 | ### begin f5121 113 | cp $INSTALL_ROOT/etc/sailfish-release $IMG_OUT_DIR 114 | ### end f5121 115 | %end 116 | 117 | %pack 118 | export SSU_RELEASE_TYPE=release 119 | ### begin hybris 120 | pushd $IMG_OUT_DIR 121 | 122 | MD5SUMFILE=md5.lst 123 | 124 | DEVICE_VERSION_FILE=./hw-release 125 | 126 | EXTRA_NAME="" 127 | 128 | if [ -n "@EXTRA_NAME@" ] && [ "@EXTRA_NAME@" != @"EXTRA_NAME"@ ]; then 129 | EXTRA_NAME="@EXTRA_NAME@-" 130 | fi 131 | 132 | DEVICE="" 133 | DEVICE_VERSION="" 134 | 135 | if [[ -a $DEVICE_VERSION_FILE ]]; then 136 | source $DEVICE_VERSION_FILE 137 | DEVICE=$ID 138 | DEVICE_VERSION=-$VERSION_ID 139 | fi 140 | 141 | source ./sailfish-release 142 | if [ "$SSU_RELEASE_TYPE" = "rnd" ]; then 143 | RELEASENAME=SailfishOS-${EXTRA_NAME// /_}$SAILFISH_FLAVOUR-$VERSION_ID-$DEVICE$DEVICE_VERSION 144 | else 145 | RELEASENAME=SailfishOS-${EXTRA_NAME// /_}$VERSION_ID-$DEVICE$DEVICE_VERSION 146 | fi 147 | 148 | # Setup btrfs image 149 | pushd $IMG_OUT_DIR 150 | 151 | IMGNAME=sailfish.img 152 | MD5SUMFILE=md5.lst 153 | 154 | DEVICE=sbj 155 | 156 | # If there is tarball then use that for the packaging, otherwise 157 | # set default tarball name. 158 | TARBALL=$(find *.tar.bz2 2> /dev/null) 159 | 160 | if [[ -n "$TARBALL" ]]; then 161 | tar --no-same-owner -xf "$TARBALL" 162 | rm -f "$TARBALL" 163 | fi 164 | 165 | if [[ -z $(ls -1 ${IMGNAME} 2> /dev/null) ]]; then 166 | echo "No loop image called '${IMGNAME}' found." 167 | exit 1 168 | fi 169 | 170 | /usr/bin/img2simg_jolla -C 688M ${IMGNAME} 171 | 172 | # Remove so that this doesn't end up to the tarball with wildcards 173 | rm ${IMGNAME} 174 | 175 | rm -f @EXTRA_NAME@* 176 | FILES=$(find -type f -name "*.*") 177 | 178 | # Calculate md5sums of files included to the tarball 179 | md5sum $FILES > $MD5SUMFILE 180 | FILES="$FILES $MD5SUMFILE" 181 | 182 | mkdir -p ${RELEASENAME} 183 | mv ${FILES} ${RELEASENAME}/ 184 | 185 | # Package stuff back to tarball 186 | tar -cjf ${RELEASENAME}.tar.bz2 $RELEASENAME 187 | 188 | # Remove the files from the output directory 189 | rm -r ${RELEASENAME} 190 | 191 | popd 192 | ### end hybris 193 | 194 | mv $IMG_OUT_DIR/${RELEASENAME}* . 195 | %end 196 | -------------------------------------------------------------------------------- /tbj-lvm.ks: -------------------------------------------------------------------------------- 1 | keyboard us 2 | user --name nemo --groups audio,input,video --password nemo 3 | timezone --utc UTC 4 | lang en_US.UTF-8 5 | 6 | part / --fstype="ext4" --size=2500 --label=root 7 | part /home --fstype="ext4" --size=800 --label=home 8 | part /fimage --fstype="ext4" --size=10 --label=fimage 9 | 10 | repo --name="adaptation0-@RELEASE@-@DEVICE_VENDOR@-@DEVICE@-@ARCH@" --baseurl=https://store-repository.jolla.com/releases/@RELEASE@/jolla-hw/adaptation-@DEVICE_VENDOR@-@DEVICE@/@ARCH@/ --ssl_verify=yes 11 | repo --name="adaptation1-@RELEASE@-@DEVICE_VENDOR@-@DEVICE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/jolla-hw/adaptation-common/@ARCH@/ --ssl_verify=yes 12 | repo --name="aliendalvik-@RELEASE@-@DEVICE@" --baseurl=https://store-repository.jolla.com/releases/@RELEASE@/aliendalvik/@DEVICE@/ --ssl_verify=yes 13 | repo --name="apps-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/jolla-apps/@RELEASE@/@ARCH@/ --ssl_verify=yes 14 | repo --name="customer-jolla-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/features/@RELEASE@/customers/jolla/@ARCH@/ --ssl_verify=yes 15 | repo --name="hotfixes-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/hotfixes/@ARCH@/ --ssl_verify=yes 16 | repo --name="jolla-@RELEASE@-@ARCH@" --baseurl=https://releases.jolla.com/releases/@RELEASE@/jolla/@ARCH@/ --ssl_verify=yes 17 | repo --name="sailfish-eas-@RELEASE@-@ARCH@" --baseurl=https://store-repository.jolla.com/features/@RELEASE@/sailfish-eas/@ARCH@/ --ssl_verify=yes 18 | repo --name="xt9-@RELEASE@-@ARCH@" --baseurl=https://store-repository.jolla.com/features/@RELEASE@/xt9/@ARCH@/ --ssl_verify=yes 19 | 20 | %packages 21 | patterns-sailfish-device-configuration-@PATTERN@ 22 | feature-jolla 23 | feature-sailfish-eas 24 | patterns-sailfish-store-applications 25 | qmf-eas-plugin 26 | feature-xt9 27 | jolla-xt9 28 | jolla-xt9-cp 29 | feature-alien 30 | %end 31 | 32 | %attachment 33 | ### Commands from /tmp/sandbox/usr/share/ssu/kickstart/attachment/f5121 34 | /boot/* 35 | /etc/hw-release 36 | /etc/sailfish-release 37 | droid-config-@DEVICE@-out-of-image-files 38 | droid-flashing-tools 39 | %end 40 | 41 | %pre 42 | export SSU_RELEASE_TYPE=release 43 | ### begin 01_init 44 | touch $INSTALL_ROOT/.bootstrap 45 | ### end 01_init 46 | %end 47 | 48 | %post 49 | export SSU_RELEASE_TYPE=release 50 | ### begin 01_arch-hack 51 | if [ "@ARCH@" == armv7hl ] || [ "armv7hl" == armv7tnhl ]; then 52 | # Without this line the rpm does not get the architecture right. 53 | echo -n "armv7hl-meego-linux" > /etc/rpm/platform 54 | 55 | # Also libzypp has problems in autodetecting the architecture so we force tha as well. 56 | # https://bugs.meego.com/show_bug.cgi?id=11484 57 | echo "arch = armv7hl" >> /etc/zypp/zypp.conf 58 | fi 59 | ### end 01_arch-hack 60 | ### begin 01_rpm-rebuilddb 61 | # Rebuild db using target's rpm 62 | echo -n "Rebuilding db using target rpm.." 63 | rm -f /var/lib/rpm/__db* 64 | rpm --rebuilddb 65 | echo "done" 66 | ### end 01_rpm-rebuilddb 67 | ### begin 50_oneshot 68 | # exit boostrap mode 69 | rm -f /.bootstrap 70 | 71 | # export some important variables until there's a better solution 72 | export LANG=en_US.UTF-8 73 | export LC_COLLATE=en_US.UTF-8 74 | export GSETTINGS_BACKEND=gconf 75 | 76 | # run the oneshot triggers for root and first user uid 77 | UID_MIN=$(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) 78 | DEVICEUSER=`getent passwd $UID_MIN | sed 's/:.*//'` 79 | 80 | if [ -x /usr/bin/oneshot ]; then 81 | /usr/bin/oneshot --mic 82 | su -c "/usr/bin/oneshot --mic" $DEVICEUSER 83 | fi 84 | ### end 50_oneshot 85 | ### begin 60_ssu 86 | if [ "$SSU_RELEASE_TYPE" = "rnd" ]; then 87 | [ -n "@RNDRELEASE@" ] && ssu release -r @RNDRELEASE@ 88 | [ -n "@RNDFLAVOUR@" ] && ssu flavour @RNDFLAVOUR@ 89 | # RELEASE is reused in RND setups with parallel release structures 90 | # this makes sure that an image created from such a structure updates from there 91 | [ -n "@RELEASE@" ] && ssu set update-version @RELEASE@ 92 | ssu mode 2 93 | else 94 | [ -n "@RELEASE@" ] && ssu release @RELEASE@ 95 | ssu mode 4 96 | fi 97 | ### end 60_ssu 98 | %end 99 | 100 | %post --nochroot 101 | export SSU_RELEASE_TYPE=release 102 | ### begin 50_os-release 103 | ( 104 | CUSTOMERS=$(find $INSTALL_ROOT/usr/share/ssu/features.d -name 'customer-*.ini' \ 105 | |xargs --no-run-if-empty sed -n 's/^name[[:space:]]*=[[:space:]]*//p') 106 | 107 | cat $INSTALL_ROOT/etc/os-release 108 | echo "SAILFISH_CUSTOMER=\"${CUSTOMERS//$'\n'/ }\"" 109 | ) > $IMG_OUT_DIR/os-release 110 | ### end 50_os-release 111 | ### begin f5121 112 | cp $INSTALL_ROOT/etc/sailfish-release $IMG_OUT_DIR 113 | ### end f5121 114 | %end 115 | 116 | %pack 117 | export SSU_RELEASE_TYPE=release 118 | ### begin hybris 119 | pushd $IMG_OUT_DIR 120 | 121 | DEVICE_VERSION_FILE=./hw-release 122 | 123 | EXTRA_NAME="" 124 | 125 | if [ -n "@EXTRA_NAME@" ] && [ "@EXTRA_NAME@" != @"EXTRA_NAME"@ ]; then 126 | EXTRA_NAME="@EXTRA_NAME@-" 127 | fi 128 | 129 | DEVICE="" 130 | DEVICE_VERSION="" 131 | 132 | if [[ -a $DEVICE_VERSION_FILE ]]; then 133 | source $DEVICE_VERSION_FILE 134 | DEVICE=$MER_HA_DEVICE 135 | DEVICE_VERSION=-$VERSION_ID 136 | fi 137 | 138 | source ./sailfish-release 139 | if [ "$SSU_RELEASE_TYPE" = "rnd" ]; then 140 | RELEASENAME=SailfishOS-${EXTRA_NAME// /_}$SAILFISH_FLAVOUR-$VERSION_ID-$DEVICE$DEVICE_VERSION 141 | else 142 | RELEASENAME=SailfishOS-${EXTRA_NAME// /_}$VERSION_ID-$DEVICE$DEVICE_VERSION 143 | fi 144 | 145 | # Setup LVM image 146 | dd if=/dev/zero bs=1 count=0 of=temp.img seek=4000M 147 | LVM_LOOP=$(/sbin/losetup -f) 148 | /sbin/losetup $LVM_LOOP temp.img 149 | /usr/sbin/pvcreate $LVM_LOOP 150 | /usr/sbin/vgcreate sailfish $LVM_LOOP 151 | 152 | # Resize root and home to minimum 153 | ROOT_LOOP=$(/sbin/losetup -f) 154 | /sbin/losetup $ROOT_LOOP root.img 155 | /sbin/e2fsck -f -y $ROOT_LOOP 156 | # The "on is al ready" sed hack is added to handle cases when resize2fs 157 | # outputs "The filesystem is already X blocks long" to stderr: 158 | BLOCKS=$(/sbin/resize2fs -M $ROOT_LOOP 2>&1 | tail -n 2 | sed "s/is already/on is al ready/" | /bin/grep "The filesystem on" | /bin/cut -d ' ' -f 7) 159 | echo We got ourselves root blocks _ $BLOCKS _ 160 | SIZE=$(/usr/bin/expr $BLOCKS \* 4096) 161 | echo after maths size _ $SIZE _ 162 | /usr/sbin/lvcreate -L ${SIZE}B --name root sailfish 163 | /bin/sync 164 | /sbin/losetup -d $ROOT_LOOP 165 | /usr/sbin/vgchange -a y 166 | dd if=root.img bs=4096 count=$BLOCKS of=/dev/sailfish/root 167 | 168 | HOME_LOOP=$(/sbin/losetup -f) 169 | /sbin/losetup $HOME_LOOP home.img 170 | /sbin/e2fsck -f -y $HOME_LOOP 171 | # The "on is al ready" sed hack is added to handle cases when resize2fs 172 | # outputs "The filesystem is already X blocks long" to stderr: 173 | BLOCKS=$(/sbin/resize2fs -M $HOME_LOOP 2>&1 | tail -n 2 | sed "s/is already/on is al ready/" | /bin/grep "The filesystem on" | /bin/cut -d ' ' -f 7) 174 | echo We got ourselves home size _ $BLOCKS _ 175 | SIZE=$(/usr/bin/expr $BLOCKS \* 4096) 176 | 177 | /usr/sbin/lvcreate -L ${SIZE}B --name home sailfish 178 | /bin/sync 179 | /sbin/losetup -d $HOME_LOOP 180 | /usr/sbin/vgchange -a y 181 | dd if=home.img bs=4096 count=$BLOCKS of=/dev/sailfish/home 182 | 183 | /usr/sbin/vgchange -a n sailfish 184 | 185 | # Temporary dir for making factory image backups. 186 | FIMAGE_TEMP=$(mktemp -d -p $(pwd)) 187 | 188 | # For some reason loop files created by imager don't shrink properly when 189 | # running resize2fs -M on them. Hence manually growing the loop file here 190 | # to make the shrinking work once we have the image populated. 191 | dd if=/dev/zero bs=1 seek=1400000000 count=1 of=fimage.img 192 | /sbin/e2fsck -f -y fimage.img 193 | /sbin/resize2fs -f fimage.img 194 | 195 | pigz -7 root.img 196 | md5sum -b root.img.gz > root.img.gz.md5 197 | 198 | pigz -7 home.img 199 | md5sum -b home.img.gz > home.img.gz.md5 200 | 201 | mount -o loop fimage.img $FIMAGE_TEMP 202 | mkdir -p $FIMAGE_TEMP/${RELEASENAME} 203 | mv root.img.gz* $FIMAGE_TEMP/${RELEASENAME} 204 | mv home.img.gz* $FIMAGE_TEMP/${RELEASENAME} 205 | umount $FIMAGE_TEMP 206 | rm -rf $FIMAGE_TEMP 207 | 208 | /sbin/e2fsck -f -y fimage.img 209 | /sbin/resize2fs -f -M fimage.img 210 | 211 | /usr/bin/img2simg_jolla -C 1152M fimage.img 212 | rm fimage.img 213 | 214 | /sbin/losetup -d $LVM_LOOP 215 | 216 | mv temp.img sailfish.img 217 | 218 | /usr/bin/atruncate sailfish.img 219 | /usr/bin/img2simg_jolla -C 1152M sailfish.img 220 | rm sailfish.img 221 | 222 | rm -f @EXTRA_NAME@* 223 | FILES=$(find -type f -name "*.*") 224 | md5sum $FILES > ${RELEASENAME}.md5 225 | 226 | # Package stuff to archive 227 | tar -cjf ${RELEASENAME}.tar.bz2 $FILES 228 | 229 | popd 230 | ### end hybris 231 | 232 | mv $IMG_OUT_DIR/${RELEASENAME}* . 233 | 234 | %end 235 | --------------------------------------------------------------------------------