공유받은 압축파일 리눅스 tftpboot 파일로 이동
001-s3c-u-boot-1.1.6_rel-4-3-0_20080530.tar.bz2
002-u-boot-1.3.4.tar.bz2
uboot_mds2450_20140306.tar.gz
cd /tftpboot/
tar zxf uboot_mds2450_20140306.tar.gz
cd uboot_mds2450
gedit Makefile +144
들가서 144번째줄 바꾸기 CROSS_COMPILE = arm-none-linux-gnueabi-
make clobber
make mds2450_config
make
gedit ./board/mds/mds2450/config.mk (교재 195슬라이드)
ifndef TEXT_BASE
TEXT_BASE = 0x33000000
endif
수정
gedit ./include/configs/mds2450.h +39
#define MEMORY_BASE_ADDRESS 0x33000000
#define MEMORY_BASE_ADDRESS_1 0x38000000
수정
gedit ./include/configs/mds2450.h
#define CONFIG_ENABLE_MMU -> #undef CONFIG_ENABLE_MMU
수정
grep -r -n "Board: MDS2450" ./
gedit ./board/mds/mds2450/mds2450.c +207
들가서
printf("Board: sunshine 2021 05 26 MDS2450 ");
나만의 부트로더로 수정
make
cp u-boot.bin /tftpboot/
테라텀에서, 내 부트로더 실행
tftp 0x33000000 u-boot.bin
go 0x33000000
내꺼 확인 가능
tar jxf 002-u-boot-1.3.4.tar.bz2
cd u-boot-1.3.4/
make clobber // 하다가 에러나서 패스, 다른거 ㄱㄱ
tar jxf 001-s3c-u-boot-1.1.6_rel-4-3-0_20080530.tar.bz2
cd s3c-u-boot-1.1.6/
make clobber
make smdk2450_config
gedit Makefile
127
ifeq ($(ARCH),arm)
CROSS_COMPILE = arm-none-linux-gnueabi-
161
CROSS_COMPILE = arm-none-linux-gnueabi-
export CROSS_COMPILE
수정
make
cd /tftpboot/u-boot-1.3.4/
gedit Makefile +2500
2500
mds2450_config : unconfig
@$(MKCONFIG) $(@:_config=) arm s3c24xx mds2450 mds s3c2450
추가
gedit Makefile +144
144
ifeq ($(ARCH),arm)
CROSS_COMPILE = arm-none-linux-gnueabi-
수정
mkdir -p ./board/mds/mds2450
cp -a ../s3c-u-boot-1.1.6/board/samsung/smdk2450/* ../u-boot-1.3.4/board/mds/mds2450/
cp -r ../s3c-u-boot-1.1.6/board/samsung/common/ ../u-boot-1.3.4/board/mds/
cd ./board/mds/mds2450
mv smdk2450.c mds2450.c
gedit ./Makefile +31
31 COBJS := mds2450.o flash.o
수정
cd /tftpboot/
cp s3c-u-boot-1.1.6/include/s3c2450.h u-boot-1.3.4/include/
cp -r s3c-u-boot-1.1.6/include/asm-arm/arch-s3c24xx u-boot-1.3.4/include/asm-arm/
cp -r s3c-u-boot-1.1.6/cpu/s3c24xx u-boot-1.3.4/cpu/
cp s3c-u-boot-1.1.6/drivers/nand/nand_base.c u-boot-1.3.4/drivers/mtd/nand/
cp s3c-u-boot-1.1.6/drivers/nand/nand_bbt.c u-boot-1.3.4/drivers/mtd/nand/
cp s3c-u-boot-1.1.6/drivers/nand/nand_ids.c u-boot-1.3.4/drivers/mtd/nand/
cp s3c-u-boot-1.1.6/drivers/nand/nand_ecc.c u-boot-1.3.4/drivers/mtd/nand/
cp s3c-u-boot-1.1.6/include/linux/mtd/nand.h u-boot-1.3.4/include/linux/mtd
cp s3c-u-boot-1.1.6/include/linux/mtd/mtd.h u-boot-1.3.4/include/linux/mtd
cp s3c-u-boot-1.1.6/include/linux/mtd/mtd-abi.h u-boot-1.3.4/include/linux/mtd
gedit ./u-boot-1.3.4/include/asm-arm/mach-types.h +1599
추가
#define MACH_TYPE_MDS2450 4208
gedit ./u-boot-1.3.4/include/asm-arm/mach-types.h +6305
추가
#ifdef CONFIG_MACH_MDS2450
# ifdef machine_arch_type
# undef machine_arch_type
# define machine_arch_type __machine_arch_type
# else
# define machine_arch_type MACH_TYPE_MDS2450
# endif
# define machine_is_mds2450() (machine_arch_type == MACH_TYPE_MDS2450)
#else
# define machine_is_mds2450() (0)
#endif
cp -a s3c-u-boot-1.1.6/include/configs/smdk2450.h u-boot-1.3.4/include/configs/
cd u-boot-1.3.4/include/configs/
mv smdk2450.h mds2450.h
gedit mds2450.h (여기서 중요설정 변경)
//#include <cmd_confdefs.h>
#include <config_cmd_default.h>
수정
//#define CONFIG_SERIAL1 1 /* we use SERIAL 1 on SMDK2450 */
#define CONFIG_SERIAL2 1 /* we use SERIAL 2 on MDS2450 */
수정
#define CFG_ENV_IS_NOWHERE 1
61 쯤에 추가
cd /tftpboot
gedit u-boot-1.3.4/mkconfig +58
# create link for s3c24xx SoC
if [ "$3" = "s3c24xx" ] ; then
rm -f regs.h
ln -s $6.h regs.h
rm -f asm-$2/arch
ln -s arch-$3 asm-$2/arch
fi
58번째 줄에 추가
cd /tftpboot
gedit u-boot-1.3.4/cpu/s3c24xx/Makefile +36
COBJS += mmc.o
COBJS += usbd-ctl-fs.o usbd-ep0-fs.o usbd-recv-fs.o usbd-send-fs.o usbd-ctl-hs.o hs_mmc.o movi.o
위 부분을 아래부분으로 대체
↓
#COBJS += mmc.o
#COBJS += usbd-ctl-fs.o usbd-ep0-fs.o usbd-recv-fs.o usbd-send-fs.o usbd-ctl-hs.o hs_mmc.o movi.o
#COBJS += mmc.o
COBJS += usbd-ctl-fs.o usbd-ep0-fs.o usbd-recv-fs.o usbd-send-fs.o usbd-ctl-hs.o
gedit u-boot-1.3.4/common/main.c +51
void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress")));
수정
gedit u-boot-1.3.4/lib_arm/board.c +137
void inline __coloured_LED_init (void) {}
//void inline coloured_LED_init (void) __attribute__((weak, alias("__coloured_LED_init")));
void inline __red_LED_on (void) {}
//void inline red_LED_on (void) __attribute__((weak, alias("__red_LED_on")));
void inline __red_LED_off(void) {}
//void inline red_LED_off(void) __attribute__((weak, alias("__red_LED_off")));
void inline __green_LED_on(void) {}
//void inline green_LED_on(void) __attribute__((weak, alias("__green_LED_on")));
void inline __green_LED_off(void) {}
//void inline green_LED_off(void)__attribute__((weak, alias("__green_LED_off")));
void inline __yellow_LED_on(void) {}
//void inline yellow_LED_on(void)__attribute__((weak, alias("__yellow_LED_on")));
void inline __yellow_LED_off(void) {}
//void inline yellow_LED_off(void)__attribute__((weak, alias("__yellow_LED_off")));
수정
gedit u-boot-1.3.4/lib_arm/board.c +384
// env_relocate ();
수정
gedit u-boot-1.3.4/board/mds/mds2450/u-boot.lds +37
board/mds/mds2450/lowlevel_init.o (.text)
수정 (37번째줄 지우고)
gedit u-boot-1.3.4/drivers/mtd/nand/nand.c +26
#if defined(CONFIG_CMD_NAND) && !defined(CFG_NAND_LEGACY) || defined(CFG_NAND)
수정
gedit u-boot-1.3.4/drivers/mtd/nand/nand_base.c +59
#if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY) || defined(CFG_NAND)
수정
gedit u-boot-1.3.4/drivers/mtd/nand/nand_bbt.c +57
#if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY) || defined(CONFIG_NAND)
수정
gedit u-boot-1.3.4/drivers/mtd/nand/nand_ids.c +16
#if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY) || defined(CONFIG_NAND)
gedit u-boot-1.3.4/drivers/mtd/nand/nand_ecc.c +42
#if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY) || defined(CONFIG_NAND)
gedit u-boot-1.3.4/common/env_nand.c +37
#if defined(CFG_ENV_IS_IN_NAND) || defined(CONFIG_NAND)
gedit u-boot-1.3.4/include/s3c2450.h +667
#define ELFIN_UART_1_BASE 0x50004000
추가
gedit u-boot-1.3.4/board/mds/mds2450/lowlevel_init.S +177
ldr r0, = ELFIN_UART_1_BASE
수정 ㅁㅁㅁ
gedit u-boot-1.3.4/board/mds/mds2450/config.mk
TEXT_BASE = 0x33000000
수정
gedit ./u-boot-1.3.4/include/configs/mds2450.h +349
//#define CFG_UBOOT_BASE 0xc3e00000
#define CFG_UBOOT_BASE 0x33000000
수정
cd /tftpboot/u-boot-1.3.4
make clobber
make mds2450_config
make
에러..
gedit common/cmd_nvedit.c +554
return (/saveenv()/ 1 ? 1 : 0);
gedit common/env_nand.c +262
int readenv (size_t offset, u_char * buf)
{
/*
size_t end = offset + CFG_ENV_RANGE;
size_t amount_loaded = 0;
size_t blocksize;
u_char *char_ptr;
blocksize = nand_info[0].erasesize;
while (amount_loaded < CFG_ENV_SIZE && offset < end) {
if (nand_block_isbad(&nand_info[0], offset)) {
offset += blocksize;
} else {
char_ptr = &buf[amount_loaded];
if (nand_read(&nand_info[0], offset, &blocksize, char_ptr))
return 1;
offset += blocksize;
amount_loaded += blocksize;
}
}
if (amount_loaded != CFG_ENV_SIZE)
return 1;
*/
return 0;
}
수정
cd /tftpboot/u-boot-1.3.4
make clobber
make mds2450_config
make
cd
root@ ~
mount -t vboxsf vboxxx share
root@ ~
cd /tftpboot
root@ /tftpboot
cd kernel-mds2450-3.0.22
root@ /tftpboot/kernel-mds2450-3.0.22
cp ../2nd_defconfig ./.config
export CROSS_COMPILE=arm-none-linux-gnueabi-
(아예 gedit ~/.bashrc 들가서 맨아랫줄에 추가)
root@ /tftpboot/kernel-mds2450-3.0.22
make zImage
cd /tftpboot/kernel-mds2450-3.0.22
cp arch/arm/boot/zImage ../ (빌드된 커널 옮기기)
cd /nfsroot/root
vim hello-1.c 만들어서 내용 작성
1 /*
2 * hello-1.c - The simplest kernel module.
3 */
4 #include <linux/module.h> /*Needed by all modules*/
5 #include <linux/kernel.h> /*Needed for KERN_INFO*/
6 int init_module(void)
7 {
8 printk(KERN_INFO "Hello world 1.\n");
9 /*
10 * A non 0 return means init_module failed; module can't be loaded.
11 */
12 return 0;
13 }
14 void cleanup_module(void)
15 {
16 printk(KERN_INFO "Goodbye world 1.\n");
17 }
vim Makefile 만들어서 내용 작성
1 obj-m += hello-1.o
2
3 #KDIR := /lib/modules/$(shell uname -r)/build
4 KDIR := /tftpboot/kernel-mds2450-3.0.22
5
6 all:
7 make -C $(KDIR) SUBDIRS=$(PWD) modules
8 clean:
9 make -C $(KDIR) SUBDIRS=$(PWD) clean
make
ls(확인)
테라텀에서도 확인가능
테라텀에서,
insmod ./hello-1.ko (insert)
lsmod
rmmod hello-1 (remove)
tail /var/log/messages
modinfo hello-1.ko (busybox에 없어서 보드에서는 안됌)
vim hello-2.c
vim hello-3.c
vim hello-4.c 작성하고
교재 참고 (108, 110, 116 슬라이드)
vim Makefile
obj-m += hello-1.o
obj-m += hello-2.o
obj-m += hello-3.o
obj-m += hello-4.o
추가
테라텀에서,
insmod ./hello-1.ko
insmod ./hello-2.ko
insmod ./hello-3.ko
insmod ./hello-4.ko
추가하면서 출력 확인
lsmod (리스트 확인)
vim start.c
vim stop.c 작성하고
교재 참고 (119 슬라이드)
vim Makefile
obj-m += startstop.o
startstop-objs := start.o stop.o
추가