- Timestamp:
- Apr 14, 2014, 6:47:07 PM (11 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/Makefile
r300 r302 1 -include build.mk 2 1 3 export # export all variable to sub-Makefile 2 4 CC = mipsel-unknown-elf-gcc … … 11 13 ### partition sectors = 524832 12 14 13 MAP_XML ?= mappings/4c_1p_ iob_sort.xml15 MAP_XML ?= mappings/4c_1p_sort_leti.xml 14 16 15 17 ### Objects to be linked for kernel.elf … … 123 125 -I. 124 126 125 all: map.bin \ 127 DISK_IMAGE := hdd/virt_hdd.dmg 128 129 ### Copy executable and miscellaneous files into disk image 130 ### Copy bootloader into sector 2 of disk image 131 all: $(DISK_IMAGE) \ 132 $(MAP_XML) \ 133 giet_config.h \ 134 map.bin \ 126 135 build/boot/boot.elf \ 127 136 build/kernel/kernel.elf \ 128 137 build/display/display.elf \ 129 build/router/router.elf \130 138 build/hello/hello.elf \ 131 139 build/pgcd/pgcd.elf \ 140 build/router/router.elf \ 132 141 build/dhrystone/dhrystone.elf \ 133 142 build/gameoflife/gameoflife.elf \ 134 143 build/sort/sort.elf \ 135 144 build/transpose/transpose.elf \ 136 hdd/virt_hdd.dmg 145 146 mcopy -so -i $(DISK_IMAGE) build ::/ 147 mcopy -so -i $(DISK_IMAGE) hdd/misc ::/ 148 mcopy -so -i $(DISK_IMAGE) map.bin ::/ 149 dd if=build/boot/boot.elf of=$(DISK_IMAGE) seek=2 conv=notrunc 137 150 138 151 ### Disk image generation 139 152 ### This requires the generic LINUX/MacOS script "create_dmg" script 140 153 ### written by C.Fuguet. (should be installed in GIET-VM root directory). 141 hdd/virt_hdd.dmg: map.bin \ 142 build/boot/boot.elf \ 143 build/kernel/kernel.elf \ 144 build/display/display.elf \ 145 build/hello/hello.elf \ 146 build/pgcd/pgcd.elf \ 147 build/router/router.elf \ 148 build/dhrystone/dhrystone.elf \ 149 build/gameoflife/gameoflife.elf \ 150 build/sort/sort.elf \ 151 build/transpose/transpose.elf 152 153 ### remove all content of virtual disk virt_hdd 154 rm -rf hdd/virt_hdd/* 155 ### copy content to virtual disk from build, misc and map.bin 156 ### the boot.elf file is not copied on the virtual disk 157 cp -r build hdd/virt_hdd 158 rm -rf hdd/virt_hdd/build/boot 159 cp -r hdd/misc hdd/virt_hdd 160 cp map.bin hdd/virt_hdd 161 ### create temporary partition image 162 ./create_dmg create hdd/virt_hdd $(basename $@) 163 ### copy boot.elf into virtual disk image (sector 2) 164 dd if=build/boot/boot.elf of=$@ seek=2 conv=notrunc 154 $(DISK_IMAGE): 155 ./create_dmg create $(basename $(DISK_IMAGE)) 165 156 166 157 ### mapping compilation … … 455 446 rm -rf build/transpose/* 456 447 rm -rf build/map.bin 457 rm -rf hdd/virt_hdd/* 448 449 distclean: clean 458 450 rm -rf hdd/virt_hdd.dmg -
soft/giet_vm/create_dmg
r300 r302 42 42 43 43 if [[ -z $2 ]]; then 44 echo "Create action need second argument: < srcdir_path>"44 echo "Create action need second argument: <disk_image>" 45 45 exit 1; 46 46 fi; 47 48 if [[ -z $3 ]]; then49 echo "Create action need third argument: <disk_image>"50 exit 1;51 fi;52 53 # RAW DISK IMAGE READ-ONLY54 # The not used space is not considered (smaller disk image)55 # format="UDRO"56 57 # RAW DISK IMAGE READ-WRITE58 # None compression is made59 format="UDRW"60 47 61 48 # -F FAT type = 32 (FAT32) … … 64 51 # -r reserved sectors 65 52 # -k backup boot sector (VBR and FS INFO) = 0xffff (no backup) 66 echo "Creating partition file $3.dmg from $2 directory"53 echo "Creating empty disk image: $2.dmg" 67 54 fsargs="-F32 -c $sectors_per_cluster -n 1 -r $reserved_sectors -k 0xffff" 55 56 # -layout = NONE (No partition scheme. Hence no Master Boot Record) 68 57 hdiutil create \ 69 58 -fs MS-DOS \ 70 59 -volname virtualdisk \ 71 - srcfolder $2\60 -layout NONE \ 72 61 -sectors $sectors \ 73 62 -ov \ 74 63 -fsargs "$fsargs" \ 75 -format $format \ 76 $3; 77 # -verbose \ 78 79 echo "Removing first sector of diskimage" 80 81 if [[ -e "/tmp" ]]; then 82 if [[ -e "/tmp/diskimage" ]]; then 83 echo "Warning /tmp/diskimage exists already. Rename it or" 84 echo "remove it before executing this script" 85 exit 86 fi; 87 88 dd if=$3.dmg of=/tmp/diskimage iseek=1 oseek=0 89 mv /tmp/diskimage $3.dmg 90 fi;; 64 -type "UDIF" \ 65 $2; 66 ;; 91 67 92 68 attach ) 93 69 # Attach created disk image to the system and mount it 94 hdiutil attach $2;; 70 hdiutil attach $2 71 ;; 95 72 96 73 detach ) 97 74 # Detach attached device. Must pass as parameter the /dev/<device> 98 hdiutil detach $2;; 75 hdiutil detach $2 76 ;; 99 77 100 78 info ) 101 hdiutil imageinfo $2;; 79 hdiutil imageinfo $2 80 ;; 102 81 103 82 * ) 104 83 echo "Pass the command as the first parameter: " 105 84 echo " - create: create disk image" 106 echo " First parameter after create action is the path"107 echo " of the directory to copy in the created "108 echo " partition"109 85 echo " - attach: attach created disk image to the system and " 110 86 echo " mount it (arg: path to disk_image)" … … 115 91 echo "" 116 92 echo "EXAMPLES:" 117 echo " ./create_diskimage.sh create /path/to/source_dirdisk_image"93 echo " ./create_diskimage.sh create disk_image" 118 94 echo " ./create_diskimage.sh attach /path/to/disk_image.dmg" 119 95 echo " ./create_diskimage.sh detach /dev/disk5" 120 96 echo " ./create_diskimage.sh info /path/to/disk_image.dmg" 97 ;; 121 98 esac; 122 99 … … 124 101 case $1 in 125 102 create ) 103 126 104 if [[ -z $2 ]]; then 127 echo "Create action need second argument: < srcdir_path>"105 echo "Create action need second argument: <disk_image>" 128 106 exit 1; 129 107 fi; 130 108 131 if [[ -z $3 ]]; then 132 echo "Create action need third argument: <disk_image>" 133 exit 1; 134 fi; 135 136 echo "Creating partition file: $3" 109 echo "Creating empty disk image: $2" 137 110 138 111 let "sectors = (sectors - 1) / 2" … … 145 118 -s $sectors_per_cluster \ 146 119 -v \ 147 $3.dmg $sectors 148 149 if [[ -e $2 ]]; then 150 echo "Copying files from $2 into partition" 151 mcopy -s -i $3.dmg $2/* ::// 152 fi;; 120 $2.dmg $sectors 121 ;; 153 122 154 123 * ) 155 124 echo "Pass the command as the first parameter: " 156 125 echo " - create: create disk image" 157 echo " First parameter after create action is the path"158 echo " of the directory to copy in the created "159 echo " partition"160 126 echo "" 161 127 echo "EXAMPLES:" 162 echo " ./create_diskimage.sh create /path/to/source_dir disk_image" 128 echo " ./create_diskimage.sh create disk_image" 129 ;; 163 130 esac; 164 131
Note: See TracChangeset
for help on using the changeset viewer.