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