]> git.vomp.tv Git - makedevenv.git/blob - dongle/build
Initial import
[makedevenv.git] / dongle / build
1 #!/bin/bash
2
3 . ../crosstool/cross-var
4
5 LKERN=../kernel/dongle/linux-2.4.31
6 LGENFS=genext2fs-1.4/genext2fs
7 OUTFILE=vomp-dongle
8
9 # Create initial file system
10
11 cp -a ../busybox/dongle/install fs
12 cp -a tofs/* fs
13
14 # Insert vompclient
15
16 cp -fv ../client/vompclient fs
17 cp -fv ../client/other/*.jpg fs
18 cp -fv ../lbox_border/lbox_border.o fs/lib/modules/2.4.31
19
20 # Get kernel files temp dir ready
21
22 mkdir kernel_temp
23 BOOT=${LKERN}/arch/ppc/boot
24 CFILES=${BOOT}/common/{dummy,misc-common,ns16550,relocate,string,util,serial_stub}.o
25 SFILES=${BOOT}/simple/{embed_config,head,misc-embedded}.o
26 KFILE=${BOOT}/images/vmlinux.gz
27 FILES=`sh -c "echo $CFILES $SFILES $KFILE ${BOOT}/lib/zlib.a ${BOOT}/ld.script"`
28 cp $FILES kernel_temp
29
30 # Check filesystem size
31
32 RAMDISK_SIZE=`du -ks fs | cut -f 1`
33 let RAMDISK_SIZE=$RAMDISK_SIZE+300
34 if [ $RAMDISK_SIZE -gt 4096 ] ; then
35   echo "ramdisk too big"
36   exit
37 fi
38
39 # Create the ramdisk out of the fs directory
40
41 ${LGENFS} -d fs -b ${RAMDISK_SIZE} -D devtable ramdisk
42 /bin/gzip ramdisk
43
44 # Put it all together
45
46 mkdir build_temp
47
48 # make_dongle() - this is straight out of arch/ppc in the linux tree
49
50 OBJCOPY=${CROSS}objcopy
51 LD=${CROSS}ld
52
53 $OBJCOPY -O elf32-powerpc \
54   --add-section=.ramdisk=ramdisk.gz \
55   --set-section-flags=.ramdisk=contents,alloc,load,readonly,data \
56   --add-section=.image=kernel_temp/vmlinux.gz \
57   --set-section-flags=.image=contents,alloc,load,readonly,data \
58   kernel_temp/dummy.o build_temp/image.o
59
60 $LD -T kernel_temp/ld.script -Ttext 0x00400000 -Bstatic -o build_temp/zvmlinux.initrd \
61   kernel_temp/head.o kernel_temp/relocate.o kernel_temp/misc-embedded.o \
62   kernel_temp/misc-common.o kernel_temp/string.o kernel_temp/util.o kernel_temp/serial_stub.o \
63   kernel_temp/embed_config.o kernel_temp/ns16550.o build_temp/image.o \
64   kernel_temp/zlib.a
65
66 $OBJCOPY -O elf32-powerpc build_temp/zvmlinux.initrd build_temp/zvmlinux.initrd \
67   -R .comment -R .stab -R .stabstr -R .sysmap
68
69 ${LKERN}/arch/ppc/boot/utils/mktree build_temp/zvmlinux.initrd $OUTFILE
70
71 # Clean up
72
73 rm -f ramdisk.gz
74 rm -rf build_temp
75 rm -rf kernel_temp
76 rm -rf fs
77
78 # Install to tftp location
79
80 if [ -d /diskless/tftp/mvp ] && [ -w /diskless/tftp/mvp ]
81 then
82   cp -v $OUTFILE /diskless/tftp/mvp
83 fi
84
85 if [ -d /diskless/tftp/wmvp ] && [ -w /diskless/tftp/wmvp ]
86 then
87   cp -v $OUTFILE /diskless/tftp/wmvp
88 fi