diff --git a/tools/kconfig/.gitignore b/tools/kconfig/.gitignore new file mode 100644 index 0000000..393baec --- /dev/null +++ b/tools/kconfig/.gitignore @@ -0,0 +1,2 @@ +y.tab.h +kconfig diff --git a/tools/kconfig/Makefile b/tools/kconfig/Makefile index 106e16f..1b5becc 100644 --- a/tools/kconfig/Makefile +++ b/tools/kconfig/Makefile @@ -1,5 +1,5 @@ CC = gcc -g -CFLAGS = -O -Wall +CFLAGS = -O -Wall -Werror YACC = byacc -d DESTDIR = /usr/local OBJS = config.o main.o lang.o mkioconf.o mkmakefile.o mkheaders.o \ diff --git a/tools/kconfig/Makefile.kconf b/tools/kconfig/Makefile.kconf new file mode 100644 index 0000000..3b587c4 --- /dev/null +++ b/tools/kconfig/Makefile.kconf @@ -0,0 +1,149 @@ +# +# Makefile for 4.4 BSD, pic32 target +# +# This makefile is constructed from a machine description: +# config machineid +# Most changes should be made in the machine description +# /sys/conf/``machineid'' +# after which you should do +# config machineid +# Machine generic makefile changes should be made in +# /sys/conf/Makefile.``machinetype'' +# after which config should be rerun for all machines of that type. +# +# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE +# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING +# +# -DTRACE compile in kernel tracing hooks +# -DQUOTA compile in file system quotas +# +# DEBUG is set to -g by config if debugging is requested (config -g). +# PROF is set to -pg by config if profiling is requested (config -p). + +.if exists(${MIPS_GCC_ROOT}/bin/mips-sde-elf-gcc) +MIPS_GCC_PREFIX ?= ${MIPS_GCC_ROOT}/bin/mips-sde-elf- +.endif +.if exists(${MIPS_GCC_ROOT}/bin/mips-elf-gcc) +MIPS_GCC_PREFIX ?= ${MIPS_GCC_ROOT}/bin/mips-elf- +.endif + +AS= ${MIPS_GCC_PREFIX}as ${DEBUG} -mips32r2 -EL +CC= ${MIPS_GCC_PREFIX}gcc ${DEBUG} -mips32r2 -EL -msoft-float -nostdinc -fno-builtin -Werror -Wall +CPP= ${MIPS_GCC_PREFIX}cpp +LD= ${MIPS_GCC_PREFIX}gcc -mips32r2 -EL +LDFLAGS= -nostdlib -T $A/${LDSCRIPT} -Wl,-Map=vmunix.map +SIZE= ${MIPS_GCC_PREFIX}size +OBJCOPY= ${MIPS_GCC_PREFIX}objcopy +OBJDUMP= ${MIPS_GCC_PREFIX}objdump + +.if exists(${MIPS_GCC_ROOT}/bin/mips-elf-gcc) +LDFLAGS+= -Wl,--oformat=elf32-littlemips +.endif + +# source tree is located via $S relative to the compilation directory +S= ../.. +A= $S/mips + +COPTS= -I. -I$S ${IDENT} -DKERNEL +CFLAGS= -O ${COPTS} + +# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP} +# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix, +# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file +# is marked as config-dependent. + +NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $< +NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< + +DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $< +DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< + +PROFILE_C= ${CC} -p -c ${COPTS} $< + +NORMAL_S= ${CPP} ${COPTS} $< | ${AS} -o $@ +NORMAL_S_C= ${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@ + +%OBJS + +%CFILES + +# load lines for config "xxx" will be emitted as: +# xxx: ${SYSTEM_DEP} swapxxx.o +# ${SYSTEM_LD_HEAD} +# ${SYSTEM_LD} swapxxx.o +# ${SYSTEM_LD_TAIL} +SYSTEM_OBJ= locore.o ${OBJS} param.o ioconf.o vnode_if.o +SYSTEM_DEP= Makefile ${SYSTEM_OBJ} $S/libkern/libkern.a +SYSTEM_LD_HEAD= sh $S/conf/newvers.sh; ${CC} $(CFLAGS) -c vers.c; rm -f $@ +SYSTEM_LD= -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -L$S/libkern -lkern -o vmunix.elf; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -L$S/libkern -lkern -o vmunix.elf +SYSTEM_LD_TAIL= ${SIZE} vmunix.elf; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ vmunix.hex; \ + $(OBJDUMP) -d -S vmunix.elf > vmunix.dis + +%LOAD + +$S/libkern/libkern.a: + cd $S/libkern && ${MAKE} all + +clean: + rm -f eddep *vmunix.elf vmunix.gdb tags *.o locore.i [a-z]*.s \ + Errs errs linterrs makelinks + +lint: /tmp param.c + @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \ + $A/pic32/Locore.c ${CFILES} $A/pic32/swapgeneric.c \ + ioconf.c param.c + +symbols.sort: $A/pic32/symbols.raw + grep -v '^#' $A/pic32/symbols.raw \ + | sed 's/^ //' | sort -u > symbols.sort + +locore.o: $A/pic32/locore.s $A/include/machAsmDefs.h \ + $A/include/machConst.h $A/include/reg.h $A/include/assym.h + ${CPP} ${COPTS} ${PARAM} -DLOCORE $A/pic32/locore.s | \ + ${AS} -o locore.o + +# the following is necessary because autoconf.o depends on #if GENERIC +autoconf.o: Makefile + +# the following are necessary because the files depend on the types of +# cpu's included in the system configuration +clock.o machdep.o autoconf.o conf.o: Makefile + +# depend on network configuration +uipc_proto.o vfs_conf.o: Makefile + +machine: + ln -s $A/include $@ + +depend: machine param.c vnode_if.h + mkdep ${COPTS} ${CFILES} ioconf.c param.c + +links: + egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ + sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink + echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ + sort -u | comm -23 - dontlink | \ + sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks + sh makelinks && rm -f dontlink + +tags: + @echo "see $S/kern/Makefile for tags" + +ioconf.o: ioconf.c + ${CC} -c ${CFLAGS} ioconf.c + +param.c: $S/conf/param.c + rm -f param.c + cp $S/conf/param.c . + +param.o: param.c Makefile + ${CC} -c ${CFLAGS} ${PARAM} param.c + +vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src + sh $S/kern/vnode_if.sh $S/kern/vnode_if.src +vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src + sh $S/kern/vnode_if.sh $S/kern/vnode_if.src + +%RULES diff --git a/tools/kconfig/config.y b/tools/kconfig/config.y index c7bb148..aa89a34 100644 --- a/tools/kconfig/config.y +++ b/tools/kconfig/config.y @@ -155,7 +155,7 @@ Config_spec: = { struct cputype *cp = (struct cputype *)malloc(sizeof (struct cputype)); - cp->cpu_name = ns($2); + cp->cpu_name = strdup($2); cp->cpu_next = cputype; cputype = cp; free(temp_id); @@ -166,10 +166,10 @@ Config_spec: MAKEOPTIONS Mkopt_list | IDENT ID - = { ident = ns($2); } + = { ident = strdup($2); } | LDSCRIPT ID - = { ldscript = ns($2); } + = { ldscript = strdup($2); } | System_spec | @@ -360,7 +360,8 @@ device_name: char buf[80]; (void) sprintf(buf, "%s%d", $1, $2); - $$ = ns(buf); free($1); + $$ = strdup(buf); + free($1); } | Save_id NUMBER ID @@ -368,7 +369,8 @@ device_name: char buf[80]; (void) sprintf(buf, "%s%d%s", $1, $2, $3); - $$ = ns(buf); free($1); + $$ = strdup(buf); + free($1); } ; @@ -382,7 +384,7 @@ Option: Save_id = { struct opt *op = (struct opt *)malloc(sizeof (struct opt)); - op->op_name = ns($1); + op->op_name = strdup($1); op->op_next = opt; op->op_value = 0; opt = op; @@ -392,9 +394,9 @@ Option: Save_id EQUALS Opt_value = { struct opt *op = (struct opt *)malloc(sizeof (struct opt)); - op->op_name = ns($1); + op->op_name = strdup($1); op->op_next = opt; - op->op_value = ns($3); + op->op_value = strdup($3); opt = op; free(temp_id); free(val_id); @@ -403,19 +405,19 @@ Option: Opt_value: ID - = { $$ = val_id = ns($1); } + = { $$ = val_id = strdup($1); } | NUMBER = { char nb[16]; (void) sprintf(nb, "%d", $1); - $$ = val_id = ns(nb); + $$ = val_id = strdup(nb); } ; Save_id: ID - = { $$ = temp_id = ns($1); } + = { $$ = temp_id = strdup($1); } ; Mkopt_list: @@ -428,9 +430,9 @@ Mkoption: Save_id EQUALS Opt_value = { struct opt *op = (struct opt *)malloc(sizeof (struct opt)); - op->op_name = ns($1); + op->op_name = strdup($1); op->op_next = mkopt; - op->op_value = ns($3); + op->op_value = strdup($3); mkopt = op; free(temp_id); free(val_id); @@ -439,7 +441,7 @@ Mkoption: Dev: ID - = { $$ = ns($1); } + = { $$ = strdup($1); } ; Device_spec: @@ -621,20 +623,6 @@ void yyerror(s) fprintf(stderr, "config: line %d: %s\n", yyline + 1, s); } -/* - * return the passed string in a new space - */ -char * -ns(str) - register char *str; -{ - register char *cp; - - cp = malloc((unsigned)(strlen(str)+1)); - (void) strcpy(cp, str); - return (cp); -} - /* * add a device to the list of devices */ @@ -725,9 +713,9 @@ void mkswap(system, fl, size, flag) if (system->f_fn) return; if (eq(fl->f_fn, "generic")) - system->f_fn = ns(fl->f_fn); + system->f_fn = strdup(fl->f_fn); else - system->f_fn = ns(system->f_needs); + system->f_fn = strdup(system->f_needs); } void mkcomp(dp) @@ -739,9 +727,9 @@ void mkcomp(dp) fl = (struct file_list *) malloc(sizeof *fl); fl->f_type = COMPDEVICE; fl->f_compinfo = dp->d_unit; - fl->f_fn = ns(dp->d_name); + fl->f_fn = strdup(dp->d_name); (void) sprintf(buf, "%s%d", dp->d_name, dp->d_unit); - fl->f_needs = ns(buf); + fl->f_needs = strdup(buf); fl->f_next = 0; for (flp = compp; *flp; flp = &(*flp)->f_next) ; @@ -839,7 +827,7 @@ huhcon(dev) dp = &rdev; init_dev(dp); dp->d_unit = QUES; - dp->d_name = ns(dev); + dp->d_name = strdup(dev); dp->d_type = oldtype; newdev(dp); dp = curp; diff --git a/tools/kconfig/devices.kconf b/tools/kconfig/devices.kconf new file mode 100644 index 0000000..20f486e --- /dev/null +++ b/tools/kconfig/devices.kconf @@ -0,0 +1 @@ +sd 0 diff --git a/tools/kconfig/files.kconf b/tools/kconfig/files.kconf new file mode 100644 index 0000000..42db771 --- /dev/null +++ b/tools/kconfig/files.kconf @@ -0,0 +1,179 @@ +isofs/cd9660/cd9660_bmap.c optional cd9660 +isofs/cd9660/cd9660_lookup.c optional cd9660 +isofs/cd9660/cd9660_node.c optional cd9660 +isofs/cd9660/cd9660_rrip.c optional cd9660 +isofs/cd9660/cd9660_util.c optional cd9660 +isofs/cd9660/cd9660_vfsops.c optional cd9660 +isofs/cd9660/cd9660_vnops.c optional cd9660 +kern/init_main.c standard +kern/init_sysent.c standard +kern/kern_acct.c standard +kern/kern_clock.c standard +kern/kern_descrip.c standard +kern/kern_exec.c standard +kern/kern_exit.c standard +kern/kern_fork.c standard +kern/kern_ktrace.c standard +kern/kern_malloc.c standard +kern/kern_physio.c standard +kern/kern_proc.c standard +kern/kern_prot.c standard +kern/kern_resource.c standard +kern/kern_sig.c standard +kern/kern_subr.c standard +kern/kern_synch.c standard +kern/kern_sysctl.c standard +kern/kern_time.c standard +kern/kern_xxx.c standard +kern/kern_lock.c standard +kern/subr_log.c standard +kern/subr_prf.c standard +kern/subr_prof.c standard +kern/subr_rmap.c standard +kern/subr_xxx.c standard +kern/sys_generic.c standard +kern/sys_process.c standard +kern/sys_socket.c standard +kern/sysv_shm.c optional sysvshm +kern/tty.c standard +kern/tty_compat.c standard +kern/tty_conf.c standard +kern/tty_pty.c optional pty +kern/tty_subr.c standard +kern/tty_tb.c optional tb +kern/tty_tty.c standard +kern/uipc_domain.c standard +kern/uipc_mbuf.c standard +kern/uipc_proto.c standard +kern/uipc_socket.c standard +kern/uipc_socket2.c standard +kern/uipc_syscalls.c standard +kern/uipc_usrreq.c standard +kern/vfs_bio.c standard +kern/vfs_cache.c standard +kern/vfs_cluster.c standard +kern/vfs_conf.c standard +kern/vfs_init.c standard +kern/vfs_lookup.c standard +kern/vfs_subr.c standard +kern/vfs_syscalls.c standard +kern/vfs_vnops.c standard +miscfs/deadfs/dead_vnops.c standard +miscfs/fdesc/fdesc_vfsops.c optional fdesc +miscfs/fdesc/fdesc_vnops.c optional fdesc +miscfs/fifofs/fifo_vnops.c optional fifo +miscfs/kernfs/kernfs_vfsops.c optional kernfs +miscfs/kernfs/kernfs_vnops.c optional kernfs +miscfs/nullfs/null_subr.c optional nullfs +miscfs/nullfs/null_vfsops.c optional nullfs +miscfs/nullfs/null_vnops.c optional nullfs +miscfs/portal/portal_vfsops.c optional portal +miscfs/portal/portal_vnops.c optional portal +miscfs/procfs/procfs_subr.c optional procfs +miscfs/procfs/procfs_vnops.c optional procfs +miscfs/procfs/procfs_vfsops.c optional procfs +miscfs/procfs/procfs_note.c optional procfs +miscfs/procfs/procfs_mem.c optional procfs +miscfs/procfs/procfs_ctl.c optional procfs +miscfs/procfs/procfs_status.c optional procfs +miscfs/procfs/procfs_regs.c optional procfs +miscfs/procfs/procfs_fpregs.c optional procfs +miscfs/specfs/spec_vnops.c standard +miscfs/umapfs/umap_subr.c optional umapfs +miscfs/umapfs/umap_vfsops.c optional umapfs +miscfs/umapfs/umap_vnops.c optional umapfs +miscfs/union/union_subr.c optional union +miscfs/union/union_vfsops.c optional union +miscfs/union/union_vnops.c optional union +net/bpf.c optional bpfilter +net/bpf_filter.c optional bpfilter +net/if.c standard +net/if_ethersubr.c optional ether +net/if_loop.c optional loop +net/if_sl.c optional sl +net/radix.c standard +net/raw_cb.c standard +net/raw_usrreq.c standard +net/route.c standard +net/rtsock.c standard +net/slcompress.c optional sl +netinet/if_ether.c optional ether +netinet/igmp.c optional inet +netinet/in.c optional inet +netinet/in_pcb.c optional inet +netinet/in_proto.c optional inet +netinet/ip_icmp.c optional inet +netinet/ip_input.c optional inet +netinet/ip_mroute.c optional inet mrouting +netinet/ip_output.c optional inet +netinet/raw_ip.c optional inet +netinet/tcp_debug.c optional inet +netinet/tcp_input.c optional inet +netinet/tcp_output.c optional inet +netinet/tcp_subr.c optional inet +netinet/tcp_timer.c optional inet +netinet/tcp_usrreq.c optional inet +netinet/udp_usrreq.c optional inet +nfs/nfs_bio.c optional nfs +nfs/nfs_node.c optional nfs +nfs/nfs_nqlease.c optional nfs +nfs/nfs_serv.c optional nfs +nfs/nfs_socket.c optional nfs +nfs/nfs_srvcache.c optional nfs +nfs/nfs_subs.c optional nfs +nfs/nfs_syscalls.c optional nfs +nfs/nfs_vfsops.c optional nfs +nfs/nfs_vnops.c optional nfs +ufs/ffs/ffs_alloc.c optional ffs +ufs/ffs/ffs_alloc.c optional mfs +ufs/ffs/ffs_balloc.c optional ffs +ufs/ffs/ffs_balloc.c optional mfs +ufs/ffs/ffs_inode.c optional ffs +ufs/ffs/ffs_inode.c optional mfs +ufs/ffs/ffs_subr.c optional ffs +ufs/ffs/ffs_subr.c optional mfs +ufs/ffs/ffs_tables.c optional ffs +ufs/ffs/ffs_tables.c optional mfs +ufs/ffs/ffs_vfsops.c optional ffs +ufs/ffs/ffs_vfsops.c optional mfs +ufs/ffs/ffs_vnops.c optional ffs +ufs/ffs/ffs_vnops.c optional mfs +ufs/lfs/lfs_alloc.c optional lfs +ufs/lfs/lfs_bio.c optional lfs +ufs/lfs/lfs_balloc.c optional lfs +ufs/lfs/lfs_cksum.c optional lfs +ufs/lfs/lfs_debug.c optional lfs +ufs/lfs/lfs_inode.c optional lfs +ufs/lfs/lfs_segment.c optional lfs +ufs/lfs/lfs_subr.c optional lfs +ufs/lfs/lfs_syscalls.c optional lfs +ufs/lfs/lfs_vfsops.c optional lfs +ufs/lfs/lfs_vnops.c optional lfs +ufs/mfs/mfs_vfsops.c optional mfs +ufs/mfs/mfs_vnops.c optional mfs +ufs/ufs/ufs_bmap.c standard +ufs/ufs/ufs_disksubr.c standard +ufs/ufs/ufs_ihash.c standard +ufs/ufs/ufs_inode.c standard +ufs/ufs/ufs_lockf.c standard +ufs/ufs/ufs_lookup.c standard +ufs/ufs/ufs_quota.c standard +ufs/ufs/ufs_vfsops.c standard +ufs/ufs/ufs_vnops.c standard +vm/device_pager.c optional devpager +vm/swap_pager.c optional swappager +vm/vm_fault.c standard +vm/vm_glue.c standard +vm/vm_init.c standard +vm/vm_kern.c standard +vm/vm_map.c standard +vm/vm_meter.c standard +vm/vm_mmap.c standard +vm/vm_object.c standard +vm/vm_page.c standard +vm/vm_pageout.c standard +vm/vm_pager.c standard +vm/vm_swap.c standard +vm/vm_unix.c standard +vm/vm_user.c standard +vm/vnode_pager.c optional vnodepager diff --git a/tools/kconfig/main.c b/tools/kconfig/main.c index 065d755..6ad3ae2 100644 --- a/tools/kconfig/main.c +++ b/tools/kconfig/main.c @@ -49,12 +49,7 @@ int main(argc, argv) int argc; char **argv; { - - extern char *optarg; - extern int optind; - struct stat buf; int ch; - char *p; while ((ch = getopt(argc, argv, "gp")) != EOF) switch (ch) { @@ -72,25 +67,29 @@ int main(argc, argv) argv += optind; if (argc != 1) { -usage: fputs("usage: config [-gp] sysname\n", stderr); +usage: fputs("usage: kconfig [-gp] sysname\n", stderr); exit(1); } - if (freopen(PREFIX = *argv, "r", stdin) == NULL) { + PREFIX = *argv; + if (! freopen(PREFIX, "r", stdin)) { perror(PREFIX); exit(2); } +#if 0 mkdir("../../compile", 0777); - if (stat(p = path((char *)NULL), &buf)) { - if (mkdir(p, 0777)) { + char *p = path((char *)NULL); + struct stat buf; + if (stat(p, &buf) < 0) { + if (mkdir(p, 0777) < 0) { perror(p); exit(2); } - } - else if ((buf.st_mode & S_IFMT) != S_IFDIR) { + } else if ((buf.st_mode & S_IFMT) != S_IFDIR) { fprintf(stderr, "config: %s isn't a directory.\n", p); exit(2); } +#endif dtab = NULL; confp = &conf_list; @@ -208,6 +207,9 @@ char * path(file) char *file; { +#if 1 + return file; +#else register char *cp; #define CDIR "../../compile/" @@ -221,4 +223,5 @@ path(file) (void) strcat(cp, file); } return (cp); +#endif } diff --git a/tools/kconfig/max32/MAX32 b/tools/kconfig/max32/MAX32 new file mode 100644 index 0000000..b36951d --- /dev/null +++ b/tools/kconfig/max32/MAX32 @@ -0,0 +1,74 @@ +# +# chipKIT Max32 board +# +# To build the kernel, use: +# cd sys/pic32/max32 +# kconfig MAX32 +# make clean depend +# make depend +# make +# +machine "pic32" + +cpu "PIC32MX" +ident CHIPKIT-MAX + +# Linker script +ldscript "pic32/bootloader-max32.ld" + +# Need to set locally +timezone 8 dst +maxusers 2 + +# Standard system options +options "CPU_KHZ=80000" # Oscillator frequency of CPU core +options "HZ=100" # Frequency of clock interrupt + +# Root filesystem at /dev/sd0a, swap at /dev/sd0b +config unix root on major 0 minor 1 + swap on major 0 minor 2 + dumps on major 0 minor 2 + +# UART ports +device uart1 flags 0x614f # pins rx=RD14, tx=RD15 - logical 39/40 +device uart4 flags 0x6268 # pins rx=RF2, tx=RF8 - serial-to-USB converter + +# Use UART4 as console +options "CONS_MAJOR=17" # UART device +options "CONS_MINOR=3" # UART4 - chipKIT WiFire board + +# SPI ports +controller spi2 flags 0x2a34 # pins sdi=RB10, sdo=RC4 - SD card + +# microSD card +disk sd0 at spi2 drive 0 flags 0x33 # select pin RC3 +options "SD_LED=0x7f" # LED4 is G15 + +# General purpose I/O ports +# Flags define a mask of available pins +# The following pins excluded: +# D14, D15 - uart1 +# F2, F8 - uart4 +# C1, D1, F1, - spi1 +# D11, F0, G6 - spi2, LED1 +# B10, B14, C3, C4 - spi3, SD card +# A15, D9, D10, F4, F5, G0, G1 - spi4, Wi-Fi +# B12 - 1/11 of input voltage +# B13 - potentiometer +#device gpio0 flags 0x46ff # port A +#device gpio1 flags 0x8bff # port B +#device gpio2 flags 0xf004 # port C +#device gpio3 flags 0x303d # port D +#device gpio4 flags 0x03ff # port E +#device gpio5 flags 0x3008 # port F +#device gpio6 flags 0xf380 # port G + +#device adc +#device pwm +#device skel + +# Buttons +options "BUTTON1=0x15" # button 1 at pin RA5 +options "BUTTON2=0x14" # button 2 at pin RA4 + +#pseudo-device pty 4 # pseudo ptys diff --git a/tools/kconfig/mkheaders.c b/tools/kconfig/mkheaders.c index 9cf7191..4dd31f3 100644 --- a/tools/kconfig/mkheaders.c +++ b/tools/kconfig/mkheaders.c @@ -70,7 +70,7 @@ void do_header(dev, hname, count) break; if ((inw = get_word(inf)) == 0 || inw == (char *)EOF) break; - inw = ns(inw); + inw = strdup(inw); cp = get_word(inf); if (cp == 0 || cp == (char *)EOF) break; diff --git a/tools/kconfig/mkmakefile.c b/tools/kconfig/mkmakefile.c index de13b1b..752ef29 100644 --- a/tools/kconfig/mkmakefile.c +++ b/tools/kconfig/mkmakefile.c @@ -152,8 +152,7 @@ void read_files() int nreqs, first = 1, configdep, isdup, std, filetype; ftab = 0; - (void) strcpy(fname, "../../conf/files"); -openit: + (void) strcpy(fname, "../files.kconf"); fp = fopen(fname, "r"); if (fp == 0) { perror(fname); @@ -169,11 +168,6 @@ next: if (wd == (char *)EOF) { (void) fclose(fp); if (first == 1) { - (void) sprintf(fname, "files.%s", machinename); - first++; - goto openit; - } - if (first == 2) { (void) sprintf(fname, "files.%s", raise(ident)); first++; fp = fopen(fname, "r"); @@ -184,7 +178,7 @@ next: } if (wd == 0) goto next; - this = ns(wd); + this = strdup(wd); next_word(fp, wd); if (wd == 0) { printf("%s: No type for %s.\n", @@ -226,7 +220,7 @@ nextparam: fname); exit(1); } - special = ns(wd); + special = strdup(wd); goto nextparam; } nreqs++; @@ -239,7 +233,7 @@ nextparam: goto nextparam; } if (needs == 0 && nreqs == 1) - needs = ns(wd); + needs = strdup(wd); if (isdup) goto invis; for (dp = dtab; dp != 0; save_dp = dp, dp = dp->d_next) @@ -252,7 +246,7 @@ nextparam: if (std) { dp = (struct device *) malloc(sizeof *dp); init_dev(dp); - dp->d_name = ns(wd); + dp->d_name = strdup(wd); dp->d_type = PSEUDO_DEVICE; dp->d_slave = 1; if (save_dp) @@ -471,8 +465,8 @@ void makefile() struct users *up; read_files(); - strcpy(line, "Makefile."); - (void) strcat(line, machinename); + strcpy(line, "../Makefile.kconf"); + //(void) strcat(line, machinename); ifp = fopen(line, "r"); if (ifp == 0) { perror(line); diff --git a/tools/kconfig/mkswapconf.c b/tools/kconfig/mkswapconf.c index dd5fa14..0aff12d 100644 --- a/tools/kconfig/mkswapconf.c +++ b/tools/kconfig/mkswapconf.c @@ -122,7 +122,7 @@ void initdevtable() register struct devdescription **dp = &devtable; FILE *fp; - (void) sprintf(buf, "../conf/devices.%s", machinename); + (void) sprintf(buf, "../devices.kconf"); fp = fopen(buf, "r"); if (fp == NULL) { fprintf(stderr, "config: can't open %s\n", buf); @@ -130,7 +130,7 @@ void initdevtable() } while (fscanf(fp, "%s\t%d\n", buf, &maj) == 2) { *dp = (struct devdescription *)malloc(sizeof (**dp)); - (*dp)->dev_name = ns(buf); + (*dp)->dev_name = strdup(buf); (*dp)->dev_major = maj; dp = &(*dp)->dev_next; } @@ -211,5 +211,5 @@ devtoname(dev) dp = devtable; (void) sprintf(buf, "%s%d%c", dp->dev_name, minor(dev) >> 3, (minor(dev) & 07) + 'a'); - return (ns(buf)); + return strdup(buf); }