forked from magnusfeuer/m1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_os_db.sh
executable file
·60 lines (45 loc) · 1.88 KB
/
create_os_db.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#
# OS -> DB
#
export TARGET=jway
# export KERNEL_VERSION=2.6.21.5
# export KERNEL_VERSION=2.6.23.14
#export KERNEL_VERSION=2.6.24
export KERNEL_VERSION=2.6.25.4
. ./Version.inc
BUSYBOX_PATH=$PWD/busybox/busybox_image.tgz
if [ ! -f $BUSYBOX_PATH ]
then
(cd busybox; make)
fi
echo "--- Creating a target file system tree."
rm -rf target_fs > /dev/null
mkdir target_fs
mkdir target_fs/boot
echo "--- Copying target file system skeleton to target file system"
ROOTFS_SKELETON=$PWD/rootfs_skeleton.tgz
(cd target_fs; tar xzpf $ROOTFS_SKELETON)
echo "--- Copying target file system busybox to target file system"
(cd target_fs; tar xpf $BUSYBOX_PATH)
echo "--- Populating root file system with udev system"
(cw=$PWD;cd udev; make install UDEV_ROOT=$cw/target_fs)
echo "--- Copying init launch script to target file system"
cp rootfs_init target_fs/sbin/init
chmod 755 target_fs/sbin/init
echo "--- Copying kernel to target file system."
cp kernel/linux-${KERNEL_VERSION}-${TARGET}/.config target_fs/boot/${KERNEL_VERSION}.config
cp kernel/linux-${KERNEL_VERSION}-${TARGET}/arch/i386/boot/bzImage target_fs/boot/bzImage-${KERNEL_VERSION}
echo "--- Copying kernel modules to target file system."
cp -a images-${KERNEL_VERSION}-${TARGET}/* target_fs
echo "--- Installing boot loader files in target file system."
mkdir -p target_fs/boot/grub
cp grub/* target_fs/boot/grub
echo "(hd0) /dev/hda" > target_fs/boot/grub/device.map
cp target_fs/boot/grub/grub.conf target_fs/boot/grub/menu.lst # To make suse grub happy
# Setup /sbin/init
cp rootfs_init target_fs/sbin/init
chmod 755 target_fs/sbin/init
echo "--- Packing up target file system to database."
./bin/db_rm_pf -h$DB_HOST -u$DB_USER -p$DB_PASSWORD -d$DB_DATABASE [email protected]/os/$VERSION
(cd target_fs; ../bin/fs2db -h$DB_HOST -u$DB_USER -p$DB_PASSWORD -d$DB_DATABASE -s0 [email protected]/os/$VERSION -ab . )
rm -rf target_fs