summaryrefslogblamecommitdiffstats
path: root/inc/build.initramfs.sh
blob: 59ca30267bfe9f016b4388bd4aa3af7774ec83ef (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                                            
                                                                                  


















                                                                              
#!/bin/bash

ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..)
SYSLINUX=${ROOT_DIR}/share/contrib/syslinux/latest

. ${ROOT_DIR}/config/paths.conf

[ ! -f ${SYSLINUX}/Makefile ] && $ROOT_DIR/inc/env.setup-syslinux.sh

[ ! -d ${ROOT_DIR}/build/sqfs-base/.setup_finished ] && $ROOT_DIR/inc/env.setup-sqfs-base.sh
[ ! -d ${ROOT_DIR}/build/cpio-base/.setup_finihsed ] && $ROOT_DIR/inc/env.setup-cpio-base.sh


########################################################## CREATE # SQFS #####
cd ${ROOT_DIR}/build
  rm -f tmp.sqfs
  mksquashfs sqfs-base tmp.sqfs -comp xz -b 1M -e $(cd sqfs-base && ls -1 .osib_*)
  mkdir cpio-base/mnt
  mv -v tmp.sqfs cpio-base/mnt/openslx.sqfs
cd -

##################################################### CREATE # INITRAMFS #####
cd ${ROOT_DIR}/build/cpio-base

  echo -e "[build-initramfs] \t Create initramfs."
  find . | cpio --quiet -H newc -o > ../initramfs-default.cpio
  cd ..
  gzip initramfs-default.cpio

  mv initramfs-default.cpio.gz initramfs-default
  INITRAMFS_SIZE=$(stat -c %s ${ROOT_DIR}/build/initramfs-default)

cd - > /dev/null 2>&1

echo -e "[build-initramfs] New initramfs created."
echo -e "   Location: ${ROOT_DIR}/build/initramfs-default."